Skip to content

Commit 9d067cb

Browse files
Restrict versioning + sourcelink to CI only.
1 parent 9b1179f commit 9d067cb

File tree

3 files changed

+66
-47
lines changed

3 files changed

+66
-47
lines changed

msbuild/props/SixLabors.Global.props

Lines changed: 54 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,58 @@
1010
that is done by the file that imports us.
1111
-->
1212

13+
<!-- Define Environmental conditionals -->
14+
<!-- Determined by environmental settings set in build-and-test.yml-->
15+
<PropertyGroup>
16+
<IsContinuousIntegration Condition="'$(CI)' == 'true'">true</IsContinuousIntegration>
17+
<IsCodeCoverage Condition="'$(codecov)' != ''">true</IsCodeCoverage>
18+
</PropertyGroup>
19+
<Choose>
20+
<When Condition="'$(IsContinuousIntegration)'=='true'">
21+
<PropertyGroup>
22+
<DefineConstants>$(DefineConstants);ENV_CI</DefineConstants>
23+
</PropertyGroup>
24+
</When>
25+
<When Condition="'$(IsCodeCoverage)'=='true'">
26+
<PropertyGroup>
27+
<DefineConstants>$(DefineConstants);ENV_CODECOV</DefineConstants>
28+
</PropertyGroup>
29+
</When>
30+
</Choose>
31+
32+
<!--Define OS platform conditions and constants.
33+
https://docs.microsoft.com/en-us/visualstudio/msbuild/property-functions?view=vs-2019#msbuild-property-functions
34+
https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.osplatform?view=net-5.0#properties
35+
-->
36+
<PropertyGroup>
37+
<IsWindows Condition="$([MSBuild]::IsOSPlatform('Windows'))">true</IsWindows>
38+
<IsOSX Condition="$([MSBuild]::IsOSPlatform('OSX'))">true</IsOSX>
39+
<IsLinux Condition="$([MSBuild]::IsOSPlatform('Linux'))">true</IsLinux>
40+
<IsFreeBSD Condition="$([MSBuild]::IsOSPlatform('FreeBSD'))">true</IsFreeBSD>
41+
</PropertyGroup>
42+
<Choose>
43+
<When Condition="'$(IsWindows)'=='true'">
44+
<PropertyGroup>
45+
<DefineConstants>$(DefineConstants);OS_WINDOWS</DefineConstants>
46+
</PropertyGroup>
47+
</When>
48+
<When Condition="'$(IsOSX)'=='true'">
49+
<PropertyGroup>
50+
<DefineConstants>$(DefineConstants);OS_OSX</DefineConstants>
51+
</PropertyGroup>
52+
</When>
53+
<When Condition="'$(IsLinux)'=='true'">
54+
<PropertyGroup>
55+
<DefineConstants>$(DefineConstants);OS_LINUX</DefineConstants>
56+
</PropertyGroup>
57+
</When>
58+
<When Condition="'$(IsFreeBSD)'=='true'">
59+
<PropertyGroup>
60+
<DefineConstants>$(DefineConstants);OS_FREEBSD</DefineConstants>
61+
</PropertyGroup>
62+
</When>
63+
</Choose>
64+
1365
<!-- Compilation settings that explicitly differ from the Sdk.props/targets defaults -->
1466
<PropertyGroup>
1567
<LangVersion Condition="'$(LangVersion)' == ''">8.0</LangVersion>
@@ -19,7 +71,7 @@
1971
<NeutralLanguage>en</NeutralLanguage>
2072
<OverwriteReadOnlyFiles>true</OverwriteReadOnlyFiles>
2173
<DebugType>portable</DebugType>
22-
<DebugType Condition="'$(codecov)' != ''">full</DebugType>
74+
<DebugType Condition="'$(IsCodeCoverage)'=='true'">full</DebugType>
2375
<NullableContextOptions>disable</NullableContextOptions>
2476
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
2577
<CheckEolTargetFramework>false</CheckEolTargetFramework>
@@ -46,7 +98,7 @@
4698

4799
<!-- Ensure deterministic builds work when triggered against individual projects. -->
48100
<!-- https://github.com/dotnet/roslyn/issues/37379#issuecomment-513371985 -->
49-
<ItemGroup Condition="'$(CI)' == 'true'">
101+
<ItemGroup Condition="'$(IsContinuousIntegration)'=='true'">
50102
<SourceRoot Include="$(MSBuildThisFileDirectory)/"/>
51103
</ItemGroup>
52104

@@ -69,39 +121,6 @@
69121
<AdditionalFiles Include="$(MSBuildThisFileDirectory)..\..\stylecop.json" />
70122
</ItemGroup>
71123

