Skip to content

Commit

Permalink
Add Cake Script and Frosting examples using Cake v0.38.5
Browse files Browse the repository at this point in the history
  • Loading branch information
augustoproiete committed Jan 15, 2021
1 parent d9f2f3a commit 347751c
Show file tree
Hide file tree
Showing 35 changed files with 485 additions and 0 deletions.
12 changes: 12 additions & 0 deletions sample/cake-tool-0-38-5/addin/.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": "0.38.5",
"commands": [
"dotnet-cake"
]
}
}
}
9 changes: 9 additions & 0 deletions sample/cake-tool-0-38-5/addin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#windows
Thumbs.db

#osx
.DS_Store
._*

#cake
.cake/
13 changes: 13 additions & 0 deletions sample/cake-tool-0-38-5/addin/build.cake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#addin "nuget:?package=Cake.PackageType.Addin&version=0.1.0"

Task("ExampleHelloAddin")
.Does(() =>
{
Information("Addin: Start");

Hello();

Information("Addin: End");
});

RunTarget("ExampleHelloAddin");
11 changes: 11 additions & 0 deletions sample/cake-tool-0-38-5/addin/build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@echo on
@cd %~dp0

set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
set DOTNET_CLI_TELEMETRY_OPTOUT=1
set DOTNET_NOLOGO=1

dotnet tool restore
@if %ERRORLEVEL% neq 0 goto :eof

dotnet cake %*
13 changes: 13 additions & 0 deletions sample/cake-tool-0-38-5/addin/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 sample/cake-tool-0-38-5/addin/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 "$@"
12 changes: 12 additions & 0 deletions sample/cake-tool-0-38-5/addin/cake.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Nuget]
Source=https://api.nuget.org/v3/index.json
UseInProcessClient=true
LoadDependencies=false

[Paths]
Tools=./.cake
Addins=./.cake/addins
Modules=./.cake/modules

[Settings]
SkipVerification=false
7 changes: 7 additions & 0 deletions sample/cake-tool-0-38-5/addin/global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"sdk": {
"allowPrerelease": false,
"version": "5.0.100",
"rollForward": "latestFeature"
}
}
12 changes: 12 additions & 0 deletions sample/cake-tool-0-38-5/module/.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": "0.38.5",
"commands": [
"dotnet-cake"
]
}
}
}
9 changes: 9 additions & 0 deletions sample/cake-tool-0-38-5/module/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#windows
Thumbs.db

#osx
.DS_Store
._*

#cake
.cake/
14 changes: 14 additions & 0 deletions sample/cake-tool-0-38-5/module/build.cake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#module "nuget:?package=Cake.PackageType.Module&version=0.1.0"
#tool hello:?package=MyAwesomePackage&version=1.2.3

Task("ExampleHelloModule")
.Does(() =>
{
Information("Module: Start");

Information("Hello Module!");

Information("Module: End");
});

RunTarget("ExampleHelloModule");
11 changes: 11 additions & 0 deletions sample/cake-tool-0-38-5/module/build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@echo on
@cd %~dp0

set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
set DOTNET_CLI_TELEMETRY_OPTOUT=1
set DOTNET_NOLOGO=1

dotnet tool restore
@if %ERRORLEVEL% neq 0 goto :eof

dotnet cake %*
13 changes: 13 additions & 0 deletions sample/cake-tool-0-38-5/module/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 sample/cake-tool-0-38-5/module/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 "$@"
12 changes: 12 additions & 0 deletions sample/cake-tool-0-38-5/module/cake.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Nuget]
Source=https://api.nuget.org/v3/index.json
UseInProcessClient=true
LoadDependencies=false

[Paths]
Tools=./.cake
Addins=./.cake/addins
Modules=./.cake/modules

[Settings]
SkipVerification=false
7 changes: 7 additions & 0 deletions sample/cake-tool-0-38-5/module/global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"sdk": {
"allowPrerelease": false,
"version": "5.0.100",
"rollForward": "latestFeature"
}
}
12 changes: 12 additions & 0 deletions sample/cake-tool-0-38-5/recipe/.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": "0.38.5",
"commands": [
"dotnet-cake"
]
}
}
}
9 changes: 9 additions & 0 deletions sample/cake-tool-0-38-5/recipe/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#windows
Thumbs.db

#osx
.DS_Store
._*

#cake
.cake/
14 changes: 14 additions & 0 deletions sample/cake-tool-0-38-5/recipe/build.cake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#load "nuget:?package=Cake.PackageType.Recipe&version=0.1.0"

