Example #1
0
 private static Func<string, string> GetNuspecPropertyProviderFunction(ITaskItem[] nuspecProperties)
 {
     return nuspecProperties == null ? null : NuspecPropertyStringProvider.GetNuspecPropertyProviderFunction(nuspecProperties.Select(p => p.ItemSpec).ToArray());
 }
                public bool SetImports(ITaskItem[] importsList)
                {
                    if (importsList != null)
                    {
                        _commandLineArgs.Add("/imports:" + string.Join(",", importsList.Select(item => item.ItemSpec.Trim())));
                    }

                    return true;
                }
Example #3
0
        protected override void AppendCommandLineArguments(IDictionary<string, string> environment, ProcessArgumentBuilder args, ITaskItem[] items)
        {
            string minimumDeploymentTarget;

            if (plist != null) {
                PString value;

                if (!plist.TryGetValue (MinimumDeploymentTargetKey, out value) || string.IsNullOrEmpty (value.Value))
                    minimumDeploymentTarget = SdkVersion;
                else
                    minimumDeploymentTarget = value.Value;

                var assetDirs = new HashSet<string> (items.Select (x => x.ItemSpec));

                if (plist.TryGetValue (ManifestKeys.XSAppIconAssets, out value) && !string.IsNullOrEmpty (value.Value)) {
                    int index = value.Value.IndexOf (".xcassets" + Path.DirectorySeparatorChar, StringComparison.Ordinal);
                    string assetDir = null;
                    var rpath = value.Value;

                    if (index != -1)
                        assetDir = rpath.Substring (0, index + ".xcassets".Length);

                    if (assetDirs != null && assetDirs.Contains (assetDir)) {
                        var assetName = Path.GetFileNameWithoutExtension (rpath);

                        if (PartialAppManifest == null) {
                            args.Add ("--output-partial-info-plist");
                            args.AddQuoted (partialAppManifest.GetMetadata ("FullPath"));

                            PartialAppManifest = partialAppManifest;
                        }

                        args.Add ("--app-icon");
                        args.AddQuoted (assetName);
                    }
                }

                if (plist.TryGetValue (ManifestKeys.XSLaunchImageAssets, out value) && !string.IsNullOrEmpty (value.Value)) {
                    int index = value.Value.IndexOf (".xcassets" + Path.DirectorySeparatorChar, StringComparison.Ordinal);
                    string assetDir = null;
                    var rpath = value.Value;

                    if (index != -1)
                        assetDir = rpath.Substring (0, index + ".xcassets".Length);

                    if (assetDirs != null && assetDirs.Contains (assetDir)) {
                        var assetName = Path.GetFileNameWithoutExtension (rpath);

                        if (PartialAppManifest == null) {
                            args.Add ("--output-partial-info-plist");
                            args.AddQuoted (partialAppManifest.GetMetadata ("FullPath"));

                            PartialAppManifest = partialAppManifest;
                        }

                        args.Add ("--launch-image");
                        args.AddQuoted (assetName);
                    }
                }

                if (plist.TryGetValue (ManifestKeys.CLKComplicationGroup, out value) && !string.IsNullOrEmpty (value.Value))
                    args.Add ("--complication", value);
            } else {
                minimumDeploymentTarget = SdkVersion;
            }

            if (OptimizePNGs)
                args.Add ("--compress-pngs");

            if (AppleSdkSettings.XcodeVersion.Major >= 7) {
                if (!string.IsNullOrEmpty (outputSpecs))
                    args.Add ("--enable-on-demand-resources", "YES");

                if (!string.IsNullOrEmpty (DeviceModel))
                    args.Add ("--filter-for-device-model", DeviceModel);

                if (!string.IsNullOrEmpty (DeviceOSVersion))
                    args.Add ("--filter-for-device-os-version", DeviceOSVersion);

                if (!string.IsNullOrEmpty (outputSpecs)) {
                    args.Add ("--asset-pack-output-specifications");
                    args.AddQuoted (Path.GetFullPath (outputSpecs));
                }
            }

            if (plist != null) {
                foreach (var targetDevice in GetTargetDevices (plist))
                    args.Add ("--target-device", targetDevice);
            }

            args.Add ("--minimum-deployment-target", minimumDeploymentTarget);

            switch (SdkPlatform) {
            case "iPhoneSimulator":
                args.Add ("--platform", IsWatchApp ? "watchsimulator" : "iphonesimulator");
                break;
            case "iPhoneOS":
                args.Add ("--platform", IsWatchApp ? "watchos" : "iphoneos");
                break;
            case "MacOSX":
                args.Add ("--platform", "macosx");
                break;
            case "WatchSimulator":
                args.Add ("--platform", "watchsimulator");
                break;
            case "WatchOS":
                args.Add ("--platform", "watchos");
                break;
            case "AppleTVSimulator":
                args.Add ("--platform", "appletvsimulator");
                break;
            case "AppleTVOS":
                args.Add ("--platform", "appletvos");
                break;
            }
        }