Ejemplo n.º 1
0
        internal IEnumerable<ICommand> PrepareCommands(DNXSettings dnxSettings, StepSettings stepSettings, EnvironmentSettings envSettings, int result)
        {
            this.stepSettings = stepSettings;
            productInfo = new ProjectsInfo(envSettings.ProductConfig, dnxSettings.Framework);
            envSettings.SetBranchVersion(productInfo.ReleaseVersion);

            factory = new CommandFactory(envSettings, productInfo);
            List<ICommand> commands = new List<ICommand>();

            if (stepSettings.EnvironmentInitialization)
                commands.Add(factory.InstallEnvironment(dnxSettings));

            if (stepSettings.Build || stepSettings.RunTests)
                commands.Add(new ActionCommand("init dnx and dnu paths", new Action(envSettings.FindPathToDNX)));

            if (stepSettings.CopyDirs)
                commands.Add(factory.CopyProjects(stepSettings.CopyPath, true));

            if (stepSettings.RemoveProjectsDirectories)
                commands.Add(factory.RemoveProjects());

            if (stepSettings.GetProjectsFromDXVCS)
                commands.Add(factory.GetProjectsFromVCS());

            if (stepSettings.Build) 
                commands.Add(factory.BuildProjects());

            if (stepSettings.RunTests)
                commands.Add(factory.RunTests());

            if (stepSettings.CollectArtifats)
                commands.Add(factory.CollectArtifacts(envSettings, envSettings.BuildArtifactsFolder, dnxSettings.Framework));

            return commands;
        }
Ejemplo n.º 2
0
 public ICommand InstallEnvironment(DNXSettings dnxsettings)
 {
     if (EnvironmentSettings.Platform == Platform.Windows)
         return new BatchCommand(
             new DownloadDNVMCommand(envSettings),
             new InstallDNXCommand(envSettings, dnxsettings),
             new GetNugetConfigCommand(envSettings, dnxsettings));
     else
         return new BatchCommand(
             new GetInstallDNXScriptComamnd(envSettings, dnxsettings),
             new InstallDNXCommand(envSettings, dnxsettings),
             new GetNugetConfigCommand(envSettings, dnxsettings));
 }
Ejemplo n.º 3
0
        private static int StartMain(string[] args)
        {
            if (args.Length == 1 && (args[0] == "-h" || args[0] == "-help"))
            {
                Console.Write(@"
CoreClrBuilder.exe [-config:<name>] [env_init] [remove] [get] [build] [test]
    env_init [-u] [-r <runtime>] [-arch <name>] [-v <version>]
    build [dnx451] [dotnet] [dnxcore50] 

-config:<config_name> - configuration file with projects and project settings (Not Supported yet)

env_init - dnx and dnvm installation, getting nuget.config, product.xml
    -u - use unstable version of dnx
    -r - runtime clr or coreclr
    -arch - x64 or x86
    -v - version of dnx (Example: 1.0.0-beta4-11566)

remove - remove direcories with projects (only for Windows)

get - get projects from DXVCS    

build - restore packages and build projects
    dnx451 or dotnet or dnxcore50 - target framework

test - run tests
");
                return 0;
            }
            StepSettings stepSettings = new StepSettings(args);
            DNXSettings dnxSettings = new DNXSettings(args);
            EnvironmentSettings envSettings = new EnvironmentSettings();
            Console.WriteLine("Init Settings");

            if (!File.Exists(envSettings.ProductConfig) && string.IsNullOrEmpty(envSettings.BranchVersion))
            {
                Console.Write("Please place Product.xml near CoreClrBuilder.exe");
                return 1;
            }
            Executor executor = new Executor();
            return executor.ExecuteTasks(dnxSettings, stepSettings, envSettings);
        }
Ejemplo n.º 4
0
 public int ExecuteTasks(DNXSettings dnxSettings, StepSettings stepSettings, EnvironmentSettings envSettings)
 {
     tmpXml = new XmlTextWriter(new StringWriter(taskBreakingLog));
     tmpXml.Formatting = Formatting.Indented;
     int result = 0;
     try
     {
         IEnumerable<ICommand> commands = PrepareCommands(dnxSettings, stepSettings, envSettings, result);
         foreach (var command in commands)
         {
             BatchCommand batchCommand = command as BatchCommand;
             if (batchCommand != null && batchCommand.IsBatchOfIndependedCommands)
             {
                 foreach (var innerCommands in batchCommand.Commands)
                 {
                     result += DoWork(innerCommands);
                 }
             }
             else
             {
                 result += DoWork(command);
                 if (result > 0)
                     break;
             }
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.ToString());
         result = 1;
     }
     tmpXml.Close();
     if (taskBreakingLog.Length > 0)
     {
         taskBreakingLog.Insert(0, "<vssPathsByTasks>\r\n");
         taskBreakingLog.Append("\r\n</vssPathsByTasks>\r\n");
         string currLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
         File.WriteAllText(Path.Combine(currLocation, "vssPathsByTasks.xml"), taskBreakingLog.ToString());
     }
     return result > 0 ? 1 : 0;
 }