Exemplo n.º 1
0
        protected override async Task ExecuteAsync()
        {
            using (var resource = await NotifyAndAcquireDesktopResourceAsync()) {
                BuildLog = Logs.Create($"build-{Platform}-{Timestamp}.txt", LogType.BuildLog.ToString());

                await RestoreNugetsAsync(BuildLog, resource, useXIBuild : true);

                using (var xbuild = new Process()) {
                    xbuild.StartInfo.FileName  = ToolName;
                    xbuild.StartInfo.Arguments = StringUtils.FormatArguments(ToolArguments);
                    SetEnvironmentVariables(xbuild);
                    xbuild.StartInfo.EnvironmentVariables ["MSBuildExtensionsPath"] = null;
                    LogEvent(BuildLog, "Building {0} ({1})", TestName, Mode);
                    if (!Harness.DryRun)
                    {
                        var timeout = TimeSpan.FromMinutes(60);
                        var result  = await ProcessManager.RunAsync(xbuild, BuildLog, timeout);

                        if (result.TimedOut)
                        {
                            ExecutionResult = TestExecutingResult.TimedOut;
                            BuildLog.WriteLine("Build timed out after {0} seconds.", timeout.TotalSeconds);
                        }
                        else if (result.Succeeded)
                        {
                            ExecutionResult = TestExecutingResult.Succeeded;
                        }
                        else
                        {
                            ExecutionResult = TestExecutingResult.Failed;
                            if (Jenkins.IsMonoMulti3Issue(BuildLog))
                            {
                                KnownFailure = $"<a href='https://github.com/mono/mono/issues/18560'>Undefined symbol ___multi3 on Release Mode</a>";
                            }
                        }
                    }
                    Jenkins.MainLog.WriteLine("Built {0} ({1})", TestName, Mode);
                }

                BuildLog.Dispose();
            }
        }