Skip to content

Commit d7b0192

Browse files
author
Jake Ginnivan
committed
Setup GitHubFlowVersion
1 parent 1bdfbab commit d7b0192

File tree

19 files changed

+192
-48
lines changed

19 files changed

+192
-48
lines changed

Build.cmd

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
@ECHO OFF
22

3-
SET msbuild="%windir%\Microsoft.NET\Framework\v4.0.30319\msbuild.exe"
4-
5-
IF '%1'=='' (SET configuration=Debug) ELSE (SET configuration=%1)
6-
IF '%2'=='' (SET platform="x86") ELSE (SET platform=%2)
7-
8-
:: Build the solution. Override the platform to account for running
9-
:: from Visual Studio Tools command prompt (x64). Log quietly to the
10-
:: console and verbosely to a file.
11-
%msbuild% TestStack.White.proj /property:Platform=%platform% /property:Configuration=%configuration%
3+
%~dp0\tools\GitHubFlowVersion\GitHubFlowVersion.exe /ProjectFile %~dp0/TestStack.White.proj /UpdateAssemblyInfo
124

135
IF NOT ERRORLEVEL 0 EXIT /B %ERRORLEVEL%
146

NextVersion.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.0.0

TestStack.White.proj

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project DefaultTargets="Test;Publish" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project ToolsVersion="4.0" DefaultTargets="Test;Publish" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
44
<Root>$(MSBuildProjectDirectory)\</Root>
55
<BuildPlatform Condition="$(BuildPlatform) == ''">Any CPU</BuildPlatform>
@@ -27,7 +27,7 @@
2727
</Target>
2828

2929
<Target Name="Build" DependsOnTargets="Cleanup">
30-
<MSBuild Projects="$(Root)src\TestStack.White.sln" Properties="Configuration=$(Configuration);Platform=$(BuildPlatform)" />
30+
<MSBuild Projects="$(Root)src\TestStack.White.sln" Properties="Configuration=$(Configuration);Platform=$(BuildPlatform)" ToolsVersion="4.0" />
3131
</Target>
3232

3333
<Target Name="Test" DependsOnTargets="Build">
@@ -42,12 +42,9 @@
4242
</Target>
4343

4444
<Target Name="Publish">
45-
<PropertyGroup>
46-
<Version Condition="'$(Version)' == ''">0.0.0.0</Version>
47-
</PropertyGroup>
4845
<MakeDir Directories="$(Root)build\Artifacts" />
49-
<Exec Command="$(Root)src\.nuget\nuget.exe pack $(Root)src\TestStack.White\TestStack.White.nuspec -Version $(Version) -OutputDir $(Root)build\Artifacts -BasePath $(Root)src\TestStack.White\bin\$(Configuration)" />
50-
<Exec Command="$(Root)src\.nuget\nuget.exe pack $(Root)src\TestStack.White.ScreenObjects\TestStack.White.ScreenObjects.nuspec -Version $(Version) -OutputDir $(Root)build\Artifacts -BasePath $(Root)src\TestStack.White.ScreenObjects\bin\$(Configuration)" />
51-
<Exec Command="$(Root)src\.nuget\nuget.exe pack $(Root)src\TestStack.White.WebBrowser\TestStack.White.WebBrowser.nuspec -Version $(Version) -OutputDir $(Root)build\Artifacts -BasePath $(Root)src\TestStack.White.WebBrowser\bin\$(Configuration)" />
46+
<Exec Command="$(Root)src\.nuget\nuget.exe pack $(Root)src\TestStack.White\TestStack.White.nuspec -Version $(GitHubFlowVersion_SemVer) -OutputDir $(Root)build\Artifacts -BasePath $(Root)src\TestStack.White\bin\$(Configuration)" />
47+
<Exec Command="$(Root)src\.nuget\nuget.exe pack $(Root)src\TestStack.White.ScreenObjects\TestStack.White.ScreenObjects.nuspec -Version $(GitHubFlowVersion_SemVer) -OutputDir $(Root)build\Artifacts -BasePath $(Root)src\TestStack.White.ScreenObjects\bin\$(Configuration)" />
48+
<Exec Command="$(Root)src\.nuget\nuget.exe pack $(Root)src\TestStack.White.WebBrowser\TestStack.White.WebBrowser.nuspec -Version $(GitHubFlowVersion_SemVer) -OutputDir $(Root)build\Artifacts -BasePath $(Root)src\TestStack.White.WebBrowser\bin\$(Configuration)" />
5249
</Target>
5350
</Project>

