protected override string GenerateCommandLineCommands()
        {
            var args = new CommandLineArgumentBuilder();

            args.Add("--compress");
            args.AddQuoted(InputScene);
            args.Add("-o");
            args.AddQuoted(OutputScene);
            args.AddQuotedFormat("--sdk-root={0}", SdkRoot);
            args.AddQuotedFormat("--target-build-dir={0}", IntermediateOutputPath);
            if (AppleSdkSettings.XcodeVersion.Major >= 13)
            {
                // I'm not sure which Xcode version these options are available in, but it's at least Xcode 13+
                args.AddQuotedFormat("--target-version={0}", SdkVersion);
                args.AddQuotedFormat("--target-platform={0}", PlatformUtils.GetTargetPlatform(SdkPlatform, IsWatchApp));
            }
            else
            {
                args.AddQuotedFormat("--target-version-{0}={1}", OperatingSystem, SdkVersion);
            }

            return(args.ToString());
        }
Exemple #2
0
        protected override void AppendCommandLineArguments(IDictionary <string, string> environment, CommandLineArgumentBuilder args, ITaskItem[] items)
        {
            if (plist != null)
            {
                PString value;

                var assetDirs = new HashSet <string> (items.Select(x => BundleResource.GetVirtualProjectPath(ProjectDir, x, !string.IsNullOrEmpty(SessionId))));

                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 (IsMessagesExtension(plist))
                        {
                            args.Add("--product-type com.apple.product-type.app-extension.messages");
                        }
                    }
                }

                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);
                }
            }

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

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

                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", MinimumOSVersion);

            var platform = PlatformUtils.GetTargetPlatform(SdkPlatform, IsWatchApp);

            if (platform != null)
            {
                args.Add("--platform", platform);
            }
        }