72-
<!--Define OS platform conditions and constants.
73-
https://docs.microsoft.com/en-us/visualstudio/msbuild/property-functions?view=vs-2019#msbuild-property-functions
74-
https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.osplatform?view=net-5.0#properties
75-
-->
76-
<PropertyGroup>
77-
<IsWindows Condition="$([MSBuild]::IsOSPlatform('Windows'))">true</IsWindows>
78-
<IsOSX Condition="$([MSBuild]::IsOSPlatform('OSX'))">true</IsOSX>
79-
<IsLinux Condition="$([MSBuild]::IsOSPlatform('Linux'))">true</IsLinux>
80-
<IsFreeBSD Condition="$([MSBuild]::IsOSPlatform('FreeBSD'))">true</IsFreeBSD>
81-
</PropertyGroup>
82-
<Choose>
83-
<When Condition="'$(IsWindows)'=='true'">
84-
<PropertyGroup>
85-
<DefineConstants>$(DefineConstants);OS_WINDOWS</DefineConstants>
86-
</PropertyGroup>
87-
</When>
88-
<When Condition="'$(IsOSX)'=='true'">
89-
<PropertyGroup>
90-
<DefineConstants>$(DefineConstants);OS_OSX</DefineConstants>
91-
</PropertyGroup>
92-
</When>
93-
<When Condition="'$(IsLinux)'=='true'">
94-
<PropertyGroup>
95-
<DefineConstants>$(DefineConstants);OS_LINUX</DefineConstants>
96-
</PropertyGroup>
97-
</When>
98-
<When Condition="'$(IsFreeBSD)'=='true'">
99-
<PropertyGroup>
100-
<DefineConstants>$(DefineConstants);OS_FREEBSD</DefineConstants>
101-
</PropertyGroup>
102-
</When>
103-
</Choose>
104-
105124
<!-- Define target framework specific constants.
106125
https://apisof.net/
107126
+===================+=======+==========+=====================+=============+=================+====================+==============+=========+============|

msbuild/props/SixLabors.Src.props

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,6 @@
88
<GenerateDocumentationFile>true</GenerateDocumentationFile>
99
</PropertyGroup>
1010

11-
<!-- Add deterministic builds in CI .-->
12-
<PropertyGroup Condition="'$(CI)' == 'true'">
13-
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
14-
<EmbedUntrackedSources>true</EmbedUntrackedSources>
15-
</PropertyGroup>
16-
1711
<!-- Common NuGet package settings. -->
1812
<PropertyGroup>
1913
<Copyright>Copyright © Six Labors</Copyright>
@@ -22,22 +16,28 @@
2216
<VersionPrefix>0.0.1</VersionPrefix>
2317
<VersionPrefix Condition="'$(packageversion)' != ''">$(PackageVersion)</VersionPrefix>
2418
<VersionSuffix></VersionSuffix>
25-
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
2619
<RepositoryType>git</RepositoryType>
2720
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
2821
<PublishRepositoryUrl>true</PublishRepositoryUrl>
22+
</PropertyGroup>
23+
24+
<!-- Deterministic settings. CI only .-->
25+
<PropertyGroup Condition="'$(IsContinuousIntegration)'=='true'">
26+
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
27+
<EmbedUntrackedSources>true</EmbedUntrackedSources>
28+
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
2929
<IncludeSymbols>true</IncludeSymbols>
3030
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
3131
</PropertyGroup>
3232

33-
<!-- Package references and additional files which are consumed by src projects -->
34-
<ItemGroup>
33+
<!-- Package references and additional files which are consumed by src projects. CI Only -->
34+
<ItemGroup Condition="'$(IsContinuousIntegration)'=='true'">
3535
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" IsImplicitlyDefined="true" />
3636
<PackageReference Include="MinVer" PrivateAssets="All" Version="2.3.1" IsImplicitlyDefined="true"/>
3737
</ItemGroup>
3838

39-
<!--MinVer Properties for versioning-->
40-
<PropertyGroup>
39+
<!--MinVer Properties for versioning. CI only-->
40+
<PropertyGroup Condition="'$(IsContinuousIntegration)'=='true'">
4141
<MinVerTagPrefix>v</MinVerTagPrefix>
4242
<MinVerVerbosity>normal</MinVerVerbosity>
4343
</PropertyGroup>

msbuild/props/SixLabors.Tests.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
Version="3.0.2"
2323
PrivateAssets="All"
2424
IsImplicitlyDefined="true"
25-
Condition="'$(codecov)' == 'true'"/>
25+
Condition="'$(IsCodeCoverage)'=='true'"/>
2626

2727
<!-- Maximum compatible version for xunit with netcore 2.0 -->
2828
<PackageReference Include="Microsoft.NET.Test.Sdk"

0 commit comments

Comments
 (0)