src/.nuget/NuGet.exe

958 KB
Binary file not shown.

src/.nuget/NuGet.targets

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@
1717
</PropertyGroup>
1818

1919
<ItemGroup Condition=" '$(PackageSources)' == '' ">
20-
<!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
20+
<!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
21+
<!-- The official NuGet package source (https://www.nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
2122
<!--
22-
<PackageSource Include="https://nuget.org/api/v2/" />
23+
<PackageSource Include="https://www.nuget.org/api/v2/" />
2324
<PackageSource Include="https://my-nuget-source/nuget/" />
2425
-->
2526
</ItemGroup>
@@ -28,19 +29,17 @@
2829
<!-- Windows specific commands -->
2930
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
3031
<PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
31-
<PackagesDir>$([System.IO.Path]::Combine($(SolutionDir), "packages"))</PackagesDir>
3232
</PropertyGroup>
3333

3434
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
3535
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
3636
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
3737
<PackagesConfig>packages.config</PackagesConfig>
38-
<PackagesDir>$(SolutionDir)packages</PackagesDir>
3938
</PropertyGroup>
4039

4140
<PropertyGroup>
4241
<!-- NuGet command -->
43-
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\nuget.exe</NuGetExePath>
42+
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
4443
<PackageSources Condition=" $(PackageSources) == '' ">@(PackageSource)</PackageSources>
4544

4645
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
@@ -49,11 +48,16 @@
4948
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
5049

5150
<RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
51+
<NonInteractiveSwitch Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' ">-NonInteractive</NonInteractiveSwitch>
52+
53+
<PaddedSolutionDir Condition=" '$(OS)' == 'Windows_NT'">"$(SolutionDir) "</PaddedSolutionDir>
54+
<PaddedSolutionDir Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)"</PaddedSolutionDir>
55+
5256
<!-- Commands -->
53-
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(RequireConsentSwitch) -o "$(PackagesDir)"</RestoreCommand>
54-
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>
57+
<RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir)</RestoreCommand>
58+
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols</BuildCommand>
5559

56-
<!-- Make the build depend on restore packages -->
60+
<!-- We need to ensure packages are restored prior to assembly resolve -->
5761
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
5862
RestorePackages;
5963
$(BuildDependsOn);
@@ -69,8 +73,16 @@
6973
<Target Name="CheckPrerequisites">
7074
<!-- Raise an error if we're unable to locate nuget.exe -->
7175
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
72-
<SetEnvironmentVariable EnvKey="VisualStudioVersion" EnvValue="$(VisualStudioVersion)" Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' " />
73-
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
76+
<!--
77+
Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
78+
This effectively acts as a lock that makes sure that the download operation will only happen once and all
79+
parallel builds will have to wait for it to complete.
80+
-->
81+
<MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT;DownloadNuGetExe=$(DownloadNuGetExe)" />
82+
</Target>
83+
84+
<Target Name="_DownloadNuGet">
85+
<DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
7486
</Target>
7587

7688
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
@@ -109,7 +121,7 @@
109121
110122
Log.LogMessage("Downloading latest version of NuGet.exe...");
111123
WebClient webClient = new WebClient();
112-
webClient.DownloadFile("https://nuget.org/nuget.exe", OutputFilename);
124+
webClient.DownloadFile("https://www.nuget.org/nuget.exe", OutputFilename);
113125
114126
return true;
115127
}
@@ -121,23 +133,4 @@
121133
</Code>
122134
</Task>
123135
</UsingTask>
124-
125-
<UsingTask TaskName="SetEnvironmentVariable" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
126-
<ParameterGroup>
127-
<EnvKey ParameterType="System.String" Required="true" />
128-
<EnvValue ParameterType="System.String" Required="true" />
129-
</ParameterGroup>
130-
<Task>
131-
<Using Namespace="System" />
132-
<Code Type="Fragment" Language="cs">
133-
<![CDATA[
134-
try {
135-
Environment.SetEnvironmentVariable(EnvKey, EnvValue, System.EnvironmentVariableTarget.Process);
136-
}
137-
catch {
138-
}
139-
]]>
140-
</Code>
141-
</Task>
142-
</UsingTask>
143136
</Project>

