Ejemplo n.º 1
0
        public DependencyListOptions(Reports reports, CommandArgument path)
        {
            bool isInputValid = true;

            // reports
            Reports = reports;

            // project
            var projectPath = path.Value ?? Directory.GetCurrentDirectory();
            Runtime.Project projectOption;

            isInputValid &= Runtime.Project.TryGetProject(projectPath, out projectOption);
            Path = projectPath;
            Project = projectOption;

            Valid = isInputValid;
        }
Ejemplo n.º 2
0
        private void AddCompileParameters()
        {
            _app.HelpOption("-h|--help");

            _outputOption = _app.Option("-o|--output <OUTPUT_DIR>", "Directory in which to place outputs", CommandOptionType.SingleValue);
            _intermediateOutputOption = _app.Option("-t|--temp-output <OUTPUT_DIR>", "Directory in which to place temporary outputs", CommandOptionType.SingleValue);
            _frameworkOption = _app.Option("-f|--framework <FRAMEWORK>", "Compile a specific framework", CommandOptionType.MultipleValue);
            _configurationOption = _app.Option("-c|--configuration <CONFIGURATION>", "Configuration under which to build", CommandOptionType.SingleValue);
            _noHostOption = _app.Option("--no-host", "Set this to skip publishing a runtime host when building for CoreCLR", CommandOptionType.NoValue);
            _projectArgument = _app.Argument("<PROJECT>", "The project to compile, defaults to the current directory. Can be a path to a project.json or a project directory");

            // Native Args
            _nativeOption = _app.Option("-n|--native", "Compiles source to native machine code.", CommandOptionType.NoValue);
            _archOption = _app.Option("-a|--arch <ARCH>", "The architecture for which to compile. x64 only currently supported.", CommandOptionType.SingleValue);
            _ilcArgsOption = _app.Option("--ilcargs <ARGS>", "Command line arguments to be passed directly to ILCompiler.", CommandOptionType.SingleValue);
            _ilcPathOption = _app.Option("--ilcpath <PATH>", "Path to the folder containing custom built ILCompiler.", CommandOptionType.SingleValue);
            _ilcSdkPathOption = _app.Option("--ilcsdkpath <PATH>", "Path to the folder containing ILCompiler application dependencies.", CommandOptionType.SingleValue);
            _appDepSdkPathOption = _app.Option("--appdepsdkpath <PATH>", "Path to the folder containing ILCompiler application dependencies.", CommandOptionType.SingleValue);
            _cppModeOption = _app.Option("--cpp", "Flag to do native compilation with C++ code generator.", CommandOptionType.NoValue);
            _cppCompilerFlagsOption = _app.Option("--cppcompilerflags <flags>", "Additional flags to be passed to the native compiler.", CommandOptionType.SingleValue);
        }
Ejemplo n.º 3
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.MultipleValue);
            _configurationOption = _app.Option("-c|--configuration <CONFIGURATION>", "Configuration under which to build", CommandOptionType.SingleValue);
            _runtimeOption = _app.Option("-r|--runtime <RUNTIME_IDENTIFIER>", "Target runtime to publish for", 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 a path to a project.json or a project directory");

            // Native Args
            _nativeOption = _app.Option("-n|--native", "Compiles source to native machine code.", CommandOptionType.NoValue);
            _archOption = _app.Option("-a|--arch <ARCH>", "The architecture for which to compile. x64 only currently supported.", CommandOptionType.SingleValue);
            _ilcArgsOption = _app.Option("--ilcarg <ARG>", "Command line option to be passed directly to ILCompiler.", CommandOptionType.MultipleValue);
            _ilcPathOption = _app.Option("--ilcpath <PATH>", "Path to the folder containing custom built ILCompiler.", CommandOptionType.SingleValue);
            _ilcSdkPathOption = _app.Option("--ilcsdkpath <PATH>", "Path to the folder containing ILCompiler application dependencies.", CommandOptionType.SingleValue);
            _appDepSdkPathOption = _app.Option("--appdepsdkpath <PATH>", "Path to the folder containing ILCompiler application dependencies.", CommandOptionType.SingleValue);
            _cppModeOption = _app.Option("--cpp", "Flag to do native compilation with C++ code generator.", CommandOptionType.NoValue);
            _cppCompilerFlagsOption = _app.Option("--cppcompilerflags <flags>", "Additional flags to be passed to the native compiler.", CommandOptionType.SingleValue);
        }
