Adding validation to ensure all runtime-only files are present on all runtime-specifi...
authorJose Perez Rodriguez <joperezr@microsoft.com>
Thu, 20 Jun 2019 20:20:10 +0000 (13:20 -0700)
committerGitHub <noreply@github.com>
Thu, 20 Jun 2019 20:20:10 +0000 (13:20 -0700)
Commit migrated from https://github.com/dotnet/corefx/commit/f80d2324feaf77b902ea93d76a3aa5236b0e2f27

src/libraries/pkg/Microsoft.Private.CoreFx.NETCoreApp/Microsoft.Private.CoreFx.NETCoreApp.pkgproj

index 7835848..4cdc993 100644 (file)
     <ExcludeFromClosure Include="System.Transactions" />
     <ExcludeFromClosure Include="WindowsBase" />
 
+    <AllowedRuntimeOnlyFiles Include="Microsoft.Win32.Registry" />
+    <AllowedRuntimeOnlyFiles Include="System.IO.FileSystem.AccessControl" />
+    <AllowedRuntimeOnlyFiles Include="System.IO.Pipes.AccessControl" />
+    <AllowedRuntimeOnlyFiles Include="System.Private.DataContractSerialization" />
+    <AllowedRuntimeOnlyFiles Include="System.Private.Uri" />
+    <AllowedRuntimeOnlyFiles Include="System.Private.Xml" />
+    <AllowedRuntimeOnlyFiles Include="System.Private.Xml.Linq" />
+    <AllowedRuntimeOnlyFiles Include="System.Runtime.WindowsRuntime" />
+    <AllowedRuntimeOnlyFiles Include="System.Runtime.WindowsRuntime.UI.Xaml" />
+    <AllowedRuntimeOnlyFiles Include="System.Security.AccessControl" />
+    <AllowedRuntimeOnlyFiles Include="System.Security.Cryptography.Cng" />
+    <AllowedRuntimeOnlyFiles Include="System.Security.Cryptography.OpenSsl" />
+    <AllowedRuntimeOnlyFiles Include="System.Security.Principal.Windows" />
+
     <!-- Permit the following implementation-only assemblies -->
     <ValidatePackageSuppression Condition="'$(PackageTargetRuntime)' != ''" Include="PermitInbox">
       <Value>
-        Microsoft.Win32.Registry;
-        System.IO.FileSystem.AccessControl;
-        System.IO.Pipes.AccessControl;
-        System.Private.DataContractSerialization;
-        System.Private.Uri;
-        System.Private.Xml;
-        System.Private.Xml.Linq;
-        System.Runtime.WindowsRuntime;
-        System.Runtime.WindowsRuntime.UI.Xaml;
-        System.Security.AccessControl;
-        System.Security.Cryptography.Cng;
-        System.Security.Cryptography.OpenSsl;
-        System.Security.Principal.Windows;
+        @(AllowedRuntimeOnlyFiles);
       </Value>
     </ValidatePackageSuppression>
     <!-- Permit missing Inbox since this used to be a shim and it is now OOB -->
     </ValidatePackageSuppression>
   </ItemGroup>
 
+  <Target Name="VerifyRuntimeOnlyFilesArePresentOnAllRuntimePackages"
+      DependsOnTargets="GetClosureFiles"
+      AfterTargets="ValidatePackage"
+      Condition="'$(PackageTargetRuntime)' != ''"
+      Inputs="%(ClosureFile.FileSet)"
+      Outputs="batching-on-FileSet-metadata">
+
+    <ItemGroup>
+      <_RuntimeOnlyMissingFile Include="@(AllowedRuntimeOnlyFiles)" Exclude="@(ClosureFile->'%(FileName)')" />
+    </ItemGroup>
+    <Error Condition="'@(_RuntimeOnlyMissingFile)' != ''" Text="Files '@(_RuntimeOnlyMissingFile)' should be present on all runtime-specific packages, but are not present for the package RID '$(PackageTargetRuntime)'" />
+  </Target>
+
   <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Directory.Build.targets))\Directory.Build.targets" />
 </Project>