Example #1
0
        /// <summary>
        ///     Build method that is invoked by commandline
        /// </summary>
        // ReSharper disable once UnusedMember.Global
        public static void Build()
        {
            try
            {
                var commandLine    = Environment.GetCommandLineArgs();
                var buildTargetArg = CommandLineUtility.GetCommandLineValue(commandLine, "buildTarget", "local");

                BuildEnvironment buildEnvironment;
                switch (buildTargetArg.ToLower())
                {
                case "cloud":
                    buildEnvironment = BuildEnvironment.Cloud;
                    break;

                case "local":
                    buildEnvironment = BuildEnvironment.Local;
                    break;

                default:
                    throw new BuildFailedException("Unknown build target value: " + buildTargetArg);
                }

                var workerTypesArg =
                    CommandLineUtility.GetCommandLineValue(commandLine, BuildWorkerTypes,
                                                           "UnityClient,UnityGameLogic");

                var wantedWorkerTypes = workerTypesArg.Split(',');
                foreach (var wantedWorkerType in wantedWorkerTypes)
                {
                    var buildTargetsForWorker           = GetBuildTargetsForWorkerForEnvironment(wantedWorkerType, buildEnvironment);
                    var buildTargetsMissingBuildSupport = BuildSupportChecker.GetBuildTargetsMissingBuildSupport(buildTargetsForWorker);

                    if (buildTargetsMissingBuildSupport.Length > 0)
                    {
                        throw new BuildFailedException(BuildSupportChecker.ConstructMissingSupportMessage(wantedWorkerType, buildEnvironment, buildTargetsMissingBuildSupport));
                    }
                }

                LocalLaunch.BuildConfig();

                foreach (var wantedWorkerType in wantedWorkerTypes)
                {
                    BuildWorkerForEnvironment(wantedWorkerType, buildEnvironment);
                }
            }
            catch (Exception e)
            {
                Debug.LogException(e);
                if (e is BuildFailedException)
                {
                    throw;
                }

                throw new BuildFailedException(e);
            }
        }
Example #2
0
        private void ConfigureBuildPlatforms(BuildEnvironmentConfig environmentConfiguration)
        {
            using (IndentLevelScope(1))
            {
                EditorGUI.BeginChangeCheck();

                var buildPlatformsString = SelectedPlatformsToString(environmentConfiguration.BuildPlatforms);
                var newBuildPlatforms    = environmentConfiguration.BuildPlatforms;
                var showBuildPlatforms   = EditorGUILayout.Foldout(environmentConfiguration.ShowBuildPlatforms,
                                                                   "Build Platforms: " + buildPlatformsString);
                if (showBuildPlatforms)
                {
                    newBuildPlatforms = EnumFlagsToggleField(environmentConfiguration.BuildPlatforms);
                }

                var currentAdjustedPlatforms = newBuildPlatforms;

                if ((currentAdjustedPlatforms & SpatialBuildPlatforms.Current) != 0)
                {
                    currentAdjustedPlatforms |= WorkerBuilder.GetCurrentBuildPlatform();
                }

                if ((currentAdjustedPlatforms & SpatialBuildPlatforms.Windows32) != 0 &&
                    (currentAdjustedPlatforms & SpatialBuildPlatforms.Windows64) != 0)
                {
                    EditorGUILayout.HelpBox(WorkerBuilder.IncompatibleWindowsPlatformsErrorMessage,
                                            MessageType.Error);
                }

                var buildTargetsMissingBuildSupport = BuildSupportChecker.GetBuildTargetsMissingBuildSupport(WorkerBuilder.GetUnityBuildTargets(newBuildPlatforms));
                if (buildTargetsMissingBuildSupport.Length > 0)
                {
                    EditorGUILayout.HelpBox($"Missing build support for {string.Join(", ", buildTargetsMissingBuildSupport)}", MessageType.Error);
                }

                if (EditorGUI.EndChangeCheck())
                {
                    EditorUtility.SetDirty(target);
                    Undo.RecordObject(target, "Configure build platforms for worker");

                    environmentConfiguration.ShowBuildPlatforms = showBuildPlatforms;
                    environmentConfiguration.BuildPlatforms     = newBuildPlatforms;
                }
            }
        }