Exemplo n.º 1
0
        public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, System.DateTime buildTime, ref BuildOptions options, string configKey, string buildPath)
        {
            // Get valid SDKs for platform
            string[] validSDKs = PlayerSettings.GetAvailableVirtualRealitySDKs(platform.targetGroup);

            // Build list of valid SDKs to set
            List <string> sdks = new List <string>();

            foreach (SDK sdk in Sdks)
            {
                string sdkName = sdkNames[sdk];

                if (Array.IndexOf(validSDKs, sdkName) != -1)
                {
                    sdks.Add(sdkName);
                }
            }

            // Update player settings
            PlayerSettings.SetVirtualRealitySupported(platform.targetGroup, VRSupported);
            PlayerSettings.SetVirtualRealitySDKs(platform.targetGroup, sdks.ToArray());
            PlayerSettings.stereoRenderingPath = StereoRenderingMode;

#if SUPPORTS_OCULUS_V2_SIGNING
            PlayerSettings.VROculus.v2Signing = OculusV2Signing;
#endif

            if (platform.targetGroup == BuildTargetGroup.Android)
            {
                PlayerSettings.Android.ARCoreEnabled = ARCoreSupported;
            }
        }
Exemplo n.º 2
0
        public static string GenerateDefaultDefines(BuildReleaseType releaseType, BuildPlatform buildPlatform, BuildArchitecture arch, BuildDistribution dist)
        {
            List <string> defines = new List <string>();

            if (releaseType != null)
            {
                defines.Add(BUILD_TYPE + SanitizeCodeString(releaseType.typeName.ToUpper().Replace(" ", "")));
            }

            if (buildPlatform != null)
            {
                defines.Add(BUILD_PLATFORM + SanitizeCodeString(buildPlatform.platformName.ToUpper().Replace(" ", "")));
            }

            if (arch != null)
            {
                defines.Add(BUILD_ARCH + SanitizeCodeString(arch.name.ToUpper().Replace(" ", "")));
            }

            if (dist != null)
            {
                defines.Add(BUILD_DIST + SanitizeCodeString(dist.distributionName.ToUpper().Replace(" ", "")));
            }

            if (releaseType != null && !string.IsNullOrEmpty(releaseType.customDefines))
            {
                string[] customDefines = releaseType.customDefines.Split(';', ',');
                for (int i = 0; i < customDefines.Length; i++)
                {
                    defines.Add(SanitizeCodeString(customDefines[i]).ToUpper());
                }
            }

            return(string.Join(";", defines.ToArray()));
        }
Exemplo n.º 3
0
        public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, System.DateTime buildTime, ref BuildOptions options, string configKey, string buildPath)
        {
            string resolvedScriptPath = BuildProject.ResolvePath(scriptPath, releaseType, platform, architecture, distribution, buildTime);
            string resolvedScriptArgs = BuildProject.ResolvePath(scriptArguments, releaseType, platform, architecture, distribution, buildTime);

            RunScript(resolvedScriptPath, resolvedScriptArgs);
        }
Exemplo n.º 4
0
        public static string ResolvePath(string prototype, BuildReleaseType releaseType, BuildPlatform buildPlatform, BuildArchitecture arch, BuildDistribution dist, DateTime buildTime)
        {
            StringBuilder sb = new StringBuilder(prototype);

            sb.Replace("$YEAR", buildTime.ToString("yyyy"));
            sb.Replace("$MONTH", buildTime.ToString("MM"));
            sb.Replace("$DAY", buildTime.ToString("dd"));
            sb.Replace("$TIME", buildTime.ToString("hhmmss"));

            string archName = arch.name;

            if (buildPlatform.variants != null && buildPlatform.variants.Length > 0)
            {
                archName += "(" + buildPlatform.variantKey + ")";
            }

            sb.Replace("$RELEASE_TYPE", SanitizeFolderName(releaseType.typeName));
            sb.Replace("$PLATFORM", SanitizeFolderName(buildPlatform.platformName));
            sb.Replace("$ARCHITECTURE", SanitizeFolderName(archName));
            sb.Replace("$DISTRIBUTION", SanitizeFolderName(dist != null ? dist.distributionName : BuildConstantsGenerator.NONE));
            sb.Replace("$VERSION", SanitizeFolderName(BuildSettings.productParameters.lastGeneratedVersion));
            sb.Replace("$BUILD", BuildSettings.productParameters.buildCounter.ToString());
            sb.Replace("$PRODUCT_NAME", SanitizeFolderName(releaseType.productName));

            return(sb.ToString());
        }
