public static string UpdateString(string contents, iOSBuildType buildType)
        {
            XDocument doc = PlistDocument.ParseXmlNoDtd(contents);
            string    str = "";

            if (buildType != iOSBuildType.Debug)
            {
                if (buildType == iOSBuildType.Release)
                {
                    str = "ReleaseForRunning";
                }
            }
            else
            {
                str = "Debug";
            }
            XElement element = doc.Root.XPathSelectElement("./LaunchAction");

            if (element == null)
            {
                return(contents);
            }
            element.SetAttributeValue("buildConfiguration", str);
            return(PlistDocument.CleanDtdToString(doc));
        }
 static AppleTVBuildWindowExtension()
 {
     iOSBuildType[] typeArray1 = new iOSBuildType[2];
     typeArray1[0] = iOSBuildType.Release;
     kOptionsOrder = typeArray1;
     kOptionDescriptions = new GUIContent[] { EditorGUIUtility.TextContent("Release"), EditorGUIUtility.TextContent("Debug") };
 }
 static AppleTVBuildWindowExtension()
 {
     iOSBuildType[] typeArray1 = new iOSBuildType[2];
     typeArray1[0]       = iOSBuildType.Release;
     kOptionsOrder       = typeArray1;
     kOptionDescriptions = new GUIContent[] { EditorGUIUtility.TextContent("Release"), EditorGUIUtility.TextContent("Debug") };
 }
Beispiel #4
0
        public void OverwriteWithCurrentBuildSettings()
        {
            scenes = EditorBuildSettings.scenes.Select(x => new BuildScene
            {
                scene   = AssetDatabase.LoadAssetAtPath <SceneAsset>(x.path),
                path    = x.path,
                guid    = x.guid.ToString(),
                enabled = x.enabled,
            })
                     .ToArray();

            activeBuildTarget = EditorUserBuildSettings.activeBuildTarget;
            activeScriptCompilationDefines =
                PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup)
                .Split(';').ToList();
            allowDebugging               = EditorUserBuildSettings.allowDebugging;
            androidBuildSubtarget        = EditorUserBuildSettings.androidBuildSubtarget;
            androidEtc2Fallback          = EditorUserBuildSettings.androidETC2Fallback;
            buildAppBundle               = EditorUserBuildSettings.buildAppBundle;
            buildScriptsOnly             = EditorUserBuildSettings.buildScriptsOnly;
            compressFilesInPackage       = EditorUserBuildSettings.compressFilesInPackage;
            compressWithPsArc            = EditorUserBuildSettings.compressWithPsArc;
            connectProfiler              = EditorUserBuildSettings.connectProfiler;
            development                  = EditorUserBuildSettings.development;
            enableHeadlessMode           = EditorUserBuildSettings.enableHeadlessMode;
            explicitArrayBoundsChecks    = EditorUserBuildSettings.explicitArrayBoundsChecks;
            explicitDivideByZeroChecks   = EditorUserBuildSettings.explicitDivideByZeroChecks;
            explicitNullChecks           = EditorUserBuildSettings.explicitNullChecks;
            exportAsGoogleAndroidProject = EditorUserBuildSettings.exportAsGoogleAndroidProject;
            forceInstallation            = EditorUserBuildSettings.forceInstallation;
            installInBuildFolder         = EditorUserBuildSettings.installInBuildFolder;
            iOsBuildConfigType           = EditorUserBuildSettings.iOSBuildConfigType;
            movePackageToDiscOuterEdge   = EditorUserBuildSettings.movePackageToDiscOuterEdge;
            needSubmissionMaterials      = EditorUserBuildSettings.needSubmissionMaterials;
            ps4BuildSubtarget            = EditorUserBuildSettings.ps4BuildSubtarget;
            ps4HardwareTarget            = EditorUserBuildSettings.ps4HardwareTarget;
            selectedBuildTargetGroup     = EditorUserBuildSettings.selectedBuildTargetGroup;
            selectedStandaloneTarget     = EditorUserBuildSettings.selectedStandaloneTarget;
            streamingInstallLaunchRange  = EditorUserBuildSettings.streamingInstallLaunchRange;
            symlinkLibraries             = EditorUserBuildSettings.symlinkLibraries;
            waitForPlayerConnection      = EditorUserBuildSettings.waitForPlayerConnection;
            windowsDevicePortalAddress   = EditorUserBuildSettings.windowsDevicePortalAddress;
            windowsDevicePortalPassword  = EditorUserBuildSettings.windowsDevicePortalPassword;
            windowsDevicePortalUsername  = EditorUserBuildSettings.windowsDevicePortalUsername;
            wsaBuildAndRunDeployTarget   = EditorUserBuildSettings.wsaBuildAndRunDeployTarget;
            wsaSubtarget                 = EditorUserBuildSettings.wsaSubtarget;
            wsaUwpsdk = EditorUserBuildSettings.wsaUWPSDK;
            wsaUwpVisualStudioVersion          = EditorUserBuildSettings.wsaUWPVisualStudioVersion;
            xboxBuildSubtarget                 = EditorUserBuildSettings.xboxBuildSubtarget;
            xboxOneDeployDrive                 = EditorUserBuildSettings.xboxOneDeployDrive;
            xboxOneDeployMethod                = EditorUserBuildSettings.xboxOneDeployMethod;
            xboxOneRebootIfDeployFailsAndRetry = EditorUserBuildSettings.xboxOneRebootIfDeployFailsAndRetry;
        }
 public static string UpdateString(string contents, iOSBuildType buildType)
 {
     XDocument doc = PlistDocument.ParseXmlNoDtd(contents);
     string str = "";
     if (buildType != iOSBuildType.Debug)
     {
         if (buildType == iOSBuildType.Release)
         {
             str = "ReleaseForRunning";
         }
     }
     else
     {
         str = "Debug";
     }
     XElement element = System.Xml.XPath.Extensions.XPathSelectElement(doc.Root, "./LaunchAction");
     if (element == null)
     {
         return contents;
     }
     element.SetAttributeValue("buildConfiguration", str);
     return PlistDocument.CleanDtdToString(doc);
 }
