Skip to content

Commit 1d8eb55

Browse files
authored
Merge pull request #2803 from sharwell/unstable-package
Adopt Nerdbank.GitVersioning
2 parents 65d8711 + e735565 commit 1d8eb55

File tree

7 files changed

+126
-18
lines changed

7 files changed

+126
-18
lines changed

StyleCop.Analyzers/Directory.Build.props

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
<Company>Tunnel Vision Laboratories, LLC</Company>
88
<Copyright>Copyright © Tunnel Vision Laboratories, LLC 2015</Copyright>
99
<NeutralLanguage>en-US</NeutralLanguage>
10-
11-
<Version>1.1.0.40</Version>
12-
<FileVersion>1.1.0.40</FileVersion>
13-
<InformationalVersion>1.1.0-dev</InformationalVersion>
1410
</PropertyGroup>
1511

1612
<PropertyGroup>
@@ -41,6 +37,10 @@
4137
<NoWarn>$(NoWarn),1573,1591,1712</NoWarn>
4238
</PropertyGroup>
4339

40+
<ItemGroup>
41+
<PackageReference Include="Nerdbank.GitVersioning" Version="2.2.13" PrivateAssets="all" />
42+
</ItemGroup>
43+
4444
<ItemGroup>
4545
<PackageReference Include="AsyncUsageAnalyzers" Version="1.0.0-alpha003" PrivateAssets="all" />
4646
<PackageReference Include="DotNetAnalyzers.DocumentationAnalyzers" Version="1.0.0-beta.46" PrivateAssets="all" />

StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/StyleCop.Analyzers.CodeFixes.csproj

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@
66
<RootNamespace>StyleCop.Analyzers</RootNamespace>
77
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
88
<IncludeSymbols>true</IncludeSymbols>
9-
<NuspecFile>StyleCop.Analyzers.nuspec</NuspecFile>
10-
<NuspecProperties>configuration=$(Configuration);version=$(InformationalVersion)</NuspecProperties>
9+
10+
<NuspecFile Condition="'$(MetadataPackage)' != 'true'">StyleCop.Analyzers.nuspec</NuspecFile>
11+
<NuspecFile Condition="'$(MetadataPackage)' == 'true'">StyleCop.Analyzers.Metadata.nuspec</NuspecFile>
12+
</PropertyGroup>
13+
14+
<PropertyGroup>
15+
<!-- This package intentionally uses SemVer 2. -->
16+
<NoWarn>$(NoWarn),NU5105</NoWarn>
1117
</PropertyGroup>
1218

1319
<Choose>
@@ -41,4 +47,38 @@
4147
<ProjectReference Include="..\StyleCop.Analyzers\StyleCop.Analyzers.csproj" />
4248
</ItemGroup>
4349