Exemplo n.º 5
0
        public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, System.DateTime buildTime, ref BuildOptions options, string configKey, string buildPath)
        {
            StringBuilder defines = new StringBuilder(BuildProject.GenerateDefaultDefines(releaseType, platform, architecture, distribution));

            if (!string.IsNullOrEmpty(removeDefines))
            {
                string   resolvedRemove = BuildProject.ResolvePath(removeDefines, releaseType, platform, architecture, distribution, buildTime);
                string[] splitRemove    = resolvedRemove.Split(';');

                for (int i = 0; i < splitRemove.Length; i++)
                {
                    defines.Replace(splitRemove[i] + ";", "");
                    defines.Replace(splitRemove[i], "");
                }
            }

            if (!string.IsNullOrEmpty(addDefines))
            {
                string resolvedAdd = BuildProject.ResolvePath(addDefines, releaseType, platform, architecture, distribution, buildTime);

                if (defines.Length > 0)
                {
                    defines.Append(";" + resolvedAdd);
                }
                else
                {
                    defines.Append(resolvedAdd);
                }
            }

            PlayerSettings.SetScriptingDefineSymbolsForGroup(platform.targetGroup, defines.ToString());
        }
        public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform,
                                             BuildArchitecture architecture, BuildDistribution distribution, System.DateTime buildTime,
                                             ref BuildOptions options, string configKey, string buildPath)
        {
            string resolvedInputPath = BuildProject.ResolvePath(inputPath.Replace("$BUILDPATH", buildPath), releaseType,
                                                                platform, architecture, distribution, buildTime);
            string resolvedOutputPath = BuildProject.ResolvePath(outputPath.Replace("$BUILDPATH", buildPath),
                                                                 releaseType, platform, architecture, distribution, buildTime);

            switch (operation)
            {
            case Operation.Copy:
                Copy(resolvedInputPath, resolvedOutputPath);
                break;

            case Operation.Move:
                Move(resolvedInputPath, resolvedOutputPath);
                break;

            case Operation.Delete:
                Delete(resolvedInputPath);
                break;
            }

            AssetDatabase.Refresh();
        }
Exemplo n.º 7
0
 /// <summary>
 /// This will be executed before/after each individual player is built.
 /// </summary>
 public virtual void PerBuildExecute(
     BuildReleaseType releaseType,
     BuildPlatform platform,
     BuildArchitecture architecture,
     BuildDistribution distribution,
     System.DateTime buildTime, ref BuildOptions options, string configKey, string buildPath)
 {
 }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
0
        public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, System.DateTime buildTime, ref BuildOptions options, string configKey, string buildPath)
        {
            // Verify that butler executable exists.
            if (!File.Exists(pathToButlerExe))
            {
                UnityEngine.Debug.LogError("Couldn't find butler.exe file at path \"" + pathToButlerExe + "\", please check provided path");
                return;
            }

            buildPath = Path.GetFullPath(buildPath);

            // Generate build args for the form: butler push {optional args} {build path} {itch username}/{itch game}:{channel}
            StringBuilder scriptArguments = new StringBuilder("push ");

            switch (architecture.target)
            {
#if UNITY_2017_3_OR_NEWER
            case BuildTarget.StandaloneOSX:
#else
            case BuildTarget.StandaloneOSXIntel:
            case BuildTarget.StandaloneOSXIntel64:
            case BuildTarget.StandaloneOSXUniversal:
#endif
            case BuildTarget.StandaloneLinux:
            case BuildTarget.StandaloneLinux64:
            case BuildTarget.StandaloneLinuxUniversal:
                // Fix exe permissions for Linux/OSX.
                scriptArguments.Append("--fix-permissions ");
                break;
            }

            if (useGeneratedBuildVersion)
            {
                // Append generated versions string.
                scriptArguments.Append(string.Format("--userversion \"{0}\" ", BuildSettings.productParameters.lastGeneratedVersion));
            }

            scriptArguments.Append("\"" + buildPath + "\"" + " " + nameOfItchUser + "/" + nameOfItchGame + ":");

            if (!string.IsNullOrEmpty(itchChannelOverride))
            {
                scriptArguments.Append(itchChannelOverride);
            }
            else
            {
                string itchChannel = GetChannelName(architecture.target);
                if (string.IsNullOrEmpty(itchChannel))
                {
                    UnityEngine.Debug.LogWarning("UploadItch: The current BuildTarget doesn't appear to be a standard Itch.IO build target.");
                }

                scriptArguments.Append(itchChannel);
            }

            // UnityEngine.Debug.Log("Would have run itch uploader with following command line: \"" + pathToButlerExe + " " + scriptArguments + "\"");
            RunScript(pathToButlerExe, scriptArguments.ToString());
        }
Exemplo n.º 10
0
        public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, DateTime buildTime, ref BuildOptions options, string configKey, string buildPath)
        {
            XRGeneralSettings generalSettings = XRGeneralSettingsPerBuildTarget.XRGeneralSettingsForBuildTarget(platform.targetGroup);
            XRManagerSettings settingsManager = generalSettings.Manager;

            generalSettings.InitManagerOnStart = InitializeXROnStartup;

            settingsManager.loaders = XRPlugins;
        }
Exemplo n.º 11
0
        public static string GenerateBuildPath(string prototype, BuildReleaseType releaseType, BuildPlatform buildPlatform, BuildArchitecture arch, BuildDistribution dist, DateTime buildTime)
        {
            string resolvedProto = ResolvePath(prototype, releaseType, buildPlatform, arch, dist, buildTime);
            string buildPath     = Path.Combine(BuildSettings.basicSettings.baseBuildFolder, resolvedProto);

            buildPath = Path.GetFullPath(buildPath).TrimEnd('\\').TrimEnd('/');


            return(buildPath);
        }
        public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, System.DateTime buildTime, ref BuildOptions options, string configKey, string buildPath)
        {
            string resolvedInputPath  = BuildProject.ResolvePath(packageFolderPath.Replace("$BUILDPATH", buildPath), releaseType, platform, architecture, distribution, buildTime);
            string resolvedOutputPath = BuildProject.ResolvePath(outputPath.Replace("$BUILDPATH", buildPath), releaseType, platform, architecture, distribution, buildTime);

            if (Directory.Exists(Path.GetDirectoryName(resolvedOutputPath)) == false)
            {
                Directory.CreateDirectory(Path.GetDirectoryName(resolvedOutputPath));
            }

            Export(resolvedInputPath, resolvedOutputPath);
        }
