Skip to content

Commit c265420

Browse files
committed
Merge branch 'release/0.1.7'
2 parents 28b6f16 + e067073 commit c265420

12 files changed

+180
-79
lines changed

GitVersion.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
mode: ContinuousDeployment
2+
branches: {}
3+
ignore:
4+
sha: []

appveyor.yml

+22-10
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,40 @@
1-
# Build script
1+
#---------------------------------#
2+
# Build Image #
3+
#---------------------------------#
4+
image: Visual Studio 2017
5+
6+
#---------------------------------#
7+
# Build Init #
8+
#---------------------------------#
29
init:
310
- git config --global core.autocrlf true
411

5-
image: Visual Studio 2017
6-
7-
# Build script
12+
#---------------------------------#
13+
# Build Script #
14+
#---------------------------------#
815
build_script:
9-
- ps: .\build.ps1 -Target AppVeyor -Verbosity Diagnostic
16+
- ps: .\build.ps1 --target="AppVeyor"
1017

18+
#---------------------------------#
1119
# Tests
20+
#---------------------------------#
1221
test: off
1322

14-
# Branches to build
23+
#---------------------------------#
24+
# Branches to build #
25+
#---------------------------------#
1526
branches:
1627
# Whitelist
1728
only:
1829
- develop
1930
- master
20-
- /r/.*/
2131
- /release/.*/
2232
- /hotfix/.*/
2333
- /feature/.*/
24-
- /improve/.*/
2534

26-
# Build cache
35+
#---------------------------------#
36+
# Build Cache #
37+
#---------------------------------#
2738
cache:
28-
- tools -> setup.cake
39+
- tools -> build.cake
40+
- packages -> build.cake

build.ps1

+95-42
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,10 @@ The build script target to run.
2121
The build configuration to use.
2222
.PARAMETER Verbosity
2323
Specifies the amount of information to be displayed.
24-
.PARAMETER Experimental
25-
Tells Cake to use the latest Roslyn release.
26-
.PARAMETER WhatIf
27-
Performs a dry run of the build script.
28-
No tasks will be executed.
29-
.PARAMETER Mono
30-
Tells Cake to use the Mono scripting engine.
24+
.PARAMETER ShowDescription
25+
Shows description about tasks.
26+
.PARAMETER DryRun
27+
Performs a dry run.
3128
.PARAMETER SkipToolPackageRestore
3229
Skips restoring of packages.
3330
.PARAMETER ScriptArgs
@@ -40,21 +37,33 @@ https://cakebuild.net
4037

4138
[CmdletBinding()]
4239
Param(
43-
[string]$Script = "setup.cake",
44-
[string]$Target = "Default",
45-
[ValidateSet("Release", "Debug")]
46-
[string]$Configuration = "Release",
40+
[string]$Script = "recipe.cake",
41+
[string]$Target,
42+
[string]$Configuration,
4743
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
48-
[string]$Verbosity = "Verbose",
49-
[switch]$Experimental,
50-
[Alias("DryRun","Noop")]
51-
[switch]$WhatIf,
52-
[switch]$Mono,
44+
[string]$Verbosity,
45+
[switch]$ShowDescription,
46+
[Alias("WhatIf", "Noop")]
47+
[switch]$DryRun,
5348
[switch]$SkipToolPackageRestore,
5449
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
5550
[string[]]$ScriptArgs
5651
)
5752

