Make it so GenAPI is only used during online source build (dotnet/corefx#38433)
authorEric StJohn <ericstj@microsoft.com>
Tue, 11 Jun 2019 15:17:34 +0000 (08:17 -0700)
committerGitHub <noreply@github.com>
Tue, 11 Jun 2019 15:17:34 +0000 (08:17 -0700)
Commit migrated from https://github.com/dotnet/corefx/commit/548e58ebe2346c04a3353a53e6d8c64ab38198d0

eng/notSupported.SourceBuild.targets [new file with mode: 0644]

diff --git a/eng/notSupported.SourceBuild.targets b/eng/notSupported.SourceBuild.targets
new file mode 100644 (file)
index 0000000..a6a0f11
--- /dev/null
@@ -0,0 +1,25 @@
+<Project InitialTargets="_RedefineNotSupportedSourceFile">
+
+  <Target Name="_RedefineNotSupportedSourceFile"
+          Condition="'$(DotNetBuildFromSource)' == 'true' and
+                     ('$(GeneratePlatformNotSupportedAssembly)' == 'true' or '$(GeneratePlatformNotSupportedAssemblyMessage)' != '')">
+                     
+    <Error Condition="'$(DotNetSourceBuildIntermediatePath)' == ''" 
+           Text="'DotNetSourceBuildIntermediatePath' must be specified when 'DotNetBuildFromSource' is true" />
+           
+    <PropertyGroup>
+      <_notSupportedSourceDirectory>$([MSBuild]::NormalizeDirectory('$(DotNetSourceBuildIntermediatePath)', '$(MSBuildProjectName)', '$(TargetGroup)-$(OSGroup)'))</_notSupportedSourceDirectory>
+      <NotSupportedSourceFile>$(_notSupportedSourceDirectory)$(TargetName).notsupported.cs</NotSupportedSourceFile>
+    </PropertyGroup>
+    
+    <MakeDir Condition="'$(OfflineBuild)' != 'true'" Directories="$(_notSupportedSourceDirectory)" />
+    
+    <Error Condition="'$(OfflineBuild)' == 'true' AND !Exists('$(NotSupportedSourceFile)')"
+           Text="Error NotSupportedSourceFile '$(NotSupportedSourceFile)' did not exist under DotNetSourceBuildIntermediatePath." />
+    
+    <!-- OfflineBuild == true, don't use GenAPI and include source from DotNetSourceBuildIntermediatePath -->  
+    <ItemGroup Condition="'$(OfflineBuild)' == 'true'">
+      <Compile Include="$(NotSupportedSourceFile)" />
+    </ItemGroup>
+  </Target>
+</Project>
\ No newline at end of file