Spaces:
Sleeping
Sleeping
File size: 5,517 Bytes
090629c |
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 |
<!--
***********************************************************************************************
Microsoft.NET.ApiCompat.ValidatePackage.targets
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
created a backup copy. Incorrect changes to this file will make it
impossible to load or build your projects from the command-line or the IDE.
Copyright (c) .NET Foundation. All rights reserved.
***********************************************************************************************
-->
<Project>
<PropertyGroup>
<ApiCompatValidatePackageSemaphoreFile>$(IntermediateOutputPath)$(MSBuildThisFileName).semaphore</ApiCompatValidatePackageSemaphoreFile>
<!-- Add any custom targets that need to run before package validation to the following property. -->
<RunPackageValidationDependsOn>CollectApiCompatInputs;_GetReferencePathFromInnerProjects;$(RunPackageValidationDependsOn)</RunPackageValidationDependsOn>
</PropertyGroup>
<Target Name="RunPackageValidation"
DependsOnTargets="$(RunPackageValidationDependsOn)"
AfterTargets="Pack"
Inputs="@(NuGetPackInput);
@(ApiCompatSuppressionFile);
$(ApiCompatSuppressionOutputFile)"
Outputs="$(ApiCompatValidatePackageSemaphoreFile)"
Condition="'$(EnablePackageValidation)' == 'true' and '$(IsPackable)' == 'true'">
<PropertyGroup>
<PackageValidationBaselineName Condition="'$(PackageValidationBaselineName)' == ''">$(PackageId)</PackageValidationBaselineName>
<PackageValidationBaselinePath Condition="'$(PackageValidationBaselinePath)' == '' and '$(PackageValidationBaselineVersion)' != ''">$([MSBuild]::NormalizePath('$(NuGetPackageRoot)', '$(PackageValidationBaselineName.ToLower())', '$(PackageValidationBaselineVersion)', '$(PackageValidationBaselineName.ToLower()).$(PackageValidationBaselineVersion).nupkg'))</PackageValidationBaselinePath>
<_packageValidationBaselinePath Condition="'$(DisablePackageBaselineValidation)' != 'true'">$(PackageValidationBaselinePath)</_packageValidationBaselinePath>
</PropertyGroup>
<ItemGroup>
<_PackageTargetPath Include="@(NuGetPackOutput->WithMetadataValue('Extension', '.nupkg'))"
Condition="!$([System.String]::new('%(Identity)').EndsWith('.symbols.nupkg'))" />
</ItemGroup>
<!-- PackageTargetPath isn't exposed by NuGet: https://github.com/NuGet/Home/issues/6671. -->
<Microsoft.DotNet.ApiCompat.Task.ValidatePackageTask
PackageTargetPath="@(_PackageTargetPath)"
RuntimeGraph="$(RuntimeIdentifierGraphPath)"
NoWarn="$(NoWarn)"
RespectInternals="$(ApiCompatRespectInternals)"
EnableRuleAttributesMustMatch="$(ApiCompatEnableRuleAttributesMustMatch)"
ExcludeAttributesFiles="@(ApiCompatExcludeAttributesFile)"
EnableRuleCannotChangeParameterName="$(ApiCompatEnableRuleCannotChangeParameterName)"
RunApiCompat="$(RunApiCompat)"
EnableStrictModeForCompatibleTfms="$(EnableStrictModeForCompatibleTfms)"
EnableStrictModeForCompatibleFrameworksInPackage="$(EnableStrictModeForCompatibleFrameworksInPackage)"
EnableStrictModeForBaselineValidation="$(EnableStrictModeForBaselineValidation)"
GenerateSuppressionFile="$(ApiCompatGenerateSuppressionFile)"
PreserveUnnecessarySuppressions="$(ApiCompatPreserveUnnecessarySuppressions)"
PermitUnnecessarySuppressions="$(ApiCompatPermitUnnecessarySuppressions)"
SuppressionFiles="@(ApiCompatSuppressionFile)"
SuppressionOutputFile="$(ApiCompatSuppressionOutputFile)"
BaselinePackageTargetPath="$(_packageValidationBaselinePath)"
RoslynAssembliesPath="$(RoslynAssembliesPath)"
PackageAssemblyReferences="@(PackageValidationReferencePath)" />
<MakeDir Directories="$([System.IO.Path]::GetDirectoryName('$(ApiCompatValidatePackageSemaphoreFile)'))" />
<Touch Files="$(ApiCompatValidatePackageSemaphoreFile)" AlwaysCreate="true" />
</Target>
<Target Name="GetReferencesForApiCompatValidatePackage"
DependsOnTargets="FindReferenceAssembliesForReferences"
Returns="@(ApiCompatAssemblyReferencesWithTargetFramework)">
<ItemGroup>
<ApiCompatAssemblyReferencesWithTargetFramework Include="$(TargetFramework)"
TargetFrameworkMoniker="$(TargetFrameworkMoniker)"
ReferencePath="@(ReferencePathWithRefAssemblies, ',')">
<TargetPlatformMoniker Condition="'$(ApiCompatIgnoreTargetPlatformMoniker)' != 'true'">$(TargetPlatformMoniker)</TargetPlatformMoniker>
</ApiCompatAssemblyReferencesWithTargetFramework>
</ItemGroup>
</Target>
<!-- Depends on NuGet's _GetTargetFrameworksOutput target to calculate inner target frameworks. -->
<Target Name="_GetReferencePathFromInnerProjects"
DependsOnTargets="_GetTargetFrameworksOutput"
Condition="'$(RunPackageValidationWithoutReferences)' != 'true'">
<MSBuild Projects="$(MSBuildProjectFullPath)"
Targets="GetReferencesForApiCompatValidatePackage"
Properties="TargetFramework=%(_TargetFrameworks.Identity);
BuildProjectReferences=false">
<Output ItemName="PackageValidationReferencePath" TaskParameter="TargetOutputs" />
</MSBuild>
</Target>
</Project>
|