Last active
April 27, 2021 14:39
-
-
Save baronfel/43faa9e85178f7a2abb3a579e942587d to your computer and use it in GitHub Desktop.
Build target for seamless signature file includes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project> | |
<PropertyGroup> | |
<!-- Provide an escape hatch/opt-in to this feature --> | |
<AutoIncludeExistingSignatures Condition="$(AutoIncludeExistingSignatures) == '' " >false</AutoIncludeExistingSignatures> | |
</PropertyGroup> | |
<Target Name="CollectFSharpSourcesAndSignatures" BeforeTargets="CoreCompile" Condition="$(AutoIncludeExistingSignatures)"> | |
<ItemGroup> | |
<!-- Cache the current set of compile options --> | |
<_Sources Include="@(Compile)" /> | |
<!-- clear out the Compile order because we need to insert the sigs before their associated source files --> | |
<Compile Remove="@(Compile)" /> | |
<!-- N.B: the %(<array name>) syntax is a way of saying 'iterate over the collection and do X for each member of the collection' --> | |
<!-- Include X.fsi if X.fsi exists. --> | |
<Compile Include="$([System.IO.Path]::ChangeExtension(%(_Sources.Identity), "fsi"))" Condition="$([System.IO.File]::Exists($([System.IO.Path]::ChangeExtension(%(_Sources.Identity), "fsi"))))" /> | |
<!-- but don't forget to also include X.fs --> | |
<Compile Include="%(_Sources.Identity)" /> | |
</ItemGroup> | |
</Target> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment