Ejemplo n.º 1
0
 static void GenericBuild(string[] scenes, string target_dir, BuildTarget build_target, BuildOptions build_options) {
     EditorUserBuildSettings.SwitchActiveBuildTarget(build_target);
     string res = BuildPipeline.BuildPlayer(scenes, target_dir, build_target, build_options);
     if (res.Length > 0) {
         throw new Exception("BuildPlayer failure: " + res);
     }
 }
Ejemplo n.º 2
0
 public BaseBuilder()
 {
     Name = "Base";
     options = BuildOptions.None;
     target = BuildTarget.Android;
     DefineSymbols = "";
 }
Ejemplo n.º 3
0
 private BuildConfiguration()
 {
     this.scenes = new List<string>();
     this.dirMappings = new Dictionary<string, string>();
     this.fileMappings = new Dictionary<string, string>();
     this.options = BuildOptions.None;
 }
Ejemplo n.º 4
0
    public static void BuildGame(BuildTarget buildTarget, BuildOptions buildOptions = BuildOptions.None)
    {
        if (BuildPipeline.isBuildingPlayer == false) {
            UnityEngine.Debug.ClearDeveloperConsole();

            var smcsFile = Path.Combine( Application.dataPath, "smcs.rsp" );
            var gmcsFile = Path.Combine( Application.dataPath, "gmcs.rsp" );

            // -define:debug;poop
            File.WriteAllText( smcsFile, "-define:BUILD" );
            File.WriteAllText( gmcsFile, "-define:BUILD" );

            AssetDatabase.Refresh();

            string[] scenes = GetSceneList();
            //string path = Application.dataPath.Remove(Application.dataPath.Length - 8, 7) + "_build";

            // Build player.
            BuildPipeline.BuildPlayer(scenes, path + "/" + StringManager.BUILDNAME + ".exe", buildTarget, buildOptions);

            // Copy a file from the project folder to the build folder, alongside the built game. eg:
            // FileUtil.CopyFileOrDirectory("Assets/WebPlayerTemplates/Readme.txt", path + "Readme.txt");

            //remove build thingies
            File.WriteAllText( smcsFile, "" );
            File.WriteAllText( gmcsFile, "" );
        }
    }
        string BuildPlayer(BuildTarget target, BuildOptions options, params string[] levels)
        {
            var output = Path.Combine(OutputDir, target.ToString());
            DirectoryEx.DeleteDirectory(output);

            BuildPipeline.BuildPlayer(levels, output, target,  options);
            return output;
        }
Ejemplo n.º 6
0
    public static void PerformIOSReleaseBuildAndRun()
    {
        _excelSuccessCallback = DoIOSReleaseBuild;

        _buildOptions = BuildOptions.Il2CPP | BuildOptions.AutoRunPlayer;

        // Process the Excel Files
        ProcessExcelFiles();
    }
Ejemplo n.º 7
0
    public static void PerformIOSDebugBuild()
    {
        _excelSuccessCallback = DoIOSDebugBuild;

        _buildOptions = BuildOptions.Il2CPP | BuildOptions.Development | BuildOptions.AllowDebugging | BuildOptions.SymlinkLibraries;

        // Process the Excel Files
        ProcessExcelFiles();
    }
 public static string GetScriptLayoutFileFromBuild(BuildOptions options, BuildTarget target, string installPath, string fileName)
 {
     IBuildPostprocessor buildPostProcessor = ModuleManager.GetBuildPostProcessor(target);
     if (buildPostProcessor != null)
     {
         return buildPostProcessor.GetScriptLayoutFileFromBuild(options, installPath, fileName);
     }
     return "";
 }
Ejemplo n.º 9
0
        private static void ParseArgs(ref BuildOptions opt, ref string outputpath)
        {
            string[] args = System.Environment.GetCommandLineArgs();

            string productPath = Path.Combine(Application.dataPath, KEngine.AppEngine.GetConfig("ProductRelPath"));

            if (!Directory.Exists(productPath))
            {
                Directory.CreateDirectory(productPath);
            }

            if (args.Length >= 2)
            {
                CommandArgs commandArg = CommandLine.Parse(args);
                //List<string> lparams = commandArg.Params;
                Dictionary<string, string> argPairs = commandArg.ArgPairs;

                foreach (KeyValuePair<string, string> item in argPairs)
                {
                    switch (item.Key)
                    {
                        case "BundleVersion":
                            PlayerSettings.bundleVersion = item.Value;
                            break;
                        case "AndroidVersionCode":
                            PlayerSettings.Android.bundleVersionCode = System.Int32.Parse(item.Value);
                            break;
                        case "AndroidKeyStoreName":
                            PlayerSettings.Android.keystoreName = item.Value;
                            break;
                        case "AndroidKeyStorePass":
                            PlayerSettings.Android.keystorePass = item.Value;
                            break;
                        case "AndroidkeyAliasName":
                            PlayerSettings.Android.keyaliasName = item.Value;
                            break;
                        case "AndroidKeyAliasPass":
                            PlayerSettings.Android.keyaliasPass = item.Value;
                            break;
                        case "BuildOptions":
                        {
                            opt = BuildOptions.None;
                            string[] opts = item.Value.Split('|');
                            foreach (string o in opts)
                            {
                                opt = opt | (BuildOptions) System.Enum.Parse(typeof (BuildOptions), o);
                            }
                        }
                            break;
                        case "Outputpath":
                            outputpath = item.Value;
                            break;
                    }
                    UnityEngine.Debug.Log(item.Key + " : " + item.Value);
                }
            }
        }
 public static string GetExtensionForBuildTarget(BuildTarget target, BuildOptions options)
 {
     IBuildPostprocessor buildPostProcessor = ModuleManager.GetBuildPostProcessor(target);
     if (buildPostProcessor == null)
     {
         return string.Empty;
     }
     return buildPostProcessor.GetExtension(target, options);
 }
Ejemplo n.º 11
0
    public static void PerformIOSReleaseBuild()
    {
        _excelSuccessCallback = DoIOSReleaseBuild;

        _buildOptions = BuildOptions.Il2CPP;

        // Process the Excel Files
        ProcessExcelFiles();
    }
Ejemplo n.º 12
0
    static void GenericBuild(string[] scenes, string target_filename, BuildTarget build_target, BuildOptions build_options)
    {
        EditorUserBuildSettings.SwitchActiveBuildTarget(build_target);
        Debug.Log("-- 빌드 과정을 시작합니다...");
        string res = BuildPipeline.BuildPlayer(scenes, target_filename, build_target, build_options);
        if (res.Length > 0) {

            throw new Exception("빌드 실패: " + res);
        }
    }
Ejemplo n.º 13
0
    public void DrawGUI(uBuildWindow window)
    {
        EditorGUILayout.BeginHorizontal();
        IsFoldOut = EditorGUILayout.Foldout( IsFoldOut, BuildName + " (" + target.ToString() + ')');
        GUILayout.FlexibleSpace();
        if(Errors.Count > 0)
        {
            GUILayout.Label(window.errBtnContent);
        }
        if(GUILayout.Button(window.rmBtnContent))
        {
            window.RemoveBuildSetting(this);
        }
        EditorGUILayout.EndHorizontal();

        if(IsFoldOut)
        {
            isEnabled = EditorGUILayout.Toggle("Enabled?", isEnabled);
            GUI.enabled = isEnabled;
            BuildName = EditorGUILayout.TextField("BuildName: ", BuildName);

            BuildTarget newtarget = (BuildTarget)EditorGUILayout.EnumPopup("Target: ", target);
            if(newtarget != target)
            {
                Extension = Extension == DeterminateExtension(target) ? DeterminateExtension(newtarget) : Extension;
                target = newtarget;
            }
            options = (BuildOptions)EditorGUILayout.EnumMaskField("Options: ", options);

            HasCustomExtension = EditorGUILayout.ToggleLeft("Custom Extension?", HasCustomExtension);

            if(HasCustomExtension)
            {
                EditorGUILayout.BeginHorizontal();
                Extension = EditorGUILayout.TextField("Custom Extension: ", Extension ?? DeterminateExtension(target));
                EditorGUILayout.EndHorizontal();
            }
            GUI.enabled = true;

            if(Errors.Count > 0)
            {
                //EditorGUILayout.BeginScrollView(errorScroll, false, false);
                GUILayout.Space(10);
                EditorGUILayout.BeginHorizontal();
                for (int i = 0; i < Errors.Count;++i)
                {

                    Vector2 h = GUI.skin.button.CalcSize(new GUIContent(Errors[i]));
                    EditorGUILayout.SelectableLabel(Errors[i], GUILayout.Height(h.y), GUILayout.Width(h.x));
                }
                EditorGUILayout.EndHorizontal();
                //EditorGUILayout.EndScrollView();
            }
        }
    }
Ejemplo n.º 14
0
 static void GenericBuild(string[] scenes, string target_dir, BuildTarget build_target, BuildOptions build_options)
 {
     if(!Directory.Exists(TARGET_DIR)){
         Directory.CreateDirectory(TARGET_DIR);
     }
         EditorUserBuildSettings.SwitchActiveBuildTarget(build_target);
         string res = BuildPipeline.BuildPlayer(scenes,target_dir,build_target,build_options);
         if (res.Length > 0) {
                 throw new Exception("BuildPlayer failure: " + res);
         }
 }
Ejemplo n.º 15
0
        internal BuildLogger(IApp app, Document doc, ScintillaControl sci, BuildOptions options)
        {
            this.app = app;
            this.doc = doc;
            this.sci = sci;
            this.options = options;

            app.CloseView("ErrorList");
            this.err = app.GetService<IErrorListService>();
            this.output = app.GetService<IOutputService>();
        }
Ejemplo n.º 16
0
 public override string PrepareForBuild(BuildOptions options, BuildTarget target)
 {
     if (EditorUserBuildSettings.wsaSDK != WSASDK.UWP)
     {
         return null;
     }
     if (Utility.UseIl2CppScriptingBackend())
     {
         return null;
     }
     return NuGet.Restore(target);
 }
Ejemplo n.º 17
0
    static void BuildPlatform(BuildTarget target, string locationPathNameBase, BuildOptions options = BuildOptions.None, string gameNamePostfix = "")
    {
        Directory.CreateDirectory(locationPathNameBase);

        var s = Path.Combine(locationPathNameBase, GetName(target, gameNamePostfix));

        Debug.Log(string.Format("building {0} to {1}", target, s));

        OnPreBuild(target, locationPathNameBase, s);
        BuildPipeline.BuildPlayer(GetLevels(target), s, target, options);
        OnPostBuild(target, locationPathNameBase, s);
    }
    public void FromJson(JObject json)
    {
        this.buildPath = null;
        this.scenesInBuild.Clear();
        this.buildTarget = (BuildTarget)0;
        this.buildOptions = BuildOptions.None;

        if (json == null)
        {
            return;
        }

        JToken obj;
        if (json.TryGetValue("path", out obj))
        {
            this.buildPath = (string)obj;
        }

        if (json.TryGetValue("buildTarget", out obj))
        {
            this.buildTarget = (BuildTarget)System.Enum.Parse(typeof(BuildTarget), (string)obj, true);
        }

        if (json.TryGetValue("buildOptions", out obj))
        {
            var options = (JObject)obj;
            var co = (CustomBuildOptions)this.buildOptions;
            foreach (var p in options)
            {
                if ((bool)p.Value)
                {
                    try
                    {
                        co |= (CustomBuildOptions)System.Enum.Parse(typeof(CustomBuildOptions), p.Key, true);
                    }
                    catch
                    {
                    }
                }
            }
            this.buildOptions = (BuildOptions)co;
        }

        if (json.TryGetValue("scenes", out obj))
        {
            var scenes = (JArray)obj;
            foreach (var s in scenes)
            {
                this.scenesInBuild.Add((string)s);
            }
        }
    }
Ejemplo n.º 19
0
 /// <summary>
 ///   <para>Builds a player.</para>
 /// </summary>
 /// <param name="levels">The scenes to be included in the build. If empty, the currently open scene will be built. Paths are relative to the project folder (AssetsMyLevelsMyScene.unity).</param>
 /// <param name="locationPathName">The path where the application will be built.</param>
 /// <param name="target">The BuildTarget to build.</param>
 /// <param name="options">Additional BuildOptions, like whether to run the built player.</param>
 /// <returns>
 ///   <para>An error message if an error occurred.</para>
 /// </returns>
 public static string BuildPlayer(string[] levels, string locationPathName, BuildTarget target, BuildOptions options)
 {
   try
   {
     uint crc;
     return BuildPipeline.BuildPlayerInternal(levels, locationPathName, target, options, out crc);
   }
   catch (Exception ex)
   {
     BuildPipeline.LogBuildExceptionAndExit("BuildPipeline.BuildPlayer", ex);
     return string.Empty;
   }
 }
