Skip to content

Commit

Permalink
Improved build
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayPianikov committed Aug 30, 2024
1 parent 65a66c2 commit 1f810e5
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
14 changes: 12 additions & 2 deletions build/CompatibilityCheckTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,13 @@ private async Task CompatibilityCheckAsync(
tempDirectory,
"--force",
"-f", framework)
.WithShortName($"create project from the dilib template for {framework}")
.RunAsync(cancellationToken: cancellationToken).EnsureSuccess();

await new DotNetRestore().WithWorkingDirectory(tempDirectory).RunAsync(cancellationToken: cancellationToken).EnsureSuccess();
await new DotNetRestore()
.WithShortName($"restore project for {framework}")
.WithWorkingDirectory(tempDirectory)
.RunAsync(cancellationToken: cancellationToken).EnsureSuccess();

if (!framework.Contains('.'))
{
Expand All @@ -102,6 +106,7 @@ private async Task CompatibilityCheckAsync(
Path.Combine(tempDirectory),
"package",
"Microsoft.NETFramework.ReferenceAssemblies")
.WithShortName($"add package Microsoft.NETFramework.ReferenceAssemblies for {framework}")
.RunAsync(cancellationToken: cancellationToken).EnsureSuccess();
}

Expand All @@ -114,9 +119,11 @@ private async Task CompatibilityCheckAsync(
settings.NextVersion.ToString(),
"-s",
Path.GetDirectoryName(generatorPackage)!)
.WithShortName($"add the package {generatorPackage} for {framework}")
.RunAsync(cancellationToken: cancellationToken).EnsureSuccess();

await new DotNetBuild().WithWorkingDirectory(tempDirectory)
.WithShortName($"build sample project for {framework}")
.RunAsync(cancellationToken: cancellationToken).EnsureSuccess();
}
finally
Expand Down Expand Up @@ -147,6 +154,7 @@ private async Task CompatibilityCheckAsync(string generatorPackage, Library libr
tempDirForFramework,
"--force",
"-f", framework)
.WithShortName($"create project from the {templateName} template for {framework}")
.RunAsync(cancellationToken: cancellationToken).EnsureSuccess();

await new DotNetCustom(
Expand All @@ -161,6 +169,7 @@ private async Task CompatibilityCheckAsync(string generatorPackage, Library libr
framework,
"-s",
Path.GetDirectoryName(generatorPackage)!)
.WithShortName($"add package Pure.DI for the {templateName} template for {framework}")
.RunAsync(cancellationToken: cancellationToken).EnsureSuccess();

var libraryPackageDir = Path.GetDirectoryName(library.Package.Path)!;
Expand All @@ -178,6 +187,7 @@ private async Task CompatibilityCheckAsync(string generatorPackage, Library libr
libraryPackageDir,
"-f",
framework)
.WithShortName($"add package {library.Name} for the {templateName} template for {framework}")
.RunAsync(cancellationToken: cancellationToken).EnsureSuccess();

await new DotNetRestore()
Expand All @@ -188,9 +198,9 @@ private async Task CompatibilityCheckAsync(string generatorPackage, Library libr
.RunAsync(cancellationToken: cancellationToken).EnsureSuccess();

await new DotNetBuild()
.WithShortName($"Build for compatibility check of {framework} for template {templateName}")
.WithWorkingDirectory(tempDirForFramework)
.WithNoRestore(true)
.WithShortName($"build for the {templateName} template for {framework}")
.RunAsync(cancellationToken: cancellationToken).EnsureSuccess();
}
}
Expand Down
1 change: 1 addition & 0 deletions build/DeployTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public async Task<int> RunAsync(CancellationToken cancellationToken)
await new DotNetNuGetPush()
.WithSources("https://api.nuget.org/v3/index.json")
.WithPackage(package.Path).WithApiKey(settings.NuGetKey)
.WithShortName($"pushing {package.Path}")
.BuildAsync(cancellationToken: cancellationToken).EnsureSuccess();
}

Expand Down
6 changes: 3 additions & 3 deletions build/GeneratorTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ private async Task<string> CreateGeneratorPackageAsync(CodeAnalysis codeAnalysis
}

await new DotNetBuild()
.WithShortName($"Building {codeAnalysis.AnalyzerRoslynPackageVersion}")
.WithShortName($"building {codeAnalysis.AnalyzerRoslynPackageVersion}")
.WithProps(props)
.BuildAsync(cancellationToken: cancellationToken).EnsureSuccess();

await new DotNetTest()
.WithShortName($"Testing {codeAnalysis.AnalyzerRoslynPackageVersion}")
.WithShortName($"testing {codeAnalysis.AnalyzerRoslynPackageVersion}")
.WithProps(props)
.WithConfiguration(settings.Configuration)
.WithNoBuild(true).WithNoLogo(true)
Expand All @@ -86,7 +86,7 @@ private async Task<string> CreateGeneratorPackageAsync(CodeAnalysis codeAnalysis
var packagePath = Path.Combine(PackagesDir, analyzerRoslynVersion.ToString());

await new DotNetPack()
.WithShortName($"Packing {codeAnalysis.AnalyzerRoslynPackageVersion}")
.WithShortName($"packing {codeAnalysis.AnalyzerRoslynPackageVersion}")
.WithProps(props)
.WithConfiguration(settings.Configuration)
.WithNoBuild(true)
Expand Down
1 change: 1 addition & 0 deletions build/LibrariesTarget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public async Task<IReadOnlyCollection<Library>> RunAsync(CancellationToken cance
("version", settings.NextVersion.ToString()))
.WithConfiguration(settings.Configuration).WithNoBuild(true).WithNoLogo(true)
.WithProject(Path.Combine(Path.GetFullPath(Path.Combine("src", library.Name)), $"{library.Name}.csproj"))
.WithShortName($"packing {library.Name}")
.BuildAsync(cancellationToken: cancellationToken).EnsureSuccess();
}

Expand Down

0 comments on commit 1f810e5

Please sign in to comment.