Ejemplo n.º 4
0
        private int OnCrossrefAdd(
            CommandLineApplication cmd,
            CommandArgument argPath)
        {
            var paths = new[] { argPath.Value }
                .Concat(cmd.RemainingArguments)
                .Select(path => Path.GetFullPath(path))
                .ToArray();

            Console.WriteLine($"Executing Crossref Add");

            var operations = new WorkspaceOperations();
            var workspace = new DotnetWorkspace();

            foreach (var path in paths)
            {
                operations.FindAndLoadSolutions(workspace, path);
            }
            operations.FindAndLoadProjects2(workspace);
            operations.FindProjectToProjectDependencies(workspace);

            foreach (var solution in workspace.Solutions)
            {
                var allProject = solution.Projects.Select(p => Tuple.Create(p, p, p));

                var allProject2Project = SelectRecursive(0, allProject);

                var allProject2ProjectLocations = allProject2Project
                    .Where(tuple => tuple.Item1.ProjectJson.ParentPath != tuple.Item3.ProjectJson.ParentPath)
                    .GroupBy(tuple => MakeRelativePath(solution.GlobalJson.FilePath, tuple.Item3.ProjectJson.ParentPath).Replace("\\", "/"))
                    .ToArray();

                var neededLocations = new List<string>();

            //                Console.WriteLine($"  {solution.GlobalJson.FolderPath}");
                foreach (var project2ProjectLocation in allProject2ProjectLocations)
                {
                    neededLocations.Add(project2ProjectLocation.Key);
              //                  Console.WriteLine($"    {project2ProjectLocation.Key}");
                    foreach (var dependencyName in project2ProjectLocation.Select(x => x.Item3.Name).Distinct())
                    {
            //                    Console.WriteLine($"      {dependencyName}");
                    }
                }

                foreach (var neededLocation in neededLocations)
                {
                    if (!solution.GlobalJson.ProjectFolders.Any(pf =>
                        string.Equals(pf.Path, neededLocation, StringComparison.OrdinalIgnoreCase)))
                    {
                        solution.GlobalJson.AddProjectFolder(neededLocation);
                    }
                }
            }

            foreach (var solution in workspace.Solutions)
            {
                solution.GlobalJson.Save();
            }

            using (var batch = File.CreateText("restore-all.cmd"))
            {
                foreach (var p in workspace.Projects)
                {
                    batch.WriteLine($"call dnu restore {p.ProjectJson.FolderPath}");
                }
            }
            return 0;
        }
Ejemplo n.º 5
0
        private int OnCrossrefClear(CommandLineApplication cmd, CommandArgument argPath)
        {
            var paths = new[] { argPath.Value }
                .Concat(cmd.RemainingArguments)
                .Select(path => Path.GetFullPath(path))
                .ToArray();

            Console.WriteLine($"Executing Crossref Clear");

            var operations = new WorkspaceOperations();
            var workspace = new DotnetWorkspace();

            foreach (var path in paths)
            {
                operations.FindAndLoadSolutions(workspace, path);
            }

            foreach (var solution in workspace.Solutions)
            {
                solution.GlobalJson.ClearAddedProjects();
            }

            foreach (var solution in workspace.Solutions)
            {
                solution.GlobalJson.Save();
            }

            return 0;
        }
Ejemplo n.º 6
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.");
 }
Ejemplo n.º 7
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.");
        }