Ejemplo n.º 20
0
    public static void BuildProject(BuildOptions _buildOption)
    {
        string[] activeScenes = GetActiveScenes();

        // get productName
        string productName = PlayerSettings.productName;
        string dateTimeNow = DateTime.Now.ToString("MM-dd-yy_HHmm");
        string buildName = productName + "_" + dateTimeNow;

        if ((productName.IndexOf("_") != -1))
        {
            productName = productName.Substring(productName.IndexOf("_") + 1);
        }

        // save location
        CreatFolder(Application.dataPath + "/../Builds/" + buildName);

        // get path from save panel
        path = EditorUtility.SaveFilePanel("Build", "Builds/" + buildName, buildName, "exe");

        if (string.Compare(path, "") != 0)
        {
            // hold file extensions
            string tail = "";
            // add .exe if needed
            tail = path.Substring(Math.Max(0, path.Length - 4));
            if (string.Compare(tail, ".exe") != 0)
            {
                path += ".exe";
            }

            UpdateVersionNumber();

            if (copyConfig){
                CopyAssets(configAssetPath, configBuildPath);
            }
            
            if(copyBatch){
                CopyBatch(batchAssetPath, batchBuildPath + buildName, buildName);
            }

            // build
            BuildPipeline.BuildPlayer(activeScenes, path, EditorUserBuildSettings.activeBuildTarget,
                                      BuildOptions.ShowBuiltPlayer | _buildOption);
        }
        else
        {
            Debug.Log("Failed to Build: Missing build name or file path");
        }
    }
Ejemplo n.º 21
0
		public static string BuildPlayer(string[] levels, string locationPathName, BuildTarget target, BuildOptions options)
		{
			string result;
			try
			{
				uint num;
				result = BuildPipeline.BuildPlayerInternal(levels, locationPathName, target, options, out num);
			}
			catch (Exception exception)
			{
				BuildPipeline.LogBuildExceptionAndExit("BuildPipeline.BuildPlayer", exception);
				result = string.Empty;
			}
			return result;
		}
Ejemplo n.º 22
0
		public static string BuildStreamedSceneAssetBundle(string[] levels, string locationPath, BuildTarget target, out uint crc, BuildOptions options)
		{
			crc = 0u;
			string result;
			try
			{
				result = BuildPipeline.BuildPlayerInternal(levels, locationPath, target, options | BuildOptions.BuildAdditionalStreamedScenes, out crc);
			}
			catch (Exception exception)
			{
				BuildPipeline.LogBuildExceptionAndExit("BuildPipeline.BuildStreamedSceneAssetBundle", exception);
				result = string.Empty;
			}
			return result;
		}
Ejemplo n.º 23
0
 protected static void Windows_PublishProduct(BuildOptions option = BuildOptions.None)
 {
     // 创建打包输出根目录
     PublishProductUtil.createPublishProductOutputPath();
     // 实例化全局数据
     ResExportSys.instance();
     // 打包生成 unity3d 资源
     PublishProductUtil.pkgResources();
     // 导出资源列表
     ResExportSys.m_instance.m_pResourcesCfgPackData.m_exportResList.exportResList();
     // 拷贝资源到输出目录
     //PublishProductUtil.copyRes2Dest();
     // 删除 Resources 目录,防止资源被重复打包进输出镜像
     //PublishProductUtil.delResources();
     // 生成镜像
     //PublishProductUtil.buildImage(option);
     // 恢复 Resources 目录资源
     //PublishProductUtil.restoreResources();
 }
    public static void Build(BuildOptions buildOptions, string name, bool includePackages = true)
    {
        Time.timeScale = 1;
        if (settings.release)
        {
            PlayerSettings.Android.keyaliasName = "friuns";
            PlayerSettings.Android.keystorePass = PlayerSettings.Android.keyaliasPass = "******";
        }
        else
            PlayerSettings.Android.keyaliasName = PlayerSettings.Android.keyaliasPass = "";
        var unsigned = string.IsNullOrEmpty(PlayerSettings.Android.keyaliasPass);
        settings.version++;
        settings.SetDirty();
        PlayerSettings.Android.bundleVersionCode = settings.version;
        PlayerSettings.bundleVersion = settings.version.ToString();
        settings.versionDate = DateTime.Now.ToShortDateString();
        if (unsigned)
        {
            PlayerSettings.Android.keyaliasName = "";
            settings.free = false;
        }
        else
            name += "Release";
        if (settings.free)
            name += "Free";

        var flash = activeBuildTarget == BuildTarget.FlashPlayer;
        var android = activeBuildTarget == BuildTarget.Android;
        var web = activeBuildTarget == BuildTarget.WebPlayer || activeBuildTarget == BuildTarget.WebPlayerStreamed;
        var linux = activeBuildTarget == BuildTarget.StandaloneLinux;
        PlayerSettings.bundleIdentifier = "com.dm.race" + (settings.free ? "free" : "");
        string outputFolder = android ? "cops/" + name + ".apk" : flash ? "cops/" + name + ".swf" : web ? "cops" : linux ? "cops/tmlinux/TrackRacing" : "cops/" + name + "PC" + "/" + name + ".exe";
        Debug.Log(outputFolder);
        Debug.Log(buildOptions);
        BuildPipeline.BuildPlayer(packages, outputFolder, activeBuildTarget, buildOptions);
        #if UNITY_EDITOR
        if (web && name != "debug")
            File.Copy("cops/cops.unity3d", "cops/" + name + ".unity3d");
        #endif
    }
Ejemplo n.º 25
0
 // <summary>
 // プロジェクトのビルド </summary>
 public static void Project(BuildTarget target, BuildOptions options, string outputName)
 {
     string directoryName = Path.GetDirectoryName (outputName);
             if (Directory.Exists (directoryName) == true) {
                     Directory.Delete (directoryName, true);
             }
             Directory.CreateDirectory (directoryName);
             EditorUserBuildSettings.SwitchActiveBuildTarget (target);
             string[] allScene = new string[EditorBuildSettings.scenes.Length];
             int count = 0;
             foreach (EditorBuildSettingsScene scene in EditorBuildSettings.scenes) {
                     allScene [count++] = scene.path;
             }
             string errorMsg = BuildPipeline.BuildPlayer (allScene, outputName, target, options);
             if (string.IsNullOrEmpty (errorMsg) == false) {
                     UnityEngine.Debug.Log (errorMsg);
                     StreamWriter sw = new StreamWriter (directoryName + "/" + "BuildError.log", true);
                     sw.WriteLine (errorMsg);
                     sw.Close ();
                     throw new System.ArgumentException ();
             }
 }
Ejemplo n.º 26
0
        public static void buildImage(BuildOptions option = BuildOptions.None)
        {
            string outputImagePath = ExportUtil.getImagePath("", ResExportSys.m_instance.m_targetPlatform);
            ExportUtil.DeleteDirectory(outputImagePath);
            ExportUtil.CreateDirectory(outputImagePath);

            string[] levelsPath = new string[1];    // 打包第一个启动场景目录
            levelsPath[0] = "Assets/Scenes/Start.unity";

            string targetName = ExportUtil.GetBuildTargetName(ResExportSys.m_instance.m_targetPlatform/*EditorUserBuildSettings.activeBuildTarget*/);
            if (targetName == null)
                return;

            // Build and copy AssetBundles.
            //option = EditorUserBuildSettings.development ? BuildOptions.Development : BuildOptions.None;

            PlayerParam param = new PlayerParam();
            param.m_levels = levelsPath;
            param.m_locationPath = outputImagePath + targetName;
            param.m_target = ResExportSys.m_instance.m_targetPlatform;
            param.m_options = option;

            ExportUtil.BuildPlayer(param);
        }
Ejemplo n.º 27
0
 public BuildPlayerOption(string desc, BuildOptions opt)
 {
     option      = opt;
     description = desc;
 }
Ejemplo n.º 28
0
        private static bool BuildPlayer(string notification, BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, DateTime buildTime, BuildOptions options, string configKey)
        {
            bool success = true;

            // Get build options.
            if (releaseType.developmentBuild)
            {
                options |= BuildOptions.Development;
            }
            if (releaseType.allowDebugging)
            {
                options |= BuildOptions.AllowDebugging;
            }

            // Generate build path.
            string buildPath = GenerateBuildPath(BuildSettings.basicSettings.buildPath, releaseType, platform, architecture, distribution, buildTime);
            string exeName   = string.Format(platform.binaryNameFormat, SanitizeFileName(releaseType.productName));

            // Set defines.
            string defines = GenerateDefaultDefines(releaseType, platform, architecture, distribution);

            PlayerSettings.SetScriptingDefineSymbolsForGroup(platform.targetGroup, defines);

            // Pre-build actions.
            PerformPreBuild(releaseType, platform, architecture, distribution, buildTime, ref options, configKey, buildPath);

            // Generate BuildConstants.
            BuildConstantsGenerator.Generate(buildTime, BuildSettings.productParameters.lastGeneratedVersion, releaseType, platform, architecture, distribution);

            // Refresh scene list to make sure nothing has been deleted or moved.
            releaseType.sceneList.Refresh();

            // Report build starting.
            BuildNotificationList.instance.AddNotification(new BuildNotification(
                                                               BuildNotification.Category.Notification,
                                                               notification, configKey,
                                                               true, null));

            // Build player.
            FileUtil.DeleteFileOrDirectory(buildPath);
            string error = BuildPipeline.BuildPlayer(releaseType.sceneList.GetSceneList(), Path.Combine(buildPath, exeName), architecture.target, options);

            if (!string.IsNullOrEmpty(error))
            {
                success = false;

                BuildNotificationList.instance.AddNotification(new BuildNotification(
                                                                   BuildNotification.Category.Error,
                                                                   "Build Failed:", configKey.ToString() + "\n" + error,
                                                                   true, null));
            }

            // Post-build actions.
            PerformPostBuild(releaseType, platform, architecture, distribution, buildTime, ref options, configKey, buildPath);

            return(success);
        }
Ejemplo n.º 29
0
 public static void BuildSingle(string keyChain, BuildOptions options = BuildOptions.None)
 {
     string[] buildConfigs = new string[] { keyChain };
     PerformBuild(buildConfigs, options);
 }
