Skip to content

Commit

Permalink
Merge pull request #95 from nils-a/release/3.1.0
Browse files Browse the repository at this point in the history
Release/3.1.0
  • Loading branch information
nils-a authored Nov 15, 2021
2 parents 9f00e90 + 4cccd4e commit 28e37a3
Show file tree
Hide file tree
Showing 23 changed files with 221 additions and 67 deletions.
19 changes: 0 additions & 19 deletions .appveyor.yml

This file was deleted.

23 changes: 20 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,36 @@ jobs:

steps:
- name: Checkout the repository
uses: actions/checkout@v2
uses: actions/checkout@v2.4.0

- name: Fetch all tags and branches
run: git fetch --prune --unshallow

- uses: actions/[email protected]
with:
# codecov and unittests need 2.1
dotnet-version: '2.1.818'
- uses: actions/[email protected]
with:
dotnet-version: '3.1.414'
- uses: actions/[email protected]
with:
# gitversion needs 5.0
dotnet-version: '5.0.402'
- uses: actions/[email protected]
with:
# need at least .NET 6 rc2 to build
dotnet-version: '6.0.100-rc.2.21505.57'
include-prerelease: true

- name: Cache Tools
uses: actions/cache@v2
uses: actions/cache@v2.1.6
with:
path: tools
key: ${{ runner.os }}-tools-${{ hashFiles('recipe.cake') }}

- name: Build project
uses: cake-build/cake-action@v1
uses: cake-build/cake-action@v1.4.0
with:
script-path: recipe.cake
target: CI
Expand Down
23 changes: 20 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,29 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v2.4.0
with:
fetch-depth: 0

- uses: actions/[email protected]
with:
# codecov and unittests need 2.1
dotnet-version: '2.1.818'
- uses: actions/[email protected]
with:
dotnet-version: '3.1.414'
- uses: actions/[email protected]
with:
# gitversion needs 5.0
dotnet-version: '5.0.402'
- uses: actions/[email protected]
with:
# need at least .NET 6 rc2 to build
dotnet-version: '6.0.100-rc.2.21505.57'
include-prerelease: true

- name: Cache Tools
uses: actions/cache@v2
uses: actions/cache@v2.1.6
with:
path: tools
key: ${{ runner.os }}-tools-${{ hashFiles('recipe.cake') }}
Expand All @@ -36,7 +53,7 @@ jobs:
languages: ${{ matrix.language }}

- name: Build project
uses: cake-build/cake-action@v1
uses: cake-build/cake-action@v1.4.0
with:
script-path: recipe.cake
target: DotNetCore-Build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependabot-cake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
runs-on: ubuntu-latest # linux, because this is a docker-action
steps:
- name: check/update cake dependencies
uses: nils-org/dependabot-cake-action@v1
uses: nils-org/dependabot-cake-action@v1.1.0
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cSpell.words": [
"Buildsystems",
"nuget"
]
}
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,34 @@ Currently modules require "bootstrapping", so the first step before running the

### Other methods