Exemplo n.º 13
0
        public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, DateTime buildTime, ref BuildOptions options, string configKey, string buildPath)
        {
            // Set preloaded assets
            Object[] preloadedAssets = PlayerSettings.GetPreloadedAssets();

            List <Object> preloadedAssetsList = PreservePreloadedAssets ?
                                                preloadedAssets.ToList() :
                                                new List <Object>();

            preloadedAssetsList.AddRange(PreloadedAssets);
            PlayerSettings.SetPreloadedAssets(preloadedAssetsList.ToArray());
        }
Exemplo n.º 14
0
        public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, System.DateTime buildTime, ref UnityEditor.BuildOptions options, string configKey, string buildPath)
        {
            string resolvedOutputPath = Path.Combine(outputPath.Replace("$BUILDPATH", buildPath), outputFileName);

            resolvedOutputPath = BuildProject.ResolvePath(resolvedOutputPath, releaseType, platform, architecture, distribution, buildTime);

            string resolvedInputPath = inputPath.Replace("$BUILDPATH", buildPath);

            resolvedInputPath = BuildProject.ResolvePath(resolvedInputPath, releaseType, platform, architecture, distribution, buildTime);

            if (!resolvedOutputPath.EndsWith(".zip"))
            {
                resolvedOutputPath += ".zip";
            }

            PerformZip(Path.GetFullPath(resolvedInputPath), Path.GetFullPath(resolvedOutputPath));
        }
Exemplo n.º 15
0
        private static void PerformPostBuild(
            BuildReleaseType releaseType,
            BuildPlatform platform,
            BuildArchitecture architecture,
            BuildDistribution distribution,
            DateTime buildTime, ref BuildOptions options, string configKey, string buildPath)
        {
            BuildAction[] buildActions = BuildSettings.postBuildActions.buildActions;
            if (buildActions != null)
            {
                for (int i = 0; i < buildActions.Length; i++)
                {
                    BuildAction action = buildActions[i];

                    // Check if execute method has been overriden.
                    MethodInfo m = action.GetType().GetMethod("PerBuildExecute");
                    if (m.GetBaseDefinition().DeclaringType != m.DeclaringType &&
                        action.actionType == BuildAction.ActionType.PerPlatform)
                    {
                        // Check build filter and execute if true.
                        if (action.filter == null ||
                            action.filter.Evaluate(releaseType, platform, architecture, distribution, configKey) &&
                            action.actionEnabled)
                        {
                            BuildNotificationList.instance.AddNotification(new BuildNotification(
                                                                               BuildNotification.Category.Notification,
                                                                               string.Format("Performing Post-Build Action ({0}/{1}).", i + 1, buildActions.Length),
                                                                               string.Format("{0}: {1}", action.actionName, configKey),
                                                                               true, null));

                            action.PerBuildExecute(releaseType, platform, architecture, distribution, buildTime,
                                                   ref options, configKey, buildPath);
                        }
                        else
                        {
                            BuildNotificationList.instance.AddNotification(new BuildNotification(
                                                                               BuildNotification.Category.Notification,
                                                                               string.Format("Skipping Post-Build Action ({0}/{1}).", i + 1, buildActions.Length),
                                                                               string.Format("{0}: {1}", action.actionName, configKey),
                                                                               true, null));
                        }
                    }
                }
            }
        }
Exemplo n.º 16
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            EditorGUI.BeginProperty(position, label, property);

            EditorGUILayout.BeginHorizontal();

            bool show = property.isExpanded;

            UnityBuildGUIUtility.DropdownHeader("SceneList", ref show, false, GUILayout.ExpandWidth(true));
            property.isExpanded = show;

            EditorGUILayout.EndHorizontal();

            //Refresh all scene lists.
            for (int i = 0; i < BuildSettings.releaseTypeList.releaseTypes.Length; i++)
            {
                BuildReleaseType rt = BuildSettings.releaseTypeList.releaseTypes[i];
                rt.sceneList.Refresh();
            }

            list = property.FindPropertyRelative("enabledScenes");
            PopulateSceneList();

            if (show)
            {
                EditorGUILayout.BeginVertical(UnityBuildGUIUtility.dropdownContentStyle);

                for (int i = 0; i < list.arraySize; i++)
                {
                    SerializedProperty platformProperty = list.GetArrayElementAtIndex(i);

                    string filePath  = platformProperty.FindPropertyRelative("filePath").stringValue;
                    string sceneName = Path.GetFileNameWithoutExtension(filePath);

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.TextArea(sceneName + " (" + filePath + ")");

                    EditorGUI.BeginDisabledGroup(i == 0);
                    if (GUILayout.Button("↑↑", UnityBuildGUIUtility.helpButtonStyle))
                    {
                        list.MoveArrayElement(i, 0);
                    }
                    if (GUILayout.Button("↑", UnityBuildGUIUtility.helpButtonStyle))
                    {
                        list.MoveArrayElement(i, i - 1);
                    }
                    EditorGUI.EndDisabledGroup();

                    EditorGUI.BeginDisabledGroup(i == list.arraySize - 1);
                    if (GUILayout.Button("↓", UnityBuildGUIUtility.helpButtonStyle))
                    {
                        list.MoveArrayElement(i, i + 1);
                    }
                    EditorGUI.EndDisabledGroup();

                    if (GUILayout.Button("X", UnityBuildGUIUtility.helpButtonStyle))
                    {
                        list.DeleteArrayElementAtIndex(i);
                    }

                    property.serializedObject.ApplyModifiedProperties();

                    PopulateSceneList();

                    EditorGUILayout.EndHorizontal();
                }

                if (list.arraySize > 0)
                {
                    GUILayout.Space(20);
                }

                if (availableScenesList.Count > 0)
                {
                    GUILayout.BeginHorizontal();

                    string[] sceneStringList = new string[availableScenesList.Count];
                    for (int i = 0; i < sceneStringList.Length; i++)
                    {
                        sceneStringList[i] = Path.GetFileNameWithoutExtension(availableScenesList[i].filePath) + " (" + availableScenesList[i].filePath.Replace("/", "\\") + ")";
                    }

                    index = EditorGUILayout.Popup(index, sceneStringList, UnityBuildGUIUtility.popupStyle, GUILayout.ExpandWidth(true));
                    if (GUILayout.Button("Add Scene", GUILayout.ExpandWidth(false), GUILayout.MaxWidth(150)) && index < availableScenesList.Count)
                    {
                        int             addedIndex = list.arraySize;
                        SceneList.Scene scene      = availableScenesList[index];
                        list.InsertArrayElementAtIndex(addedIndex);
                        list.GetArrayElementAtIndex(addedIndex).FindPropertyRelative("filePath").stringValue = scene.filePath;

                        availableScenesList.RemoveAt(index);

                        index = 0;
                    }

                    GUILayout.EndHorizontal();
                }

                list.serializedObject.ApplyModifiedProperties();
                property.serializedObject.ApplyModifiedProperties();

                if (GUILayout.Button("Refresh Scene List", GUILayout.ExpandWidth(true)))
                {
                    PopulateSceneList();
                }

                EditorGUILayout.EndVertical();
            }

            EditorGUI.EndProperty();
        }
 public override void PerBuildExecute(BuildReleaseType releaseType, BuildPlatform platform, BuildArchitecture architecture, BuildDistribution distribution, DateTime buildTime, ref BuildOptions options, string configKey, string buildPath)
 {
     PackagesToRemove.ForEach(id => HandleRequest(Client.Remove(id), id));
     PackagesToAdd.ForEach(id => HandleRequest(Client.Add(id), id));
 }
