-
Notifications
You must be signed in to change notification settings - Fork 796
/
Copy pathCommon.prod.props
203 lines (174 loc) · 11.1 KB
/
Common.prod.props
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<Project>
<Import Project=".\Common.props" />
<PropertyGroup>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)/OpenTelemetry.prod.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Label="BuildFlags">
<ExposeExperimentalFeatures Condition="'$(ExposeExperimentalFeatures)' == ''">true</ExposeExperimentalFeatures>
<EnablePackageValidation Condition="'$(EnablePackageValidation)' == ''">false</EnablePackageValidation>
</PropertyGroup>
<PropertyGroup Label="PackageProperties">
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/open-telemetry/opentelemetry-dotnet</RepositoryUrl>
<PackageTags>Observability;OpenTelemetry;Monitoring;Telemetry;Tracing;Metrics;Logging</PackageTags>
<PackageIcon>opentelemetry-icon-color.png</PackageIcon>
<PackageProjectUrl>https://opentelemetry.io</PackageProjectUrl>
<Authors>OpenTelemetry Authors</Authors>
<Copyright>Copyright The OpenTelemetry Authors</Copyright>
<PackageOutputPath Condition="$(Build_ArtifactStagingDirectory) != ''">$(Build_ArtifactStagingDirectory)</PackageOutputPath>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackagePrimaryLicenseFile>$(RepoRoot)\LICENSE.TXT</PackagePrimaryLicenseFile>
<PackageThirdPartyNoticesFile>$(RepoRoot)\THIRD-PARTY-NOTICES.TXT</PackageThirdPartyNoticesFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageChangelogFile>CHANGELOG.md</PackageChangelogFile>
<PackageReleaseNotesFile>$(RepoRoot)\RELEASENOTES.md</PackageReleaseNotesFile>
</PropertyGroup>
<PropertyGroup Label="SourceLinkProperties">
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<ContinuousIntegrationBuild Condition="'$(Deterministic)'=='true'">true</ContinuousIntegrationBuild>
</PropertyGroup>
<ItemGroup>
<!-- Note: Disable net6.0 target for package validation because it has been
removed. It should be possible to remove this once a stable version has been
released to NuGet without net6.0. -->
<PackageValidationBaselineFrameworkToIgnore Include="net6.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MinVer" PrivateAssets="All" Condition="'$(IntegrationBuild)' != 'true'" />
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" Condition="'$(IntegrationBuild)' != 'true'" />
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)opentelemetry-icon-color.png" Pack="true" PackagePath="\" />
<SourceRoot Condition="'$(Deterministic)'=='true'" Include="$(MSBuildThisFileDirectory)/" />
<None Include="$(IntermediateOutputPath)$(ProjectName).BuildFlags.txt"
Link="$(ProjectName).BuildFlags.txt"
CopyToOutputDirectory="PreserveNewest"
Visible="false" />
<!-- Note: This includes all the PublicApiAnalyzers files in projects to make editing easier in the IDE -->
<None Include=".publicApi\**\PublicAPI.*.txt" />
</ItemGroup>
<Target Name="IncludeSigningSignaturesInPackages" BeforeTargets="_GetTargetFrameworksOutput">
<!-- Note: This target adds any signatures found to nuget packages -->
<ItemGroup>
<SignatureFiles Include="$(RepoRoot)\src\$(MSBuildProjectName)\bin\$(Configuration)\*\$(MSBuildProjectName).dll-keyless.sig" />
<Content Include="@(SignatureFiles)" Link="%(RecursiveDir)%(Filename)%(Extension)" PackagePath="lib" />
<CertificateFiles Include="$(RepoRoot)\src\$(MSBuildProjectName)\bin\$(Configuration)\*\$(MSBuildProjectName).dll-keyless.pem" />
<Content Include="@(CertificateFiles)" Link="%(RecursiveDir)%(Filename)%(Extension)" PackagePath="lib" />
</ItemGroup>
<Message Importance="high" Text="**IncludeSignaturesInPackagesDebug** SignatureFiles: @(SignatureFiles)" />
<Message Importance="high" Text="**IncludeCertificatesInPackagesDebug** SignatureFiles: @(CertificateFiles)" />
</Target>
<Target Name="AssemblyVersionTarget" AfterTargets="MinVer" Condition="'$(MinVerVersion)' != '' AND '$(BuildNumber)' != ''">
<!-- Note: $(BuildNumber) is typically only set for builds initiated by the
publish workflow. The goal here is to set the assembly FileVersion and
resolve ExposeExperimentalFeatures based on the version MinVer resolved from
the git tag -->
<PropertyGroup>
<FileVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch).$(BuildNumber)</FileVersion>
<ExposeExperimentalFeatures Condition="'$(MinVerPreRelease)' != ''">true</ExposeExperimentalFeatures>
<ExposeExperimentalFeatures Condition="'$(MinVerPreRelease)' == ''">false</ExposeExperimentalFeatures>
</PropertyGroup>
<Error
Condition="'$(MinVerTagPrefix)' == 'coreunstable-' AND ('$(MinVerPreRelease)' == '' OR $(MinVerPreRelease.StartsWith('rc')))"
Text="Unstable core packages cannot be released stable or as release candidates." />
<!-- Note: The '$(TargetFramework)' != '' check here is to reduce log spam
in builds like dotnet pack which fire MinVer but don't resolve the actual
TargetFramework -->
<Message
Condition="'$(TargetFramework)' != ''"
Importance="high"
Text="**AssemblyVersionDebug** TargetFramework: $(TargetFramework), MinVerVersion: $(MinVerVersion), BuildNumber: $(BuildNumber), FileVersion: $(FileVersion), ExposeExperimentalFeatures: $(ExposeExperimentalFeatures)" />
</Target>
<Target Name="EnsurePackageValidationBaselineVersion"
BeforeTargets="RunPackageValidation"
Condition="'$(DisablePackageBaselineValidation)' != 'true' AND '$(PackageValidationBaselineVersion)' == '' AND '$(MinVerTagPrefix)' != 'coreunstable-'">
<Error Text="Cannot perform package validation without a baseline package version." />
</Target>
<Target Name="IncludeReadmeAndReleaseNotesInPackages" BeforeTargets="_GetTargetFrameworksOutput">
<!-- Note: This target runs during pack to convert relative links in
markdowns into github permalinks which will work when rendered on Nuget. -->
<Exec
Command="git rev-parse HEAD"
ConsoleToMsBuild="True"
IgnoreExitCode="True"
StandardOutputImportance="low">
<Output PropertyName="GitCommitConsoleOutput" TaskParameter="ConsoleOutput"/>
<Output PropertyName="GitCommitExitCode" TaskParameter="ExitCode"/>
</Exec>
<Exec
Command="git remote get-url origin"
ConsoleToMsBuild="True"
IgnoreExitCode="True"
StandardOutputImportance="low">
<Output PropertyName="GitOriginConsoleOutput" TaskParameter="ConsoleOutput"/>
<Output PropertyName="GitOriginExitCode" TaskParameter="ExitCode"/>
</Exec>
<PropertyGroup>
<MarkdownCommentRegex>\[([^]]+?)\]\(\.(.+?)\)</MarkdownCommentRegex>
<GitHubRepoUrl>$(GitOriginConsoleOutput.Replace('.git',''))</GitHubRepoUrl>
<GitHubPermalinkUrl Condition="'$(PackTag)' != ''">$(GitHubRepoUrl)/blob/$(PackTag)</GitHubPermalinkUrl>
<GitHubPermalinkUrl Condition="'$(PackTag)' == ''">$(GitHubRepoUrl)/blob/$(GitCommitConsoleOutput)</GitHubPermalinkUrl>
</PropertyGroup>
<Message Importance="high" Text="**GitInformationDebug** GitCommitConsoleOutput: $(GitCommitConsoleOutput), GitCommitExitCode: $(GitCommitExitCode), GitOriginConsoleOutput: $(GitOriginConsoleOutput), GitOriginExitCode: $(GitOriginExitCode), GitHubPermalinkUrl: $(GitHubPermalinkUrl)" />
<ItemGroup>
<PackageMarkdownFiles Include="README.md" />
</ItemGroup>
<ItemGroup>
<PackageMarkdownFiles Update="@(PackageMarkdownFiles)" Path="$([MSBuild]::ValueOrDefault('%(FullPath)','').Replace('$(RepoRoot)', '').Replace('%(FileName)%(Extension)', ''))" />
</ItemGroup>
<WriteLinesToFile
File="$(IntermediateOutputPath)%(PackageMarkdownFiles.Filename)%(PackageMarkdownFiles.Extension)"
Lines="$([System.Text.RegularExpressions.Regex]::Replace($([System.IO.File]::ReadAllText(%(PackageMarkdownFiles.FullPath))), '$(MarkdownCommentRegex)', '[$1]($(GitHubPermalinkUrl)%(PackageMarkdownFiles.Path).$2)').Replace('\', '/'))"
Overwrite="true"
Encoding="UTF-8"/>
<PropertyGroup>
<_PackageReleaseNotesFilePath>$([System.IO.Path]::GetFullPath('$(PackageReleaseNotesFile)').Replace('$(RepoRoot)', '').Replace('\', '/'))</_PackageReleaseNotesFilePath>
<_PackageChangelogFilePath>$([System.IO.Path]::GetFullPath('$(PackageChangelogFile)').Replace('$(RepoRoot)', '').Replace('\', '/'))</_PackageChangelogFilePath>
<PackageReleaseNotes>
For highlights and announcements see: $(GitHubPermalinkUrl)$(_PackageReleaseNotesFilePath).
For detailed changes see: $(GitHubPermalinkUrl)$(_PackageChangelogFilePath).
</PackageReleaseNotes>
</PropertyGroup>
<ItemGroup>
<Content Include="$(IntermediateOutputPath)*.md" PackagePath="/" />
</ItemGroup>
</Target>
<Target Name="ResolveExposeExperimentalFeatures" BeforeTargets="CoreCompile" DependsOnTargets="AssemblyVersionTarget">
<!-- Note: This runs for all builds. The goal here is to set the
EXPOSE_EXPERIMENTAL_FEATURES compiler constant if
$(ExposeExperimentalFeatures) is enabled and then select the correct api
files for the analyzer -->
<PropertyGroup Condition="'$(ExposeExperimentalFeatures)' == 'true'">
<DefineConstants>$(DefineConstants);EXPOSE_EXPERIMENTAL_FEATURES</DefineConstants>
</PropertyGroup>
<!-- Note: We write a file into the output dir which captures the state of
ExposeExperimentalFeatures for the current compilation. This is used by
consuming projects (tests, benchmarks, examples, etc) to add compiler
constants which can be used to detect experimental APIs -->
<WriteLinesToFile
File="$(IntermediateOutputPath)$(ProjectName).BuildFlags.txt"
Lines="ExposeExperimentalFeatures=$(ExposeExperimentalFeatures)"
Overwrite="true"/>
<!-- Note: This selects the correct PublicApiAnalyzers files based on $(ExposeExperimentalFeatures) -->
<ItemGroup>
<AdditionalFiles Include=".publicApi\Stable\PublicAPI.*.txt" />
<AdditionalFiles Include=".publicApi\Stable\$(TargetFramework)\PublicAPI.*.txt" />
<AdditionalFiles Include=".publicApi\Experimental\PublicAPI.*.txt" Condition="'$(ExposeExperimentalFeatures)' == 'true'" />
<AdditionalFiles Include=".publicApi\Experimental\$(TargetFramework)\PublicAPI.*.txt" Condition="'$(ExposeExperimentalFeatures)' == 'true'" />
<AdditionalFiles Include=".publicApi\PublicAPI.*.txt" />
<AdditionalFiles Include=".publicApi\$(TargetFramework)\PublicAPI.*.txt" />
</ItemGroup>
<!-- Note: The '$(BuildNumber)' != '' check here is to reduce log spam in
local and CI builds. We only want to log this for the publish workflows
where official builds are generated -->
<Message
Condition="'$(BuildNumber)' != ''"
Importance="high"
Text="**ResolveExposeExperimentalFeaturesDebug** TargetFramework: $(TargetFramework), DefineConstants: $(DefineConstants)" />
</Target>
</Project>