Ejemplo n.º 30
0
        /// <inheritdoc />
        public override void Build(BuildOptions options)
        {
            var root        = options.IntermediateFolder;
            var packagePath = Path.Combine(root, "package.zip");
            var filesToKeep = new[]
            {
                "freetype.Build.cs",
            };

            // Get the source
            Downloader.DownloadFileFromUrlToPath("https://sourceforge.net/projects/freetype/files/freetype2/2.10.0/ft2100.zip/download", packagePath);
            using (ZipArchive archive = ZipFile.Open(packagePath, ZipArchiveMode.Read))
            {
                archive.ExtractToDirectory(root);
                root = Path.Combine(root, archive.Entries.First().FullName);
            }

            var configurationMsvc  = "Release Static";
            var binariesToCopyMsvc = new[]
            {
                "freetype.lib",
                "freetype.pdb",
            };
            var vsSolutionPath  = Path.Combine(root, "builds", "windows", "vc2010", "freetype.sln");
            var vcxprojPath     = Path.Combine(root, "builds", "windows", "vc2010", "freetype.vcxproj");
            var vcxprojContents = File.ReadAllText(vcxprojPath);
            var libraryFileName = "libfreetype.a";

            vcxprojContents = vcxprojContents.Replace("<RuntimeLibrary>MultiThreaded</RuntimeLibrary>", "<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>");
            vcxprojContents = vcxprojContents.Replace("<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>", "<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>");

            foreach (var platform in options.Platforms)
            {
                switch (platform)
                {
                case TargetPlatform.Windows:
                {
                    // Fix the MSVC project settings for Windows
                    PatchWindowsTargetPlatformVersion(vcxprojPath, vcxprojContents, "8.1", "140");

                    // Build for Win64
                    Deploy.VCEnvironment.BuildSolution(vsSolutionPath, configurationMsvc, "x64");
                    var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
                    foreach (var filename in binariesToCopyMsvc)
                    {
                        Utilities.FileCopy(Path.Combine(root, "objs", "x64", configurationMsvc, filename), Path.Combine(depsFolder, filename));
                    }

                    break;
                }

                case TargetPlatform.UWP:
                {
                    // Fix the MSVC project settings for UWP
                    PatchWindowsTargetPlatformVersion(vcxprojPath, vcxprojContents, "10.0.17763.0", "v141");

                    // Build for UWP x64
                    Deploy.VCEnvironment.BuildSolution(vsSolutionPath, configurationMsvc, "x64");
                    var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
                    foreach (var filename in binariesToCopyMsvc)
                    {
                        Utilities.FileCopy(Path.Combine(root, "objs", "x64", configurationMsvc, filename), Path.Combine(depsFolder, filename));
                    }

                    break;
                }

                case TargetPlatform.XboxOne:
                {
                    // Fix the MSVC project settings for Xbox One
                    PatchWindowsTargetPlatformVersion(vcxprojPath, vcxprojContents, "10.0.17763.0", "v141");

                    // Build for Xbox One x64
                    Deploy.VCEnvironment.BuildSolution(vsSolutionPath, configurationMsvc, "x64");
                    var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
                    foreach (var filename in binariesToCopyMsvc)
                    {
                        Utilities.FileCopy(Path.Combine(root, "objs", "x64", configurationMsvc, filename), Path.Combine(depsFolder, filename));
                    }

                    break;
                }

                case TargetPlatform.Linux:
                {
                    var envVars = new Dictionary <string, string>
                    {
                        { "CC", "clang-7" },
                        { "CC_FOR_BUILD", "clang-7" }
                    };
                    var buildDir = Path.Combine(root, "build");

                    // Fix scripts
                    Utilities.Run("sed", "-i -e \'s/\r$//\' autogen.sh", null, root, Utilities.RunOptions.None, envVars);
                    Utilities.Run("sed", "-i -e \'s/\r$//\' configure", null, root, Utilities.RunOptions.None, envVars);
                    Utilities.Run("chmod", "+x autogen.sh", null, root, Utilities.RunOptions.None);
                    Utilities.Run("chmod", "+x configure", null, root, Utilities.RunOptions.None);

                    Utilities.Run(Path.Combine(root, "autogen.sh"), null, null, root, Utilities.RunOptions.Default, envVars);

                    // Disable using libpng even if it's found on the system
                    var cmakeFile = Path.Combine(root, "CMakeLists.txt");
                    File.WriteAllText(cmakeFile,
                                      File.ReadAllText(cmakeFile)
                                      .Replace("find_package(PNG)", "")
                                      .Replace("find_package(ZLIB)", "")
                                      .Replace("find_package(BZip2)", "")
                                      );

                    // Build for Linux
                    SetupDirectory(buildDir, true);
                    var toolchain = UnixToolchain.GetToolchainName(platform, TargetArchitecture.x64);
                    Utilities.Run("cmake", string.Format("-G \"Unix Makefiles\" -DFT_WITH_BZIP2=OFF -DFT_WITH_ZLIB=OFF -DFT_WITH_PNG=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER_TARGET={0} ..", toolchain), null, buildDir, Utilities.RunOptions.None, envVars);
                    Utilities.Run("cmake", "--build .", null, buildDir, Utilities.RunOptions.None, envVars);
                    var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
                    Utilities.FileCopy(Path.Combine(buildDir, libraryFileName), Path.Combine(depsFolder, libraryFileName));

                    break;
                }

                case TargetPlatform.PS4:
                {
                    // Get the build data files
                    Utilities.DirectoryCopy(
                        Path.Combine(GetBinariesFolder(options, platform), "Data", "freetype"),
                        Path.Combine(root, "builds", "PS4"), false, true);

                    // Build for PS4
                    var solutionPath = Path.Combine(root, "builds", "PS4", "freetype.sln");
                    Deploy.VCEnvironment.BuildSolution(solutionPath, "Release", "ORBIS");
                    var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
                    Utilities.FileCopy(Path.Combine(root, "lib", "PS4", libraryFileName), Path.Combine(depsFolder, libraryFileName));

                    break;
                }

                case TargetPlatform.XboxScarlett:
                {
                    // Fix the MSVC project settings for Xbox Scarlett
                    PatchWindowsTargetPlatformVersion(vcxprojPath, vcxprojContents, "10.0.19041.0", "v142");

                    // Build for Xbox Scarlett
                    Deploy.VCEnvironment.BuildSolution(vsSolutionPath, configurationMsvc, "x64");
                    var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
                    foreach (var filename in binariesToCopyMsvc)
                    {
                        Utilities.FileCopy(Path.Combine(root, "objs", "x64", configurationMsvc, filename), Path.Combine(depsFolder, filename));
                    }

                    break;
                }

                case TargetPlatform.Android:
                {
                    var buildDir = Path.Combine(root, "build");

                    // Disable using libpng even if it's found on the system
                    var cmakeFile = Path.Combine(root, "CMakeLists.txt");
                    File.WriteAllText(cmakeFile,
                                      File.ReadAllText(cmakeFile)
                                      .Replace("find_package(PNG)", "")
                                      .Replace("find_package(ZLIB)", "")
                                      .Replace("find_package(BZip2)", "")
                                      );

                    // Build for Android
                    SetupDirectory(buildDir, true);
                    RunCmake(buildDir, TargetPlatform.Android, TargetArchitecture.ARM64, ".. -DFT_WITH_BZIP2=OFF -DFT_WITH_ZLIB=OFF -DFT_WITH_PNG=OFF -DCMAKE_BUILD_TYPE=Release");
                    Utilities.Run("cmake", "--build .", null, buildDir, Utilities.RunOptions.None);
                    var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.ARM64);
                    Utilities.FileCopy(Path.Combine(buildDir, libraryFileName), Path.Combine(depsFolder, libraryFileName));
                    break;
                }
                }
            }

            // Backup files
            var srcIncludePath = Path.Combine(root, "include", "freetype");
            var dstIncludePath = Path.Combine(options.ThirdPartyFolder, "freetype");

            foreach (var filename in filesToKeep)
            {
                var src = Path.Combine(dstIncludePath, filename);
                var dst = Path.Combine(options.IntermediateFolder, filename + ".tmp");
                Utilities.FileCopy(src, dst);
            }

            // Setup headers directory
            SetupDirectory(dstIncludePath, true);

            // Deploy header files and restore files
            Utilities.DirectoryCopy(srcIncludePath, dstIncludePath, true, true);
            Utilities.FileCopy(Path.Combine(root, "include", "ft2build.h"), Path.Combine(dstIncludePath, "ft2build.h"));
            Utilities.FileCopy(Path.Combine(root, "docs", "LICENSE.TXT"), Path.Combine(dstIncludePath, "LICENSE.TXT"));
            foreach (var filename in filesToKeep)
            {
                var src = Path.Combine(options.IntermediateFolder, filename + ".tmp");
                var dst = Path.Combine(dstIncludePath, filename);
                Utilities.FileCopy(src, dst);
            }
        }
Ejemplo n.º 31
0
            static bool PickBuildLocation(BuildTargetGroup targetGroup, BuildTarget target, BuildOptions options, out bool updateExistingBuild)
            {
                updateExistingBuild = false;
                var previousPath = EditorUserBuildSettings.GetBuildLocation(target);

                string defaultFolder;
                string defaultName;

                if (previousPath == String.Empty)
                {
                    defaultFolder = FileUtil.DeleteLastPathNameComponent(Application.dataPath);
                    defaultName   = "";
                }
                else
                {
                    defaultFolder = FileUtil.DeleteLastPathNameComponent(previousPath);
                    defaultName   = FileUtil.GetLastPathNameComponent(previousPath);
                }

                string extension = PostprocessBuildPlayer.GetExtensionForBuildTarget(targetGroup, target, options);

                // Invalidate default name, if extension mismatches the default file (for ex., when switching between folder type export to file type export, see Android)
                if (extension != Path.GetExtension(defaultName).Replace(".", ""))
                {
                    defaultName = string.Empty;
                }

                // Hack: For Windows Standalone, we want the BuildPanel to choose a folder,
                // but we don't want BuildPlayer to take a folder path because historically it took an .exe path
                // and we would be breaking tons of projects!
                bool   isWindowsStandalone = target == BuildTarget.StandaloneWindows || target == BuildTarget.StandaloneWindows64;
                string realExtension       = extension;

                if (isWindowsStandalone)
                {
                    extension = string.Empty;
                    // Remove the filename.exe part from the path
                    if (!string.IsNullOrEmpty(defaultName))
                    {
                        defaultName = Path.GetDirectoryName(defaultName);
                    }
                }

                string title = "Build " + BuildPlatforms.instance.GetBuildTargetDisplayName(targetGroup, target);
                string path  = EditorUtility.SaveBuildPanel(target, title, defaultFolder, defaultName, extension, out updateExistingBuild);

                if (path == string.Empty)
                {
                    return(false);
                }

                if (isWindowsStandalone)
                {
                    extension = realExtension;
                    path      = Path.Combine(path, PlayerSettings.productName + '.' + extension);
                }

                if (!IsBuildPathValid(path))
                {
                    return(false);
                }

                // Enforce extension if needed
                if (extension != string.Empty && FileUtil.GetPathExtension(path).ToLower() != extension)
                {
                    path += '.' + extension;
                }

                // A path may not be empty initially, but it could contain, e.g., a drive letter (as in Windows),
                // so even appending an extention will work fine, but in reality the name will be, for example,
                // G:/
                //Debug.Log(path);

                string currentlyChosenName = FileUtil.GetLastPathNameComponent(path);

                if (currentlyChosenName == string.Empty)
                {
                    return(false); // No nameless projects, please
                }
                // We don't want to re-create a directory that already exists, this may
                // result in access-denials that will make users unhappy.
                string check_dir = extension != string.Empty ? FileUtil.DeleteLastPathNameComponent(path) : path;

                if (!Directory.Exists(check_dir))
                {
                    Directory.CreateDirectory(check_dir);
                }

                // On OSX we've got replace/update dialog, for other platforms warn about deleting
                // files in target folder.
                if ((target == BuildTarget.iOS) && (Application.platform != RuntimePlatform.OSXEditor))
                {
                    if (!FolderIsEmpty(path) && !UserWantsToDeleteFiles(path))
                    {
                        return(false);
                    }
                }

                EditorUserBuildSettings.SetBuildLocation(target, path);
                return(true);
            }
Ejemplo n.º 32
0
 /// <summary>
 /// Gets the dependency packages binaries folder.
 /// </summary>
 /// <param name="options">The options.</param>
 /// <param name="platform">The target platform.</param>
 /// <returns>The absolute path to the deps folder for the given platform and architecture configuration.</returns>
 public static string GetBinariesFolder(BuildOptions options, TargetPlatform platform)
 {
     return(Path.Combine(options.PlatformsFolder, platform.ToString(), "Binaries"));
 }
Ejemplo n.º 33
0
 /// <summary>
 /// Builds the dependency package using the specified options.
 /// </summary>
 /// <param name="options">The options.</param>
 public abstract void Build(BuildOptions options);
 private IEnumerable <string> GetFilePaths(BuildOptions options)
 {
     return(options.SourceFiles.Select(f => _project.MakeRelative(f.Path)));
 }
Ejemplo n.º 35
0
 /// <summary>
 /// Setups the linking files arguments.
 /// </summary>
 /// <param name="graph">The graph.</param>
 /// <param name="options">The options.</param>
 /// <param name="args">The arguments.</param>
 protected virtual void SetupLinkFilesArgs(TaskGraph graph, BuildOptions options, List <string> args)
 {
 }
Ejemplo n.º 36
0
    // 실제 빌드 함수
    private static bool ProcessBuild(string[] scenes, string targetDir, BuildTarget buildTarget, BuildOptions buildOptions)
    {
        // 빌드 메뉴를 플랫폼별로 생성시에만 필요.
        // 플랫폼별로 프로젝트를 생성하는게 관리 소홀
        if (buildTarget != EditorUserBuildSettings.activeBuildTarget)
        {
            Debug.LogError(buildTarget + " does not matched with " + EditorUserBuildSettings.activeBuildTarget);
            // 필요시 EditorUserBuildSettings.SwitchActiveBuildTarget(buildTarget) 를 통해서 변경 가능
            return(false);
        }

        bool buildSuccess = true;

        string message = BuildPipeline.BuildPlayer(scenes, targetDir, buildTarget, buildOptions);

        if (!string.IsNullOrEmpty(message))
        {
            buildSuccess = false;
            throw new System.Exception(buildTarget + " processBuild failed.");
        }

        if (!buildSuccess)
        {
            return(false);
        }

        Debug.Log(buildTarget + " processBuild succeed.");

        return(AfterProcessBuild(targetDir, buildTarget));
    }
Ejemplo n.º 37
0
    /// <inheritdoc />
    public override void Setup(BuildOptions options)
    {
        base.Setup(options);

        options.PublicDefinitions.Add("ENET");
    }
