diff --git a/GitReleaseManager.yaml b/GitReleaseManager.yaml
new file mode 100644
index 0000000..beb3f4e
--- /dev/null
+++ b/GitReleaseManager.yaml
@@ -0,0 +1,56 @@
+# The labels that will be used to include issues in release notes.
+issue-labels-include:
+- Feature
+- Enhancement
+- Bug
+- Build
+- Documentation
+# The labels that will NOT be used when including issues in release notes.
+issue-labels-exclude:
+- Refactor
+# Overrides default pluralization and header names for specific labels.
+issue-labels-alias:
+- name: Build
+ header: Build
+ plural: Build
+- name: Documentation
+ header: Documentation
+ plural: Documentation
+# Configuration values used when creating new releases
+create:
+ include-footer: true
+ footer-heading: Packages
+ footer-content: >-
+ There are two different packages available for the extension.
+
+ - For a chocolatey install: `nunit-extension-nunit-v2-result-writer.{milestone}.nupkg`
+
- For a nuget install: `NUnit.Extension.NUnitV2ResultWriter.{milestone}.nupkg`
+
+ You may also download the extension from
+ [chocolatey.org](https://chocolatey.org/packages/nunit-extension-nunit-v2-result-writer/)
+ or [nuget.org](https://nuget.org/packages/NUnit.Extension.NUnitV2ResultWriter/).
+ footer-includes-milestone: true
+ milestone-replace-text: '{milestone}'
+ include-sha-section: true
+ sha-section-heading: "SHA256 Hashes of the release artifacts"
+ sha-section-line-format: "- `{1}\t{0}`"
+ allow-update-to-published: false
+# Configuration values used when exporting release notes
+export:
+ include-created-date-in-title: true
+ created-date-string-format: MMMM dd, yyyy
+ perform-regex-removal: false
+# regex-text: '### Where to get it(\r\n)*You can .*\.'
+# multiline-regex: false
+# Configuration values used when closing a milestone
+close:
+# Whether to add comments to issues closed with the published milestone release.
+ use-issue-comments: true
+ issue-comment: |-
+ :tada: This issue has been resolved in version {milestone} :tada:
+
+ The release is available on:
+
+ - [GitHub Release](https://github.com/{owner}/{repository}/releases/tag/{milestone})
+ - [NuGet Package](https://www.nuget.org/packages/NUnit.Extension.NUnitV2ResultWriter/{milestone})
+ - [Chocolatey Package](https://chocolatey.org/packages/nunit-extension-nunit-v2-result-writer/{milestone})
diff --git a/appveyor.yml b/appveyor.yml
index 88ac5a0..1de6c6d 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -14,6 +14,8 @@ environment:
MYGET_API_KEY:
secure: wtAvJDVl2tfwiVcyLExFHLvZVfUWiQRHsfdHBFCNEATeCHo1Nd8JP642PfY8xhji
NUGET_API_KEY:
- secure: 3ojZLs9hiHk/7047hiirFk/qG2RxUACmA8DAUk+8AoILr5R7c4tDGXeTsBjjhq5h
+ secure: PVHROoT0SmGkr9CHgrKapuA0/CcJGHSP63M3fZaNLvcEVbBnzYLeCwpc0PZHhdvD
CHOCO_API_KEY:
secure: aDsu1U+umVYFVybjkBVtVQsatSj3QKbD7VkGQci9mNF3493g9Giao/GABISIaHjT
+ GITHUB_ACCESS_TOKEN:
+ secure: xmGXWrw5Nj3CI3fPxhw/DWIU5YL/1mM06pSmjpkd9LpKs3t3EYXbECbEQs62lU/O
diff --git a/build.cake b/build.cake
index 4cc71e7..123ebda 100644
--- a/build.cake
+++ b/build.cake
@@ -1,4 +1,5 @@
#tool nuget:?package=GitVersion.CommandLine&version=5.0.0
+#tool nuget:?package=GitReleaseManager&version=0.11.0
#tool nuget:?package=NUnit.ConsoleRunner&version=3.12.0
#tool nuget:?package=NUnit.ConsoleRunner&version=3.11.1
#tool nuget:?package=NUnit.ConsoleRunner&version=3.10.0
@@ -10,6 +11,8 @@
const string SOLUTION_FILE = "nunit.v2.driver.sln";
const string NUGET_ID = "NUnit.Extension.NUnitV2Driver";
const string CHOCO_ID = "nunit-extension-nunit-v2-driver";
+const string GITHUB_OWNER = "nunit";
+const string GITHUB_REPO = "nunit-v2-framework-driver";
const string DEFAULT_VERSION = "3.9.0";
const string DEFAULT_CONFIGURATION = "Release";
@@ -63,16 +66,6 @@ Task("Clean")
CleanDirectory(parameters.OutputDirectory);
});
-Task("CleanAll")
- .Does((parameters) =>
- {
- Information("Cleaning all output directories");
- CleanDirectory(parameters.ProjectDirectory + "bin/");
-
- Information("Deleting object directories");
- DeleteObjectDirectories(parameters);
- });
-
//////////////////////////////////////////////////////////////////////
// INITIALIZE FOR BUILD
//////////////////////////////////////////////////////////////////////
@@ -313,6 +306,71 @@ Task("PublishToChocolatey")
}
});
+//////////////////////////////////////////////////////////////////////
+// CREATE A DRAFT RELEASE
+//////////////////////////////////////////////////////////////////////
+
+Task("CreateDraftRelease")
+ .Does((parameters) =>
+ {
+ if (parameters.IsReleaseBranch)
+ {
+ // NOTE: Since this is a release branch, the pre-release label
+ // is "pre", which we don't want to use for the draft release.
+ // The branch name contains the full information to be used
+ // for both the name of the draft release and the milestone,
+ // i.e. release-2.0.0, release-2.0.0-beta2, etc.
+ string milestone = parameters.BranchName.Substring(8);
+ string releaseName = $"Visual Studio Project Loader Extension {milestone}";
+
+ Information($"Creating draft release...");
+
+ try
+ {
+ GitReleaseManagerCreate(parameters.GitHubAccessToken, GITHUB_OWNER, GITHUB_REPO, new GitReleaseManagerCreateSettings()
+ {
+ Name = releaseName,
+ Milestone = milestone
+ });
+ }
+ catch
+ {
+ Error($"Unable to create draft release for {releaseName}.");
+ Error($"Check that there is a {milestone} milestone with at least one closed issue.");
+ Error("");
+ throw;
+ }
+ }
+ else
+ {
+ Information("Skipping Release creation because this is not a release branch");
+ }
+ });
+
+//////////////////////////////////////////////////////////////////////
+// CREATE A PRODUCTION RELEASE
+//////////////////////////////////////////////////////////////////////
+
+Task("CreateProductionRelease")
+ .Does((parameters) =>
+ {
+ if (parameters.IsProductionRelease)
+ {
+ string token = parameters.GitHubAccessToken;
+ string tagName = parameters.PackageVersion;
+ string assets = $"\"{parameters.NuGetPackage},{parameters.ChocolateyPackage}\"";
+
+ Information($"Publishing release {tagName} to GitHub");
+
+ GitReleaseManagerAddAssets(token, GITHUB_OWNER, GITHUB_REPO, tagName, assets);
+ GitReleaseManagerClose(token, GITHUB_OWNER, GITHUB_REPO, tagName);
+ }
+ else
+ {
+ Information("Skipping CreateProductionRelease because this is not a production release");
+ }
+ });
+
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
@@ -336,7 +394,9 @@ Task("Appveyor")
.IsDependentOn("Build")
.IsDependentOn("Test")
.IsDependentOn("Package")
- .IsDependentOn("PublishPackages");
+ .IsDependentOn("PublishPackages")
+ .IsDependentOn("CreateDraftRelease")
+ .IsDependentOn("CreateProductionRelease");
Task("Travis")
.IsDependentOn("Build")
diff --git a/build.ps1 b/build.ps1
index 3f52e6e..b36d238 100644
--- a/build.ps1
+++ b/build.ps1
@@ -21,78 +21,133 @@ The build script target to run.
The build configuration to use.
.PARAMETER Verbosity
Specifies the amount of information to be displayed.
-.PARAMETER Experimental
-Tells Cake to use the latest Roslyn release.
-.PARAMETER WhatIf
-Performs a dry run of the build script.
-No tasks will be executed.
-.PARAMETER Mono
-Tells Cake to use the Mono scripting engine.
+.PARAMETER ShowDescription
+Shows description about tasks.
+.PARAMETER DryRun
+Performs a dry run.
.PARAMETER SkipToolPackageRestore
Skips restoring of packages.
.PARAMETER ScriptArgs
Remaining arguments are added here.
.LINK
-http://cakebuild.net
+https://cakebuild.net
#>
[CmdletBinding()]
Param(
- [string]$Script = "build.cake",
- [string]$Target = "Default",
- [string]$Configuration = "Release",
+ [string]$Script,
+ [string]$Target,
+ [string]$Configuration,
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
- [string]$Verbosity = "Normal",
- [switch]$Experimental,
- [Alias("DryRun","Noop")]
- [switch]$WhatIf,
- [switch]$Mono,
+ [string]$Verbosity,
+ [switch]$ShowDescription,
+ [Alias("WhatIf", "Noop")]
+ [switch]$DryRun,
[switch]$SkipToolPackageRestore,
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
[string[]]$ScriptArgs
)
-Write-Host "Preparing to run build script..."
+# This is an automatic variable in PowerShell Core, but not in Windows PowerShell 5.x
+if (-not (Test-Path variable:global:IsCoreCLR)) {
+ $IsCoreCLR = $false
+}
-$PSScriptRoot = split-path -parent $MyInvocation.MyCommand.Definition;
-$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
-$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
-$NUGET_URL = "http://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
-$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"
-$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config"
+# Attempt to set highest encryption available for SecurityProtocol.
+# PowerShell will not set this by default (until maybe .NET 4.6.x). This
+# will typically produce a message for PowerShell v2 (just an info
+# message though)
+try {
+ # Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48)
+ # Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't
+ # exist in .NET 4.0, even though they are addressable if .NET 4.5+ is
+ # installed (.NET 4.5 is an in-place upgrade).
+ # PowerShell Core already has support for TLS 1.2 so we can skip this if running in that.
+ if (-not $IsCoreCLR) {
+ [System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48
+ }
+ } catch {
+ Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to upgrade to .NET Framework 4.5+ and PowerShell v3'
+ }
-# Should we use mono?
-$UseMono = "";
-if($Mono.IsPresent) {
- Write-Verbose -Message "Using the Mono based scripting engine."
- $UseMono = "-mono"
+[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null
+function MD5HashFile([string] $filePath)
+{
+ if ([string]::IsNullOrEmpty($filePath) -or !(Test-Path $filePath -PathType Leaf))
+ {
+ return $null
+ }
+
+ [System.IO.Stream] $file = $null;
+ [System.Security.Cryptography.MD5] $md5 = $null;
+ try
+ {
+ $md5 = [System.Security.Cryptography.MD5]::Create()
+ $file = [System.IO.File]::OpenRead($filePath)
+ return [System.BitConverter]::ToString($md5.ComputeHash($file))
+ }
+ finally
+ {
+ if ($file -ne $null)
+ {
+ $file.Dispose()
+ }
+
+ if ($md5 -ne $null)
+ {
+ $md5.Dispose()
+ }
+ }
}
-# Should we use the new Roslyn?
-$UseExperimental = "";
-if($Experimental.IsPresent -and !($Mono.IsPresent)) {
- Write-Verbose -Message "Using experimental version of Roslyn."
- $UseExperimental = "-experimental"
+function GetProxyEnabledWebClient
+{
+ $wc = New-Object System.Net.WebClient
+ $proxy = [System.Net.WebRequest]::GetSystemWebProxy()
+ $proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
+ $wc.Proxy = $proxy
+ return $wc
}
-# Is this a dry run?
-$UseDryRun = "";
-if($WhatIf.IsPresent) {
- $UseDryRun = "-dryrun"
+Write-Host "Preparing to run build script..."
+
+if(!$PSScriptRoot){
+ $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
}
+if(!$Script){
+ $Script = Join-Path $PSScriptRoot "build.cake"
+}
+$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
+$ADDINS_DIR = Join-Path $TOOLS_DIR "Addins"
+$MODULES_DIR = Join-Path $TOOLS_DIR "Modules"
+$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
+$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"
+$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
+$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config"
+$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum"
+$ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config"
+$MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config"
+
+$env:CAKE_PATHS_TOOLS = $TOOLS_DIR
+$env:CAKE_PATHS_ADDINS = $ADDINS_DIR
+$env:CAKE_PATHS_MODULES = $MODULES_DIR
+
# Make sure tools folder exists
if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
Write-Verbose -Message "Creating tools directory..."
- New-Item -Path $TOOLS_DIR -Type directory | out-null
+ New-Item -Path $TOOLS_DIR -Type Directory | Out-Null
}
# Make sure that packages.config exist.
if (!(Test-Path $PACKAGES_CONFIG)) {
Write-Verbose -Message "Downloading packages.config..."
- try { Invoke-WebRequest -Uri http://cakebuild.net/download/bootstrapper/packages -OutFile $PACKAGES_CONFIG } catch {
+ try {
+ $wc = GetProxyEnabledWebClient
+ $wc.DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG)
+ } catch {
Throw "Could not download packages.config."
}
}
@@ -100,7 +155,7 @@ if (!(Test-Path $PACKAGES_CONFIG)) {
# Try find NuGet.exe in path if not exists
if (!(Test-Path $NUGET_EXE)) {
Write-Verbose -Message "Trying to find nuget.exe in PATH..."
- $existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_) }
+ $existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_ -PathType Container) }
$NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1
if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) {
Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)."
@@ -112,25 +167,88 @@ if (!(Test-Path $NUGET_EXE)) {
if (!(Test-Path $NUGET_EXE)) {
Write-Verbose -Message "Downloading NuGet.exe..."
try {
- (New-Object System.Net.WebClient).DownloadFile($NUGET_URL, $NUGET_EXE)
+ $wc = GetProxyEnabledWebClient
+ $wc.DownloadFile($NUGET_URL, $NUGET_EXE)
} catch {
Throw "Could not download NuGet.exe."
}
}
+# These are automatic variables in PowerShell Core, but not in Windows PowerShell 5.x
+if (-not (Test-Path variable:global:ismacos)) {
+ $IsLinux = $false
+ $IsMacOS = $false
+}
+
# Save nuget.exe path to environment to be available to child processed
-$ENV:NUGET_EXE = $NUGET_EXE
+$env:NUGET_EXE = $NUGET_EXE
+$env:NUGET_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) {
+ "mono `"$NUGET_EXE`""
+} else {
+ "`"$NUGET_EXE`""
+}
# Restore tools from NuGet?
if(-Not $SkipToolPackageRestore.IsPresent) {
Push-Location
Set-Location $TOOLS_DIR
+
+ # Check for changes in packages.config and remove installed tools if true.
+ [string] $md5Hash = MD5HashFile $PACKAGES_CONFIG
+ if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or
+ ($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) {
+ Write-Verbose -Message "Missing or changed package.config hash..."
+ Get-ChildItem -Exclude packages.config,nuget.exe,Cake.Bakery |
+ Remove-Item -Recurse -Force
+ }
+
Write-Verbose -Message "Restoring tools from NuGet..."
- $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""
+
+ $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""
+
+ if ($LASTEXITCODE -ne 0) {
+ Throw "An error occurred while restoring NuGet tools."
+ }
+ else
+ {
+ $md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII"
+ }
+ Write-Verbose -Message ($NuGetOutput | Out-String)
+
+ Pop-Location
+}
+
+# Restore addins from NuGet
+if (Test-Path $ADDINS_PACKAGES_CONFIG) {
+ Push-Location
+ Set-Location $ADDINS_DIR
+
+ Write-Verbose -Message "Restoring addins from NuGet..."
+ $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`""
+
+ if ($LASTEXITCODE -ne 0) {
+ Throw "An error occurred while restoring NuGet addins."
+ }
+
+ Write-Verbose -Message ($NuGetOutput | Out-String)
+
+ Pop-Location
+}
+
+# Restore modules from NuGet
+if (Test-Path $MODULES_PACKAGES_CONFIG) {
+ Push-Location
+ Set-Location $MODULES_DIR
+
+ Write-Verbose -Message "Restoring modules from NuGet..."
+ $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`""
+
if ($LASTEXITCODE -ne 0) {
- Throw "An error occured while restoring NuGet tools."
+ Throw "An error occurred while restoring NuGet modules."
}
- Write-Verbose -Message ($NuGetOutput | out-string)
+
+ Write-Verbose -Message ($NuGetOutput | Out-String)
+
Pop-Location
}
@@ -139,7 +257,31 @@ if (!(Test-Path $CAKE_EXE)) {
Throw "Could not find Cake.exe at $CAKE_EXE"
}
+$CAKE_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) {
+ "mono `"$CAKE_EXE`""
+} else {
+ "`"$CAKE_EXE`""
+}
+
+ # Build an array (not a string) of Cake arguments to be joined later
+$cakeArguments = @()
+if ($Script) { $cakeArguments += "`"$Script`"" }
+if ($Target) { $cakeArguments += "--target=`"$Target`"" }
+if ($Configuration) { $cakeArguments += "--configuration=$Configuration" }
+if ($Verbosity) { $cakeArguments += "--verbosity=$Verbosity" }
+if ($ShowDescription) { $cakeArguments += "--showdescription" }
+if ($DryRun) { $cakeArguments += "--dryrun" }
+$cakeArguments += $ScriptArgs
+
# Start Cake
Write-Host "Running build script..."
-Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs"
-exit $LASTEXITCODE
+Invoke-Expression "& $CAKE_EXE_INVOCATION $($cakeArguments -join " ")"
+$cakeExitCode = $LASTEXITCODE
+
+# Clean up environment variables that were created earlier in this bootstrapper
+$env:CAKE_PATHS_TOOLS = $null
+$env:CAKE_PATHS_ADDINS = $null
+$env:CAKE_PATHS_MODULES = $null
+
+# Return exit code
+exit $cakeExitCode
diff --git a/build.sh b/build.sh
index 1654b64..d87e411 100755
--- a/build.sh
+++ b/build.sh
@@ -1,73 +1,126 @@
-#!/bin/bash
-###############################################################
-# This is the Cake bootstrapper script that is responsible for
-# downloading Cake and all specified tools from NuGet.
-###############################################################
+#!/usr/bin/env bash
+
+##########################################################################
+# This is the Cake bootstrapper script for Linux and OS X.
+# This file was downloaded from https://github.com/cake-build/resources
+# Feel free to change this file to fit your needs.
+##########################################################################
# Define directories.
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
TOOLS_DIR=$SCRIPT_DIR/tools
+ADDINS_DIR=$TOOLS_DIR/Addins
+MODULES_DIR=$TOOLS_DIR/Modules
NUGET_EXE=$TOOLS_DIR/nuget.exe
CAKE_EXE=$TOOLS_DIR/Cake/Cake.exe
-NUNIT_CONSOLE_EXE=$TOOLS_DIR/NUnit.ConsoleRunner/tools/nunit3-console.exe
-NUNIT_AGENT_EXE=$TOOLS_DIR/NUnit.ConsoleRunner/tools/nunit-agent.exe
-NUNIT_AGENT_X86_EXE=$TOOLS_DIR/NUnit.ConsoleRunner/tools/nunit-agent-x86.exe
+PACKAGES_CONFIG=$TOOLS_DIR/packages.config
+PACKAGES_CONFIG_MD5=$TOOLS_DIR/packages.config.md5sum
+ADDINS_PACKAGES_CONFIG=$ADDINS_DIR/packages.config
+MODULES_PACKAGES_CONFIG=$MODULES_DIR/packages.config
+
+export CAKE_PATHS_TOOLS=$TOOLS_DIR
+export CAKE_PATHS_ADDINS=$ADDINS_DIR
+export CAKE_PATHS_MODULES=$MODULES_DIR
+
+# Define md5sum or md5 depending on Linux/OSX
+MD5_EXE=
+if [[ "$(uname -s)" == "Darwin" ]]; then
+ MD5_EXE="md5 -r"
+else
+ MD5_EXE="md5sum"
+fi
# Define default arguments.
-SCRIPT="build.cake"
-TARGET="Default"
-CONFIGURATION="Release"
-VERBOSITY="verbose"
-DRYRUN=false
-SHOW_VERSION=false
+SCRIPT=$SCRIPT_DIR/build.cake
+CAKE_ARGUMENTS=()
# Parse arguments.
for i in "$@"; do
case $1 in
-s|--script) SCRIPT="$2"; shift ;;
- -t|--target) TARGET="$2"; shift ;;
- -c|--configuration) CONFIGURATION="$2"; shift ;;
- -v|--verbosity) VERBOSITY="$2"; shift ;;
- -d|--dryrun) DRYRUN=true ;;
- --version) SHOW_VERSION=true ;;
+ --) shift; CAKE_ARGUMENTS+=("$@"); break ;;
+ *) CAKE_ARGUMENTS+=("$1") ;;
esac
shift
done
-chmod +x $NUNIT_CONSOLE_EXE
-chmod +x $NUNIT_AGENT_EXE
-chmod +x $NUNIT_AGENT_X86_EXE
+# Make sure the tools folder exist.
+if [ ! -d "$TOOLS_DIR" ]; then
+ mkdir "$TOOLS_DIR"
+fi
+
+# Make sure that packages.config exist.
+if [ ! -f "$TOOLS_DIR/packages.config" ]; then
+ echo "Downloading packages.config..."
+ curl -Lsfo "$TOOLS_DIR/packages.config" https://cakebuild.net/download/bootstrapper/packages
+ if [ $? -ne 0 ]; then
+ echo "An error occurred while downloading packages.config."
+ exit 1
+ fi
+fi
# Download NuGet if it does not exist.
-if [ ! -f $NUGET_EXE ]; then
+if [ ! -f "$NUGET_EXE" ]; then
echo "Downloading NuGet..."
- curl -Lsfo $NUGET_EXE https://www.nuget.org/nuget.exe
- chmod +x $NUGET_EXE
+ curl -Lsfo "$NUGET_EXE" https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
if [ $? -ne 0 ]; then
- echo "An error occured while downloading nuget.exe."
+ echo "An error occurred while downloading nuget.exe."
exit 1
fi
fi
# Restore tools from NuGet.
-pushd $TOOLS_DIR >/dev/null
-mono $NUGET_EXE install -ExcludeVersion
+pushd "$TOOLS_DIR" >/dev/null
+if [ ! -f "$PACKAGES_CONFIG_MD5" ] || [ "$( cat "$PACKAGES_CONFIG_MD5" | sed 's/\r$//' )" != "$( $MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' )" ]; then
+ find . -type d ! -name . ! -name 'Cake.Bakery' | xargs rm -rf
+fi
+
+mono "$NUGET_EXE" install -ExcludeVersion
+if [ $? -ne 0 ]; then
+ echo "Could not restore NuGet tools."
+ exit 1
+fi
+
+$MD5_EXE "$PACKAGES_CONFIG" | awk '{ print $1 }' >| "$PACKAGES_CONFIG_MD5"
+
popd >/dev/null
+# Restore addins from NuGet.
+if [ -f "$ADDINS_PACKAGES_CONFIG" ]; then
+ pushd "$ADDINS_DIR" >/dev/null
+
+ mono "$NUGET_EXE" install -ExcludeVersion
+ if [ $? -ne 0 ]; then
+ echo "Could not restore NuGet addins."
+ exit 1
+ fi
+
+ popd >/dev/null
+fi
+
+# Restore modules from NuGet.
+if [ -f "$MODULES_PACKAGES_CONFIG" ]; then
+ pushd "$MODULES_DIR" >/dev/null
+
+ mono "$NUGET_EXE" install -ExcludeVersion
+ if [ $? -ne 0 ]; then
+ echo "Could not restore NuGet modules."
+ exit 1
+ fi
+
+ popd >/dev/null
+fi
+
# Make sure that Cake has been installed.
-if [ ! -f $CAKE_EXE ]; then
- echo "Could not find Cake.exe."
+if [ ! -f "$CAKE_EXE" ]; then
+ echo "Could not find Cake.exe at '$CAKE_EXE'."
exit 1
fi
# Start Cake
-if $SHOW_VERSION; then
- mono $CAKE_EXE -version
-elif $DRYRUN; then
- mono $CAKE_EXE $SCRIPT -verbosity=$VERBOSITY -configuration=$CONFIGURATION -target=$TARGET -dryrun
-else
- mono $CAKE_EXE $SCRIPT -verbosity=$VERBOSITY -configuration=$CONFIGURATION -target=$TARGET
-fi
-
-exit $?
+exec mono "$CAKE_EXE" $SCRIPT "${CAKE_ARGUMENTS[@]}"
+# Clean up environment variables that were created earlier in this bootstrapper
+unset CAKE_PATHS_TOOLS
+unset CAKE_PATHS_ADDINS
+unset CAKE_PATHS_MODULES
diff --git a/cake/local-targets.cake b/cake/local-targets.cake
new file mode 100644
index 0000000..0d522da
--- /dev/null
+++ b/cake/local-targets.cake
@@ -0,0 +1,42 @@
+////////////////////////////////////////////////////////////////////
+// TARGETS FOR DEVELOPER USE ON LOCAL MACHINE
+//////////////////////////////////////////////////////////////////////
+
+using System;
+
+// Dependent task for all local targets
+Task("MustBeLocalBuild")
+ .Does((parameters) =>
+ {
+ if (!parameters.IsLocalBuild)
+ throw new Exception($"{parameters.Target} may only be run locally!");
+ });
+
+Task("CleanAll")
+ .Description("Clean both configs and all obj directories")
+ .IsDependentOn("MustBeLocalBuild")
+ .Does((parameters) =>
+ {
+ Information("Cleaning all output directories");
+ CleanDirectory(parameters.ProjectDirectory + "bin/");
+
+ Information("Deleting object directories");
+ DeleteObjectDirectories(parameters);
+ });
+
+// Download existing draft release for modification or for use in
+// updating the CHANGES.md file.
+Task("DownloadDraftRelease")
+ .Description("Download draft release for local use")
+ .IsDependentOn("MustBeLocalBuild")
+ .Does((parameters) =>
+ {
+ if (!parameters.IsReleaseBranch)
+ throw new Exception("DownloadDraftRelease requires a release branch!");
+
+ string milestone = parameters.BranchName.Substring(8);
+
+ GitReleaseManagerExport(parameters.GitHubAccessToken, GITHUB_OWNER, GITHUB_REPO, "DraftRelease.md",
+ new GitReleaseManagerExportSettings() { TagName = milestone });
+ });
+
diff --git a/cake/parameters.cake b/cake/parameters.cake
index a2de0cf..2b38588 100644
--- a/cake/parameters.cake
+++ b/cake/parameters.cake
@@ -5,6 +5,7 @@
#load "./test-results.cake"
#load "./test-reports.cake"
#load "./utilities.cake"
+#load "./local-targets.cake"
using System;
diff --git a/nunit.v2.driver.sln b/nunit.v2.driver.sln
index 8374401..49f8092 100644
--- a/nunit.v2.driver.sln
+++ b/nunit.v2.driver.sln
@@ -14,6 +14,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
build.ps1 = build.ps1
build.sh = build.sh
CHANGES.txt = CHANGES.txt
+ GitReleaseManager.yaml = GitReleaseManager.yaml
GitVersion.yml = GitVersion.yml
LICENSE.txt = LICENSE.txt
nunit.v2.driver.nuspec = nunit.v2.driver.nuspec
@@ -26,6 +27,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.v2.driver.tests", "sr
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "cake", "cake", "{0E1320F6-992A-48FA-871B-5FD018BD8BE8}"
ProjectSection(SolutionItems) = preProject
+ cake\local-targets.cake = cake\local-targets.cake
cake\package-checks.cake = cake\package-checks.cake
cake\package-tests.cake = cake\package-tests.cake
cake\packaging.cake = cake\packaging.cake
diff --git a/tools/packages.config b/tools/packages.config
index acac1aa..4926432 100644
--- a/tools/packages.config
+++ b/tools/packages.config
@@ -1,5 +1,5 @@
-
+