예제 #1
0
        protected async void Start()
        {
            Application.targetFrameRate = 60;

            var args           = CommandLineArgs.FromCommandLine();
            var deploymentName = string.Empty;

            if (args.TryGetCommandLineValue(DeploymentNameFlag, ref deploymentName))
            {
                connectPlayersWithDevAuth = deploymentName != "local";
            }
            else
            {
                // We are probably in the Editor.
                connectPlayersWithDevAuth = false;
            }

            await Connect(GetConnectionHandlerBuilder(), new ForwardingDispatcher());

            if (SimulatedPlayerWorkerConnector == null)
            {
                Worker.LogDispatcher.HandleLog(LogType.Error, new LogEvent("Did not find a SimulatedPlayerWorkerConnector GameObject."));
                return;
            }

            Bounds = await GetWorldBounds();

            await LoadWorld();
            await ConnectSimulatedPlayers();
        }
예제 #2
0
        /// <summary>
        ///     Build method that is invoked by commandline
        /// </summary>
        // ReSharper disable once UnusedMember.Global
        public static void Build()
        {
            try
            {
                var args = CommandLineArgs.FromCommandLine();

                // Parse command line arguments
                var buildTargetFilter    = CommandlineParser.GetBuildTargetFilter(args);
                var wantedWorkerTypes    = CommandlineParser.GetWorkerTypesToBuild(args);
                var scriptImplementation = CommandlineParser.GetScriptingImplementation(args);
                var buildEnvironment     = CommandlineParser.GetBuildEnvironment(args);

                // Create BuildContext for each worker
                var buildContexts = BuildContext.GetBuildContexts(wantedWorkerTypes, buildEnvironment, scriptImplementation,
                                                                  buildTargetFilter);

                if (buildContexts.Count == 0)
                {
                    throw new BuildFailedException(
                              $"Attempted a build with no valid targets!");
                }

                BuildWorkers(buildContexts);
            }
            catch (Exception e)
            {
                Debug.LogException(e);
                if (e is BuildFailedException)
                {
                    throw;
                }

                throw new BuildFailedException(e);
            }
        }
예제 #3
0
        /// <summary>
        ///     Build method that is invoked by commandline
        /// </summary>
        // ReSharper disable once UnusedMember.Global
        public static void Build()
        {
            try
            {
                var args = CommandLineArgs.FromCommandLine();

                // Parse command line arguments
                var buildContextFilter = BuildContextSettings.FromCommandLine(args);

                // Create BuildContext for each worker
                var buildConfig   = BuildConfig.GetInstance();
                var buildContexts = BuildContext.GetBuildContexts(buildConfig, buildContextFilter);

                if (buildContexts.Count == 0)
                {
                    throw new BuildFailedException("Attempted a build with no valid targets!");
                }

                BuildWorkers(buildContexts);
            }
            catch (Exception e)
            {
                Debug.LogException(e);
                if (e is BuildFailedException)
                {
                    throw;
                }

                throw new BuildFailedException(e);
            }
        }