Ejemplo n.º 38
0
        private void App_OnStartup(object sender, StartupEventArgs e)
        {
#if __DESIGN_DEVELOP
            var designWindow = new __DESIGN_DEVELOP();
            designWindow.ShowDialog();
            return;
#endif
            RenderOptions.ProcessRenderMode         = RenderMode.SoftwareOnly;
            ApplicationStateManager.App             = this;
            ApplicationStateManager.ApplicationExit = () =>
            {
                this.Dispatcher.Invoke(() =>
                {
                    this.Shutdown();
                });
            };
            var isDevelop   = Environment.GetCommandLineArgs().Contains("-dev");
            var isLauncher  = Environment.GetCommandLineArgs().Contains("-lc");
            var launcherPID = ParseLauncherPID();
            Launcher.SetIsUpdated(Environment.GetCommandLineArgs().Contains("-updated"));
            Launcher.SetIsUpdatedFailed(Environment.GetCommandLineArgs().Contains("-updateFailed"));
            Launcher.SetIsLauncher(isLauncher);
            // Set working directory to exe
            var pathSet = false;
            var path    = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            if (path != null)
            {
                if (isLauncher)
                {
                    var oneUpPath = new Uri(Path.Combine(path, @"..\")).LocalPath;
                    Paths.SetRoot(oneUpPath);
                    Paths.SetAppRoot(path);
                    // TODO this might be problematic
                    Environment.CurrentDirectory = oneUpPath;
                }
                else if (isDevelop)
                {
                    Paths.SetRoot(path);
                    Paths.SetAppRoot(path);
                    Environment.CurrentDirectory = path;
                }
                else
                {
                    MessageBox.Show("You must run the application via 'NiceHashMiner.exe' launcher", "Direct run disabled!", MessageBoxButton.YesNo);
                    Application.Current.Shutdown();
                    return;
                }
                pathSet = true;
            }

            // Add common folder to path for launched processes
            const string pathKey = "PATH";
            var          pathVar = Environment.GetEnvironmentVariable(pathKey);
            pathVar += $";{Path.Combine(Paths.AppRoot, "common")}";
            Environment.SetEnvironmentVariable(pathKey, pathVar);

            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            // Set security protocols
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls |
                                                    SecurityProtocolType.Tls11 |
                                                    SecurityProtocolType.Tls12 |
                                                    SecurityProtocolType.Ssl3;

            // Initialize config
            ConfigManager.InitializeConfig();

            ThemeSetterManager.SetTheme(GUISettings.Instance.DisplayTheme);

            // Check multiple instances
            if (!MiscSettings.Instance.AllowMultipleInstances)
            {
                try
                {
                    var current      = Process.GetCurrentProcess();
                    var processesIds = Process.GetProcessesByName(current.ProcessName).Select(p => p.Id);
                    if (processesIds.Any(pid => pid != current.Id && pid != launcherPID))
                    {
                        var singleInstanceNotice = new SingleInstanceNotice {
                        };
                        singleInstanceNotice.ShowDialog();
                        // Shutdown to exit
                        Shutdown();
                        return;
                    }
                }
                catch
                { }
            }

            // Init logger
            Logger.ConfigureWithFile(LoggingDebugConsoleSettings.Instance.LogToFile, Level.Info, LoggingDebugConsoleSettings.Instance.LogMaxFileSize);
            BuildOptions.Init();
            Logger.Info(Tag, $"Build {BuildOptions.BUILD_TAG}");

            if (LoggingDebugConsoleSettings.Instance.DebugConsole)
            {
                PInvokeHelpers.AllocConsole();
                Logger.ConfigureConsoleLogging(Level.Info);
            }

            if (!pathSet)
            {
                Logger.Warn(Tag, "Path not set to executable");
            }

            // Set to explicit shutdown or else these intro windows will cause shutdown
            ShutdownMode = ShutdownMode.OnExplicitShutdown;

            Logger.Info(Tag, $"Starting up {ApplicationStateManager.Title}");
            if (ToSSetings.Instance.AgreedWithTOS != ApplicationStateManager.CurrentTosVer)
            {
                Logger.Info(Tag, $"TOS differs! agreed: {ToSSetings.Instance.AgreedWithTOS} != Current {ApplicationStateManager.CurrentTosVer}");

                var eula     = new EulaWindowFirstLong {
                };
                var accepted = eula.ShowDialog();
                if (accepted.HasValue && eula.AcceptedTos)
                {
                    ToSSetings.Instance.AgreedWithTOS = ApplicationStateManager.CurrentTosVer;
                }
                else
                {
                    Logger.Error(Tag, "TOS differs AFTER TOS confirmation window");
                    Shutdown();
                    return;
                }
            }

            // Check 3rd party miners TOS
            if (ToSSetings.Instance.Use3rdPartyMinersTOS != ApplicationStateManager.CurrentTosVer)
            {
                var thirdPty = new EulaWindowSecondShort {
                };
                thirdPty.ShowDialog();
                if (!thirdPty.Accepted)
                {
                    Logger.Error(Tag, "3rd party TOS not accepted");
                    Shutdown();
                    return;
                }
                ToSSetings.Instance.Use3rdPartyMinersTOS = ApplicationStateManager.CurrentTosVer;
                ConfigManager.GeneralConfigFileCommit();
            }

            // Chose lang
            if (string.IsNullOrEmpty(TranslationsSettings.Instance.Language) && AppRuntimeSettings.ShowLanguage)
            {
                if (Translations.GetAvailableLanguagesNames().Count > 1)
                {
                    var lang = new ChooseLanguageWindow {
                    };
                    lang.ShowDialog();
                }
                // check if user didn't choose anything
                if (string.IsNullOrEmpty(TranslationsSettings.Instance.Language))
                {
                    TranslationsSettings.Instance.Language = "en";
                }
                ConfigManager.GeneralConfigFileCommit();
            }
            else if (string.IsNullOrEmpty(TranslationsSettings.Instance.Language) && !AppRuntimeSettings.ShowLanguage)
            {
                // while we have locale disabled set english
                TranslationsSettings.Instance.Language = "en";
                ConfigManager.GeneralConfigFileCommit();
            }

            Translations.SelectedLanguage = TranslationsSettings.Instance.Language;

            // Check sys requirements
            var canRun = ApplicationStateManager.SystemRequirementsEnsured();
            if (!canRun)
            {
                Shutdown();
                return;
            }

            bool?loginSuccess = null;
#if ENABLE_LOGIN
            FilterOSSpecific.GetWindowsVersion();
            // show login if no BTC
            if (!CredentialsSettings.Instance.IsBitcoinAddressValid && AppRuntimeSettings.ShowLoginWindow && SystemVersion.BuildNumber >= 17110)
            {
                var login = new LoginWindow {
                };
                login.ShowDialog();
                loginSuccess = login.LoginSuccess;
            }
#endif
            if (!CredentialsSettings.Instance.IsBitcoinAddressValid)
            {
                var btcNotice = new DemoBTCNotice {
                };
                btcNotice.ShowDialog();
            }

            var main = new MainWindow(loginSuccess);
            main.Show();

            //// Set shutdown mode back to default
            //ShutdownMode = ShutdownMode.OnLastWindowClose;
        }
Ejemplo n.º 39
0
        /// <inheritdoc />
        public override void Build(BuildOptions options)
        {
            var root            = options.IntermediateFolder;
            var configuration   = "Release";
            var outputFileNames = new[]
            {
                "DirectXTex.lib",
                "DirectXTex.pdb",
            };

            // Get the source
            CloneGitRepo(root, "https://github.com/Microsoft/DirectXTex.git");
            GitCheckout(root, "master", "9a417f506c43e087b84c017260ad673abd6c64e1");

            foreach (var platform in options.Platforms)
            {
                switch (platform)
                {
                case TargetPlatform.Windows:
                {
                    var solutionPath = Path.Combine(root, "DirectXTex_Desktop_2015.sln");
                    var binFolder    = Path.Combine(root, "DirectXTex", "Bin", "Desktop_2015");
                    Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, "x64");
                    var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
                    foreach (var file in outputFileNames)
                    {
                        Utilities.FileCopy(Path.Combine(binFolder, "x64", configuration, file), Path.Combine(depsFolder, file));
                    }
                    break;
                }

                case TargetPlatform.UWP:
                case TargetPlatform.XboxOne:
                {
                    var solutionPath = Path.Combine(root, "DirectXTex_Windows10_2017.sln");
                    var binFolder    = Path.Combine(root, "DirectXTex", "Bin", "Windows10_2017");
                    Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, "x64");
                    var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
                    foreach (var file in outputFileNames)
                    {
                        Utilities.FileCopy(Path.Combine(binFolder, "x64", configuration, file), Path.Combine(depsFolder, file));
                    }
                    break;
                }

                case TargetPlatform.XboxScarlett:
                {
                    var solutionPath = Path.Combine(root, "DirectXTex_GXDK_2017.sln");
                    File.Copy(Path.Combine(GetBinariesFolder(options, platform), "DirectXTex_GXDK_2017.sln"), solutionPath, true);
                    var projectFileContents = File.ReadAllText(Path.Combine(GetBinariesFolder(options, platform), "DirectXTex_GXDK_2017.vcxproj"));
                    projectFileContents = projectFileContents.Replace("___VS_TOOLSET___", "v142");
                    var projectPath = Path.Combine(root, "DirectXTex", "DirectXTex_GXDK_2017.vcxproj");
                    File.WriteAllText(projectPath, projectFileContents);
                    var binFolder = Path.Combine(root, "DirectXTex", "Bin", "GXDK_2017");
                    Deploy.VCEnvironment.BuildSolution(solutionPath, configuration, "Gaming.Xbox.Scarlett.x64");
                    var depsFolder = GetThirdPartyFolder(options, platform, TargetArchitecture.x64);
                    foreach (var file in outputFileNames)
                    {
                        Utilities.FileCopy(Path.Combine(binFolder, "Gaming.Xbox.Scarlett.x64", configuration, file), Path.Combine(depsFolder, file));
                    }
                    break;
                }
                }
            }

            // Deploy header files and license file
            var dstIncludePath = Path.Combine(options.ThirdPartyFolder, "DirectXTex");

            foreach (var file in new[]
            {
                "DirectXTex/DirectXTex.h",
                "DirectXTex/DirectXTex.inl",
                "LICENSE",
            })
            {
                Utilities.FileCopy(Path.Combine(root, file), Path.Combine(dstIncludePath, Path.GetFileName(file)));
            }
        }