Exemplo n.º 18
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;
            }
            if (releaseType.enableHeadlessMode)
            {
                options |= BuildOptions.EnableHeadlessMode;
            }

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

            // Save current user defines, and then set target defines.
            string preBuildDefines = PlayerSettings.GetScriptingDefineSymbolsForGroup(platform.targetGroup);
            string buildDefines    = GenerateDefaultDefines(releaseType, platform, architecture, distribution);

            buildDefines = MergeDefines(preBuildDefines, buildDefines);

            PlayerSettings.SetScriptingDefineSymbolsForGroup(platform.targetGroup, buildDefines);
            //Debug.Log("Build Defines: " + buildDefines);

            // Set bundle info.
            // Unfortunately, there's not a good way to do this pre-5.6 that doesn't break building w/ batch mode.
#if UNITY_5_6_OR_NEWER
            PlayerSettings.SetApplicationIdentifier(platform.targetGroup, releaseType.bundleIndentifier);
#endif

            // Set product name.
            PlayerSettings.companyName = releaseType.companyName;
            PlayerSettings.productName = releaseType.productName;

            // Apply build variant.
            platform.ApplyVariant();

            // 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 = "";
#if UNITY_2018_1_OR_NEWER
            UnityEditor.Build.Reporting.BuildReport buildReport = BuildPipeline.BuildPlayer(releaseType.sceneList.GetSceneFileList(), Path.Combine(buildPath, exeName), architecture.target, options);
            if (buildReport.summary.result == UnityEditor.Build.Reporting.BuildResult.Failed)
            {
                error = buildReport.summary.totalErrors + " occurred.";
            }
#else
            error = BuildPipeline.BuildPlayer(releaseType.sceneList.GetSceneFileList(), Path.Combine(buildPath, exeName), architecture.target, options);
#endif
            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);

            // Restore pre-build settings.
            PlayerSettings.SetScriptingDefineSymbolsForGroup(platform.targetGroup, preBuildDefines);

            return(success);
        }
Exemplo n.º 19
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;
            }
            if (releaseType.enableHeadlessMode)
            {
                options |= BuildOptions.EnableHeadlessMode;
            }

            // Generate build path.生成生成路径。
            string buildPath = GenerateBuildPath(BuildSettings.basicSettings.buildPath, releaseType, platform, architecture, distribution, buildTime);
            string binName   = string.Format(architecture.binaryNameFormat, SanitizeFileName(releaseType.productName));

            // Save current user defines, and then set target defines.保存当前用户定义,然后设置目标定义。
            string preBuildDefines = PlayerSettings.GetScriptingDefineSymbolsForGroup(platform.targetGroup);
            string buildDefines    = GenerateDefaultDefines(releaseType, platform, architecture, distribution);

            buildDefines = MergeDefines(preBuildDefines, buildDefines);

            PlayerSettings.SetScriptingDefineSymbolsForGroup(platform.targetGroup, buildDefines);
            //Debug.Log("Build Defines: " + buildDefines);

            // Save current player settings, and then set target settings.保存当前播放机设置,然后设置目标设置。
            string preBuildCompanyName = PlayerSettings.companyName;
            string preBuildProductName = PlayerSettings.productName;

            PlayerSettings.companyName = releaseType.companyName;
            PlayerSettings.productName = releaseType.productName;

            // Set bundle info.设置捆绑信息。
            // Unfortunately, there's not a good way to do this pre-5.6 that doesn't break building w/ batch mode.不幸的是,在5.6之前没有一个好的方法可以不破坏构建w/batch模式。
