コード例 #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);
            }
        }