Ejemplo n.º 40
0
    /// <summary>
    /// 显示平台设置界面
    /// </summary>
    void OnGUI()
    {
        EditorGUILayout.LabelField("SDK配置", EditorStyles.boldLabel);

        webUrl           = EditorGUILayout.TextField("热更地址", webUrl);
        loginIP          = EditorGUILayout.TextField("服务器IP", loginIP);
        loginPort        = EditorGUILayout.TextField("服务器端口", loginPort);
        bundleIdentifier = EditorGUILayout.TextField("应用id", bundleIdentifier);
        serverVersion    = EditorGUILayout.TextField("服务器版本号", serverVersion);
        string[] selectNames = { BuildTarget.StandaloneWindows.ToString(),
                                 BuildTarget.StandaloneWindows64.ToString(),
                                 BuildTarget.Android.ToString(),
                                 BuildTarget.iOS.ToString() };
        int[]    selectValues = { BuildTarget.StandaloneWindows.GetHashCode(),
                                  BuildTarget.StandaloneWindows64.GetHashCode(),
                                  BuildTarget.Android.GetHashCode(),
                                  BuildTarget.iOS.GetHashCode() };
        buildTarget   = EditorGUILayout.IntPopup("发布平台", buildTarget, selectNames, selectValues);
        isDevelopment = EditorGUILayout.Toggle("是否开发版本", isDevelopment);
        if (isDevelopment)
        {
            isAutoConnect = EditorGUILayout.Toggle("是否性能分析", isAutoConnect);
            isDebug       = EditorGUILayout.Toggle("是否调试版本", isDebug);
        }
        else
        {
            isAutoConnect = false;
            isDebug       = false;
        }
        isAutoBuild = EditorGUILayout.Toggle("是否自动出包", isAutoBuild);


        if (GUILayout.Button("设置", GUILayout.Width(50)))
        {
            FileInfo     scriptFile = new FileInfo("Assets/Scripts/Platform/Global/GlobalData.cs");
            StreamReader reader     = new StreamReader(scriptFile.FullName);
            string       scriptStr  = reader.ReadToEnd();
            reader.Close();
            string webUrlStr        = string.Format("    public const string WebUrl = \"{0}\";", webUrl);
            string loginIPStr       = string.Format("    public static string LoginServer = \"{0}\";", loginIP);
            string loginPortStr     = string.Format("    public static int LoginPort = {0};", loginPort);
            string platformStr      = string.Format("    public static SDKPlatform sdkPlatform = SDKPlatform.{0};", plat.ToString());
            string serverVersionStr = string.Format("    public static string VERSIONS = \"{0}\";", serverVersion);
            Regex  reg1             = new Regex(@"    public const string WebUrl = .*");
            scriptStr = reg1.Replace(scriptStr, webUrlStr);
            Regex reg2 = new Regex(@"    public static string LoginServer = .*");
            scriptStr = reg2.Replace(scriptStr, loginIPStr);
            Regex reg3 = new Regex(@"    public static int LoginPort = .*");
            scriptStr = reg3.Replace(scriptStr, loginPortStr);
            Regex reg4 = new Regex(@"    public static SDKPlatform sdkPlatform = .*");
            scriptStr = reg4.Replace(scriptStr, platformStr);
            Regex reg5 = new Regex(@"    public static string VERSIONS = .*");
            scriptStr = reg5.Replace(scriptStr, serverVersionStr);
            TextEditor textEditor = new TextEditor();
            textEditor.text = scriptStr;
            textEditor.OnFocus();
            textEditor.Copy();
            FileStream   fs = new FileStream("Assets/Scripts/Platform/Global/GlobalData.cs", FileMode.Create);
            StreamWriter sw = new StreamWriter(fs);
            //开始写入
            sw.Write(textEditor.text);
            //清空缓冲区
            sw.Flush();
            //关闭流
            sw.Close();
            fs.Close();
            PlayerSettings.bundleVersion    = serverVersion;
            PlayerSettings.bundleIdentifier = bundleIdentifier;
            if (callBack != null)
            {
                callBack();
            }
            AssetDatabase.Refresh();
            string url = Application.dataPath.Replace("/Assets", "/");
            if (buildTarget == BuildTarget.StandaloneWindows.GetHashCode() || buildTarget == BuildTarget.StandaloneWindows64.GetHashCode())
            {
                url += "client/client.exe";
            }
            else if (buildTarget == BuildTarget.Android.GetHashCode() && plat == SDKPlatform.ANDROID)
            {
                url += string.Format("微信登录端{0}.apk", serverVersion);
            }
            else if (buildTarget == BuildTarget.Android.GetHashCode() && plat == SDKPlatform.LOCAL)
            {
                url += string.Format("客户端{0}.apk", serverVersion);
            }
            else if (buildTarget == BuildTarget.iOS.GetHashCode())
            {
                url += "XCode";
            }
            BuildOptions buildOptions = BuildOptions.None;
            if (isDevelopment)
            {
                buildOptions |= BuildOptions.Development;
            }
            if (isDebug)
            {
                buildOptions |= BuildOptions.AllowDebugging;
            }
            if (isAutoConnect)
            {
                buildOptions |= BuildOptions.ConnectWithProfiler;
            }
            if (isAutoBuild)
            {
                BuildPipeline.BuildPlayer(GetBuildScenes(), url, (BuildTarget)buildTarget, buildOptions);
                string folderUrl = url;
                while (folderUrl.IndexOf('/') != -1)
                {
                    folderUrl = folderUrl.Replace('/', '\\');
                }
                System.Diagnostics.Process.Start("Explorer.exe", "/select," + folderUrl);
            }
            Debug.LogError("版本设置完成");
        }
    }
Ejemplo n.º 41
0
    static void GenericBuild(string[] scenes, string target_dir, BuildTargetGroup targetGroup, BuildTarget build_target, BuildOptions build_options)
    {
        EditorUserBuildSettings.SwitchActiveBuildTarget(targetGroup, build_target);
        string res = BuildPipeline.BuildPlayer(scenes, target_dir, build_target, build_options);

        if (res.Length > 0)
        {
            UnityEngine.Debug.LogFormat("<color=red>BuildPlayer error: {0}</color>", res);
        }

        ProcessStartInfo pi = new ProcessStartInfo(
#if UNITY_EDITOR_WIN
            "explorer.exe",
#elif UNITY_EDITOR_OSX
            "open",
#endif
            TARGET_DIR
            );

        Process.Start(pi);
    }
Ejemplo n.º 42
0
    // ------------------------------------------------------------------------
    // e.g. BuildTargetGroup.Standalone, BuildTarget.StandaloneOSX
    // ------------------------------------------------------------------------
    private static void BuildProject(string[] scenes, string targetDir, BuildTargetGroup buildTargetGroup, BuildTarget buildTarget, BuildOptions buildOptions)
    {
        PlayerSettings.keyaliasPass = "******";
        PlayerSettings.keystorePass = "******";

        System.Console.WriteLine("[JenkinsBuild] Building:" + targetDir + " buildTargetGroup:" + buildTargetGroup.ToString() + " buildTarget:" + buildTarget.ToString());

        // https://docs.unity3d.com/ScriptReference/EditorUserBuildSettings.SwitchActiveBuildTarget.html
        bool switchResult = EditorUserBuildSettings.SwitchActiveBuildTarget(buildTargetGroup, buildTarget);

        if (switchResult)
        {
            System.Console.WriteLine("[JenkinsBuild] Successfully changed Build Target to: " + buildTarget.ToString());
        }
        else
        {
            System.Console.WriteLine("[JenkinsBuild] Unable to change Build Target to: " + buildTarget.ToString() + " Exiting...");
            return;
        }

        // https://docs.unity3d.com/ScriptReference/BuildPipeline.BuildPlayer.html
        BuildReport  buildReport  = BuildPipeline.BuildPlayer(scenes, targetDir, buildTarget, buildOptions);
        BuildSummary buildSummary = buildReport.summary;

        if (buildSummary.result == BuildResult.Succeeded)
        {
            System.Console.WriteLine("[JenkinsBuild] Build Success: Time:" + buildSummary.totalTime + " Size:" + buildSummary.totalSize + " bytes");
        }
        else
        {
            System.Console.WriteLine("[JenkinsBuild] Build Failed: Time:" + buildSummary.totalTime + " Total Errors:" + buildSummary.totalErrors);
        }
    }
Ejemplo n.º 43
0
    static void GenericBuild(string[] scenes, string target_dir, BuildTarget build_target, BuildOptions build_options)
    {
        if (!Directory.Exists(TARGET_DIR))
        {
            Directory.CreateDirectory(TARGET_DIR);
        }
        EditorUserBuildSettings.SwitchActiveBuildTarget(build_target);
        string res = BuildPipeline.BuildPlayer(scenes, target_dir, build_target, build_options);

        if (res.Length > 0)
        {
            throw new Exception("BuildPlayer failure: " + res);
        }
    }
 public override string GetExtension(BuildTarget target, BuildOptions options)
 {
     return "tpk";
 }
Ejemplo n.º 45
0
 /// <summary>
 /// Gets the dependency third-party packages binaries folder.
 /// </summary>
 /// <param name="options">The options.</param>
 /// <param name="platform">The target platform.</param>
 /// <param name="architecture">The target architecture.</param>
 /// <returns>The absolute path to the deps folder for the given platform and architecture configuration.</returns>
 public static string GetThirdPartyFolder(BuildOptions options, TargetPlatform platform, TargetArchitecture architecture)
 {
     return(Path.Combine(options.PlatformsFolder, platform.ToString(), "Binaries", "ThirdParty", architecture.ToString()));
 }
Ejemplo n.º 46
0
    private static void BuildGameOnPlatform( string where, BuildTarget buildTarget, BuildOptions buildOptions )
    {
        string[] levels = GetLevelsForBuild();

        // Build player.
        BuildPipeline.BuildPlayer( levels, where, buildTarget, buildOptions );
    }
Ejemplo n.º 47
0
        public static void BuildProject()
        {
            // Gather values from args
            var options = ArgumentsParser.GetValidatedOptions();

            // Gather values from project
            var scenes = EditorBuildSettings.scenes.Where(scene => scene.enabled).Select(s => s.path).ToArray();

            // Get all buildOptions from options
            BuildOptions buildOptions = BuildOptions.None;

            foreach (string buildOptionString in Enum.GetNames(typeof(BuildOptions)))
            {
                if (options.ContainsKey(buildOptionString))
                {
                    BuildOptions buildOptionEnum = (BuildOptions)Enum.Parse(typeof(BuildOptions), buildOptionString);
                    buildOptions |= buildOptionEnum;
                }
            }

            // Define BuildPlayer Options
            var buildPlayerOptions = new BuildPlayerOptions {
                scenes           = scenes,
                locationPathName = options["customBuildPath"],
                target           = (BuildTarget)Enum.Parse(typeof(BuildTarget), options["buildTarget"]),
                options          = buildOptions
            };

            // Set version for this build
            VersionApplicator.SetVersion(options["buildVersion"]);
            VersionApplicator.SetAndroidVersionCode(options["androidVersionCode"]);

            // Apply Android settings
            if (buildPlayerOptions.target == BuildTarget.Android)
            {
                AndroidSettings.Apply(options);
            }

            // Execute default AddressableAsset content build, if the package is installed.
            // Version defines would be the best solution here, but Unity 2018 doesn't support that,
            // so we fall back to using reflection instead.
            var addressableAssetSettingsType = Type.GetType(
                "UnityEditor.AddressableAssets.Settings.AddressableAssetSettings,Unity.Addressables.Editor");

            if (addressableAssetSettingsType != null)
            {
                // ReSharper disable once PossibleNullReferenceException, used from try-catch
                try
                {
                    addressableAssetSettingsType.GetMethod("CleanPlayerContent", BindingFlags.Static | BindingFlags.Public)
                    .Invoke(null, new object[] { null });
                    addressableAssetSettingsType.GetMethod("BuildPlayerContent", new Type[0]).Invoke(null, new object[0]);
                }
                catch (Exception e)
                {
                    Debug.LogError($"Failed to run default addressables build:\n{e}");
                }
            }

            // Perform build
            BuildReport buildReport = BuildPipeline.BuildPlayer(buildPlayerOptions);

            // Summary
            BuildSummary summary = buildReport.summary;

            StdOutReporter.ReportSummary(summary);

            // Result
            BuildResult result = summary.result;

            StdOutReporter.ExitWithResult(result);
        }
Ejemplo n.º 48
0
 private static string GetCachePath(Module module, BuildOptions moduleOptions)
 {
     return(Path.Combine(moduleOptions.IntermediateFolder, module.Name + ".Bindings.cache"));
 }
