Skip to content

Commit 9a1c6f7

Browse files
authored
Merge branch 'master' into fix-mainline-develop-version-#1035
2 parents 8f3d698 + 6130867 commit 9a1c6f7

File tree

102 files changed

+1387
-857
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+1387
-857
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: csharp
22
sudo: required
33
dist: trusty
4-
dotnet: 2.1.403
4+
dotnet: 2.1.503
55
mono:
66
- latest
77
os:

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ works out the [semantic version][semver] of the commit being built.
2727
| **Docker FullFX** | [FullFX][dockerhub-fullfx] | - |
2828

2929
## Compatibility
30-
31-
GitVersion works on Mac, Linux with Mono and Windows.
30+
GitVersion works Windows, Linux, and Mac.
3231

3332
Tip: If you get `System.TypeInitializationException: The type initializer for
3433
'LibGit2Sharp.Core.NativeMethods' threw an exception. --->

azure-pipelines.yml

Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,21 @@
1+
variables:
2+
DOTNET_SDK_VERSION: '2.1.503'
3+
DOTNET_PACKAGE_TYPE: 'sdk'
4+
RUBY_VERSION: '2.5'
5+
16
jobs:
2-
- job: macOS
3-
pool:
7+
- template: build/tmpl/jobs.yml
8+
parameters:
9+
name: macOS
410
vmImage: 'macOS 10.13'
5-
steps:
6-
- task: DotNetCoreInstaller@0
7-
displayName: 'Use .NET Core sdk 2.1.403'
8-
inputs:
9-
version: 2.1.403
10-
- powershell: ./build.ps1 -script build.cake -target Default
11-
displayName: 'Cake build'
12-
- job: Linux
13-
pool:
11+
installRuby: 'false'
12+
13+
- template: build/tmpl/jobs.yml
14+
parameters:
15+
name: Linux
1416
vmImage: 'Ubuntu 16.04'
15-
steps:
16-
- task: DotNetCoreInstaller@0
17-
displayName: 'Use .NET Core sdk 2.1.403'
18-
inputs:
19-
version: 2.1.403
20-
- task: UseRubyVersion@0
21-
inputs:
22-
addToPath: true # Optional
23-
- powershell: ./build.ps1 -script build.cake -target Default
24-
displayName: 'Cake build'
25-
- job: Windows
26-
pool:
17+
18+
- template: build/tmpl/jobs.yml
19+
parameters:
20+
name: Windows
2721
vmImage: 'VS2017-Win2016'
28-
steps:
29-
- task: DotNetCoreInstaller@0
30-
displayName: 'Use .NET Core sdk 2.1.403'
31-
inputs:
32-
version: 2.1.403
33-
- task: UseRubyVersion@0
34-
inputs:
35-
addToPath: true # Optional
36-
- powershell: ./build.ps1 -script build.cake -target Default
37-
displayName: 'Cake build'

build.cake

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Install modules
2+
#module nuget:?package=Cake.DotNetTool.Module&version=0.1.0
13

24
// Install addins.
35
#addin "nuget:?package=Cake.Gitter&version=0.9.0"
@@ -7,15 +9,20 @@
79
#addin "nuget:?package=Cake.Json&version=3.0.0"
810
#addin "nuget:?package=Cake.Tfx&version=0.8.0"
911
#addin "nuget:?package=Cake.Gem&version=0.7.0"
10-
#addin "nuget:?package=Cake.Coverlet&version=1.3.2"
11-
#addin "nuget:?package=Cake.Codecov&version=0.4.0"
12+
#addin "nuget:?package=Cake.Coverlet&version=2.2.1"
13+
#addin "nuget:?package=Cake.Codecov&version=0.5.0"
1214
#addin "nuget:?package=Newtonsoft.Json&version=9.0.1"
1315

1416
// Install tools.
17+
#tool "nuget:?package=GitReleaseManager&version=0.7.1"
1518
#tool "nuget:?package=NUnit.ConsoleRunner&version=3.9.0"
1619
#tool "nuget:?package=GitReleaseNotes&version=0.7.1"
1720
#tool "nuget:?package=ILRepack&version=2.0.16"
1821
#tool "nuget:?package=Codecov&version=1.1.0"
22+
#tool "nuget:?package=nuget.commandline&version=4.9.2"
23+
24+
// Install .NET Core Global tools.
25+
#tool "dotnet:?package=GitReleaseManager.Tool&version=0.8.0"
1926

2027
// Load other scripts.
2128
#load "./build/parameters.cake"
@@ -26,7 +33,6 @@
2633
//////////////////////////////////////////////////////////////////////
2734
bool publishingError = false;
2835

29-
3036
///////////////////////////////////////////////////////////////////////////////
3137
// SETUP / TEARDOWN
3238
///////////////////////////////////////////////////////////////////////////////
@@ -183,7 +189,6 @@ Task("Test")
183189
nunitSettings.Agents = 1;
184190
}
185191

186-
FixForMono(nunitSettings, "nunit3-console.exe");
187192
NUnit3(testAssemblies, nunitSettings);
188193
});
189194

@@ -322,7 +327,6 @@ Task("Pack-Nuget")
322327
.ToArray()
323328
};
324329

325-
FixForMono(nugetSettings, "nuget.exe");
326330
NuGetPack(package.NuspecPath, nugetSettings);
327331
}
328332
}
@@ -355,7 +359,7 @@ Task("Pack-Chocolatey")
355359

356360
var files = GetFiles(artifactPath + "/**/*.*")
357361
.Select(file => new ChocolateyNuSpecContent { Source = file.FullPath, Target = file.FullPath.Replace(artifactPath, "") });
358-
var txtFiles = GetFiles("./nuspec/*.txt")
362+
var txtFiles = (GetFiles("./nuspec/*.txt") + GetFiles("./nuspec/*.ps1"))
359363
.Select(file => new ChocolateyNuSpecContent { Source = file.FullPath, Target = file.GetFilename().ToString() });
360364

361365
ChocolateyPack(package.NuspecPath, new ChocolateyPackSettings {
@@ -515,7 +519,7 @@ Task("Publish-AzurePipeline")
515519

516520
if (FileExists(parameters.Paths.Files.TestCoverageOutputFilePath)) {
517521
var data = new TFBuildPublishTestResultsData {
518-
TestResultsFiles = new[] { parameters.Paths.Files.TestCoverageOutputFilePath.ToString() },
522+
TestResultsFiles = new[] { parameters.Paths.Files.TestCoverageOutputFilePath },
519523
TestRunner = TFTestRunnerType.NUnit
520524
};
521525
TFBuild.Commands.PublishTestResults(data);
@@ -532,7 +536,7 @@ Task("Publish-Tfs")
532536
.WithCriteria<BuildParameters>((context, parameters) => parameters.EnabledPublishTfs, "Publish-Tfs was disabled.")
533537
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsRunningOnWindows, "Publish-Tfs works only on Windows agents.")
534538
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsRunningOnAppVeyor, "Publish-Tfs works only on AppVeyor.")
535-
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsStableRelease(), "Publish-Tfs works only for releases.")
539+
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsStableRelease(), "Publish-Tfs works only for releases.")
536540
.IsDependentOn("Pack-Tfs")
537541
.Does<BuildParameters>((parameters) =>
538542
{

build.config

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
CAKE_VERSION=0.32.1
3+
DOTNET_VERSION=2.1.503

build.ps1

Lines changed: 80 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -45,45 +45,62 @@ Param(
4545
)
4646

4747
Write-Host "Preparing to run build script..."
48+
$DotNetInstallerUri = 'https://dot.net/v1/dotnet-install.ps1';
49+
$DotNetUnixInstallerUri = 'https://dot.net/v1/dotnet-install.sh'
50+
$DotNetChannel = 'LTS'
51+
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
4852

49-
if ($PSEdition -eq "Desktop") { $IsWindows = $true }
50-
51-
$CakeVersion = "0.30.0"
52-
53-
$DotNetChannel = "Current";
54-
$DotNetInstaller = if ($IsWindows) { "dotnet-install.ps1" } else { "dotnet-install.sh" }
55-
$DotNetInstallerUri = "https://dot.net/v1/$DotNetInstaller";
56-
$DotNetVersion = (Get-Content ./src/global.json | ConvertFrom-Json).sdk.version;
57-
58-
$NugetUrl = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
53+
[string] $CakeVersion = ''
54+
[string] $DotNetVersion= ''
55+
foreach($line in Get-Content "$PSScriptRoot\build.config")
56+
{
57+
if ($line -like 'CAKE_VERSION=*') {
58+
$CakeVersion = $line.SubString(13)
59+
}
60+
elseif ($line -like 'DOTNET_VERSION=*') {
61+
$DotNetVersion =$line.SubString(15)
62+
}
63+
}
5964

60-
$PathSplitter = if ($IsWindows) { ';' } else { ':' }
6165

62-
# SSL FIX
63-
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;
66+
if ([string]::IsNullOrEmpty($CakeVersion) -or [string]::IsNullOrEmpty($DotNetVersion)) {
67+
'Failed to parse Cake / .NET Core SDK Version'
68+
exit 1
69+
}
6470

6571
# Make sure tools folder exists
66-
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
6772
$ToolPath = Join-Path $PSScriptRoot "tools"
6873
if (!(Test-Path $ToolPath)) {
6974
Write-Verbose "Creating tools directory..."
70-
New-Item -Path $ToolPath -Type directory | out-null
75+
New-Item -Path $ToolPath -Type Directory -Force | out-null
7176
}
7277

78+
# SSL FIX
79+
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;
80+
7381
###########################################################################
7482
# INSTALL .NET CORE CLI
7583
###########################################################################
76-
function Remove-PathVariable([string]$VariableToRemove) {
84+
85+
Function Remove-PathVariable([string]$VariableToRemove)
86+
{
87+
$SplitChar = ';'
88+
if ($IsMacOS -or $IsLinux) {
89+
$SplitChar = ':'
90+
}
91+
7792
$path = [Environment]::GetEnvironmentVariable("PATH", "User")
78-
if ($path -ne $null) {
79-
$newItems = $path.Split($PathSplitter, [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
80-
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join($PathSplitter, $newItems), "User")
93+
if ($path -ne $null)
94+
{
95+
$newItems = $path.Split($SplitChar, [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
96+
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join($SplitChar, $newItems), "User")
8197
}
8298

8399
$path = [Environment]::GetEnvironmentVariable("PATH", "Process")
84-
if ($path -ne $null) {
85-
$newItems = $path.Split($PathSplitter, [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
86-
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join($PathSplitter, $newItems), "Process")
100+
if ($path -ne $null)
101+
{
102+
$newItems = $path.Split($SplitChar, [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
103+
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join($SplitChar, $newItems), "Process")
87104
}
88105
}
89106

@@ -95,55 +112,59 @@ if (Get-Command dotnet -ErrorAction SilentlyContinue) {
95112

96113
if($FoundDotNetCliVersion -ne $DotNetVersion) {
97114
$InstallPath = Join-Path $PSScriptRoot ".dotnet"
98-
99115
if (!(Test-Path $InstallPath)) {
100-
New-Item -ItemType Directory $InstallPath | Out-Null;
116+
New-Item -Path $InstallPath -ItemType Directory -Force | Out-Null;
101117
}
102118

103-
[string] $InstalledDotNetVersion = Get-ChildItem -Path ./.dotnet -File `
104-
| Where-Object { $_.Name -eq 'dotnet' -or $_.Name -eq 'dotnet.exe' } `
105-
| ForEach-Object { &$_.FullName --version }
106-
107-
if ($InstalledDotNetVersion -ne $DotNetVersion)
108-
{
109-
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, "$InstallPath/$DotNetInstaller");
110-
$Cmd = "$InstallPath/$DotNetInstaller -Channel $DotNetChannel -Version $DotNetVersion -InstallDir $InstallPath -NoPath"
111-
if (!$IsWindows) { $Cmd = "bash $Cmd" }
112-
Invoke-Expression "& $Cmd"
119+
if ($IsMacOS -or $IsLinux) {
120+
(New-Object System.Net.WebClient).DownloadFile($DotNetUnixInstallerUri, "$InstallPath\dotnet-install.sh");
121+
& bash $InstallPath\dotnet-install.sh --version "$DotNetVersion" --install-dir "$InstallPath" --channel "$DotNetChannel" --no-path
122+
}
123+
else {
124+
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, "$InstallPath\dotnet-install.ps1");
125+
& $InstallPath\dotnet-install.ps1 -Channel $DotNetChannel -Version $DotNetVersion -InstallDir $InstallPath;
113126
}
114127

115-
# Ensure the installed .NET Core CLI is always used but putting it on the front of the path.
116128
Remove-PathVariable "$InstallPath"
117-
$env:PATH = "$InstallPath$PathSplitter$env:PATH"
118-
$env:DOTNET_ROOT="$InstallPath"
129+
$env:PATH = "$InstallPath;$env:PATH"
119130
}
120131

121-
# Temporarily skip verification of addins.
122-
$env:CAKE_SETTINGS_SKIPVERIFICATION='true'
123132
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
124133
$env:DOTNET_CLI_TELEMETRY_OPTOUT=1
125134

126-
###########################################################################
127-
# INSTALL NUGET
128-
###########################################################################
129-
130-
# Make sure nuget.exe exists.
131-
$NugetPath = Join-Path $ToolPath "nuget.exe"
132-
if (!(Test-Path $NugetPath)) {
133-
Write-Host "Downloading NuGet.exe..."
134-
(New-Object System.Net.WebClient).DownloadFile($NugetUrl, $NugetPath);
135-
}
136135

137136
###########################################################################
138137
# INSTALL CAKE
139138
###########################################################################
140139

141140
# Make sure Cake has been installed.
142-
Write-Host "Installing Cake..."
143-
$CakeInstallPath = Join-Path $PSScriptRoot ".cake"
144-
if (!(Test-Path $CakeInstallPath)) {
145-
New-Item -ItemType Directory $CakeInstallPath | Out-Null;
146-
Invoke-Expression "& dotnet tool install Cake.Tool --version $CakeVersion --tool-path $CakeInstallPath"
141+
[string] $CakeExePath = ''
142+
[string] $CakeInstalledVersion = Get-Command dotnet-cake -ErrorAction SilentlyContinue | % {&$_.Source --version}
143+
144+
if ($CakeInstalledVersion -eq $CakeVersion) {
145+
# Cake found locally
146+
$CakeExePath = (Get-Command dotnet-cake).Source
147+
}
148+
else {
149+
$CakePath = Join-Path $ToolPath ".store\cake.tool\$CakeVersion"
150+
$CakeExePath = (Get-ChildItem -Path $ToolPath -Filter "dotnet-cake*" -File| ForEach-Object FullName | Select-Object -First 1)
151+
152+
153+
if ((!(Test-Path -Path $CakePath -PathType Container)) -or (!(Test-Path $CakeExePath -PathType Leaf))) {
154+
155+
if ((![string]::IsNullOrEmpty($CakeExePath)) -and (Test-Path $CakeExePath -PathType Leaf))
156+
{
157+
& dotnet tool uninstall --tool-path $ToolPath Cake.Tool
158+
}
159+
160+
& dotnet tool install --tool-path $ToolPath --version $CakeVersion Cake.Tool
161+
if ($LASTEXITCODE -ne 0)
162+
{
163+
'Failed to install cake'
164+
exit 1
165+
}
166+
$CakeExePath = (Get-ChildItem -Path $ToolPath -Filter "dotnet-cake*" -File| ForEach-Object FullName | Select-Object -First 1)
167+
}
147168
}
148169

149170
# ###########################################################################
@@ -162,8 +183,11 @@ $Arguments = @{
162183
# Start Cake
163184
Write-Host "Running build script..."
164185

165-
$Cmd = "$CakeInstallPath/dotnet-cake $Script $Arguments"
166-
Invoke-Expression "& $Cmd"
186+
& "$CakeExePath" $Script --bootstrap
187+
if ($LASTEXITCODE -eq 0)
188+
{
189+
& "$CakeExePath" $Script $Arguments
190+
}
167191

168192
if ($env:APPVEYOR) {
169193
$host.SetShouldExit($LASTEXITCODE)

build/parameters.cake

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ public class BuildParameters
88
public string Target { get; private set; }
99
public string Configuration { get; private set; }
1010

11-
public string NetCoreVersion { get; private set; } = "netcoreapp2.0";
12-
public string FullFxVersion { get; private set; } = "net40";
11+
public string NetCoreVersion { get; private set; } = "netcoreapp2.1";
12+
public string FullFxVersion { get; private set; } = "net461";
1313

1414
public bool EnabledUnitTests { get; private set; }
1515
public bool EnabledPublishGem { get; private set; }
@@ -131,7 +131,16 @@ public class BuildParameters
131131

132132
if(!IsRunningOnWindows)
133133
{
134-
var frameworkPathOverride = new FilePath(typeof(object).Assembly.Location).GetDirectory().FullPath + "/";
134+
var frameworkPathOverride = context.Environment.Runtime.IsCoreClr
135+
? new []{
136+
new DirectoryPath("/Library/Frameworks/Mono.framework/Versions/Current/lib/mono"),
137+
new DirectoryPath("/usr/lib/mono"),
138+
new DirectoryPath("/usr/local/lib/mono")
139+
}
140+
.Select(directory =>directory.Combine("4.5"))
141+
.FirstOrDefault(directory => context.DirectoryExists(directory))
142+
?.FullPath + "/"
143+
: new FilePath(typeof(object).Assembly.Location).GetDirectory().FullPath + "/";
135144

136145
// Use FrameworkPathOverride when not running on Windows.
137146
context.Information("Build will use FrameworkPathOverride={0} since not building on Windows.", frameworkPathOverride);

build/paths.cake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class BuildPaths
2626

2727
var artifactsDir = (DirectoryPath)(context.Directory("./artifacts") + context.Directory("v" + semVersion));
2828
var artifactsBinDir = artifactsDir.Combine("bin");
29-
var artifactsBinFullFxDir = artifactsBinDir.Combine("net40");
29+
var artifactsBinFullFxDir = artifactsBinDir.Combine("net461");
3030
var artifactsBinFullFxILMergeDir = artifactsBinFullFxDir.Combine("il-merge");
3131
var artifactsBinFullFxPortableDir = artifactsBinFullFxDir.Combine("portable");
3232
var artifactsBinFullFxCmdlineDir = artifactsBinFullFxDir.Combine("cmdline");

0 commit comments

Comments
 (0)