#if UNITY_5_6_OR_NEWER
            string preBuildBundleIdentifier = PlayerSettings.GetApplicationIdentifier(platform.targetGroup);
            PlayerSettings.SetApplicationIdentifier(platform.targetGroup, releaseType.bundleIndentifier);
#endif

            // Apply build variant.应用生成变量。
            platform.ApplyVariant();

            // 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 = "";
#if UNITY_2018_1_OR_NEWER
            //    string[] levels = BuildInfomation.levels;
            /////   Debug.Log("这里才开始生成");

            //string parth = BuildInfomation. Pathlevels+"/Test.exe";

            //    string[]levels = new string[] { "Assets/Scenes/2.unity" };
            string[] levels = BuildInfomation.levels;
            ///\   Debug.Log("这里才开始生成");

            string parth = BuildInfomation.Pathlevels;
            Debug.Log(parth);

            //  Debug.Log("这里才开始生成---"+ BuildInfomation.levels[0].ToString()+"---"+ parth);
            //  Debug.Log(releaseType.sceneList.GetSceneFileList() + "  --AAA--  " + Path.Combine(buildPath, binName)  );
            //  UnityEditor.Build.Reporting.BuildReport buildReport = BuildPipeline.BuildPlayer(levels, @"C:/Users/YNHol/Desktop/00000000000000/Scenes3/Test.exe", BuildTarget.StandaloneWindows, BuildOptions.None);
            UnityEditor.Build.Reporting.BuildReport buildReport = BuildPipeline.BuildPlayer(levels, parth, BuildTarget.WebGL, BuildOptions.None);
            // UnityEditor.Build.Reporting.BuildReport buildReport = BuildPipeline.BuildPlayer(releaseType.sceneList.GetSceneFileList(), Path.Combine(buildPath, binName), architecture.target, options);
            //   Debug.Log(levels[0].ToString() + "__生产___" + parth); ;
            foreach (var item in releaseType.sceneList.GetSceneFileList())
            {
                Debug.Log(item);
            }
            //  Debug.Log("这里生成开始完毕");
            if (buildReport.summary.result == UnityEditor.Build.Reporting.BuildResult.Failed)
            {
                error = buildReport.summary.totalErrors + " occurred.";
            }
#else
            error = BuildPipeline.BuildPlayer(releaseType.sceneList.GetSceneFileList(), Path.Combine(buildPath, binName), architecture.target, options);
#endif
            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);

            // Restore pre-build settings.
            PlayerSettings.SetScriptingDefineSymbolsForGroup(platform.targetGroup, preBuildDefines);
            PlayerSettings.companyName = preBuildCompanyName;
            PlayerSettings.productName = preBuildProductName;

#if UNITY_5_6_OR_NEWER
            PlayerSettings.SetApplicationIdentifier(platform.targetGroup, preBuildBundleIdentifier);
