2
2
<#
3
3
4
4
. SYNOPSIS
5
- This is a Powershell script to bootstrap a Cake build.
5
+ This is a PowerShell script to bootstrap a Cake build.
6
6
7
7
. DESCRIPTION
8
- This Powershell script will download NuGet if missing, restore NuGet tools (including Cake)
8
+ This PowerShell script will restore NuGet tools (including Cake)
9
9
and execute your Cake build script with the parameters you provide.
10
10
11
11
. PARAMETER Script
@@ -16,13 +16,9 @@ The build script target to run.
16
16
The build configuration to use.
17
17
. PARAMETER Verbosity
18
18
Specifies the amount of information to be displayed.
19
- . PARAMETER Experimental
20
- Tells Cake to use the latest Roslyn release.
21
19
. PARAMETER WhatIf
22
20
Performs a dry run of the build script.
23
21
No tasks will be executed.
24
- . PARAMETER Mono
25
- Tells Cake to use the Mono scripting engine.
26
22
27
23
. LINK
28
24
http://cakebuild.net
@@ -34,10 +30,8 @@ Param(
34
30
[string ]$Configuration = " Release" ,
35
31
[ValidateSet (" Quiet" , " Minimal" , " Normal" , " Verbose" , " Diagnostic" )]
36
32
[string ]$Verbosity = " Verbose" ,
37
- [switch ]$Experimental ,
38
33
[Alias (" DryRun" , " Noop" )]
39
34
[switch ]$WhatIf ,
40
- [switch ]$Mono ,
41
35
[switch ]$SkipToolPackageRestore ,
42
36
[switch ]$Verbose
43
37
)
@@ -54,23 +48,6 @@ if ($Verbose.IsPresent)
54
48
}
55
49
56
50
$TOOLS_DIR = Join-Path $PSScriptRoot " tools"
57
- $NUGET_EXE = Join-Path $TOOLS_DIR " nuget.exe"
58
- $PACKAGES_CONFIG = Join-Path $TOOLS_DIR " packages.config"
59
- $DOTNET = " dotnet.exe"
60
-
61
- # Should we use mono?
62
- $UseMono = " " ;
63
- if ($Mono.IsPresent ) {
64
- Write-Verbose - Message " Using the Mono based scripting engine."
65
- $UseMono = " -mono"
66
- }
67
-
68
- # Should we use the new Roslyn?
69
- $UseExperimental = " " ;
70
- if ($Experimental.IsPresent -and ! ($Mono.IsPresent )) {
71
- Write-Verbose - Message " Using experimental version of Roslyn."
72
- $UseExperimental = " -experimental"
73
- }
74
51
75
52
# Is this a dry run?
76
53
$UseDryRun = " " ;
@@ -83,20 +60,6 @@ if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
83
60
New-Item - Path $TOOLS_DIR - Type directory | out-null
84
61
}
85
62
86
- # Try download NuGet.exe if not exists
87
- if (! (Test-Path $NUGET_EXE )) {
88
- Write-Verbose - Message " Downloading NuGet.exe..."
89
- Invoke-WebRequest - Uri https:// dist.nuget.org/ win- x86- commandline/ latest/ nuget.exe - OutFile $NUGET_EXE
90
- }
91
-
92
- # Make sure NuGet exists where we expect it.
93
- if (! (Test-Path $NUGET_EXE )) {
94
- Throw " Could not find NuGet.exe"
95
- }
96
-
97
- # Save nuget.exe path to environment to be available to child processed
98
- $ENV: NUGET_EXE = $NUGET_EXE
99
-
100
63
# Restore tools from NuGet?
101
64
if (-Not $SkipToolPackageRestore.IsPresent )
102
65
{
@@ -106,18 +69,9 @@ if (-Not $SkipToolPackageRestore.IsPresent)
106
69
107
70
Write-Verbose - Message " Restoring tools from NuGet..."
108
71
109
- # Restore packages
110
- if (Test-Path $PACKAGES_CONFIG )
111
- {
112
- $NuGetOutput = Invoke-Expression " &`" $NUGET_EXE `" install -ExcludeVersion"
113
- Write-Verbose ($NuGetOutput | Out-String )
114
- }
115
- # Install just Cake if missing config
116
- else
117
- {
118
- $NuGetOutput = Invoke-Expression " &`" $DOTNET `" tool install Cake.Tool --version 3.0.0"
119
- Write-Verbose ($NuGetOutput | Out-String )
120
- }
72
+ $NuGetOutput = Invoke-Expression " & dotnet tool restore"
73
+ Write-Verbose ($NuGetOutput | Out-String )
74
+
121
75
Pop-Location
122
76
if ($LASTEXITCODE -ne 0 )
123
77
{
@@ -127,5 +81,5 @@ if (-Not $SkipToolPackageRestore.IsPresent)
127
81
128
82
# Start Cake
129
83
Write-Host " Running build script..."
130
- Invoke-Expression " dotnet dotnet-cake `" $Script `" --target=`" $Target `" --configuration=`" $Configuration `" --verbosity=`" $Verbosity `" $UseMono $ UseDryRun $UseExperimental "
84
+ Invoke-Expression " dotnet dotnet-cake `" $Script `" --target=`" $Target `" --configuration=`" $Configuration `" --verbosity=`" $Verbosity `" $UseDryRun "
131
85
exit $LASTEXITCODE
0 commit comments