Пример #1
0
 public void Init()
 {
     if (!Platform.IsUnix())
     {
         VsDevHelper.ReplaceVariablesToVs();
         ModuleBuilderHelper.FindMsBuildsWindows();
         ModuleBuilderHelper.KillMsBuild(log);
     }
 }
Пример #2
0
        private bool RunBuildScript(Dep dep, BuildScriptWithBuildData script)
        {
            var sw      = Stopwatch.StartNew();
            var command = script.Script;
            var runner  = PrepareShellRunner();

            int exitCode = -1;

            for (int timesTry = 0; timesTry < 2 && exitCode != 0; timesTry++)
            {
                ModuleBuilderHelper.KillMsBuild(log);
                if (timesTry != 0)
                {
                    command = script.ScriptIfFail;
                }
                log.DebugFormat("Build command: '{0}'", command);
                if (buildSettings.ShowOutput)
                {
                    ConsoleWriter.WriteInfo($"BUILDING {command}");
                }
                exitCode = runner.RunInDirectory(Path.Combine(Helper.CurrentWorkspace, dep.Name), command, TimeSpan.FromMinutes(60));
            }

            sw.Stop();
            TotalMsbuildTime += sw.Elapsed;

            var elapsedTime    = Helper.ConvertTime(sw.ElapsedMilliseconds);
            var warnCount      = runner.Output.Split('\n').Count(ModuleBuilderHelper.IsWarning);
            var obsoleteUsages = runner.Output.Split('\n').Where(ModuleBuilderHelper.IsObsoleteWarning).ToList();

            var buildName = script.BuildData == null ? "" : script.BuildData.Name;

            if (exitCode != 0)
            {
                PrintBuildFailResult(dep, buildName, runner);
                return(false);
            }

            PrintBuildResult(dep, buildName, warnCount, elapsedTime, obsoleteUsages);
            return(true);
        }