Ejemplo n.º 49
0
        /// <inheritdoc />
        public override CompileOutput CompileCppFiles(TaskGraph graph, BuildOptions options, List <string> sourceFiles, string outputPath)
        {
            var compileEnvironment = options.CompileEnv;
            var output             = new CompileOutput();

            // Setup arguments shared by all source files
            var commonArgs = new List <string>();

            SetupCompileCppFilesArgs(graph, options, commonArgs);
            {
                // Suppress Startup Banner
                commonArgs.Add("/nologo");

                // Compile Without Linking
                commonArgs.Add("/c");

                // Generate Intrinsic Functions
                if (compileEnvironment.IntrinsicFunctions)
                {
                    commonArgs.Add("/Oi");
                }

                // Enable Function-Level Linking
                if (compileEnvironment.FunctionLevelLinking)
                {
                    commonArgs.Add("/Gy");
                }
                else
                {
                    commonArgs.Add("/Gy-");
                }

                // List Include Files
                //commonArgs.Add("/showIncludes");

                // Code Analysis
                commonArgs.Add("/analyze-");

                // Remove unreferenced COMDAT
                commonArgs.Add("/Zc:inline");

                // Favor Small Code, Favor Fast Code
                if (compileEnvironment.FavorSizeOrSpeed == FavorSizeOrSpeed.FastCode)
                {
                    commonArgs.Add("/Ot");
                }
                else if (compileEnvironment.FavorSizeOrSpeed == FavorSizeOrSpeed.SmallCode)
                {
                    commonArgs.Add("/Os");
                }

                // Run-Time Error Checks
                if (compileEnvironment.RuntimeChecks && !compileEnvironment.CompileAsWinRT)
                {
                    commonArgs.Add("/RTC1");
                }

                // Inline Function Expansion
                if (compileEnvironment.Inlining)
                {
                    commonArgs.Add("/Ob2");
                }

                if (compileEnvironment.DebugInformation)
                {
                    // Debug Information Format
                    commonArgs.Add("/Zi");

                    // Enhance Optimized Debugging
                    commonArgs.Add("/Zo");
                }

                if (compileEnvironment.Optimization)
                {
                    // Enable Most Speed Optimizations
                    commonArgs.Add("/Ox");

                    // Generate Intrinsic Functions
                    commonArgs.Add("/Oi");

                    // Frame-Pointer Omission
                    commonArgs.Add("/Oy");

                    if (compileEnvironment.WholeProgramOptimization)
                    {
                        // Whole Program Optimization
                        commonArgs.Add("/GL");
                    }
                }
                else
                {
                    // Disable compiler optimizations (Debug)
                    commonArgs.Add("/Od");

                    // Frame-Pointer Omission
                    commonArgs.Add("/Oy-");
                }

                // Full Path of Source Code File in Diagnostics
                commonArgs.Add("/FC");

                // Report Internal Compiler Errors
                commonArgs.Add("/errorReport:prompt");

                // Exception Handling Model
                if (!compileEnvironment.CompileAsWinRT)
                {
                    if (compileEnvironment.EnableExceptions)
                    {
                        commonArgs.Add("/EHsc");
                    }
                    else
                    {
                        commonArgs.Add("/D_HAS_EXCEPTIONS=0");
                    }
                }

                // Eliminate Duplicate Strings
                if (compileEnvironment.StringPooling)
                {
                    commonArgs.Add("/GF");
                }
                else
                {
                    commonArgs.Add("/GF-");
                }

                // Use Run-Time Library
                if (compileEnvironment.UseDebugCRT)
                {
                    commonArgs.Add("/MDd");
                }
                else
                {
                    commonArgs.Add("/MD");
                }

                // Specify floating-point behavior
                commonArgs.Add("/fp:fast");
                commonArgs.Add("/fp:except-");

                // Buffer Security Check
                if (compileEnvironment.BufferSecurityCheck)
                {
                    commonArgs.Add("/GS");
                }
                else
                {
                    commonArgs.Add("/GS-");
                }

                // Enable Run-Time Type Information
                if (compileEnvironment.RuntimeTypeInfo)
                {
                    commonArgs.Add("/GR");
                }
                else
                {
                    commonArgs.Add("/GR-");
                }

                // Treats all compiler warnings as errors
                if (compileEnvironment.TreatWarningsAsErrors)
                {
                    commonArgs.Add("/WX");
                }
                else
                {
                    commonArgs.Add("/WX-");
                }

                // Show warnings
                commonArgs.Add("/W3");

                // Silence macro redefinition warning
                commonArgs.Add("/wd\"4005\"");

                // wchar_t is Native Type
                commonArgs.Add("/Zc:wchar_t");

                // Common Language Runtime Compilation
                if (compileEnvironment.CompileAsWinRT)
                {
                    commonArgs.Add("/clr");
                }

                // Windows Runtime Compilation
                if (compileEnvironment.WinRTComponentExtensions)
                {
                    commonArgs.Add("/ZW");
                    //commonArgs.Add("/ZW:nostdlib");

                    var dir = GetCppCXMetadataDirectory();
                    if (dir != null)
                    {
                        commonArgs.Add(string.Format("/AI\"{0}\"", dir));
                        commonArgs.Add(string.Format("/FU\"{0}\\platform.winmd\"", dir));
                    }
                }
            }

            // Add preprocessor definitions
            foreach (var definition in compileEnvironment.PreprocessorDefinitions)
            {
                commonArgs.Add(string.Format("/D \"{0}\"", definition));
            }

            // Add include paths
            foreach (var includePath in compileEnvironment.IncludePaths)
            {
                AddIncludePath(commonArgs, includePath);
            }

            // Compile all C++ files
            var args = new List <string>();

            foreach (var sourceFile in sourceFiles)
            {
                var sourceFilename = Path.GetFileNameWithoutExtension(sourceFile);
                var task           = graph.Add <CompileCppTask>();

                // Use shared arguments
                args.Clear();
                args.AddRange(commonArgs);

                if (compileEnvironment.DebugInformation)
                {
                    // Program Database File Name
                    var pdbFile = Path.Combine(outputPath, sourceFilename + ".pdb");
                    args.Add(string.Format("/Fd\"{0}\"", pdbFile));
                    output.DebugDataFiles.Add(pdbFile);
                }

                if (compileEnvironment.GenerateDocumentation)
                {
                    // Process Documentation Comments
                    var docFile = Path.Combine(outputPath, sourceFilename + ".xdc");
                    args.Add(string.Format("/doc\"{0}\"", docFile));
                    output.DocumentationFiles.Add(docFile);
                }

                // Object File Name
                var objFile = Path.Combine(outputPath, sourceFilename + ".obj");
                args.Add(string.Format("/Fo\"{0}\"", objFile));
                output.ObjectFiles.Add(objFile);
                task.ProducedFiles.Add(objFile);

                // Source File Name
                args.Add("\"" + sourceFile + "\"");

                // Request included files to exist
                var includes = IncludesCache.FindAllIncludedFiles(sourceFile);
                task.PrerequisiteFiles.AddRange(includes);

                // Compile
                task.WorkingDirectory = options.WorkingDirectory;
                task.CommandPath      = _compilerPath;
                task.CommandArguments = string.Join(" ", args);
                task.PrerequisiteFiles.Add(sourceFile);
                task.Cost = task.PrerequisiteFiles.Count; // TODO: include source file size estimation to improve tasks sorting
            }

            return(output);
        }
Ejemplo n.º 50
0
    /// <inheritdoc />
    public override void Setup(BuildOptions options)
    {
        base.Setup(options);

        options.SourcePaths.Clear();
        options.SourceFiles.AddRange(Directory.GetFiles(FolderPath, "*.*", SearchOption.TopDirectoryOnly));

        var depsRoot = options.DepsFolder;

        bool useNone    = true;
        bool useOpenAL  = false;
        bool useXAudio2 = false;

        switch (options.Platform.Target)
        {
        case TargetPlatform.Windows:
            useNone   = true;
            useOpenAL = true;
            //useXAudio2 = true;
            break;

        case TargetPlatform.XboxOne:
        case TargetPlatform.UWP:
        case TargetPlatform.XboxScarlett:
            useXAudio2 = true;
            break;

        case TargetPlatform.Linux:
            useOpenAL = true;
            break;

        case TargetPlatform.PS4:
            options.SourcePaths.Add(Path.Combine(Globals.EngineRoot, "Source", "Platforms", "PS4", "Engine", "Audio"));
            options.CompileEnv.PreprocessorDefinitions.Add("AUDIO_API_PS4");
            break;

        case TargetPlatform.Android:
            useOpenAL = true;
            break;

        case TargetPlatform.Switch:
            options.SourcePaths.Add(Path.Combine(Globals.EngineRoot, "Source", "Platforms", "Switch", "Engine", "Audio"));
            options.CompileEnv.PreprocessorDefinitions.Add("AUDIO_API_SWITCH");
            break;

        default: throw new InvalidPlatformException(options.Platform.Target);
        }

        if (useNone)
        {
            options.SourcePaths.Add(Path.Combine(FolderPath, "None"));
            options.CompileEnv.PreprocessorDefinitions.Add("AUDIO_API_NONE");
        }

        if (useOpenAL)
        {
            options.SourcePaths.Add(Path.Combine(FolderPath, "OpenAL"));
            options.CompileEnv.PreprocessorDefinitions.Add("AUDIO_API_OPENAL");

            switch (options.Platform.Target)
            {
            case TargetPlatform.Windows:
            case TargetPlatform.XboxOne:
            case TargetPlatform.UWP:
                options.OutputFiles.Add(Path.Combine(depsRoot, "OpenAL32.lib"));
                options.DependencyFiles.Add(Path.Combine(depsRoot, "OpenAL32.dll"));
                break;

            case TargetPlatform.Linux:
                options.OutputFiles.Add(Path.Combine(depsRoot, "libopenal.a"));
                break;

            case TargetPlatform.Android:
                options.OutputFiles.Add(Path.Combine(depsRoot, "libopenal.a"));
                options.Libraries.Add("OpenSLES");
                break;

            default: throw new InvalidPlatformException(options.Platform.Target);
            }
        }

        if (useXAudio2)
        {
            options.SourcePaths.Add(Path.Combine(FolderPath, "XAudio2"));
            options.CompileEnv.PreprocessorDefinitions.Add("AUDIO_API_XAUDIO2");

            switch (options.Platform.Target)
            {
            case TargetPlatform.Windows:
            case TargetPlatform.XboxOne:
            case TargetPlatform.UWP:
            case TargetPlatform.XboxScarlett:
                options.OutputFiles.Add("xaudio2.lib");
                break;

            default: throw new InvalidPlatformException(options.Platform.Target);
            }
        }

        options.PrivateDependencies.Add("AudioTool");
    }
Ejemplo n.º 51
0
 private string BuildCallback(string[] _scenes, string _buildPath, BuildTarget _desiredTarget, BuildOptions _options)
 {
     return BuildPipeline.BuildPlayer(_scenes, _buildPath, _desiredTarget, _options);
 }
