Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[repo] Package validation tweaks deux #4927

Merged
merged 5 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@
<OTelLatestStableVer>1.6.0</OTelLatestStableVer>
</PropertyGroup>

<Target Name="PreparePackageValidation" BeforeTargets="Restore">
<PropertyGroup>
<EnablePackageValidation Condition="'$(EnablePackageValidation)' == ''">true</EnablePackageValidation>
<PackageValidationBaselineVersion Condition="'$(MinVerTagPrefix)' == 'core-'">$(OTelLatestStableVer)</PackageValidationBaselineVersion>
</PropertyGroup>
</Target>

<!--
This section covers packages that are directly referenced by the NuGet packages published from this repository.
Any security vulnerability in these packages or their downstream dependencies will be considered as a security
Expand Down Expand Up @@ -68,7 +61,6 @@
<PackageVersion Include="Grpc.Tools" Version="[2.56.2,3.0)" />
<PackageVersion Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="[3.11.0-beta1.23402.2]" />
<PackageVersion Include="Microsoft.Data.SqlClient" Version="2.1.2" />
<PackageVersion Include="Microsoft.DotNet.ApiCompat" Version="6.0.0-beta.21308.1" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="[3.1.6,5.0)" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="3.1.20" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="[6.0.0,)" />
Expand Down
4 changes: 0 additions & 4 deletions NuGet.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<clear />
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
<add key="dotnet8" value="https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet8/nuget/v3/index.json" />
<add key=".Net Core Tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
</packageSources>

<!-- Define mappings by adding package patterns beneath the target source. -->
Expand All @@ -17,9 +16,6 @@
<packageSource key="dotnet8">
<package pattern="Microsoft.CodeAnalysis.PublicApiAnalyzers" />
</packageSource>
<packageSource key=".Net Core Tools">
<package pattern="Microsoft.DotNet.ApiCompat" />
</packageSource>
</packageSourceMapping>

<disabledPackageSources />
Expand Down
1 change: 1 addition & 0 deletions build/Common.prod.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<PropertyGroup>
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)/OpenTelemetry.prod.ruleset</CodeAnalysisRuleSet>
<ExposeExperimentalFeatures Condition="'$(ExposeExperimentalFeatures)' == ''">true</ExposeExperimentalFeatures>
<EnablePackageValidation Condition="'$(EnablePackageValidation)' == ''">false</EnablePackageValidation>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: package validation is an opt-in feature. No need to specify it here. Or am I missing something?

Suggested change
<EnablePackageValidation Condition="'$(EnablePackageValidation)' == ''">false</EnablePackageValidation>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a convenience thing so that when someone wants to test package validation from IDE we can toggle it to true and then kick off a package.

Copy link

@ViktorHofer ViktorHofer Oct 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Is there any reason why you don't want to enable it by default? That's what we usually recommend. Currently, it runs part of a single CI leg.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel passionately it shouldn't be ON by default. My thinking was, we have the public api analyzer currently. That's what we all suffer through at dev-time 😄 The CI also runs a pass through the package validation. If we turn this on by default, I don't think it will add much benefit. Because I don't think most devs run a pack ever. I think package validation only fires during pack? Basically it will just add some cycles at restore to fetch the stable versions which didn't seem crucial or really beneficial so I left it OFF.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fetching a baseline package during restore should be super fast and not be noticeable (especially as it's cached after the first restore) but I understand where you're coming from. Thanks for the clarification :)

</PropertyGroup>

<PropertyGroup Label="PackageProperties">
Expand Down
1 change: 1 addition & 0 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project>

<PropertyGroup>
<PackageValidationBaselineVersion Condition="'$(MinVerTagPrefix)' == 'core-'">$(OTelLatestStableVer)</PackageValidationBaselineVersion>
CodeBlanch marked this conversation as resolved.
Show resolved Hide resolved
<TargetFrameworkMonikerAssemblyAttributesPath>$([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)'))</TargetFrameworkMonikerAssemblyAttributesPath>
</PropertyGroup>

Expand Down