Task("ExampleHelloRecipe")
.Does(() =>
{
Information("Recipe: Start");

SayHello(System.Environment.UserName);
SayBye(System.Environment.UserName);

Information("Recipe: End");
});

RunTarget("ExampleHelloRecipe");
11 changes: 11 additions & 0 deletions sample/cake-tool-0-38-5/recipe/build.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@echo on
@cd %~dp0

set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
set DOTNET_CLI_TELEMETRY_OPTOUT=1
set DOTNET_NOLOGO=1

dotnet tool restore
@if %ERRORLEVEL% neq 0 goto :eof

dotnet cake %*
13 changes: 13 additions & 0 deletions sample/cake-tool-0-38-5/recipe/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 sample/cake-tool-0-38-5/recipe/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 "$@"
12 changes: 12 additions & 0 deletions sample/cake-tool-0-38-5/recipe/cake.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[Nuget]
Source=https://api.nuget.org/v3/index.json
UseInProcessClient=true
LoadDependencies=false

[Paths]
Tools=./.cake
Addins=./.cake/addins
Modules=./.cake/modules

[Settings]
SkipVerification=false
7 changes: 7 additions & 0 deletions sample/cake-tool-0-38-5/recipe/global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"sdk": {
"allowPrerelease": false,
"version": "5.0.100",
"rollForward": "latestFeature"
}
}
9 changes: 9 additions & 0 deletions sample/frosting-0-38-5/addin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#windows
Thumbs.db

#osx
.DS_Store
._*

#cake
.cake/
2 changes: 2 additions & 0 deletions sample/frosting-0-38-5/addin/build.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/usr/bin/env bash
DOTNET_VERSION=3.1.402
70 changes: 70 additions & 0 deletions sample/frosting-0-38-5/addin/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/env pwsh
$DotNetInstallerUri = 'https://dot.net/v1/dotnet-install.ps1';
$DotNetUnixInstallerUri = 'https://dot.net/v1/dotnet-install.sh'
$DotNetChannel = 'LTS'
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent

[string] $DotNetVersion= ''
foreach($line in Get-Content (Join-Path $PSScriptRoot 'build.config'))
{
if ($line -like 'DOTNET_VERSION=*') {
$DotNetVersion =$line.SubString(15)
}
}


if ([string]::IsNullOrEmpty($DotNetVersion)) {
'Failed to parse .NET Core SDK Version'
exit 1
}

$DotNetInstallerUri = "https://dot.net/v1/dotnet-install.ps1";

# Make sure tools folder exists
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
$ToolPath = Join-Path $PSScriptRoot "tools"
if (!(Test-Path $ToolPath)) {
Write-Verbose "Creating tools directory..."
New-Item -Path $ToolPath -Type directory | out-null
}

###########################################################################
# INSTALL .NET CORE CLI
###########################################################################

Function Remove-PathVariable([string]$VariableToRemove)
{
$path = [Environment]::GetEnvironmentVariable("PATH", "User")
$newItems = $path.Split(';') | Where-Object { $_.ToString() -inotlike $VariableToRemove }
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "User")
$path = [Environment]::GetEnvironmentVariable("PATH", "Process")
$newItems = $path.Split(';') | Where-Object { $_.ToString() -inotlike $VariableToRemove }
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "Process")
}

# Get .NET Core CLI path if installed.
$FoundDotNetCliVersion = $null;
if (Get-Command dotnet -ErrorAction SilentlyContinue) {
$FoundDotNetCliVersion = dotnet --version;
}

if($FoundDotNetCliVersion -ne $DotNetVersion) {
$InstallPath = Join-Path $PSScriptRoot ".dotnet"
if (!(Test-Path $InstallPath)) {
mkdir -Force $InstallPath | Out-Null;
}
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, "$InstallPath\dotnet-install.ps1");
& $InstallPath\dotnet-install.ps1 -Version $DotNetVersion -InstallDir $InstallPath;

Remove-PathVariable "$InstallPath"
$env:PATH = "$InstallPath;$env:PATH"
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
$env:DOTNET_CLI_TELEMETRY_OPTOUT=1
}

###########################################################################
# RUN BUILD SCRIPT
###########################################################################

dotnet run --project build/Build.csproj -- $args
exit $LASTEXITCODE;
Loading

0 comments on commit 347751c

Please sign in to comment.