src/.nuget/packages.config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="GitReleaseNotes" version="0.2.1" />
4+
</packages>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<ProjectConfiguration>
2+
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
3+
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
4+
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies>
5+
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
6+
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
7+
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
8+
<RunPreBuildEvents>false</RunPreBuildEvents>
9+
<RunPostBuildEvents>false</RunPostBuildEvents>
10+
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
11+
<InstrumentAssembly>true</InstrumentAssembly>
12+
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
13+
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
14+
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
15+
<DefaultTestTimeout>60000</DefaultTestTimeout>
16+
<UseBuildConfiguration></UseBuildConfiguration>
17+
<UseBuildPlatform></UseBuildPlatform>
18+
<ProxyProcessPath></ProxyProcessPath>
19+
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
20+
<IgnoredTests>
21+
<RegexTestSelector>
22+
<RegularExpression>.*</RegularExpression>
23+
</RegexTestSelector>
24+
</IgnoredTests>
25+
</ProjectConfiguration>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<ProjectConfiguration>
2+
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
3+
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
4+
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies>
5+
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
6+
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
7+
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
8+
<RunPreBuildEvents>false</RunPreBuildEvents>
9+
<RunPostBuildEvents>false</RunPostBuildEvents>
10+
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
11+
<InstrumentAssembly>true</InstrumentAssembly>
12+
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
13+
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
14+
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
15+
<DefaultTestTimeout>60000</DefaultTestTimeout>
16+
<UseBuildConfiguration></UseBuildConfiguration>
17+
<UseBuildPlatform></UseBuildPlatform>
18+
<ProxyProcessPath></ProxyProcessPath>
19+
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
20+
<IgnoredTests>
21+
<RegexTestSelector>
22+
<RegularExpression>.*</RegularExpression>
23+
</RegexTestSelector>
24+
</IgnoredTests>
25+
</ProjectConfiguration>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<ProjectConfiguration>
2+
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
3+
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
4+
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies>
5+
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
6+
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
7+
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
8+
<RunPreBuildEvents>false</RunPreBuildEvents>
9+
<RunPostBuildEvents>false</RunPostBuildEvents>
10+
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
11+
<InstrumentAssembly>true</InstrumentAssembly>
12+
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
13+
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
14+
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
15+
<DefaultTestTimeout>60000</DefaultTestTimeout>
16+
<UseBuildConfiguration></UseBuildConfiguration>
17+
<UseBuildPlatform></UseBuildPlatform>
18+
<ProxyProcessPath></ProxyProcessPath>
19+
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
20+
<MSTestThreadApartmentState>STA</MSTestThreadApartmentState>
21+
<BuildProcessArchitecture>x86</BuildProcessArchitecture>
22+
<IgnoredTests>
23+
<RegexTestSelector>
24+
<RegularExpression>.*</RegularExpression>
25+
</RegexTestSelector>
26+
</IgnoredTests>
27+
</ProjectConfiguration>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<ProjectConfiguration>
2+
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
3+
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
4+
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies>
5+
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
6+
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
7+
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
8+
<RunPreBuildEvents>false</RunPreBuildEvents>
9+
<RunPostBuildEvents>false</RunPostBuildEvents>
10+
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
11+
<InstrumentAssembly>true</InstrumentAssembly>
12+
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
13+
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
14+
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
15+
<DefaultTestTimeout>60000</DefaultTestTimeout>
16+
<UseBuildConfiguration></UseBuildConfiguration>
17+
<UseBuildPlatform></UseBuildPlatform>
18+
<ProxyProcessPath></ProxyProcessPath>
19+
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
20+
<IgnoredTests>
21+
<RegexTestSelector>
22+
<RegularExpression>.*</RegularExpression>
23+
</RegexTestSelector>
24+
</IgnoredTests>
25+
</ProjectConfiguration>

0 commit comments

Comments
 (0)