internal override ShellProcessOutput RunTestMode(string exeName, string workingDirPath, int timeout)
        {
            var app = $"{workingDirPath}/{exeName}{ExecutableExtension}";

            if (!Directory.Exists(app))
            {
                throw new Exception($"Couldn't find iOS app at: {app} ");
            }
            using (var progress = new BuildProgress("Running the iOS app", "Please wait..."))
            {
                var shellArgs = new ShellProcessArguments
                {
                    Executable = FindIOSDeploy(),
                    Arguments  = new[]
                    {
                        "--noninteractive",
                        "--debug",
                        "--uninstall",
                        "--bundle",
                        app
                    },
                    WorkingDirectory = new DirectoryInfo(workingDirPath)
                };
                if (timeout > 0)
                {
                    shellArgs.MaxIdleTimeInMilliseconds = timeout;
                    shellArgs.MaxIdleKillIsAnError      = false;
                }

                return(ShellProcess.Run(shellArgs));
            }
        }
        private static string FindIOSDeploy()
        {
            var shellArgs = new ShellProcessArguments
            {
                Executable = "ls",
                Arguments  = new[]
                {
                    iOSDeployFolder
                },
                ThrowOnError = false
            };
            var output = ShellProcess.Run(shellArgs);

            var versionStr = "0.0.0";

            if (output.ExitCode == 0)
            {
                var versions = output.FullOutput.Split('\n');
                foreach (var v in versions)
                {
                    if (v.Length > 0 && (new System.Version(v)).CompareTo(new System.Version(versionStr)) > 0)
                    {
                        versionStr = v;
                    }
                }
            }
            if (versionStr == "0.0.0")
            {
                throw new Exception($"iOS deploy is required in order to install and launch the app, to install it simply run \"brew install ios-deploy\"");
            }
            return($"{iOSDeployFolder}/{versionStr}/bin/ios-deploy");
        }
Example #3
0
        internal override ShellProcessOutput RunTestMode(string exeName, string workingDirPath, int timeout)
        {
            var shellArgs = new ShellProcessArguments
            {
                Executable = $"{workingDirPath}/{exeName}{ExecutableExtension}",
                Arguments = new string[] { },
            };

            return DesktopRun.RunTestMode(shellArgs, workingDirPath, timeout);
        }
Example #4
0
        internal override ShellProcessOutput RunTestMode(string exeName, string workingDirPath, int timeout)
        {
            var shellArgs = new ShellProcessArguments
            {
                Executable = Path.GetFullPath(Path.Combine(UnityEditor.EditorApplication.applicationContentsPath, "MonoBleedingEdge", "bin", "mono")),
                Arguments = new[] { $"\"{workingDirPath}/{exeName}{ExecutableExtension}\"" },
            };

            return DesktopRun.RunTestMode(shellArgs, workingDirPath, timeout);
        }
        private static Process StartPosixSocketBridgeProcess()
        {
            var shellArgs = new ShellProcessArguments
            {
                Executable = SocketBridgeExecutable,
                Arguments  = new [] { "6690" },
            };

            var posixSocketBridgeProcess = ShellProcess.Start(shellArgs);

            return(posixSocketBridgeProcess.Process);
        }
Example #6
0
        internal static ShellProcessOutput RunTestMode(ShellProcessArguments shellArgs, string workingDirPath, int timeout)
        {
            shellArgs.WorkingDirectory = new DirectoryInfo(workingDirPath);
            shellArgs.ThrowOnError     = false;

            // samples should be killed on timeout
            if (timeout > 0)
            {
                shellArgs.MaxIdleTimeInMilliseconds = timeout;
                shellArgs.MaxIdleKillIsAnError      = false;
            }

            return(ShellProcess.Run(shellArgs));
        }
Example #7
0
        static IEnumerator <BeeProgressInfo> Run(string arguments, StringBuilder command, StringBuilder output, DirectoryInfo workingDirectory = null)
        {
            var beeExe     = Path.GetFullPath($"{Constants.DotsRuntimePackagePath}/bee~/bee.exe");
            var executable = beeExe;

            arguments = "--no-colors " + arguments;

#if !UNITY_EDITOR_WIN
            arguments  = "\"" + executable + "\" " + arguments;
            executable = Path.Combine(UnityEditor.EditorApplication.applicationContentsPath,
                                      "MonoBleedingEdge/bin/mono");
#endif

            command.Append(executable);
            command.Append(" ");
            command.Append(arguments);

            var progressInfo = new BeeProgressInfo()
            {
                Progress = 0.0f,
                Info     = null
            };

            void ProgressHandler(object sender, DataReceivedEventArgs args)
            {
                if (string.IsNullOrWhiteSpace(args.Data))
                {
                    return;
                }

                var match = BeeProgressRegex.Match(args.Data);

                if (match.Success)
                {
                    var num = match.Groups["nominator"].Value;
                    var den = match.Groups["denominator"].Value;
                    if (int.TryParse(num, out var numInt) && int.TryParse(den, out var denInt))
                    {
                        progressInfo.Progress = (float)numInt / denInt;
                    }
                    progressInfo.Info = ShortenAnnotation(match.Groups["annotation"].Value);
                }

                var busyMatch = BeeBusyRegex.Match(args.Data);

                if (busyMatch.Success)
                {
                    progressInfo.Info = ShortenAnnotation(busyMatch.Groups["annotation"].Value);
                }

                progressInfo.FullInfo = args.Data;
                lock (output)
                {
                    output.AppendLine(args.Data);
                }
            }

            var config = new ShellProcessArguments()
            {
                Executable       = executable,
                Arguments        = new[] { arguments },
                WorkingDirectory = workingDirectory,
#if !UNITY_EDITOR_WIN
                // bee requires external programs to perform build actions
                EnvironmentVariables = new Dictionary <string, string>()
                {
                    { "PATH", string.Join(":",
                                          Path.Combine(UnityEditor.EditorApplication.applicationContentsPath,
                                                       "MonoBleedingEdge/bin"),
                                          "/bin",
                                          "/usr/bin",
                                          "/usr/local/bin") }
                },
#else
                EnvironmentVariables = null,
#endif
                OutputDataReceived = ProgressHandler,
                ErrorDataReceived  = ProgressHandler
            };

            var bee = ShellProcess.Start(config);
            progressInfo.Process = bee;

            yield return(progressInfo);

            const int maxBuildTimeInMs = 30 * 60 * 1000; // 30 minutes

            var statusEnum = bee.WaitForProcess(maxBuildTimeInMs);
            while (statusEnum.MoveNext())
            {
                yield return(progressInfo);
            }

            progressInfo.Progress = 1.0f;
            progressInfo.IsDone   = true;
            progressInfo.ExitCode = bee.Process.ExitCode;
            progressInfo.Info     = "Build completed";
            yield return(progressInfo);
        }