Skip to content

Skip validation of assembly version attributes for global CLI tool packages #680

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

Merged
merged 2 commits into from
May 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
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
12 changes: 12 additions & 0 deletions modules/NuGetPackageVerifier/console/Constants.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using NuGet.Packaging.Core;

namespace NuGetPackageVerifier
{
public class Constants
{
public static PackageType DotNetTool = new PackageType("DotnetTool", PackageType.EmptyVersion);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ public class DotNetToolPackageRule : IPackageVerifierRule
{
private const string ToolManifestFileName = "DotnetToolSettings.xml";

private static PackageType DotNetTool = new PackageType("DotnetTool", PackageType.EmptyVersion);

public IEnumerable<PackageVerifierIssue> Validate(PackageAnalysisContext context)
{
if (!context.Metadata.PackageTypes.Any(p => p == DotNetTool))
if (!context.Metadata.PackageTypes.Any(p => p == Constants.DotNetTool))
{
yield break;
}
Expand All @@ -28,7 +26,7 @@ public IEnumerable<PackageVerifierIssue> Validate(PackageAnalysisContext context

if (packageFiles == null || manifests.Count() == 0)
{
yield return PackageIssueFactory.DotNetToolMustHaveManifest(DotNetTool.Name, ToolManifestFileName);
yield return PackageIssueFactory.DotNetToolMustHaveManifest(Constants.DotNetTool.Name, ToolManifestFileName);
yield break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ public class PackageVersionMatchesAssemblyVersionRule : IPackageVerifierRule
{
public IEnumerable<PackageVerifierIssue> Validate(PackageAnalysisContext context)
{
if (context.Metadata.PackageTypes.Any(p => p == Constants.DotNetTool))
{
// Skip for dotnet global tool packages which contain assemblies from other teams and projects
yield break;
}

AssemblyAttributesDataHelper.SetAssemblyAttributesData(context);
foreach (var assemblyData in context.AssemblyData)
{
Expand Down
2 changes: 1 addition & 1 deletion version.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<KoreBuildChannel>release/2.1</KoreBuildChannel>
<VersionPrefix>2.1.0</VersionPrefix>
<VersionPrefix>2.1.1</VersionPrefix>
<VersionSuffix>rtm</VersionSuffix>
<BuildNumber Condition="'$(BuildNumber)' == ''">t000</BuildNumber>
<VersionSuffix Condition="'$(VersionSuffix)' != '' AND '$(BuildNumber)' != ''">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
Expand Down