Beispiel #6
0
    private static void DoBuildIOSInternal(iOSBuildType buildType, iOSSdkVersion sdkVersion)
    {
        Debug.Log("Building iOS...");

        CurrentGroup = BuildTargetGroup.iOS;

        var xrGeneralSettings         = XRGeneralSettingsPerBuildTarget.XRGeneralSettingsForBuildTarget(BuildTargetGroup.iOS);
        var prevCompilerConfiguration = PlayerSettings.GetIl2CppCompilerConfiguration(BuildTargetGroup.iOS);
        var prevScriptingDefines      = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS);
        var prev_sdkVersion           = PlayerSettings.iOS.sdkVersion;
        var isDebug       = !(buildType == iOSBuildType.Debug);
        var disabledARKit = false;

        using var revertSettings = new Disposable(() =>
        {
            CurrentGroup = null;

            PlayerSettings.iOS.sdkVersion = prev_sdkVersion;
            PlayerSettings.SetIl2CppCompilerConfiguration(BuildTargetGroup.iOS, prevCompilerConfiguration);

            if (!Application.isBatchMode)
            {
                PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS, prevScriptingDefines);
            }

            if (disabledARKit)
            {
                XRPackageMetadataStore.AssignLoader(
                    xrGeneralSettings.AssignedSettings,
                    typeof(UnityEngine.XR.ARKit.ARKitLoader).FullName,
                    BuildTargetGroup.iOS);
            }
        });

        var compilerConfiguration = isDebug ? Il2CppCompilerConfiguration.Debug : Il2CppCompilerConfiguration.Master;

        PlayerSettings.SetIl2CppCompilerConfiguration(BuildTargetGroup.iOS, compilerConfiguration);
        PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.iOS, ProcessDefines(prevScriptingDefines, isDebug));
        PlayerSettings.iOS.sdkVersion = sdkVersion;

        if (sdkVersion == iOSSdkVersion.SimulatorSDK &&
            xrGeneralSettings.AssignedSettings.activeLoaders.Any(m => m.GetType() == typeof(UnityEngine.XR.ARKit.ARKitLoader)))
        {
            // ARKit is not supported on iOS Simulator - disable it temporairly
            XRPackageMetadataStore.RemoveLoader(
                xrGeneralSettings.AssignedSettings,
                typeof(UnityEngine.XR.ARKit.ARKitLoader).FullName,
                BuildTargetGroup.iOS);
            disabledARKit = true;
        }

        string exportPath = Path.GetFullPath(Path.Combine(ProjectPath, "../../ios/UnityExport"));
        string buildPath  = iosBuildPath;

        if (Directory.Exists(buildPath))
        {
            Directory.Delete(buildPath, true);
        }

        EditorUserBuildSettings.iOSBuildConfigType = buildType;

        try
        {
            var options = (buildType == iOSBuildType.Debug ? BuildOptions.AllowDebugging : BuildOptions.None);
            var report  = BuildPipeline.BuildPlayer(
                GetEnabledScenes(),
                buildPath,
                BuildTarget.iOS,
                options
                );

            if (report.summary.result != BuildResult.Succeeded)
            {
                throw new Exception("Build failed");
            }

            // Clear UnityExport
            DeleteFolderContent(exportPath);

            // Copy build output to UnityExport
            Debug.Log("Copy to UnityExport");
            CopyDirectory(
                buildPath,
                exportPath,
                mergeDirectories: false,
                overwriteFiles: true);
        }
        catch (Exception e)
        {
            Debug.Log("Export failed!");

            if (Application.isBatchMode)
            {
                Debug.LogError(e);
                EditorApplication.Exit(-1);
            }
            else
            {
                throw;
            }
        }
        finally
        {
            Debug.Log("Export completed!");

            if (Application.isBatchMode)
            {
                EditorApplication.Exit(0);
            }
        }
    }