Skip to content

Commit

Permalink
Add build log and artifacts directory
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaslevesque committed Sep 23, 2018
1 parent 439168d commit 909eada
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ obj/
.vscode/
*.user

artifacts/

_ReSharper.Caches/
30 changes: 26 additions & 4 deletions tools/build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,45 @@ public void OnExecute(CommandLineApplication app)
}

Directory.SetCurrentDirectory(GetSolutionDirectory());

string artifactsDir = Path.GetFullPath("artifacts");
string logsDir = Path.Combine(artifactsDir, "logs");
string buildLogFile = Path.Combine(logsDir, "build.binlog");
string packagesDir = Path.Combine(artifactsDir, "packages");

string solutionFile = "AspNetCore.AsyncInitialization.sln";
string libraryProject = "src/AspNetCore.AsyncInitialization/AspNetCore.AsyncInitialization.csproj";
string testProject = "tests/AspNetCore.AsyncInitialization.Tests/AspNetCore.AsyncInitialization.Tests.csproj";

Target(
"artifactDirectories",
() =>
{
Directory.CreateDirectory(artifactsDir);
Directory.CreateDirectory(logsDir);
Directory.CreateDirectory(packagesDir);
});

Target(
"build",
() => Run("dotnet", $"build -c \"{Configuration}\" /p:Version=\"{Version}\" \"{solutionFile}\""));
DependsOn("artifactDirectories"),
() => Run(
"dotnet",
$"build -c \"{Configuration}\" /p:Version=\"{Version}\" /bl:\"{buildLogFile}\" \"{solutionFile}\""));

Target(
"test",
DependsOn("build"),
() => Run("dotnet", $"test -c \"{Configuration}\" --no-build \"{testProject}\""));
() => Run(
"dotnet",
$"test -c \"{Configuration}\" --no-build \"{testProject}\""));

Target(
"pack",
DependsOn("build"),
() => Run("dotnet", $"pack -c \"{Configuration}\" --no-build /p:Version=\"{Version}\" \"{libraryProject}\""));
DependsOn("artifactDirectories", "build"),
() => Run(
"dotnet",
$"pack -c \"{Configuration}\" --no-build /p:Version=\"{Version}\" -o \"{packagesDir}\" \"{libraryProject}\""));

Target("default", DependsOn("test", "pack"));

Expand Down

0 comments on commit 909eada

Please sign in to comment.