Ejemplo n.º 52
0
        /// <inheritdoc />
        public override void LinkFiles(TaskGraph graph, BuildOptions options, string outputFilePath)
        {
            var linkEnvironment = options.LinkEnv;
            var task            = graph.Add <LinkTask>();

            // Setup arguments
            var args = new List <string>();

            SetupLinkFilesArgs(graph, options, args);
            {
                // Suppress startup banner
                args.Add("/NOLOGO");

                // Report internal compiler errors
                args.Add("/ERRORREPORT:PROMPT");

                // Output File Name
                args.Add(string.Format("/OUT:\"{0}\"", outputFilePath));

                // Specify target platform
                switch (Architecture)
                {
                case TargetArchitecture.x86:
                    args.Add("/MACHINE:x86");
                    break;

                case TargetArchitecture.x64:
                    args.Add("/MACHINE:x64");
                    break;

                case TargetArchitecture.ARM:
                case TargetArchitecture.ARM64:
                    args.Add("/MACHINE:ARM");
                    break;

                default: throw new InvalidArchitectureException(Architecture);
                }

                // Specify subsystem
                if (linkEnvironment.LinkAsConsoleProgram)
                {
                    args.Add("/SUBSYSTEM:CONSOLE");
                }
                else
                {
                    args.Add("/SUBSYSTEM:WINDOWS");
                }

                // Generate Windows Metadata
                if (linkEnvironment.GenerateWindowsMetadata)
                {
                    args.Add("/WINMD");
                    args.Add(string.Format("/WINMDFILE:\"{0}\"", Path.ChangeExtension(outputFilePath, "winmd")));
                    args.Add("/APPCONTAINER");
                    if (linkEnvironment.Output == LinkerOutput.SharedLibrary)
                    {
                        args.Add("/DYNAMICBASE");
                    }
                }

                if (linkEnvironment.LinkTimeCodeGeneration)
                {
                    // Link-time code generation
                    args.Add("/LTCG");
                }

                if (linkEnvironment.Output == LinkerOutput.ImportLibrary)
                {
                    // Create an import library
                    args.Add("/DEF");

                    // Ignore libraries
                    args.Add("/NODEFAULTLIB");

                    // Specify the name
                    args.Add(string.Format("/NAME:\"{0}\"", Path.GetFileNameWithoutExtension(outputFilePath)));

                    // Ignore warnings about files with no public symbols
                    args.Add("/IGNORE:4221");
                }
                else
                {
                    // Don't create Side-by-Side Assembly Manifest
                    args.Add("/MANIFEST:NO");

                    // Fixed Base Address
                    args.Add("/FIXED:NO");

                    if (Architecture == TargetArchitecture.x86)
                    {
                        // Handle Large Addresses
                        args.Add("/LARGEADDRESSAWARE");
                    }

                    // Compatible with Data Execution Prevention
                    args.Add("/NXCOMPAT");

                    // Allow delay-loaded DLLs to be explicitly unloaded
                    args.Add("/DELAY:UNLOAD");

                    if (linkEnvironment.Output == LinkerOutput.SharedLibrary)
                    {
                        // Build a DLL
                        args.Add("/DLL");
                    }

                    // Redirect imports LIB file auto-generated for EXE/DLL
                    var libFile = Path.ChangeExtension(outputFilePath, Platform.StaticLibraryFileExtension);
                    args.Add("/IMPLIB:\"" + libFile + "\"");
                    task.ProducedFiles.Add(libFile);

                    // Don't embed the full PDB path
                    args.Add("/PDBALTPATH:%_PDB%");

                    // Optimize
                    if (linkEnvironment.Optimization && !linkEnvironment.UseIncrementalLinking)
                    {
                        // Generate an EXE checksum
                        args.Add("/RELEASE");

                        // Eliminate unreferenced symbols
                        args.Add("/OPT:REF");

                        // Remove redundant COMDATs
                        args.Add("/OPT:ICF");
                    }
                    else
                    {
                        // Keep symbols that are unreferenced
                        args.Add("/OPT:NOREF");

                        // Disable identical COMDAT folding
                        args.Add("/OPT:NOICF");
                    }

                    // Link Incrementally
                    if (linkEnvironment.UseIncrementalLinking)
                    {
                        args.Add("/INCREMENTAL");
                    }
                    else
                    {
                        args.Add("/INCREMENTAL:NO");
                    }

                    if (linkEnvironment.DebugInformation)
                    {
                        // Generate debug information
                        if (Toolset != WindowsPlatformToolset.v140 && linkEnvironment.UseFastPDBLinking)
                        {
                            args.Add("/DEBUG:FASTLINK");
                        }
                        else if (linkEnvironment.UseFullDebugInformation)
                        {
                            args.Add("/DEBUG:FULL");
                        }
                        else
                        {
                            args.Add("/DEBUG");
                        }

                        // Use Program Database
                        var pdbFile = Path.ChangeExtension(outputFilePath, Platform.ProgramDatabaseFileExtension);
                        args.Add(string.Format("/PDB:\"{0}\"", pdbFile));
                        task.ProducedFiles.Add(pdbFile);
                    }
                }
            }

            // Delay-load DLLs
            if (linkEnvironment.Output == LinkerOutput.Executable || linkEnvironment.Output == LinkerOutput.SharedLibrary)
            {
                foreach (var dll in options.DelayLoadLibraries)
                {
                    args.Add(string.Format("/DELAYLOAD:\"{0}\"", dll));
                }
            }

            // Additional lib paths
            foreach (var libpath in linkEnvironment.LibraryPaths)
            {
                args.Add(string.Format("/LIBPATH:\"{0}\"", libpath));
            }

            // Input libraries
            task.PrerequisiteFiles.AddRange(linkEnvironment.InputLibraries);
            foreach (var library in linkEnvironment.InputLibraries)
            {
                args.Add(string.Format("\"{0}\"", library));
            }

            // Input files
            task.PrerequisiteFiles.AddRange(linkEnvironment.InputFiles);
            foreach (var file in linkEnvironment.InputFiles)
            {
                args.Add(string.Format("\"{0}\"", file));
            }

            // Use a response file (it can contain any commands that you would specify on the command line)
            bool   useResponseFile = true;
            string responseFile    = null;

            if (useResponseFile)
            {
                responseFile = Path.Combine(options.IntermediateFolder, Path.GetFileName(outputFilePath) + ".response");
                task.PrerequisiteFiles.Add(responseFile);
                Utilities.WriteFileIfChanged(responseFile, string.Join(Environment.NewLine, args));
            }

            // Link
            task.WorkingDirectory = options.WorkingDirectory;
            task.CommandPath      = linkEnvironment.Output == LinkerOutput.ImportLibrary ? _libToolPath : _linkerPath;
            task.CommandArguments = useResponseFile ? string.Format("@\"{0}\"", responseFile) : string.Join(" ", args);
            if (linkEnvironment.Output == LinkerOutput.ImportLibrary)
            {
                task.InfoMessage = "Building import library " + outputFilePath;
            }
            else
            {
                task.InfoMessage = "Linking " + outputFilePath;
            }
            task.Cost = task.PrerequisiteFiles.Count;
            task.ProducedFiles.Add(outputFilePath);

            // Check if need to generate documentation
            if (linkEnvironment.GenerateDocumentation)
            {
                args.Clear();
                var docTask = graph.Add <Task>();

                // Use old input format
                args.Add("/old");
                args.Add(string.Format("\"{0}\"", Path.GetFileNameWithoutExtension(outputFilePath)));

                // Suppress copyright message
                args.Add("/nologo");

                // Output file
                var outputDocFile = Path.ChangeExtension(outputFilePath, "xml");
                docTask.ProducedFiles.Add(outputDocFile);
                args.Add(string.Format("/Fo\"{0}\"", outputDocFile));

                // Input files
                docTask.PrerequisiteFiles.AddRange(linkEnvironment.DocumentationFiles);
                foreach (var file in linkEnvironment.DocumentationFiles)
                {
                    args.Add(string.Format("/Fs\"{0}\"", file));
                }

                // Generate docs
                docTask.WorkingDirectory = options.WorkingDirectory;
                docTask.CommandPath      = _xdcmakePath;
                docTask.CommandArguments = string.Join(" ", args);
                docTask.Cost             = linkEnvironment.DocumentationFiles.Count;
            }

            // Check if need to generate metadata file
            if (linkEnvironment.GenerateWindowsMetadata)
            {
                var configFile   = Path.Combine(options.IntermediateFolder, Path.GetFileNameWithoutExtension(outputFilePath) + ".priconfig.xml");
                var manifestFile = Path.Combine(options.IntermediateFolder, Path.GetFileNameWithoutExtension(outputFilePath) + ".AppxManifest.xml");
                var priFile      = Path.ChangeExtension(outputFilePath, "pri");

                // Generate pri config file
                var priConfigTask = graph.Add <Task>();
                priConfigTask.WorkingDirectory = options.WorkingDirectory;
                priConfigTask.CommandPath      = _makepriPath;
                priConfigTask.CommandArguments = string.Format("createconfig /cf \"{0}\" /dq en-US /o", configFile);
                priConfigTask.Cost             = 1;
                priConfigTask.ProducedFiles.Add(configFile);

                // Create AppxManifest file
                {
                    using (var stringWriter = new StringWriterWithEncoding(Encoding.UTF8))
                        using (var xmlTextWriter = XmlWriter.Create(stringWriter, new XmlWriterSettings
                        {
                            Encoding = Encoding.UTF8,
                            Indent = true,
                        }))
                        {
                            xmlTextWriter.WriteStartDocument();

                            // Package
                            {
                                xmlTextWriter.WriteStartElement("Package", "http://schemas.microsoft.com/appx/2010/manifest");

                                // Identity
                                {
                                    xmlTextWriter.WriteStartElement("Identity");

                                    xmlTextWriter.WriteAttributeString("Name", "FlaxGame");
                                    xmlTextWriter.WriteAttributeString("Publisher", "CN=Flax, O=Flax, C=Poland");
                                    xmlTextWriter.WriteAttributeString("Version", "1.0.0.0"); // TODO: get Flax version number

                                    switch (Architecture)
                                    {
                                    case TargetArchitecture.AnyCPU:
                                        xmlTextWriter.WriteAttributeString("ProcessorArchitecture", "neutral");
                                        break;

                                    case TargetArchitecture.x86:
                                        xmlTextWriter.WriteAttributeString("ProcessorArchitecture", "x86");
                                        break;

                                    case TargetArchitecture.x64:
                                        xmlTextWriter.WriteAttributeString("ProcessorArchitecture", "x64");
                                        break;

                                    case TargetArchitecture.ARM:
                                    case TargetArchitecture.ARM64:
                                        xmlTextWriter.WriteAttributeString("ProcessorArchitecture", "arm");
                                        break;

                                    default: throw new InvalidArchitectureException(Architecture);
                                    }

                                    xmlTextWriter.WriteEndElement();
                                }

                                // Properties
                                {
                                    xmlTextWriter.WriteStartElement("Properties");

                                    // TODO: better logo handling
                                    var logoSrcPath = Path.Combine(Globals.EngineRoot, "Source", "Logo.png");
                                    var logoDstPath = Path.Combine(options.IntermediateFolder, "Logo.png");
                                    if (!File.Exists(logoDstPath))
                                    {
                                        Utilities.FileCopy(logoSrcPath, logoDstPath);
                                    }

                                    xmlTextWriter.WriteElementString("DisplayName", "FlaxGame");
                                    xmlTextWriter.WriteElementString("PublisherDisplayName", "Flax");
                                    xmlTextWriter.WriteElementString("Logo", "Logo.png");

                                    xmlTextWriter.WriteEndElement();
                                }

                                // Resources
                                {
                                    xmlTextWriter.WriteStartElement("Resources");

                                    xmlTextWriter.WriteStartElement("Resource");
                                    xmlTextWriter.WriteAttributeString("Language", "en-us");
                                    xmlTextWriter.WriteEndElement();

                                    xmlTextWriter.WriteEndElement();
                                }

                                // Prerequisites
                                {
                                    xmlTextWriter.WriteStartElement("Prerequisites");

                                    xmlTextWriter.WriteElementString("OSMinVersion", "6.2");
                                    xmlTextWriter.WriteElementString("OSMaxVersionTested", "6.2");

                                    xmlTextWriter.WriteEndElement();
                                }
                            }

                            xmlTextWriter.WriteEndDocument();
                            xmlTextWriter.Flush();

                            // Save manifest to file
                            var contents = stringWriter.GetStringBuilder().ToString();
                            Utilities.WriteFileIfChanged(manifestFile, contents);
                        }
                }

                var dummyWorkspace = Path.Combine(options.IntermediateFolder, "Dummy");
                if (!Directory.Exists(dummyWorkspace))
                {
                    Directory.CreateDirectory(dummyWorkspace);
                }

                // Generate pri file
                var priNewFile = graph.Add <Task>();
                priNewFile.WorkingDirectory = options.WorkingDirectory;
                priNewFile.CommandPath      = _makepriPath;
                priNewFile.CommandArguments = string.Format("new /cf \"{0}\" /pr \"{1}\" /of \"{2}\" /mn \"{3}\" /o", configFile, dummyWorkspace, priFile, manifestFile);
                priNewFile.Cost             = 1;
                priNewFile.PrerequisiteFiles.Add(configFile);
                priNewFile.ProducedFiles.Add(priFile);
            }
        }
Ejemplo n.º 53
0
    static void PerformBuild(string outputpath, BuildTarget tag, BuildOptions opt)
    {
        CSymbolLinkHelper.SymbolLinkResource();
        RefreshProgramVersion();

        EditorUserBuildSettings.SwitchActiveBuildTarget(tag);

        ParseArgs(ref opt, ref outputpath);

        string fullPath = System.IO.Path.Combine(Application.dataPath, System.IO.Path.Combine(CCosmosEngine.GetConfig("ProductRelPath"), outputpath));

        string fullDir = System.IO.Path.GetDirectoryName(fullPath);

        if (!Directory.Exists(fullDir))
            Directory.CreateDirectory(fullDir);

        CDebug.Log("Build Client {0} to: {1}", tag, fullPath);
        BuildPipeline.BuildPlayer(GetScenePaths(), fullPath, tag, opt);
    }
Ejemplo n.º 54
0
 public NexusFirstWithForge(BuildOptions buildOptions, MacroData macroData, ActiveUnitData activeUnitData, AttackData attackData, ChatService chatService, ChronoData chronoData, ICounterTransitioner counterTransitioner, UnitCountService unitCountService, MicroTaskData microTaskData)
     : base(buildOptions, macroData, activeUnitData, attackData, chatService, chronoData, counterTransitioner, unitCountService, microTaskData)
 {
 }
