Esempio n. 1
0
        private void AddCompileParameters()
        {
            _app.HelpOption("-h|--help");

            _outputOption = _app.Option("-o|--output <OUTPUT_DIR>", "Directory in which to place outputs", CommandOptionType.SingleValue);
            _buildBasePath = _app.Option("-b|--build-base-path <OUTPUT_DIR>", "Directory in which to place temporary outputs", CommandOptionType.SingleValue);
            _frameworkOption = _app.Option("-f|--framework <FRAMEWORK>", "Compile a specific framework", CommandOptionType.SingleValue);
            _runtimeOption = _app.Option("-r|--runtime <RUNTIME_IDENTIFIER>", "Produce runtime-specific assets for the specified runtime", CommandOptionType.SingleValue);
            _configurationOption = _app.Option("-c|--configuration <CONFIGURATION>", "Configuration under which to build", CommandOptionType.SingleValue);
            _versionSuffixOption = _app.Option("--version-suffix <VERSION_SUFFIX>", "Defines what `*` should be replaced with in version field in project.json", CommandOptionType.SingleValue);
            _projectArgument = _app.Argument("<PROJECT>", "The project to compile, defaults to the current directory. " +
                                                          "Can be one or multiple paths to project.json, project directory " +
                                                          "or globbing pattern that matches project.json files", multipleValues: true);

            _shouldPrintIncrementalPreconditionsArgument = _app.Option(BuildProfileFlag, "Set this flag to print the incremental safety checks that prevent incremental compilation", CommandOptionType.NoValue);
            _shouldNotUseIncrementalityArgument = _app.Option(NoIncrementalFlag, "Set this flag to turn off incremental build", CommandOptionType.NoValue);
            _shouldSkipDependenciesArgument = _app.Option("--no-dependencies", "Set this flag to ignore project to project references and only build the root project", CommandOptionType.NoValue);
        }
Esempio n. 2
0
        private void AddDotnetTestParameters()
        {
            _app.HelpOption("-?|-h|--help");

            _parentProcessIdOption = _app.Option(
                "--parentProcessId",
                "Used by IDEs to specify their process ID. Test will exit if the parent process does.",
                CommandOptionType.SingleValue);
            _portOption = _app.Option(
                "--port",
                "Used by IDEs to specify a port number to listen for a connection.",
                CommandOptionType.SingleValue);
            _configurationOption = _app.Option(
                "-c|--configuration <CONFIGURATION>",
                "Configuration under which to build",
                CommandOptionType.SingleValue);
            _outputOption = _app.Option(
                "-o|--output <OUTPUT_DIR>",
                "Directory in which to find the binaries to be run",
                CommandOptionType.SingleValue);
            _buildBasePath = _app.Option(
                "-b|--build-base-path <OUTPUT_DIR>",
                "Directory in which to find temporary outputs",
                CommandOptionType.SingleValue);
            _frameworkOption = _app.Option(
                "-f|--framework <FRAMEWORK>",
                "Looks for test binaries for a specific framework",
                CommandOptionType.SingleValue);
            _runtimeOption = _app.Option(
                "-r|--runtime <RUNTIME_IDENTIFIER>",
                "Look for test binaries for a for the specified runtime",
                CommandOptionType.SingleValue);
            _noBuildOption =
                _app.Option("--no-build", "Do not build project before testing", CommandOptionType.NoValue);
            _projectPath = _app.Argument(
                "<PROJECT>",
                "The project to test, defaults to the current directory. Can be a path to a project.json or a project directory.");
        }
Esempio n. 3
0
 private void AddDotnetBaseParameters()
 {
     _app.HelpOption("-?|-h|--help");
     
     _configurationOption = _app.Option(
         "-c|--configuration <CONFIGURATION>",
         "Configuration under which to build",
         CommandOptionType.SingleValue);
     _outputOption = _app.Option(
         "-o|--output <OUTPUT_DIR>",
         "Directory in which to find the binaries to be run",
         CommandOptionType.SingleValue);
     _buildBasePath = _app.Option(
         "-b|--build-base-path <OUTPUT_DIR>",
         "Directory in which to find temporary outputs",
         CommandOptionType.SingleValue);
     _frameworkOption = _app.Option(
         "-f|--framework <FRAMEWORK>",
         "Looks for test binaries for a specific framework",
         CommandOptionType.SingleValue);
     _runtimeOption = _app.Option(
         "-r|--runtime <RUNTIME_IDENTIFIER>",
         "Look for test binaries for a for the specified runtime",
         CommandOptionType.SingleValue);  
     _projectPath = _app.Option(
         "-p|--project-path <PROJECT_JSON_PATH>",
         "Path to Project.json that contains the tool dependency",
         CommandOptionType.SingleValue);
     _command = _app.Argument(
         "<COMMAND>",
         "The command to execute.");
 }
Esempio n. 4
0
        private static bool MonitorHostProcess(CommandOption host)
        {
            if (!host.HasValue())
            {
                Console.Error.WriteLine($"Option \"{host.LongName}\" is missing.");
                return false;
            }

            int hostPID;
            if (int.TryParse(host.Value(), out hostPID))
            {
                var hostProcess = Process.GetProcessById(hostPID);
                hostProcess.EnableRaisingEvents = true;
                hostProcess.Exited += (s, e) =>
                {
                    Process.GetCurrentProcess().Kill();
                };

                Reporter.Output.WriteLine($"Server will exit when process {hostPID} exits.");
                return true;
            }
            else
            {
                Reporter.Error.WriteLine($"Option \"{host.LongName}\" is not a valid Int32 value.");
                return false;
            }
        }
Esempio n. 5
0
        private static int CheckPort(CommandOption port)
        {
            if (!port.HasValue())
            {
                Reporter.Error.WriteLine($"Option \"{port.LongName}\" is missing.");
            }

            int result;
            if (int.TryParse(port.Value(), out result))
            {
                return result;
            }
            else
            {
                Reporter.Error.WriteLine($"Option \"{port.LongName}\" is not a valid Int32 value.");
                return -1;
            }
        }