예제 #1
0
        private async Task <DirectoryInfo> GetProjectDirectory(string command)
        {
            if (Exists())
            {
                var result = await CommandLine.Execute(FilePath, command, DirectoryAccessor.GetFullyQualifiedRoot());

                var path = string.Join("", result.Output);
                if (result.ExitCode == 0 && !string.IsNullOrEmpty(path))
                {
                    var projectDirectory = new DirectoryInfo(string.Join("", result.Output));
                    if (projectDirectory.Exists)
                    {
                        return(projectDirectory);
                    }
                }
            }

            return(null);
        }
예제 #2
0
        public ProjectAsset(IDirectoryAccessor directoryAccessor, string csprojFileName = null) : base(directoryAccessor)
        {
            if (directoryAccessor == null)
            {
                throw new ArgumentNullException(nameof(directoryAccessor));
            }

            if (string.IsNullOrWhiteSpace(csprojFileName))
            {
                var firstProject = DirectoryAccessor.GetAllFiles().Single(f => f.Extension == ".csproj");
                _projectFile = DirectoryAccessor.GetFullyQualifiedFilePath(firstProject.FileName);
            }
            else
            {
                _projectFile = DirectoryAccessor.GetFullyQualifiedFilePath(csprojFileName);
            }

            Directory = DirectoryAccessor.GetFullyQualifiedRoot();
            Name      = _projectFile?.Name ?? Directory?.Name;
            _lastBuildErrorLogFile = directoryAccessor.GetFullyQualifiedFilePath(".trydotnet-builderror");
            _cleanupStep           = new PipelineStep <AnalyzerResult>(LoadResultOrCleanAsync);
            _projectBuildStep      = _cleanupStep.Then(BuildProjectAsync);
            _workspaceStep         = _projectBuildStep.Then(BuildWorkspaceAsync);
        }
예제 #3
0
 public Task Prepare()
 {
     return(CommandLine.Execute(FilePath, MLS.PackageTool.PackageToolConstants.PreparePackage, DirectoryAccessor.GetFullyQualifiedRoot()));
 }
예제 #4
0
        public async Task <WebAssemblyAsset> LocateWasmAsset()
        {
            var result = await CommandLine.Execute(GetFilePath(), MLS.PackageTool.PackageToolConstants.LocateWasmAsset, DirectoryAccessor.GetFullyQualifiedRoot());

            var projectDirectory = new DirectoryInfo(string.Join("", result.Output));

            if (!projectDirectory.Exists)
            {
                return(null);
            }

            return(new WebAssemblyAsset(new FileSystemDirectoryAccessor(projectDirectory)));
        }