Skip to content

Commit

Permalink
Make it so GenAPI is only used during online source build (dotnet/cor…
Browse files Browse the repository at this point in the history
…efx#38433)

Commit migrated from dotnet/corefx@548e58e
  • Loading branch information
ericstj authored Jun 11, 2019
1 parent e7324e2 commit d733ef7
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions eng/notSupported.SourceBuild.targets
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit d733ef7

Please sign in to comment.