50+
<Target Name="SetNuspecProperties" AfterTargets="GetBuildVersion">
51+
<PropertyGroup>
52+
<BaseNuspecId>StyleCop.Analyzers</BaseNuspecId>
53+
<ImplementationNuspecId>$(BaseNuspecId)</ImplementationNuspecId>
54+
<MetadataNuspecId>$(BaseNuspecId)</MetadataNuspecId>
55+
56+
<ImplementationNuspecId Condition="'$(PrereleaseVersion)' != ''">$(BaseNuspecId).Unstable</ImplementationNuspecId>
57+
<MetadataNuspecId Condition="'$(PrereleaseVersion)' == ''">$(BaseNuspecId).Unstable</MetadataNuspecId>
58+
59+
<NuspecId Condition="'$(MetadataPackage)' != 'true'">$(ImplementationNuspecId)</NuspecId>
60+
<NuspecId Condition="'$(MetadataPackage)' == 'true'">$(MetadataNuspecId)</NuspecId>
61+
62+
<NuspecUnstableVersion>$(AssemblyVersion)</NuspecUnstableVersion>
63+
<NuspecUnstableVersion Condition="'$(PublicRelease)' != 'true'">$(NuspecUnstableVersion)-g$(GitCommitIdShort)</NuspecUnstableVersion>
64+
<NuspecStableVersion>$(PackageVersion)</NuspecStableVersion>
65+
66+
<UnstablePackage Condition="('$(PrereleaseVersion)' != '' AND '$(MetadataPackage)' != 'true') OR ('$(PrereleaseVersion)' == '' AND '$(MetadataPackage)' == 'true')">true</UnstablePackage>
67+
68+
<NuspecVersion Condition="'$(UnstablePackage)' != 'true'">$(NuspecStableVersion)</NuspecVersion>
69+
<NuspecVersion Condition="'$(UnstablePackage)' == 'true'">$(NuspecUnstableVersion)</NuspecVersion>
70+
71+
<ImplementationNuspecVersion Condition="'$(PrereleaseVersion)' != ''">$(NuspecUnstableVersion)</ImplementationNuspecVersion>
72+
<ImplementationNuspecVersion Condition="'$(PrereleaseVersion)' == ''">$(NuspecStableVersion)</ImplementationNuspecVersion>
73+
74+
<NuspecProperties>id=$(NuspecId);configuration=$(Configuration);GitCommitIdShort=$(GitCommitIdShort);version=$(NuspecVersion);tag=$(NuspecStableVersion);implId=$(ImplementationNuspecId);implVersion=$(ImplementationNuspecVersion)</NuspecProperties>
75+
</PropertyGroup>
76+
</Target>
77+
78+
<Target Name="PackMetadata" AfterTargets="Pack" Condition="'$(MetadataPackage)' != 'true'">
79+
<MSBuild Projects="$(MSBuildProjectFullPath)"
80+
Targets="Pack"
81+
Properties="MetadataPackage=true;IncludeSymbols=false" />
82+
</Target>
83+
4484
</Project>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0"?>
2+
<package>
3+
<metadata minClientVersion="2.7">
4+
<id>$id$</id>
5+
<version>0.0.0</version>
6+
<title>$id$</title>
7+
<authors>Sam Harwell et. al.</authors>
8+
<owners>Sam Harwell</owners>
9+
<licenseUrl>https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/$GitCommitIdShort$/LICENSE</licenseUrl>
10+
<projectUrl>https://github.com/DotNetAnalyzers/StyleCopAnalyzers</projectUrl>
11+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
12+
<description>An implementation of StyleCop's rules using Roslyn analyzers and code fixes</description>
13+
<releaseNotes>https://github.com/DotNetAnalyzers/StyleCopAnalyzers/releases/$tag$</releaseNotes>
14+
<copyright>Copyright 2015 Tunnel Vision Laboratories, LLC</copyright>
15+
<tags>StyleCop DotNetAnalyzers Roslyn Diagnostic Analyzer</tags>
16+
<developmentDependency>true</developmentDependency>
17+
<dependencies>
18+
<dependency id="$implId$" version="$implVersion$"/>
19+
</dependencies>
20+
</metadata>
21+
<files>
22+
23+
<!-- Additional Files -->
24+
<file src="..\..\LICENSE" />
25+
<file src="..\..\THIRD-PARTY-NOTICES.txt" />
26+
27+
</files>
28+
</package>

StyleCop.Analyzers/StyleCop.Analyzers.CodeFixes/StyleCop.Analyzers.nuspec

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
11
<?xml version="1.0"?>
22
<package>
33
<metadata minClientVersion="2.7">
4-
<id>StyleCop.Analyzers</id>
4+
<id>$id$</id>
55
<version>0.0.0</version>
6-
<title>StyleCop.Analyzers</title>
6+
<title>$id$</title>
77
<authors>Sam Harwell et. al.</authors>
88
<owners>Sam Harwell</owners>
9-
<licenseUrl>https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/$version$/LICENSE</licenseUrl>
9+
<licenseUrl>https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/$GitCommitIdShort$/LICENSE</licenseUrl>
1010
<projectUrl>https://github.com/DotNetAnalyzers/StyleCopAnalyzers</projectUrl>
1111
<requireLicenseAcceptance>false</requireLicenseAcceptance>
1212
<description>An implementation of StyleCop's rules using Roslyn analyzers and code fixes</description>
13-
<releaseNotes>https://github.com/DotNetAnalyzers/StyleCopAnalyzers/releases/$version$</releaseNotes>
14-
<copyright>Copyright Sam Harwell 2015</copyright>
13+
<releaseNotes>https://github.com/DotNetAnalyzers/StyleCopAnalyzers/releases/$tag$</releaseNotes>
14+
<copyright>Copyright 2015 Tunnel Vision Laboratories, LLC</copyright>
1515
<tags>StyleCop DotNetAnalyzers Roslyn Diagnostic Analyzer</tags>
1616
<developmentDependency>true</developmentDependency>
1717
</metadata>
1818
<files>
1919