53+
# Attempt to set highest encryption available for SecurityProtocol.
54+
# PowerShell will not set this by default (until maybe .NET 4.6.x). This
55+
# will typically produce a message for PowerShell v2 (just an info
56+
# message though)
57+
try {
58+
# Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48)
59+
# Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't
60+
# exist in .NET 4.0, even though they are addressable if .NET 4.5+ is
61+
# installed (.NET 4.5 is an in-place upgrade).
62+
[System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48
63+
} catch {
64+
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'
65+
}
66+
5867
[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null
5968
function MD5HashFile([string] $filePath)
6069
{
@@ -80,38 +89,31 @@ function MD5HashFile([string] $filePath)
8089
}
8190
}
8291

92+
function GetProxyEnabledWebClient
93+
{
94+
$wc = New-Object System.Net.WebClient
95+
$proxy = [System.Net.WebRequest]::GetSystemWebProxy()
96+
$proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
97+
$wc.Proxy = $proxy
98+
return $wc
99+
}
100+
83101
Write-Host "Preparing to run build script..."
84102

85103
if(!$PSScriptRoot){
86104
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
87105
}
88106

89107
$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
108+
$ADDINS_DIR = Join-Path $TOOLS_DIR "Addins"
109+
$MODULES_DIR = Join-Path $TOOLS_DIR "Modules"
90110
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
91111
$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"
92112
$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
93113
$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config"
94114
$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum"
95-
96-
# Should we use mono?
97-
$UseMono = "";
98-
if($Mono.IsPresent) {
99-
Write-Verbose -Message "Using the Mono based scripting engine."
100-
$UseMono = "-mono"
101-
}
102-
103-
# Should we use the new Roslyn?
104-
$UseExperimental = "";
105-
if($Experimental.IsPresent -and !($Mono.IsPresent)) {
106-
Write-Verbose -Message "Using experimental version of Roslyn."
107-
$UseExperimental = "-experimental"
108-
}
109-
110-
# Is this a dry run?
111-
$UseDryRun = "";
112-
if($WhatIf.IsPresent) {
113-
$UseDryRun = "-dryrun"
114-
}
115+
$ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config"
116+
$MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config"
115117

116118
# Make sure tools folder exists
117119
if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
@@ -122,7 +124,10 @@ if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
122124
# Make sure that packages.config exist.
123125
if (!(Test-Path $PACKAGES_CONFIG)) {
124126
Write-Verbose -Message "Downloading packages.config..."
125-
try { (New-Object System.Net.WebClient).DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) } catch {
127+
try {
128+
$wc = GetProxyEnabledWebClient
129+
$wc.DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG)
130+
} catch {
126131
Throw "Could not download packages.config."
127132
}
128133
}
@@ -142,7 +147,8 @@ if (!(Test-Path $NUGET_EXE)) {
142147
if (!(Test-Path $NUGET_EXE)) {
143148
Write-Verbose -Message "Downloading NuGet.exe..."
144149
try {
145-
(New-Object System.Net.WebClient).DownloadFile($NUGET_URL, $NUGET_EXE)
150+
$wc = GetProxyEnabledWebClient
151+
$wc.DownloadFile($NUGET_URL, $NUGET_EXE)
146152
} catch {
147153
Throw "Could not download NuGet.exe."
148154
}
@@ -161,20 +167,56 @@ if(-Not $SkipToolPackageRestore.IsPresent) {
161167
if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or
162168
($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) {
163169
Write-Verbose -Message "Missing or changed package.config hash..."
164-
Remove-Item * -Recurse -Exclude packages.config,nuget.exe
170+
Get-ChildItem -Exclude packages.config,nuget.exe,Cake.Bakery |
171+
Remove-Item -Recurse
165172
}
166173

167174
Write-Verbose -Message "Restoring tools from NuGet..."
168175
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""
169176

170177
if ($LASTEXITCODE -ne 0) {
171-
Throw "An error occured while restoring NuGet tools."
178+
Throw "An error occurred while restoring NuGet tools."
172179
}
173180
else
174181
{
175182
$md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII"
176183
}
177184
Write-Verbose -Message ($NuGetOutput | out-string)
185+
186+
Pop-Location
187+
}
188+
189+
# Restore addins from NuGet
190+
if (Test-Path $ADDINS_PACKAGES_CONFIG) {
191+
Push-Location
192+
Set-Location $ADDINS_DIR
193+
194+
Write-Verbose -Message "Restoring addins from NuGet..."
195+
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`""
196+
197+
if ($LASTEXITCODE -ne 0) {
198+
Throw "An error occurred while restoring NuGet addins."
199+
}
200+
201+
Write-Verbose -Message ($NuGetOutput | out-string)
202+
203+
Pop-Location
204+
}
205+
206+
# Restore modules from NuGet
207+
if (Test-Path $MODULES_PACKAGES_CONFIG) {
208+
Push-Location
209+
Set-Location $MODULES_DIR
210+
211+
Write-Verbose -Message "Restoring modules from NuGet..."
212+
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`""
213+
214+
if ($LASTEXITCODE -ne 0) {
215+
Throw "An error occurred while restoring NuGet modules."
216+
}
217+
218+
Write-Verbose -Message ($NuGetOutput | out-string)
219+
178220
Pop-Location
179221
}
180222

@@ -183,7 +225,18 @@ if (!(Test-Path $CAKE_EXE)) {
183225
Throw "Could not find Cake.exe at $CAKE_EXE"
184226
}
185227

228+
229+
230+
# Build Cake arguments
231+
$cakeArguments = @("$Script");
232+
if ($Target) { $cakeArguments += "-target=$Target" }
233+
if ($Configuration) { $cakeArguments += "-configuration=$Configuration" }
234+
if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" }
235+
if ($ShowDescription) { $cakeArguments += "-showdescription" }
236+
if ($DryRun) { $cakeArguments += "-dryrun" }
237+
$cakeArguments += $ScriptArgs
238+
186239
# Start Cake
187240
Write-Host "Running build script..."
188-
Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs"
189-
exit $LASTEXITCODE
241+
&$CAKE_EXE $cakeArguments
242+
exit $LASTEXITCODE

nuspec/nuget/VCSVersion.nuspec

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<package>
3+
<metadata>
4+
<id>VCSVersion</id>
5+
<title>VCSVersion</title>
6+
<version>0.0.0</version>
7+
<authors>vCipher</authors>
8+
<owners>vCipher, phantomtypist, hgtools, gep13</owners>
9+
<description>Provide Semantic versioning using Version Control System history.</description>
10+
<projectUrl>https://github.com/hgtools/VCSVersion</projectUrl>
11+
<iconUrl>https://avatars2.githubusercontent.com/u/49282992?v=3&amp;s=64</iconUrl>
12+
<requireLicenseAcceptance>true</requireLicenseAcceptance>
13+
<copyright>Copyright (c) vCipher 2017</copyright>
14+
<license type="expression">MIT</license>
15+
<repository type="git" url="https://github.com/hgtools/VCSVersion.git"/>
16+
<tags>vcs semver</tags>
17+
<dependencies>
18+
<dependency id="YamlDotNet" version="5.4.0" />
19+
</dependencies>
20+
</metadata>
21+
<files>
22+
<file src="net461/VCSVersion.dll" target="lib/net461" />
23+
<file src="net461/VCSVersion.pdb" target="lib/net461" />
24+
<file src="net461/VCSVersion.xml" target="lib/net461" />
25+
<file src="netstandard2.0/VCSVersion.dll" target="lib/netstandard2.0" />
26+
<file src="netstandard2.0/VCSVersion.pdb" target="lib/netstandard2.0" />
27+
<file src="netstandard2.0/VCSVersion.xml" target="lib/netstandard2.0" />
28+
</files>
29+
</package>

setup.cake recipe.cake

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#load nuget:https://www.myget.org/F/cake-contrib/api/v2?package=Cake.Recipe&prerelease
1+
#load nuget:?package=Cake.Recipe&version=1.1.0
22

33
Environment.SetVariableNames();
44

@@ -7,11 +7,15 @@ BuildParameters.SetParameters(
77
buildSystem: BuildSystem,
88
sourceDirectoryPath: "./src",
99
title: "VCSVersion",
10-
repositoryOwner: "vCipher",
10+
repositoryOwner: "hgtools",
1111
repositoryName: "VCSVersion",
12-
appVeyorAccountName: "vCipher",
12+
appVeyorAccountName: "hgtools",
13+
shouldPostToGitter: false,
14+
shouldPostToSlack: false,
15+
shouldPostToTwitter: false,
16+
shouldPostToMicrosoftTeams: false,
1317
shouldRunCodecov: false,
14-
shouldRunDotNetCorePack: true,
18+
shouldRunGitVersion: true,
1519
solutionFilePath: "./src/VCSVersion.sln");
1620

1721
BuildParameters.PrintParameters(Context);

src/VCSVersion/VCSVersion.csproj

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
<AssemblyName>VCSVersion</AssemblyName>
55
<PackageId>VCSVersion</PackageId>
66
<Authors>vCipher</Authors>
7-
<Description>Provide Semantic versioning using Version Control System history</Description>
7+
<Description>Provide Semantic versioning using Version Control System history.</Description>
88
<GenerateDocumentationFile>true</GenerateDocumentationFile>
99
<Copyright>Copyright © vCipher 2017</Copyright>
10-
<PackageProjectUrl>https://github.com/vCipher/VCSVersion</PackageProjectUrl>
11-
<RepositoryUrl>https://github.com/vCipher/VCSVersion</RepositoryUrl>
12-
<PackageTags>cake vcs semver</PackageTags>
10+
<PackageProjectUrl>https://github.com/hgtools/VCSVersion</PackageProjectUrl>
11+
<RepositoryUrl>https://github.com/hgtools/VCSVersion</RepositoryUrl>
12+
<PackageTags>vcs semver</PackageTags>
1313
<NoWarn>1591</NoWarn>
1414
</PropertyGroup>
1515
<ItemGroup>
16-
<PackageReference Include="YamlDotNet" Version="4.2.3" />
16+
<PackageReference Include="YamlDotNet" Version="5.4.0" />
1717
</ItemGroup>
1818
</Project>

src/VCSVersionTests/VCSVersionTests.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<TargetFramework>netcoreapp2.0</TargetFramework>
44
</PropertyGroup>
55
<ItemGroup>
6-
<PackageReference Include="AutoFixture" Version="3.51.0" />
7-
<PackageReference Include="AutoFixture.AutoMoq" Version="3.51.0" />
6+
<PackageReference Include="AutoFixture" Version="4.8.0" />
7+
<PackageReference Include="AutoFixture.AutoMoq" Version="4.8.0" />
88
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
99
<PackageReference Include="Moq" Version="4.8.0" />
1010
<PackageReference Include="NUnit" Version="3.9.0" />

0 commit comments

Comments
 (0)