#endif
            ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            Build_Over_Num++;
            Debug.Log("这里是北京时间:" + System.DateTime.Now + "  完成了___ " + Build_Over_Num + " ___个");

            if (Build_Over_Num < File.ReadAllLines(Application.dataPath + "/Pathlevels.txt", Encoding.Default).Length)
            {
                BuildInfomation.Pathlevels = File.ReadAllLines(Application.dataPath + "/Pathlevels.txt", Encoding.Default)[Build_Over_Num];
                BuildInfomation.levels     = new string[] { File.ReadAllLines(Application.dataPath + "/levels.txt", Encoding.Default)[Build_Over_Num] };
                BuildProject.BuildAll();
            }
            else
            {
                Debug.Log("这里是北京时间:" + System.DateTime.Now + "  全部完成! " + Build_Over_Num + "个");
                Build_Over_Num = 0;
            }

            return(success);
        }
        public static void Generate(
            DateTime buildTime,
            string currentVersion = "",
            BuildReleaseType currentReleaseType        = null,
            BuildPlatform currentBuildPlatform         = null,
            BuildArchitecture currentBuildArchitecture = null,
            BuildDistribution currentBuildDistribution = null)
        {
            // Find the BuildConstants file.
            string filePath = FindFile();

            if (string.IsNullOrEmpty(filePath))
            {
                return;
            }

            // Cache any current values if needed.
            string versionString     = string.IsNullOrEmpty(currentVersion) ? BuildConstants.version.ToString() : currentVersion;
            string releaseTypeString = currentReleaseType == null?BuildConstants.releaseType.ToString() : SanitizeString(currentReleaseType.typeName);

            string platformString = currentBuildPlatform == null?BuildConstants.platform.ToString() : SanitizeString(currentBuildPlatform.platformName);

            string archString = currentBuildArchitecture == null?BuildConstants.architecture.ToString() : SanitizeString(currentBuildArchitecture.name);

            string distributionString = string.Empty;

            if (currentBuildDistribution == null)
            {
                if (currentReleaseType == null)
                {
                    // No new parameter specified, so use the old value.
                    distributionString = BuildConstants.architecture.ToString();
                }
                else
                {
                    // There are new parameters but no distribution. Should be intentional, so distribution is NONE.
                    distributionString = NONE;
                }
            }
            else
            {
                distributionString = SanitizeString(currentBuildDistribution.distributionName);
            }

            // Delete any existing version.
            if (File.Exists(filePath))
            {
                File.Delete(filePath);
            }

            // Create a buffer that we'll use to check for any duplicated names.
            List <string> enumBuffer = new List <string>();

            using (StreamWriter writer = new StreamWriter(filePath))
            {
                // Start of file and class.
                writer.WriteLine("// This file is auto-generated. Do not modify or move this file.");
                writer.WriteLine();
                writer.WriteLine("public static class BuildConstants");
                writer.WriteLine("{");

                // Write ReleaseType enum.
                writer.WriteLine("    public enum ReleaseType");
                writer.WriteLine("    {");
                writer.WriteLine("        {0},", NONE);
                enumBuffer.Add(NONE);
                foreach (BuildReleaseType releaseType in BuildSettings.releaseTypeList.releaseTypes)
                {
                    string addedString = SanitizeString(releaseType.typeName);

                    if (!enumBuffer.Contains(addedString))
                    {
                        enumBuffer.Add(addedString);
                        writer.WriteLine("        {0},", addedString);
                    }
                }
                writer.WriteLine("    }");
                writer.WriteLine();

                // Validate ReleaseType string.
                if (!enumBuffer.Contains(releaseTypeString))
                {
                    releaseTypeString = NONE;
                }

                // Write Platform enum.
                enumBuffer.Clear();
                writer.WriteLine("    public enum Platform");
                writer.WriteLine("    {");
                writer.WriteLine("        {0},", NONE);
                enumBuffer.Add(NONE);
                foreach (BuildPlatform platform in BuildSettings.platformList.platforms)
                {
                    string addedString = SanitizeString(platform.platformName);

                    if (platform.enabled && !enumBuffer.Contains(addedString))
                    {
                        enumBuffer.Add(addedString);
                        writer.WriteLine("        {0},", addedString);
                    }
                }
                writer.WriteLine("    }");
                writer.WriteLine();

                // Validate Platform string.
                if (!enumBuffer.Contains(platformString))
                {
                    platformString = NONE;
                }

                // Write Architecture enum.
                enumBuffer.Clear();
                writer.WriteLine("    public enum Architecture");
                writer.WriteLine("    {");
                writer.WriteLine("        {0},", NONE);
                enumBuffer.Add(NONE);
                foreach (BuildPlatform platform in BuildSettings.platformList.platforms)
                {
                    if (platform.enabled)
                    {
                        foreach (BuildArchitecture arch in platform.architectures)
                        {
                            string addedString = SanitizeString(arch.name);

                            if (arch.enabled && !enumBuffer.Contains(addedString))
                            {
                                enumBuffer.Add(addedString);
                                writer.WriteLine("        {0},", addedString);
                            }
                        }
                    }
                }
                writer.WriteLine("    }");
                writer.WriteLine();

                // Validate Architecture string.
                if (!enumBuffer.Contains(archString))
                {
                    archString = NONE;
                }

                // Write Distribution enum.
                enumBuffer.Clear();
                writer.WriteLine("    public enum Distribution");
                writer.WriteLine("    {");
                writer.WriteLine("        {0},", NONE);
                enumBuffer.Add(NONE);
                foreach (BuildPlatform platform in BuildSettings.platformList.platforms)
                {
                    if (platform.enabled)
                    {
                        foreach (BuildDistribution dist in platform.distributionList.distributions)
                        {
                            string addedString = SanitizeString(dist.distributionName);

                            if (dist.enabled && !enumBuffer.Contains(addedString))
                            {
                                enumBuffer.Add(addedString);
                                writer.WriteLine("        {0},", addedString);
                            }
                        }
                    }
                }
                writer.WriteLine("    }");
                writer.WriteLine();

                // Validate Distribution string.
                if (!enumBuffer.Contains(distributionString))
                {
                    distributionString = NONE;
                }

                // Write current values.
                writer.WriteLine("    public static readonly System.DateTime buildDate = new System.DateTime({0});", buildTime.Ticks);
                writer.WriteLine("    public const string version = \"{0}\";", versionString);
                writer.WriteLine("    public const ReleaseType releaseType = ReleaseType.{0};", releaseTypeString);
                writer.WriteLine("    public const Platform platform = Platform.{0};", platformString);
                writer.WriteLine("    public const Architecture architecture = Architecture.{0};", archString);
                writer.WriteLine("    public const Distribution distribution = Distribution.{0};", distributionString);

                // End of class.
                writer.WriteLine("}");
                writer.WriteLine();
            }

            // Refresh AssetDatabse so that changes take effect.
            AssetDatabase.Refresh();
        }
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            EditorGUI.BeginProperty(position, label, property);

            EditorGUILayout.BeginHorizontal();

            bool show = property.isExpanded;

            UnityBuildGUIUtility.DropdownHeader("SceneList", ref show, false, GUILayout.ExpandWidth(true));
            property.isExpanded = show;

            EditorGUILayout.EndHorizontal();

            //Refresh all scene lists.
            for (int i = 0; i < BuildSettings.releaseTypeList.releaseTypes.Length; i++)
            {
                BuildReleaseType rt = BuildSettings.releaseTypeList.releaseTypes[i];
                rt.sceneList.Refresh();
            }

            list = property.FindPropertyRelative("enabledScenes");

            if (show)
            {
                EditorGUILayout.BeginVertical(UnityBuildGUIUtility.dropdownContentStyle);

                SerializedProperty platformProperty;
                string             fileGUID;
                string             filePath;
                string             sceneName = "N/A";
                if (list.arraySize > 0)
                {
                    platformProperty = list.GetArrayElementAtIndex(0);
                    fileGUID         = platformProperty.FindPropertyRelative("fileGUID").stringValue;
                    filePath         = AssetDatabase.GUIDToAssetPath(fileGUID);
                    sceneName        = Path.GetFileNameWithoutExtension(filePath);
                }

                EditorGUILayout.BeginHorizontal();

                show = list.isExpanded;
                UnityBuildGUIUtility.DropdownHeader(string.Format("Scenes ({0}) (First Scene: {1})", list.arraySize, sceneName), ref show, false, GUILayout.ExpandWidth(true));
                list.isExpanded = show;

                EditorGUILayout.EndHorizontal();

                if (show)
                {
                    for (int i = 0; i < list.arraySize; i++)
                    {
                        platformProperty = list.GetArrayElementAtIndex(i);
                        fileGUID         = platformProperty.FindPropertyRelative("fileGUID").stringValue;
                        filePath         = AssetDatabase.GUIDToAssetPath(fileGUID);
                        sceneName        = Path.GetFileNameWithoutExtension(filePath);

                        EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.TextArea(sceneName + " (" + filePath + ")");

                        EditorGUI.BeginDisabledGroup(i == 0);
                        if (GUILayout.Button("↑↑", UnityBuildGUIUtility.helpButtonStyle))
                        {
                            list.MoveArrayElement(i, 0);
                        }
                        if (GUILayout.Button("↑", UnityBuildGUIUtility.helpButtonStyle))
                        {
                            list.MoveArrayElement(i, i - 1);
                        }
                        EditorGUI.EndDisabledGroup();

                        EditorGUI.BeginDisabledGroup(i == list.arraySize - 1);
                        if (GUILayout.Button("↓", UnityBuildGUIUtility.helpButtonStyle))
                        {
                            list.MoveArrayElement(i, i + 1);
                        }
                        EditorGUI.EndDisabledGroup();

                        if (GUILayout.Button("X", UnityBuildGUIUtility.helpButtonStyle))
                        {
                            list.DeleteArrayElementAtIndex(i);
                        }

                        property.serializedObject.ApplyModifiedProperties();

                        EditorGUILayout.EndHorizontal();
                    }
                }

                GUILayout.Space(20);

                Rect dropArea = GUILayoutUtility.GetRect(0, 50.0f, GUILayout.ExpandWidth(true));
                GUI.Box(dropArea, "Drag and Drop scene files here to add to list.", UnityBuildGUIUtility.dragDropStyle);
                Event currentEvent = Event.current;

                switch (currentEvent.type)
                {
                case EventType.DragUpdated:
                case EventType.DragPerform:
                    if (dropArea.Contains(currentEvent.mousePosition))
                    {
                        DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
                        if (currentEvent.type == EventType.DragPerform)
                        {
                            DragAndDrop.AcceptDrag();

                            foreach (Object obj in DragAndDrop.objectReferences)
                            {
                                if (obj.GetType() == typeof(UnityEditor.SceneAsset))
                                {
                                    string objFilepath = AssetDatabase.GetAssetPath(obj);
                                    string objGUID     = AssetDatabase.AssetPathToGUID(objFilepath);
                                    AddScene(objGUID);
                                }
                            }

                            if (list.arraySize >= AUTO_COLLAPSE_SIZE)
                            {
                                list.isExpanded = false;
                            }
                        }
                    }
                    break;
                }

                if (GUILayout.Button("Clear Scene List", GUILayout.ExpandWidth(true)))
                {
                    list.ClearArray();
                }

                if (GUILayout.Button("Add Scene File Directory", GUILayout.ExpandWidth(true)))
                {
                    GetSceneFileDirectory("Add Scene Files");
                }

                if (GUILayout.Button("Set First Scene by File", GUILayout.ExpandWidth(true)))
                {
                    SetFirstSceneByFile();
                }

                list.serializedObject.ApplyModifiedProperties();
                property.serializedObject.ApplyModifiedProperties();

                EditorGUILayout.EndVertical();
            }

            EditorGUI.EndProperty();
        }