Ejemplo n.º 55
0
        private static bool LoadCache(ref ModuleInfo moduleInfo, BuildOptions moduleOptions, List <string> headerFiles)
        {
            var path = GetCachePath(moduleInfo.Module, moduleOptions);

            if (!File.Exists(path))
            {
                return(false);
            }
            using (var stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
                using (var reader = new BinaryReader(stream, Encoding.UTF8))
                {
                    // Version
                    var version = reader.ReadInt32();
                    if (version != 5)
                    {
                        return(false);
                    }
                    if (File.GetLastWriteTime(Assembly.GetExecutingAssembly().Location).Ticks != reader.ReadInt64())
                    {
                        return(false);
                    }

                    // Build options
                    if (reader.ReadString() != moduleOptions.IntermediateFolder ||
                        reader.ReadInt32() != (int)moduleOptions.Platform.Target ||
                        reader.ReadInt32() != (int)moduleOptions.Architecture ||
                        reader.ReadInt32() != (int)moduleOptions.Configuration)
                    {
                        return(false);
                    }
                    var publicDefinitions = Read(reader, Utilities.GetEmptyArray <string>());
                    if (publicDefinitions.Length != moduleOptions.PublicDefinitions.Count || publicDefinitions.Any(x => !moduleOptions.PublicDefinitions.Contains(x)))
                    {
                        return(false);
                    }
                    var privateDefinitions = Read(reader, Utilities.GetEmptyArray <string>());
                    if (privateDefinitions.Length != moduleOptions.PrivateDefinitions.Count || privateDefinitions.Any(x => !moduleOptions.PrivateDefinitions.Contains(x)))
                    {
                        return(false);
                    }
                    var preprocessorDefinitions = Read(reader, Utilities.GetEmptyArray <string>());
                    if (preprocessorDefinitions.Length != moduleOptions.CompileEnv.PreprocessorDefinitions.Count || preprocessorDefinitions.Any(x => !moduleOptions.CompileEnv.PreprocessorDefinitions.Contains(x)))
                    {
                        return(false);
                    }

                    // Header files
                    var headerFilesCount = reader.ReadInt32();
                    if (headerFilesCount != headerFiles.Count)
                    {
                        return(false);
                    }
                    for (int i = 0; i < headerFilesCount; i++)
                    {
                        var headerFile = headerFiles[i];
                        if (headerFile != reader.ReadString())
                        {
                            return(false);
                        }
                        if (File.GetLastWriteTime(headerFile).Ticks > reader.ReadInt64())
                        {
                            return(false);
                        }
                    }

                    // Info
                    var newModuleInfo = new ModuleInfo
                    {
                        Module      = moduleInfo.Module,
                        Name        = moduleInfo.Name,
                        Namespace   = moduleInfo.Namespace,
                        IsFromCache = true,
                    };
                    try
                    {
                        newModuleInfo.Read(reader);

                        // Skip parsing and use data loaded from cache
                        moduleInfo = newModuleInfo;
                        return(true);
                    }
                    catch
                    {
                        // Skip loading cache
                        return(false);
                    }
                }
        }
Ejemplo n.º 56
0
    static void GenericBuild(string[] scenes, string target_dir, BuildTarget build_target, BuildOptions build_options)
    {
        EditorUserBuildSettings.SwitchActiveBuildTarget(build_target);
        string res = BuildPipeline.BuildPlayer(scenes, target_dir, build_target, build_options);

        if (res.Length > 0)
        {
            throw new Exception("BuildPlayer failure: " + res);
        }
    }
Ejemplo n.º 57
0
    static string BaseBuild(BuildTargetGroup buildTargetGroup, BuildTarget buildTarget, BuildOptions buildOptions, bool needReturnBuildTarget, bool incrementPatch, string folderPath, string buildPath)
    {
        folderPath = folderPath.Replace(' ', '-');
        buildPath  = buildPath.Replace(' ', '-');
        string           basePath               = $"Builds/{PlayerSettings.productName}_{PlayerSettings.bundleVersion}.{LastBuildPatch}".Replace(' ', '-');
        BuildTarget      targetBeforeStart      = EditorUserBuildSettings.activeBuildTarget;
        BuildTargetGroup targetGroupBeforeStart = BuildPipeline.GetBuildTargetGroup(targetBeforeStart);

        if (LastBundleVersion != PlayerSettings.bundleVersion)
        {
            LastBundleVersion = PlayerSettings.bundleVersion;
            LastBuildPatch    = 0;
        }

        BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions {
            scenes           = EditorBuildSettings.scenes.Where(s => s.enabled).Select(s => s.path).ToArray(),
            locationPathName = basePath + buildPath,
            targetGroup      = buildTargetGroup,
            target           = buildTarget,
            options          = buildOptions,
        };


        BuildReport  report  = BuildPipeline.BuildPlayer(buildPlayerOptions);
        BuildSummary summary = report.summary;

        //TODO: Зробити вивід гарнішим. Щоб виглядало по типу таблиці.
        //Зараз \t не вирівнює його, коли summary.platform дуже різних довжин, наприклад StandaloneWindows та StandaloneOSX
        if (summary.result == BuildResult.Succeeded)
        {
            Debug.Log($"{summary.platform} succeeded.  \t Time: {string.Format("{0:mm\\:ss}", summary.totalTime)}  \t Size: {summary.totalSize / 1048576}");
        }
        else if (summary.result == BuildResult.Failed)
        {
            Debug.Log(
                $"{summary.platform} failed.   \t Time: {string.Format("{0:mm\\:ss}", summary.totalTime)}  \t Size: {summary.totalSize / 1048576}" + "\n" +
                $"Warnings: {summary.totalWarnings}" + "\n" +
                $"Errors:   {summary.totalErrors}"
                );
        }

        if (incrementPatch)
        {
            ++LastBuildPatch;
        }

        if (needReturnBuildTarget)
        {
            EditorUserBuildSettings.SwitchActiveBuildTarget(targetGroupBeforeStart, targetBeforeStart);
        }

        return(summary.result == BuildResult.Succeeded ? basePath + folderPath : "");
    }
Ejemplo n.º 58
0
    /// <inheritdoc />
    public override void Setup(BuildOptions options)
    {
        base.Setup(options);

        options.PublicDefinitions.Add("COMPILE_WITH_OGL_SHADER_COMPILER");
    }
Ejemplo n.º 59
0
        void OnGUI()
        {
            var style = new GUIStyle
            {
                fontSize = 18
            };
            var color = GUI.backgroundColor;

            //搜索框;
            GUILayout.BeginHorizontal(GUI.skin.FindStyle("Toolbar"));
            var searchString = "";

            searchString = GUILayout.TextField(searchString, GUI.skin.FindStyle("ToolbarSeachTextField"));
            if (GUILayout.Button("", GUI.skin.FindStyle("ToolbarSeachCancelButton")))
            {
                searchString = "";
                GUI.FocusControl(null);
            }
            GUILayout.EndHorizontal();

            if (GUILayout.Button("File", EditorStyles.toolbarDropDown, GUILayout.Width(50)))
            {
                var menu = new GenericMenu();
                menu.AddItem(new GUIContent("设置"), false, () =>
                {
                    LogHelper.PrintError("File->设置");
                });
                menu.ShowAsContext();
            }

            using (var v = new EditorGUILayout.VerticalScope(GUI.skin.box))
            {
                GUILayout.Space(5);
                using (var vv = new EditorGUILayout.VerticalScope(GUI.skin.box))
                {
                    EditorGUILayout.LabelField("打包", style);
                    GUILayout.Space(5);
                    using (var h = new EditorGUILayout.HorizontalScope())
                    {
                        EditorGUILayout.LabelField("选择目标平台:", style);
                        GUILayout.Space(15);
                        _platform = (BuildPlatform)EditorGUILayout.EnumPopup(_platform);
                    }
                    GUILayout.Space(5);
                    using (var h = new EditorGUILayout.HorizontalScope())
                    {
                        EditorGUILayout.LabelField("打包选项:", style);
                        GUILayout.Space(15);
                        _buildOptions = (BuildOptions)EditorGUILayout.EnumFlagsField(_buildOptions);
                    }
                    GUILayout.Space(5);
                    using (var h = new EditorGUILayout.HorizontalScope())
                    {
                        EditorGUILayout.LabelField("是否打Release包:", style);
                        GUILayout.Space(15);
                        bool curValue = _isRelease;
                        _isRelease = EditorGUILayout.Toggle(_isRelease);
                        if (_isRelease)
                        {
                            _buildOptions = BuildOptions.None;
                        }
                        else
                        {
                            if (curValue)
                            {
                                _buildOptions = BuildOptions.AllowDebugging | BuildOptions.Development;
                            }
                        }
                    }
                    GUILayout.Space(5);
                    using (var h = new EditorGUILayout.HorizontalScope())
                    {
                        EditorGUILayout.LabelField("打包资源完整完整包体:", style);
                        GUILayout.Space(15);
                        _isCompletePack = EditorGUILayout.Toggle(_isCompletePack);
                    }
                    GUILayout.Space(5);
                    using (var h = new EditorGUILayout.HorizontalScope())
                    {
                        EditorGUILayout.LabelField("重新打包AssetBundle:", style);
                        GUILayout.Space(15);
                        _isBuildAssetBundle = EditorGUILayout.Toggle(_isBuildAssetBundle);
                        if (_isRelease)
                        {
                            _isBuildAssetBundle = true;
                        }
                    }
                    GUILayout.Space(20);
                    GUI.backgroundColor = Color.green;
                    if (GUILayout.Button("开始打包", GUILayout.Height(30)))
                    {
                        if (EditorUtility.DisplayDialog("提示", "确认开始打包?", "确认"))
                        {
                            _locationPathName            = EditorUtility.OpenFolderPanel("选择输出文件夹", _locationPathName, "");
                            EditorApplication.delayCall += () =>
                            {
                                if (string.IsNullOrEmpty(_locationPathName))
                                {
                                    return;
                                }
                                if (Directory.Exists(_locationPathName))
                                {
                                    Directory.Delete(_locationPathName, true);
                                }
                                Directory.CreateDirectory(_locationPathName);

                                if (_isBuildAssetBundle)
                                {
                                    AssetBundleGenerate.GenerateAll();
                                }
                                if (_isCompletePack)
                                {
                                    ExportABPackage.ExportAssetBundlePackage();
                                }
                                else
                                {
                                    if (File.Exists(ExportABPackage.ZipStreamingAssetsPath))
                                    {
                                        File.Delete(ExportABPackage.ZipStreamingAssetsPath);
                                    }
                                }
                                string log = string.Empty;
                                try
                                {
                                    string extensionName = string.Empty;
                                    switch (_platform)
                                    {
                                    case BuildPlatform.Android:
                                        extensionName = ".apk";
                                        break;

                                    case BuildPlatform.Windows64:
                                        extensionName = ".exe";
                                        break;

                                    default:
                                        break;
                                    }
                                    BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions();
                                    buildPlayerOptions.scenes           = EditorBuildSettingsScene.GetActiveSceneList(EditorBuildSettings.scenes);
                                    buildPlayerOptions.locationPathName = _locationPathName + "/" + PlayerSettings.productName + extensionName;
                                    buildPlayerOptions.target           = (BuildTarget)_platform;
                                    buildPlayerOptions.options          = _buildOptions;
                                    var report = BuildPipeline.BuildPlayer(buildPlayerOptions);
                                    log = report.ToString();
                                }
                                catch (Exception e)
                                {
                                    LogHelper.PrintError(string.Format("打包失败:{0},{1}.", log, e.ToString()));
                                    return;
                                }
                                LogHelper.PrintError(string.Format("打包成功:{0}.", log));
                            };
                            Close();
                        }
                    }
                    GUI.backgroundColor = color;
                }
                GUILayout.Space(10);
                using (var vv = new EditorGUILayout.VerticalScope(GUI.skin.box))
                {
                    EditorGUILayout.LabelField("打热更包", style);
                    GUILayout.Space(5);
                }
            }
        }
Ejemplo n.º 60
0
        private static void PerformBuild(string[] buildConfigs, BuildOptions options = BuildOptions.None)
        {
            int successCount = 0;
            int failCount    = 0;

            // Save current script defines, build constants, etc. so we can restore them after build.
            string currentDefines            = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone);
            string buildConstantsPath        = BuildConstantsGenerator.FindFile();
            string currentBuildConstantsFile = null;

            if (!string.IsNullOrEmpty(buildConstantsPath))
            {
                currentBuildConstantsFile = FileUtil.GetUniqueTempPathInProject();
                File.Copy(buildConstantsPath, currentBuildConstantsFile);
            }

            DateTime buildTime;

            PerformPreBuild(out buildTime);

            for (int i = 0; i < buildConfigs.Length; i++)
            {
                BuildReleaseType  releaseType;
                BuildPlatform     platform;
                BuildArchitecture arch;
                BuildDistribution dist;
                string            configKey = buildConfigs[i];

                // Parse build config and perform build.
                string notification = string.Format("Building ({0}/{1}): ", i + 1, buildConfigs.Length);
                BuildSettings.projectConfigurations.ParseKeychain(configKey, out releaseType, out platform, out arch, out dist);
                bool success = BuildPlayer(notification, releaseType, platform, arch, dist, buildTime, options, configKey);

                if (success)
                {
                    ++successCount;
                }
                else
                {
                    ++failCount;
                }
            }

            PerformPostBuild();

            // Restore editor status.
            PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, currentDefines);
            if (!string.IsNullOrEmpty(buildConstantsPath))
            {
                File.Copy(currentBuildConstantsFile, buildConstantsPath, true);
                File.Delete(currentBuildConstantsFile);
            }

            // Report success/failure.
            StringBuilder sb = new StringBuilder();

            if (failCount == 0)
            {
                sb.AppendFormat("{0} successful build{1}. No failures. ✔️",
                                successCount, successCount > 1 ? "s" : "");
            }
            else if (successCount == 0)
            {
                sb.AppendFormat("No successful builds. {0} failure{1}. ✖️",
                                failCount, failCount > 1 ? "s" : "");
            }
            else
            {
                sb.AppendFormat("{0} successful build{1}. {2} failure{3}.",
                                successCount, successCount > 1 ? "s" : "",
                                failCount, failCount > 1 ? "s" : "");
            }
            BuildNotificationList.instance.AddNotification(new BuildNotification(
                                                               BuildNotification.Category.Notification,
                                                               "Build Complete.", sb.ToString(),
                                                               true, null));

            // Open output folder if option is enabled.
            if (BuildSettings.basicSettings.openFolderPostBuild)
            {
                System.Diagnostics.Process.Start(BuildSettings.basicSettings.baseBuildFolder);
            }
        }