You can also integrate this module into your own build process, even with a customised `build.ps1`/`build.sh`. As long as the `Cake.BuildSystems.Module` NuGet package is installed into your modules directory ([by default](https://cakebuild.net/docs/running-builds/configuration/default-configuration-values) `./tools/Modules`), `cake.exe` should pick them up when it runs. Note that you can also change your modules directory using the `cake.config` file or passing arguments to `cake.exe` as outlined in [the documentation](https://cakebuild.net/docs/running-builds/configuration/set-configuration-values)).
You can also integrate this module into your own build process, even with a customized `build.ps1`/`build.sh`. As long as the `Cake.BuildSystems.Module` NuGet package is installed into your modules directory ([by default](https://cakebuild.net/docs/running-builds/configuration/default-configuration-values) `./tools/Modules`), `cake.exe` should pick them up when it runs. Note that you can also change your modules directory using the `cake.config` file or passing arguments to `cake.exe` as outlined in [the documentation](https://cakebuild.net/docs/running-builds/configuration/set-configuration-values)).

### Versioning
### Cake.Frosting

While Cake script will load all modules automatically that are present in the modules directory, the same is not the case when using Cake.Frosting.

Before using Cake.Buildsystems.Module you have to reference the NuGet package either by adding `<PackageReference Include="Cake.BuildSystems.Module" Version="##see below for note on versioning##" />` to the `csproj` file of the build project, or by running `dotnet add package cake.buildsystems.module` in the folder of the build project.

To actually make use of the different modules included in Cake.Buildsystems.Module they need to be registered to the `CakeHost`. This can be done by using `ICakeHost.UseModule<TModule>()`. Typically the `CakeHost` is set up in the `Main` method of the build project. All modules included in Cake.Buildsystems.Module can be registered, regardless of the underlying build system, as each modules will only be triggered for the intended build system.

An example that registers all currently existing modules from Cake.Buildsystems.Module:

```csharp
public static int Main(string[] args)
{
return new CakeHost()
// Register all modules from Cake.Buildsystems.Module
.UseModule<AzurePipelinesModule>()
.UseModule<MyGetModule>()
.UseModule<TravisCIModule>()
.UseModule<TeamCityModule>()
// continue with the "normal" setup of the CakeHost
.UseContext<BuildContext>()
.Run(args);
}
```

## Versioning

Note that since modules interact with the internals of Cake, they are tied to a specific version of Cake. The version of Cake supported by the particular module version will always be in the Release Notes of the NuGet package (and therefore also on [nuget.org](https://nuget.org/packages/Cake.BuildSystems.Module/)). Make sure to match this version number to the Cake version you're using.

Expand Down
27 changes: 0 additions & 27 deletions azure-pipelines.yml

This file was deleted.

12 changes: 12 additions & 0 deletions demo/dsl/.config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"cake.tool": {
"version": "1.1.0",
"commands": [
"dotnet-cake"
]
}
}
}
23 changes: 23 additions & 0 deletions demo/dsl/build.cake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#module nuget:?package=Cake.BuildSystems.Module&version=3.0.3

///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
///////////////////////////////////////////////////////////////////////////////

var target = Argument("target", "Default");
///////////////////////////////////////////////////////////////////////////////
// TASKS
///////////////////////////////////////////////////////////////////////////////
Task("Default")
.Does(() => {
Information("Hello Cake!");
Verbose("This is really verbose.");
Warning("This is a warning.");
Debug("This is a debug-message.");
Information("Next comes the error:");
Error("This is an error.");
});

RunTarget(target);
13 changes: 13 additions & 0 deletions demo/dsl/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$ErrorActionPreference = 'Stop'

Set-Location -LiteralPath $PSScriptRoot

$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = '1'
$env:DOTNET_CLI_TELEMETRY_OPTOUT = '1'
$env:DOTNET_NOLOGO = '1'

dotnet tool restore
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

dotnet cake @args
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
12 changes: 12 additions & 0 deletions demo/dsl/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -euox pipefail

cd "$(dirname "${BASH_SOURCE[0]}")"

export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_NOLOGO=1

dotnet tool restore

dotnet cake "$@"
2 changes: 2 additions & 0 deletions demo/frosting/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dotnet run --project build/Build.csproj -- $args
exit $LASTEXITCODE;
1 change: 1 addition & 0 deletions demo/frosting/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dotnet run --project ./build/Build.csproj -- "$@"
12 changes: 12 additions & 0 deletions demo/frosting/build/Build.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Cake.BuildSystems.Module" Version="3.0.3" />
<PackageReference Include="Cake.Frosting" Version="1.1.0" />
<PackageReference Include="JetBrains.Annotations" Version="2021.1.0" />
</ItemGroup>
</Project>
46 changes: 46 additions & 0 deletions demo/frosting/build/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using Cake.AzurePipelines.Module;
using Cake.Common.Diagnostics;
using Cake.Core;
using Cake.Frosting;
using Cake.MyGet.Module;
using Cake.TeamCity.Module;
using Cake.TravisCI.Module;
using JetBrains.Annotations;

public static class Program
{
public static int Main(string[] args)
{
return new CakeHost()
// Register all modules from Cake.Buildsystems.Module
.UseModule<AzurePipelinesModule>()
.UseModule<MyGetModule>()
.UseModule<TravisCIModule>()
.UseModule<TeamCityModule>()
.UseContext<BuildContext>()
.Run(args);
}
}

public class BuildContext : FrostingContext
{
public BuildContext(ICakeContext context)
: base(context)
{
}
}

[TaskName("Default")]
[UsedImplicitly]
public class DefaultTask : FrostingTask
{
public override void Run(ICakeContext context)
{
context.Information("Hello Cake!");
context.Verbose("This is really verbose.");
context.Warning("This is a warning.");
context.Debug("This is a debug-message.");
context.Information("Next comes the error:");
context.Error("This is an error.");
}
}
7 changes: 7 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"sdk": {
"allowPrerelease": true,
"version": "6.0.100-rc.2",
"rollForward": "latestFeature"
}
}
7 changes: 6 additions & 1 deletion recipe.cake
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ BuildParameters.SetParameters(
shouldRunDotNetCorePack: true,
shouldUseDeterministicBuilds: true,
gitterMessage: "@/all " + standardNotificationMessage,
twitterMessage: standardNotificationMessage);
twitterMessage: standardNotificationMessage,
preferredBuildProviderType: BuildProviderType.GitHubActions,
preferredBuildAgentOperatingSystem: PlatformFamily.Linux);

BuildParameters.PrintParameters(Context);

ToolSettings.SetToolSettings(context: Context);

ToolSettings.SetToolPreprocessorDirectives(
reSharperTools: "#tool nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2021.2.0");

Build.RunDotNetCore();
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<ItemGroup>
<PackageReference Include="Cake.Core" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Cake.Common" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="JetBrains.Annotations" Version="2021.1.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
4 changes: 3 additions & 1 deletion src/Cake.BuildSystems.Module/Cake.BuildSystems.Module.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<Description>This Cake module will introduce a number of features for running in hosted CI build environments to tightly integrate with the host environment/tools.</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/cake-contrib/Cake.BuildSystems.Module/</PackageProjectUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageTags>cake;build;script;cake-build;module;cake-contrib;cake-module;ci;tfs;azure-devops;azure-devops-server;myget;teamcity;travisci</PackageTags>
<RepositoryUrl>https://github.com/cake-contrib/Cake.BuildSystems.Module.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
Expand All @@ -44,12 +45,13 @@
</ItemGroup>

<ItemGroup>
<None Include="$(ProjectDir)../../README.md" Link="README.md" PackagePath="" Pack="true" />
<None Include="$(OutputPath)/**/Cake.*" PackagePath="lib/$(TargetFramework)" Pack="true" />
<None Remove="icon.png" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="CakeContrib.Guidelines" Version="1.1.0">
<PackageReference Include="CakeContrib.Guidelines" Version="1.1.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
4 changes: 2 additions & 2 deletions src/Cake.Module.Shared/Cake.Module.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<ItemGroup>
<PackageReference Include="Cake.Core" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Cake.Common" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="JetBrains.Annotations" Version="2021.1.0" PrivateAssets="All"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" PrivateAssets="All"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
4 changes: 2 additions & 2 deletions src/Cake.MyGet.Module/Cake.MyGet.Module.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<ItemGroup>
<PackageReference Include="Cake.Core" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Cake.Common" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="JetBrains.Annotations" Version="2021.1.0" PrivateAssets="All"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
<PackageReference Include="JetBrains.Annotations" Version="2021.3.0" PrivateAssets="All"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Loading

0 comments on commit 28e37a3

Please sign in to comment.