Skip to content

Commit 96331e1

Browse files
authored
Merge branch 'master' into add-dockerfile-with-centos
2 parents 3c1f783 + 02807b2 commit 96331e1

File tree

143 files changed

+1695
-7762
lines changed

Some content is hidden

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

143 files changed

+1695
-7762
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.500
4+
dotnet: 2.1.503
55
mono:
66
- latest
77
os:

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.500'
8-
inputs:
9-
version: 2.1.500
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.500'
18-
inputs:
19-
version: 2.1.500
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.500'
31-
inputs:
32-
version: 2.1.500
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,8 +9,8 @@
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,6 +19,10 @@
1719
#tool "nuget:?package=GitReleaseNotes&version=0.7.1"
1820
#tool "nuget:?package=ILRepack&version=2.0.16"
1921
#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"
2026

2127
// Load other scripts.
2228
#load "./build/parameters.cake"
@@ -27,7 +33,6 @@
2733
//////////////////////////////////////////////////////////////////////
2834
bool publishingError = false;
2935

30-
3136
///////////////////////////////////////////////////////////////////////////////
3237
// SETUP / TEARDOWN
3338
///////////////////////////////////////////////////////////////////////////////
@@ -168,7 +173,8 @@ Task("Test")
168173
settings.Filter = "TestCategory!=NoMono";
169174
}
170175

171-
DotNetCoreTest(project.FullPath, settings, coverletSettings);
176+
// DotNetCoreTest(project.FullPath, settings, coverletSettings);
177+
DotNetCoreTest(project.FullPath, settings);
172178
}
173179

174180
// run using NUnit
@@ -184,7 +190,6 @@ Task("Test")
184190
nunitSettings.Agents = 1;
185191
}
186192

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

@@ -323,7 +328,6 @@ Task("Pack-Nuget")
323328
.ToArray()
324329
};
325330

326-
FixForMono(nugetSettings, "nuget.exe");
327331
NuGetPack(package.NuspecPath, nugetSettings);
328332
}
329333
}
@@ -517,7 +521,7 @@ Task("Publish-AzurePipeline")
517521

518522
if (FileExists(parameters.Paths.Files.TestCoverageOutputFilePath)) {
519523
var data = new TFBuildPublishTestResultsData {
520-
TestResultsFiles = new[] { parameters.Paths.Files.TestCoverageOutputFilePath.ToString() },
524+
TestResultsFiles = new[] { parameters.Paths.Files.TestCoverageOutputFilePath },
521525
TestRunner = TFTestRunnerType.NUnit
522526
};
523527
TFBuild.Commands.PublishTestResults(data);
@@ -534,7 +538,7 @@ Task("Publish-Tfs")
534538
.WithCriteria<BuildParameters>((context, parameters) => parameters.EnabledPublishTfs, "Publish-Tfs was disabled.")
535539
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsRunningOnWindows, "Publish-Tfs works only on Windows agents.")
536540
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsRunningOnAppVeyor, "Publish-Tfs works only on AppVeyor.")
537-
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsStableRelease(), "Publish-Tfs works only for releases.")
541+
.WithCriteria<BuildParameters>((context, parameters) => parameters.IsStableRelease(), "Publish-Tfs works only for releases.")
538542
.IsDependentOn("Pack-Tfs")
539543
.Does<BuildParameters>((parameters) =>
540544
{

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.31.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: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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/tmpl/jobs.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
parameters:
2+
name: '' # defaults for any parameters that aren't specified
3+
vmImage: ''
4+
installRuby: 'true'
5+
jobs:
6+
- job: ${{ parameters.name }}
7+
pool:
8+
vmImage: ${{ parameters.vmImage }}
9+
steps:
10+
- task: DotNetCoreInstaller@0
11+
displayName: 'Use .NET Core sdk $(DOTNET_SDK_VERSION)'
12+
inputs:
13+
version: $(DOTNET_SDK_VERSION)
14+
packageType: $(DOTNET_PACKAGE_TYPE)
15+
- ${{ if eq(parameters.installRuby, 'true') }}:
16+
- task: UseRubyVersion@0
17+
inputs:
18+
versionSpec: $(RUBY_VERSION)
19+
addToPath: true # Optional
20+
- powershell: ./build.ps1 -script build.cake -target Default
21+
displayName: 'Cake build'

0 commit comments

Comments
 (0)