Exemplo n.º 22
0
        private static string GetChannelName(string channelNameFormat, BuildTarget target, BuildReleaseType buildReleaseType)
        {
            string platform     = string.Empty;
            string architecture = string.Empty;

            switch (target)
            {
            // Windows
            case BuildTarget.StandaloneWindows:
                platform     = WINDOWS;
                architecture = ARCHITECTURE_X86;
                break;

            case BuildTarget.StandaloneWindows64:
                platform     = WINDOWS;
                architecture = ARCHITECTURE_X64;
                break;

            // Linux
            case BuildTarget.StandaloneLinux:
                platform     = LINUX;
                architecture = ARCHITECTURE_X86;
                break;

            case BuildTarget.StandaloneLinux64:
                platform     = LINUX;
                architecture = ARCHITECTURE_X64;
                break;

            case BuildTarget.StandaloneLinuxUniversal:
                platform     = LINUX;
                architecture = ARCHITECTURE_UNIVERSAL;
                break;

                // OSX
#if UNITY_2017_3_OR_NEWER
            case BuildTarget.StandaloneOSX:
                platform = OSX;
                break;
#else
            case BuildTarget.StandaloneOSXIntel:
                platform     = OSX;
                architecture = ARCHITECTURE_INTEL;
                break;

            case BuildTarget.StandaloneOSXIntel64:
                platform     = OSX;
                architecture = ARCHITECTURE_INTEL64;
                break;

            case BuildTarget.StandaloneOSXUniversal:
                platform     = OSX;
                architecture = ARCHITECTURE_UNIVERSAL;
                break;
#endif

            // WebGL
            case BuildTarget.WebGL:
                platform = WEBGL;
                break;

            default:
                return(null);
            }

            string channelName = channelNameFormat;
            channelName = channelName.Replace("$PLATFORM", platform);
            channelName = channelName.Replace("$ARCHITECTURE", architecture);
            channelName = channelName.Replace("$RELEASE_TYPE", buildReleaseType.typeName);

            return(channelName);
        }
