private CommandSpec ResolveFromProjectTools(CommandResolverArguments commandResolverArguments) { var projectFactory = new ProjectFactory(_environment); var project = projectFactory.GetProject( commandResolverArguments.ProjectDirectory, commandResolverArguments.Framework, commandResolverArguments.Configuration, commandResolverArguments.BuildBasePath, commandResolverArguments.OutputPath); if (project == null) { Reporter.Verbose.WriteLine(string.Format( LocalizableStrings.DidNotFindProject, ProjectToolsCommandResolverName)); return(null); } var tools = project.GetTools(); return(ResolveCommandSpecFromAllToolLibraries( tools, commandResolverArguments.CommandName, commandResolverArguments.CommandArguments.OrEmptyIfNull(), project)); }
private string ResolveFromProjectOutput( string projectDirectory, NuGetFramework framework, string configuration, string commandName, IEnumerable <string> commandArguments, string outputPath, string buildBasePath) { var projectFactory = new ProjectFactory(_environment); var project = projectFactory.GetProject( projectDirectory, framework, configuration, buildBasePath, outputPath); if (project == null) { return(null); } var buildOutputPath = project.FullOutputPath; if (!Directory.Exists(buildOutputPath)) { Reporter.Verbose.WriteLine($"outputpathresolver: {buildOutputPath} does not exist"); return(null); } return(_environment.GetCommandPathFromRootPath(buildOutputPath, commandName)); }
private CommandSpec ResolveFromProjectTools(CommandResolverArguments commandResolverArguments) { var projectFactory = new ProjectFactory(_environment); var project = projectFactory.GetProject( commandResolverArguments.ProjectDirectory, commandResolverArguments.Framework, commandResolverArguments.Configuration, commandResolverArguments.BuildBasePath, commandResolverArguments.OutputPath); if (project == null) { Reporter.Verbose.WriteLine($"projecttoolscommandresolver: ProjectFactory did not find Project."); return(null); } var tools = project.GetTools(); return(ResolveCommandSpecFromAllToolLibraries( tools, commandResolverArguments.CommandName, commandResolverArguments.CommandArguments.OrEmptyIfNull(), project)); }
private CommandSpec ResolveFromProjectDependencies( string projectDirectory, NuGetFramework framework, string configuration, string commandName, IEnumerable <string> commandArguments, string outputPath, string buildBasePath) { var allowedExtensions = GetAllowedCommandExtensionsFromEnvironment(_environment); var projectFactory = new ProjectFactory(_environment); var project = projectFactory.GetProject( projectDirectory, framework, configuration, buildBasePath, outputPath); if (project == null) { Reporter.Verbose.WriteLine($"projectdependenciescommandresolver: Didn't find a matching project {projectDirectory}."); return(null); } var depsFilePath = project.DepsJsonPath; if (!File.Exists(depsFilePath)) { Reporter.Verbose.WriteLine($"projectdependenciescommandresolver: {depsFilePath} does not exist"); return(null); } var runtimeConfigPath = project.RuntimeConfigJsonPath; if (!File.Exists(runtimeConfigPath)) { Reporter.Verbose.WriteLine($"projectdependenciescommandresolver: {runtimeConfigPath} does not exist"); return(null); } var lockFile = project.GetLockFile(); var toolLibrary = GetToolLibraryForContext(lockFile, commandName, framework); var normalizedNugetPackagesRoot = PathUtility.EnsureNoTrailingDirectorySeparator(lockFile.PackageFolders.First().Path); var commandSpec = _packagedCommandSpecFactory.CreateCommandSpecFromLibrary( toolLibrary, commandName, commandArguments, allowedExtensions, normalizedNugetPackagesRoot, s_commandResolutionStrategy, depsFilePath, runtimeConfigPath); commandSpec?.AddEnvironmentVariablesFromProject(project); return(commandSpec); }
private CommandSpec ResolveFromProjectTools(CommandResolverArguments commandResolverArguments) { var projectFactory = new ProjectFactory(_environment); var project = projectFactory.GetProject( commandResolverArguments.ProjectDirectory, commandResolverArguments.Framework, commandResolverArguments.Configuration, commandResolverArguments.BuildBasePath, commandResolverArguments.OutputPath); var tools = project.GetTools(); return(ResolveCommandSpecFromAllToolLibraries( tools, commandResolverArguments.CommandName, commandResolverArguments.CommandArguments.OrEmptyIfNull(), project.GetLockFile(), project)); }
private CommandSpec ResolveFromProjectDependencies( string projectDirectory, NuGetFramework framework, string configuration, string commandName, IEnumerable <string> commandArguments, string outputPath, string buildBasePath) { var allowedExtensions = GetAllowedCommandExtensionsFromEnvironment(_environment); var projectFactory = new ProjectFactory(_environment); var project = projectFactory.GetProject( projectDirectory, framework, configuration, buildBasePath, outputPath); if (project == null) { Reporter.Verbose.WriteLine(string.Format( LocalizableStrings.DidNotFindAMatchingProject, ProjectDependenciesCommandResolverName, projectDirectory)); return(null); } var depsFilePath = project.DepsJsonPath; if (!File.Exists(depsFilePath)) { Reporter.Verbose.WriteLine(string.Format( LocalizableStrings.DoesNotExist, ProjectDependenciesCommandResolverName, depsFilePath)); return(null); } var runtimeConfigPath = project.RuntimeConfigJsonPath; if (!File.Exists(runtimeConfigPath)) { Reporter.Verbose.WriteLine(string.Format( LocalizableStrings.DoesNotExist, ProjectDependenciesCommandResolverName, runtimeConfigPath)); return(null); } var lockFile = project.GetLockFile(); var toolLibrary = GetToolLibraryForContext(lockFile, commandName, framework); var commandSpec = _packagedCommandSpecFactory.CreateCommandSpecFromLibrary( toolLibrary, commandName, commandArguments, allowedExtensions, lockFile, s_commandResolutionStrategy, depsFilePath, runtimeConfigPath); commandSpec?.AddEnvironmentVariablesFromProject(project); return(commandSpec); }