20+
<!-- Additional Files -->
21+
<file src="..\..\LICENSE" />
22+
<file src="..\..\THIRD-PARTY-NOTICES.txt" />
23+
2024
<!-- Binaries and symbols -->
2125
<file src="bin\$Configuration$\netstandard1.1\StyleCop.Analyzers.dll" target="analyzers\dotnet\cs" />
2226
<file src="bin\$Configuration$\netstandard1.1\**\StyleCop.Analyzers.resources.dll" target="analyzers\dotnet\cs" />

StyleCop.Analyzers/version.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
3+
"version": "1.1.0-beta.{height}",
4+
// The build number offset accounts for the delay in adopting Nerdbank.GitVersioning
5+
"buildNumberOffset": 40,
6+
"assemblyVersion": {
7+
"precision": "revision"
8+
},
9+
"publicReleaseRefSpec": [
10+
"^refs/heads/master$"
11+
],
12+
"nugetPackageVersion": {
13+
"semVer": 2
14+
},
15+
"cloudBuild": {
16+
"buildNumber": {
17+
"enabled": true
18+
}
19+
}
20+
}

appveyor.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,38 @@
1-
version: 1.0.{build}
1+
version: '{build}'
22
image: Visual Studio 2017
33
init:
44
- git config --global core.autocrlf true
5+
configuration:
6+
- Debug
7+
- Release
58
before_build:
69
- nuget restore
10+
skip_tags: true
711
build:
812
project: StyleCopAnalyzers.sln
913
verbosity: minimal
1014
test_script:
1115
- cd build
12-
- ps: .\opencover-report.ps1 -Debug -NoBuild -NoReport -AppVeyor
16+
- ps: |
17+
if ($env:Configuration -eq 'Debug') {
18+
.\opencover-report.ps1 -Debug -NoBuild -NoReport -AppVeyor
19+
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
20+
$packageConfig = [xml](Get-Content ..\.nuget\packages.config)
21+
$codecov_version = $packageConfig.SelectSingleNode('/packages/package[@id="Codecov"]').version
22+
$codecov = "..\packages\Codecov.$codecov_version\tools\codecov.exe"
23+
&$codecov -f '..\build\OpenCover.Reports\OpenCover.StyleCopAnalyzers.xml'
24+
} else {
25+
.\opencover-report.ps1 -NoBuild -NoReport -AppVeyor
26+
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
27+
}
1328
- cd ..
14-
- .\packages\Codecov.1.1.0\tools\codecov.exe -f ".\build\OpenCover.Reports\OpenCover.StyleCopAnalyzers.xml"
15-
- .\StyleCop.Analyzers\StyleCop.Analyzers.Status.Generator\bin\Debug\net46\StyleCop.Analyzers.Status.Generator.exe .\StyleCopAnalyzers.sln > StyleCop.Analyzers.Status.json
29+
- .\StyleCop.Analyzers\StyleCop.Analyzers.Status.Generator\bin\%Configuration%\net46\StyleCop.Analyzers.Status.Generator.exe .\StyleCopAnalyzers.sln > StyleCop.Analyzers.Status.json
1630
cache:
1731
- packages -> **\packages.config
1832
- C:\Users\appveyor\.nuget\packages -> appveyor.yml
33+
34+
# 'Release' is hard-coded to ensure VSIX and NuGet artifacts are only published for release configuration builds
1935
artifacts:
20-
- path: 'StyleCop.Analyzers\**\*.vsix'
21-
- path: 'StyleCop.Analyzers\**\*.nupkg'
36+
- path: 'StyleCop.Analyzers\StyleCop.Analyzers.Vsix\bin\Release\net452\*.vsix'
37+
- path: 'StyleCop.Analyzers\StyleCop.Analyzers.CodeFixes\bin\Release\*.nupkg'
2238
- path: 'StyleCop.Analyzers.Status.json'

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ <h3>Commit information</h3>
173173
</script>
174174

175175
<script type="text/javascript">
176-
$.getJSON("https://ci.appveyor.com/api/projects/sharwell/stylecopanalyzers/artifacts/StyleCop.Analyzers.Status.json?branch=master&pr=false&stream=true", function (data) {
176+
$.getJSON("https://ci.appveyor.com/api/projects/sharwell/stylecopanalyzers/artifacts/StyleCop.Analyzers.Status.json?branch=master&pr=false&stream=true&job=Configuration:%20Release", function (data) {
177177
$("#renderedDiagnostics").html($.templates($("#diagnostics").html()).render(data));
178178
$("#renderedCommitInfo").html($.templates($("#commitInfo").html()).render(data.git));
179179
});

0 commit comments

Comments
 (0)