Exemplo n.º 23
0
        public bool ParseKeychain(string keychain, out BuildReleaseType releaseType, out BuildPlatform platform, out BuildArchitecture architecture, out BuildDistribution distribution)
        {
            bool success = false;

            string[] keys      = keychain.Split('/');
            int      keyCount  = keys.Length;
            int      targetKey = 0;

            releaseType  = null;
            platform     = null;
            architecture = null;
            distribution = null;

            // Parse release type.
            if (keyCount > targetKey)
            {
                for (int i = 0; i < BuildSettings.releaseTypeList.releaseTypes.Length; i++)
                {
                    BuildReleaseType rt = BuildSettings.releaseTypeList.releaseTypes[i];

                    if (keys[targetKey] == rt.typeName)
                    {
                        releaseType = rt;
                        break;
                    }
                }
            }

            if (releaseType == null)
            {
                return(false);
            }

            // Parse platform.
            if (keyCount > ++targetKey)
            {
                for (int i = 0; i < BuildSettings.platformList.platforms.Length; i++)
                {
                    BuildPlatform p = BuildSettings.platformList.platforms[i];

                    if (keys[targetKey] == p.platformName)
                    {
                        platform = p;
                        break;
                    }
                }
            }

            if (platform == null)
            {
                return(false);
            }

            // Parse architecture.
            if (platform.architectures.Length == 1)
            {
                // Only one architecture, so it won't even appear in dictionary. Just get it directly.
                architecture = platform.architectures[0];
                success      = true;
            }
            else if (keyCount > ++targetKey)
            {
                for (int i = 0; i < platform.architectures.Length; i++)
                {
                    BuildArchitecture arch = platform.architectures[i];

                    if (keys[targetKey] == arch.name)
                    {
                        architecture = arch;
                        success      = true;
                        break;
                    }
                }
            }

            if (architecture == null)
            {
                return(false);
            }

            // TODO: Parse variants.

            // Parse distribution.
            if (keyCount > ++targetKey)
            {
                success = false;
                for (int i = 0; i < platform.distributionList.distributions.Length; i++)
                {
                    BuildDistribution dist = platform.distributionList.distributions[i];

                    if (keys[targetKey] == dist.distributionName)
                    {
                        distribution = dist;
                        success      = true;
                        break;
                    }
                }
            }

            return(success);
        }
Exemplo n.º 24
0
        public bool ParseKeychain(string keychain, out BuildReleaseType releaseType, out BuildPlatform platform, out BuildArchitecture architecture, out BuildDistribution distribution)
        {
            bool success = false;

            string[] keys      = keychain.Split('/');
            int      keyCount  = keys.Length;
            int      targetKey = 0;

            releaseType  = null;
            platform     = null;
            architecture = null;
            distribution = null;

            // Parse release type.
            if (keyCount > targetKey)
            {
                for (int i = 0; i < BuildSettings.releaseTypeList.releaseTypes.Length; i++)
                {
                    BuildReleaseType rt = BuildSettings.releaseTypeList.releaseTypes[i];

                    if (keys[targetKey] == rt.typeName)
                    {
                        releaseType = rt;
                        break;
                    }
                }
            }

            if (releaseType == null)
            {
                return(false);
            }

            // Parse platform.
            if (keyCount > ++targetKey)
            {
                // Scan ahead and try to parse a variant key.
                string variantKey = "";
                if (keys[targetKey + 1].Contains("("))
                {
                    int startIndex = keys[targetKey + 1].IndexOf('(');
                    int endIndex   = keys[targetKey + 1].IndexOf(')');
                    variantKey = keys[targetKey + 1].Substring(startIndex + 1, endIndex - startIndex - 1);

                    keys[targetKey + 1] = keys[targetKey + 1].Remove(startIndex).Trim();
                }

                for (int i = 0; i < BuildSettings.platformList.platforms.Count; i++)
                {
                    BuildPlatform p = BuildSettings.platformList.platforms[i];

                    if (keys[targetKey] == p.platformName && p.variantKey == variantKey)
                    {
                        platform = p;
                        break;
                    }
                }
            }

            if (platform == null)
            {
                return(false);
            }

            // Parse architecture.
            if (platform.architectures.Length == 1)
            {
                // Only one architecture, so it won't even appear in dictionary. Just get it directly.
                ++targetKey;
                architecture = platform.architectures[0];
                success      = true;
            }
            else if (keyCount > ++targetKey)
            {
                for (int i = 0; i < platform.architectures.Length; i++)
                {
                    BuildArchitecture arch = platform.architectures[i];

                    if (keys[targetKey] == arch.name)
                    {
                        architecture = arch;
                        success      = true;
                        break;
                    }
                }
            }

            if (architecture == null)
            {
                return(false);
            }

            // TODO: Parse variants.

            // Parse distribution.
            if (keyCount > ++targetKey)
            {
                success = false;
                for (int i = 0; i < platform.distributionList.distributions.Length; i++)
                {
                    BuildDistribution dist = platform.distributionList.distributions[i];

                    if (keys[targetKey] == dist.distributionName)
                    {
                        distribution = dist;
                        success      = true;
                        break;
                    }
                }
            }

            return(success);
        }