예제 #4
0
        /// <summary>
        ///     Build method that is invoked by commandline
        /// </summary>
        // ReSharper disable once UnusedMember.Global
        public static void Build()
        {
            try
            {
                var args           = CommandLineArgs.FromCommandLine();
                var buildTargetArg = args.GetCommandLineValue("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    = args.GetCommandLineValue(BuildWorkerTypes, "UnityClient,UnityGameLogic");
                var wantedWorkerTypes = workerTypesArg.Split(',');

                ScriptingImplementation scriptingBackend;
                var wantedScriptingBackend = args.GetCommandLineValue("scriptingBackend", "mono");
                switch (wantedScriptingBackend)
                {
                case "mono":
                    scriptingBackend = ScriptingImplementation.Mono2x;
                    break;

                case "il2cpp":
                    scriptingBackend = ScriptingImplementation.IL2CPP;
                    break;

                default:
                    throw new BuildFailedException("Unknown scripting backend value: " + wantedScriptingBackend);
                }

                var buildsSucceeded = BuildWorkers(wantedWorkerTypes, buildEnvironment, scriptingBackend);

                if (!buildsSucceeded)
                {
                    throw new BuildFailedException("Not all builds were completed successfully. See the log for more information.");
                }
            }
            catch (Exception e)
            {
                Debug.LogException(e);
                if (e is BuildFailedException)
                {
                    throw;
                }

                throw new BuildFailedException(e);
            }
        }
        protected override async void Start()
        {
            var args = CommandLineArgs.FromCommandLine();

            var deploymentName = string.Empty;

            if (args.TryGetCommandLineValue(DeploymentNameFlag, ref deploymentName))
            {
                connectPlayersWithDevAuth = deploymentName != "local";
            }
            else
            {
                // We are probably in the Editor.
                connectPlayersWithDevAuth = false;
            }

            Application.targetFrameRate = 60;
            await AttemptConnect();
        }
        public static void Parse()
        {
            var args = CommandLineArgs.FromCommandLine();
            var xmlResultsDirectory = string.Empty;
            var jsonOutputDirectory = string.Empty;

            if (!args.TryGetCommandLineValue(xmlResultsDirKey, ref xmlResultsDirectory) ||
                !args.TryGetCommandLineValue(jsonOutputDirKey, ref jsonOutputDirectory))
            {
                Debug.LogError($"You must provide valid {xmlResultsDirKey} and {jsonOutputDirKey} arguments.");
                return;
            }

            var jsonOutputPath = Path.GetFullPath(jsonOutputDirectory);
            Directory.CreateDirectory(jsonOutputPath);

            var testResults = Directory.EnumerateFiles(Path.GetFullPath(xmlResultsDirectory), "*.xml");
            foreach (var testResult in testResults)
            {
                try
                {
                    var jsonFileName = Path.ChangeExtension(Path.GetFileName(testResult), "json");
                    var jsonFilePath = Path.Combine(jsonOutputPath, jsonFileName);

                    var xmlParser = new TestResultXmlParser();
                    var run = xmlParser.GetPerformanceTestRunFromXml(testResult);
                    if (run == null)
                    {
                        Debug.LogError($"No result at given path: {testResult}");
                        return;
                    }

                    File.WriteAllText(jsonFilePath, JsonConvert.SerializeObject(run, Formatting.Indented));
                }
                catch (Exception e)
                {
                    Debug.LogException(e);
                }
            }
        }
예제 #7
0
        /// <summary>
        ///     Build method that is invoked by commandline
        /// </summary>
        // ReSharper disable once UnusedMember.Global
        public static void Build()
        {
            try
            {
                var args = CommandLineArgs.FromCommandLine();
                var buildEnvironmentArg = args.GetCommandLineValue("buildEnvironment", "local");

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

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

                default:
                    throw new BuildFailedException("Unknown build environment value: " + buildEnvironmentArg);
                }

                IEnumerable <BuildTarget> buildTargetFilter = null;
                var buildTargetFilterArg = string.Empty;
                if (args.TryGetCommandLineValue("buildTargetFilter", ref buildTargetFilterArg))
                {
                    buildTargetFilter = buildTargetFilterArg
                                        .Split(',')
                                        .Select(target =>
                    {
                        switch (buildTargetFilterArg.ToLower())
                        {
                        case "android":
                            return(BuildTarget.Android);

                        case "ios":
                            return(BuildTarget.iOS);

                        case "winx86":
                            return(BuildTarget.StandaloneWindows);

                        case "win":
                            return(BuildTarget.StandaloneWindows64);

                        case "linux":
                            return(BuildTarget.StandaloneLinux64);

                        case "macos":
                            return(BuildTarget.StandaloneOSX);

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

                var workerTypesArg    = args.GetCommandLineValue(BuildWorkerTypes, "UnityClient,UnityGameLogic");
                var wantedWorkerTypes = workerTypesArg.Split(',');

                ScriptingImplementation scriptingBackend;
                var wantedScriptingBackend = args.GetCommandLineValue("scriptingBackend", "mono");
                switch (wantedScriptingBackend)
                {
                case "mono":
                    scriptingBackend = ScriptingImplementation.Mono2x;
                    break;

                case "il2cpp":
                    scriptingBackend = ScriptingImplementation.IL2CPP;
                    break;

                default:
                    throw new BuildFailedException("Unknown scripting backend value: " + wantedScriptingBackend);
                }

                var buildsSucceeded = BuildWorkers(wantedWorkerTypes, buildEnvironment, buildTargetFilter, scriptingBackend);

                if (!buildsSucceeded)
                {
                    throw new BuildFailedException("Not all builds were completed successfully. See the log for more information.");
                }
            }
            catch (Exception e)
            {
                Debug.LogException(e);
                if (e is BuildFailedException)
                {
                    throw;
                }

                throw new BuildFailedException(e);
            }
        }