コード例 #1
0
ファイル: Build.cs プロジェクト: aidmsu/cement
        protected override int Execute()
        {
            var cwd        = Directory.GetCurrentDirectory();
            var moduleName = Path.GetFileName(cwd);

            configuration = configuration ?? "full-build";

            if (!new ConfigurationParser(new FileInfo(cwd)).ConfigurationExists(configuration))
            {
                ConsoleWriter.WriteError($"Configuration '{configuration}' was not found in {moduleName}.");
                return(-1);
            }

            var shellRunner     = new ShellRunner(LogManager.GetLogger <ShellRunner>());
            var cleaner         = new Cleaner(shellRunner);
            var builder         = new ModuleBuilder(Log, buildSettings);
            var builderInitTask = Task.Run(() => builder.Init());
            var modulesOrder    = new BuildPreparer(Log).GetModulesOrder(moduleName, configuration);
            var builtStorage    = BuiltInfoStorage.Deserialize();

            builtStorage.RemoveBuildInfo(moduleName);

            builderInitTask.Wait();
            var module = new Dep(moduleName, null, configuration);

            if (FeatureFlags.CleanBeforeBuild || buildSettings.CleanBeforeBuild)
            {
                if (cleaner.IsNetStandard(module))
                {
                    cleaner.Clean(module);
                }
            }

            BuildDeps.TryNugetRestore(new List <Dep> {
                module
            }, builder);

            if (!builder.Build(module))
            {
                builtStorage.Save();
                return(-1);
            }
            builtStorage.AddBuiltModule(module, modulesOrder.CurrentCommitHashes);
            builtStorage.Save();
            return(0);
        }
コード例 #2
0
        protected override int Execute()
        {
            var cwd        = Directory.GetCurrentDirectory();
            var moduleName = Path.GetFileName(cwd);

            configuration = configuration ?? "full-build";

            List <Dep> modulesToUpdate;
            List <Dep> topSortedDeps;
            Dictionary <string, string> currentCommitHases;

            if (!new ConfigurationParser(new FileInfo(cwd)).ConfigurationExists(configuration))
            {
                ConsoleWriter.WriteError($"Configuration '{configuration}' was not found in {moduleName}.");
                return(-1);
            }

            var builder         = new ModuleBuilder(Log, buildSettings);
            var builderInitTask = Task.Run(() => builder.Init());

            new BuildPreparer(Log).GetModulesOrder(moduleName, configuration, out topSortedDeps, out modulesToUpdate, out currentCommitHases);

            var builtStorage = BuiltInfoStorage.Deserialize();

            builtStorage.RemoveBuildInfo(moduleName);

            builderInitTask.Wait();
            var module = new Dep(moduleName, null, configuration);

            BuildDeps.TryNugetRestore(new List <Dep> {
                module
            }, builder);

            if (!builder.Build(module))
            {
                builtStorage.Save();
                return(-1);
            }
            builtStorage.AddBuiltModule(module, currentCommitHases);
            builtStorage.Save();
            return(0);
        }