-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from nils-a/release/4.0.0
Release/4.0.0
- Loading branch information
Showing
18 changed files
with
237 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ on: | |
- "feature/**" | ||
- "release/**" | ||
- "hotfix/**" | ||
- "support/**" | ||
tags: | ||
- "*" | ||
paths-ignore: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<CakeVersion>3.0.0</CakeVersion> | ||
<CakeVersion>4.0.0</CakeVersion> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"version": 1, | ||
"isRoot": true, | ||
"tools": { | ||
"cake.tool": { | ||
"version": "4.0.0", | ||
"commands": [ | ||
"dotnet-cake" | ||
], | ||
"rollForward": false | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.exe | ||
!*.nupkg | ||
// do not exlude the nupkg - we need it for testing and don't want to have to rebuild it every time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
var target = Argument("target", "Default"); | ||
|
||
Task("Clean") | ||
.Does(() => | ||
{ | ||
DeleteFiles("**/*.exe"); | ||
DeleteFiles("**/*.nupkg"); | ||
}); | ||
|
||
Task("Build-EXEs") | ||
.DoesForEach(GetFiles("**/*.rs"), (f) => | ||
{ | ||
using(var p = StartAndReturnProcess("rustc", new ProcessSettings | ||
{ | ||
Arguments = f.FullPath | ||
})) | ||
{ | ||
p.WaitForExit(); | ||
if(p.GetExitCode() != 0) | ||
{ | ||
throw new Exception($"Failed to compile {f.FullPath}"); | ||
} | ||
|
||
var exe = f.GetFilenameWithoutExtension() + ".exe"; | ||
MoveFile(exe, $"cake-demo/tools/{exe}"); | ||
} | ||
}); | ||
|
||
Task("Build-Choco") | ||
.IsDependentOn("Build-EXEs") | ||
.Does(() => | ||
{ | ||
using(var p = StartAndReturnProcess("choco", new ProcessSettings | ||
{ | ||
Arguments = "pack", | ||
WorkingDirectory = "cake-demo", | ||
})) | ||
{ | ||
p.WaitForExit(); | ||
if(p.GetExitCode() != 0) | ||
{ | ||
throw new Exception("Failed to pack choco package"); | ||
} | ||
|
||
MoveFiles(GetFiles("**/*.nupkg"), "./"); | ||
} | ||
}); | ||
|
||
Task("Default") | ||
.IsDependentOn("Clean") | ||
.IsDependentOn("Build-Choco"); | ||
|
||
RunTarget(target); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 build.cake @args | ||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
## Summary | ||
|
||
This is the test-package, to be used in tests with Cake.Chocolatey.Module. | ||
It contains the following parts: | ||
|
||
- The choco package | ||
- hello-world.exe | ||
This exe does nothing really, but it can be used as a simple tool in tests. | ||
- build.cake | ||
This script builds the hello-world.exe (using rust) and then creates the choco package | ||
The choco package is "checked in" - so it does not need to be re-created every time. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd"> | ||
<metadata> | ||
<id>cake-demo</id> | ||
<version>0.1.0</version> | ||
<owners>nils-a</owners> | ||
<title>cake-demo (Portable)</title> | ||
<authors>Nils Andresen</authors> | ||
<projectUrl>https://github.com/cake-contrib/Cake.Chocolatey.Module</projectUrl> | ||
<copyright>2024 - present Cake Contributors</copyright> | ||
<tags>cake choco demo not-a-real-package do-not-use</tags> | ||
<summary>This is only a demo project to be used in the Cake.Chocolatey.Module demo</summary> | ||
<description>This is only a demo project to be used in the Cake.Chocolatey.Module demo</description> | ||
</metadata> | ||
<files> | ||
<file src="tools\**" target="tools" /> | ||
</files> | ||
</package> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
$ErrorActionPreference = 'Stop' # stop on all errors | ||
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" | ||
|
||
## Adding a shim when not automatically found - Chocolatey automatically shims exe files found in package directory. | ||
## - https://docs.chocolatey.org/en-us/create/functions/install-binfile | ||
## - https://docs.chocolatey.org/en-us/create/create-packages#how-do-i-exclude-executables-from-getting-shims | ||
#Install-BinFile | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
fn main() { | ||
println!("Hello, World!"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.toolpath.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// do not reference Cake.Chocolatey.Module.dll directly, prepare.cake will place it in the modules folder | ||
#tool choco:?package=cake-demo&version=0.1.0 | ||
|
||
var target = Argument("target", "Build"); | ||
|
||
Task("Build") | ||
.Does(() => | ||
{ | ||
StartProcess("hello.exe"); | ||
}); | ||
|
||
RunTarget(target); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
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 } | ||
|
||
@("tools", ".cake") | % { | ||
if (Test-Path $_) { | ||
Remove-Item -Recurse -Force $_ | ||
} | ||
} | ||
|
||
Write-Host "`npreparing the module`n" | ||
dotnet cake prepare.cake | ||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } | ||
|
||
# Set the choco dir to somethin local, so installing the test package | ||
# does not screw up your system. We'll need this only on windows | ||
# so, adding it to the .ps1 is probably enough. | ||
$toolPath = "$(pwd)/tools" | ||
if (Test-Path .toolpath.env) { | ||
# that file is written by the prepare.cake script | ||
$toolPath = Get-Content .toolpath.env | ||
} | ||
$chocoPath = "$toolPath/choco" | ||
Write-Host "`nSetting ChocolateyInstallDir to $chocoPath`n" | ||
Remove-Item -Path $chocoPath -Force -ErrorAction Ignore | ||
$env:ChocolateyInstallDir = "$chocoPath" | ||
Write-Host "`nNow running the build script`n" | ||
dotnet cake build.cake @args | ||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env bash | ||
set -euo 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 | ||
|
||
rm -rf tools 2>/dev/null || true | ||
rm -rf .cake 2>/dev/null || true | ||
|
||
echo "" | ||
echo "preparing the module" | ||
echo "" | ||
dotnet cake prepare.cake | ||
|
||
echo "" | ||
echo "Now running the build script" | ||
echo "" | ||
# no need to set the CakeInstallDir, as | ||
dotnet cake build.cake "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
; The configuration file for Cake. | ||
|
||
[Chocolatey] | ||
Source=../choco-source/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
const string tfm = "net6.0"; | ||
|
||
private DirectoryPath GetModulesPath() | ||
{ | ||
var env = Context.Environment; | ||
var root = Directory(".").Path.MakeAbsolute(env); | ||
return Context.Configuration.GetModulePath(root, env); | ||
} | ||
|
||
private DirectoryPath GetToolPath() | ||
{ | ||
var env = Context.Environment; | ||
var root = Directory(".").Path.MakeAbsolute(env); | ||
return Context.Configuration.GetToolPath(root, env); | ||
} | ||
|
||
Task("Build-Module") | ||
.Does(() => | ||
{ | ||
// dotnet clean will only clean things that will be creted by dotnet build. "old" files will not be removed. | ||
CleanDirectory("../../Source/Cake.Chocolatey.Module/bin"); | ||
DotNetBuild("../../Source/Cake.Chocolatey.Module/Cake.Chocolatey.Module.csproj"); | ||
var moduleFolder = GetModulesPath(); | ||
if(!DirectoryExists(moduleFolder)) | ||
{ | ||
CreateDirectory(moduleFolder); | ||
} | ||
|
||
var target = moduleFolder + $"/Cake.Chocolatey.Module.0.0.0/lib/{tfm}"; | ||
System.IO.File.WriteAllText(".toolpath.env", GetToolPath().FullPath); | ||
CleanDirectory(target); // this will NOT WORK if the dll existed before cake was started. | ||
CopyFiles($"../../Source/Cake.Chocolatey.Module/bin/Debug/{tfm}/Cake.Chocolatey.Module.dll", target); | ||
Information("Module copied to " + target); | ||
}); | ||
|
||
RunTarget("Build-Module"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
C:/_dev/cake/cake-contrib/Cake.Chocolatey.Module/demo/dsl/.cake |