예제 #1
0
        public int Build()
        {
            var project = _contexts.First().ProjectFile;

            var packDiagnostics = new List<DiagnosticMessage>();

            var mainPackageGenerator = new PackageGenerator(project, _configuration, _artifactPathsCalculator);
            var symbolsPackageGenerator =
                new SymbolPackageGenerator(project, _configuration, _artifactPathsCalculator);

            return mainPackageGenerator.BuildPackage(_contexts, packDiagnostics) &&
                symbolsPackageGenerator.BuildPackage(_contexts, packDiagnostics) ? 0 : 1;
        }
예제 #2
0
        private static bool TryBuildPackage(string path, string configuration, string outputValue, string intermediateOutputValue, ProjectReaderSettings settings = null)
        {
            var contexts = ProjectContext.CreateContextForEachFramework(path, settings);
            var project  = contexts.First().ProjectFile;

            if (project.Files.SourceFiles.Any())
            {
                var argsBuilder = new StringBuilder();
                argsBuilder.Append($"--configuration {configuration}");

                if (!string.IsNullOrEmpty(outputValue))
                {
                    argsBuilder.Append($" --output \"{outputValue}\"");
                }

                if (!string.IsNullOrEmpty(intermediateOutputValue))
                {
                    argsBuilder.Append($" --temp-output \"{intermediateOutputValue}\"");
                }

                argsBuilder.Append($" \"{path}\"");

                var result = Command.Create("dotnet-build", argsBuilder.ToString())
                             .ForwardStdOut()
                             .ForwardStdErr()
                             .Execute();

                if (result.ExitCode != 0)
                {
                    return(false);
                }
            }

            var packDiagnostics = new List <DiagnosticMessage>();

            var mainPackageGenerator    = new PackageGenerator(project, configuration, outputValue);
            var symbolsPackageGenerator = new SymbolPackageGenerator(project, configuration, outputValue);

            return(mainPackageGenerator.BuildPackage(contexts, packDiagnostics) &&
                   symbolsPackageGenerator.BuildPackage(contexts, packDiagnostics));
        }
예제 #3
0
파일: Program.cs 프로젝트: yonglehou/cli-1
        private static bool TryBuildPackage(string path, string configuration, string outputValue, string intermediateOutputValue, ProjectReaderSettings settings = null)
        {
            var contexts = ProjectContext.CreateContextForEachFramework(path, settings);
            var project = contexts.First().ProjectFile;

            if (project.Files.SourceFiles.Any())
            {
                var argsBuilder = new StringBuilder();
                argsBuilder.Append($"--configuration {configuration}");

                if (!string.IsNullOrEmpty(outputValue))
                {
                    argsBuilder.Append($" --output \"{outputValue}\"");
                }

                if (!string.IsNullOrEmpty(intermediateOutputValue))
                {
                    argsBuilder.Append($" --temp-output \"{intermediateOutputValue}\"");
                }

                argsBuilder.Append($" \"{path}\"");

                var result = Command.Create("dotnet-build", argsBuilder.ToString())
                       .ForwardStdOut()
                       .ForwardStdErr()
                       .Execute();

                if (result.ExitCode != 0)
                {
                    return false;
                }
            }

            var packDiagnostics = new List<DiagnosticMessage>();

            var mainPackageGenerator = new PackageGenerator(project, configuration, outputValue);
            var symbolsPackageGenerator = new SymbolPackageGenerator(project, configuration, outputValue);

            return mainPackageGenerator.BuildPackage(contexts, packDiagnostics) &&
                symbolsPackageGenerator.BuildPackage(contexts, packDiagnostics);
        }