forked from dotnet/fsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FSharpBuild.Directory.Build.targets
64 lines (53 loc) · 3.38 KB
/
FSharpBuild.Directory.Build.targets
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
<Project>
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<Import Project="eng\targets\Imports.targets" />
<Import Project="eng\targets\NuGet.targets" />
<Import Project="eng\targets\NGenBinaries.targets" />
<Import Project="FSharp.Profiles.props" />
<Target Name="NoneSubstituteTextFiles"
Inputs="@(NoneSubstituteText)"
Outputs="@(NoneSubstituteText->'$(IntermediateOutputPath)%(Filename)%(Extension)')"
BeforeTargets="AssignTargetPaths;BeforeBuild">
<PropertyGroup>
<__TargetFilePath>@(NoneSubstituteText->'$(IntermediateOutputPath)%(Filename)%(Extension)')</__TargetFilePath>
<__TargetFileName>@(NoneSubstituteText->'%(Filename)%(Extension)')</__TargetFileName>
<_ReplacementText>$([System.IO.File]::ReadAllText('%(NoneSubstituteText.FullPath)'))</_ReplacementText>
<_ReplacementText Condition="'%(NoneSubstituteText.Pattern1)' != ''">$(_ReplacementText.Replace('%(NoneSubstituteText.Pattern1)', '%(NoneSubstituteText.Replacement1)'))</_ReplacementText>
<_ReplacementText Condition="'%(NoneSubstituteText.Pattern2)' != ''">$(_ReplacementText.Replace('%(NoneSubstituteText.Pattern2)', '%(NoneSubstituteText.Replacement2)'))</_ReplacementText>
<_CopyToOutputDirectory Condition="'%(NoneSubstituteText.CopyToOutputDirectory)' != ''">%(NoneSubstituteText.CopyToOutputDirectory)</_CopyToOutputDirectory>
<_CopyToOutputDirectory Condition="'%(NoneSubstituteText.CopyToOutputDirectory)' == ''">Never</_CopyToOutputDirectory>
</PropertyGroup>
<MakeDir Directories="$(IntermediateOutputPath)"
Condition="!Exists('$(IntermediateOutputPath)')" />
<WriteLinesToFile File="$(__TargetFilePath)" Lines="$(_ReplacementText)" Overwrite="true" WriteOnlyWhenDifferent="true" />
<!-- Make sure it will get cleaned -->
<ItemGroup >
<None Include="$(__TargetFilePath)" CopyToOutputDirectory="$(_CopyToOutputDirectory)" />
<FileWrites Include="$(__TargetFilePath)" Condition="'$(__TargetFileName)' != 'App.config'" />
</ItemGroup>
</Target>
<Target Name="_GenerateBuildPropertiesFile"
Outputs="$(IntermediateOutputPath)buildproperties.fs"
BeforeTargets="BeforeBuild"
Condition="'$(Language)'=='F#'">
<ItemGroup>
<_BuildPropertyLines Remove="@(_BuildPropertyLines)" />
<_BuildPropertyLines Include="// <auto-generated >" />
<_BuildPropertyLines Include="// <Generated by the FSharp WriteCodeFragment class./>" />
<_BuildPropertyLines Include="// </auto-generated/>" />
<_BuildPropertyLines Include="//" />
<_BuildPropertyLines Include="module internal FSharp.BuildProperties" />
<_BuildPropertyLines Include="let fsProductVersion = "$(FSPRODUCTVERSION)"" />
<_BuildPropertyLines Include="let fsLanguageVersion = "$(FSLANGUAGEVERSION)"" />
</ItemGroup>
<MakeDir
Directories="$(IntermediateOutputPath)"
Condition="!Exists('$(IntermediateOutputPath)')" />
<WriteLinesToFile File="$(IntermediateOutputPath)buildproperties.fs" Lines="@(_BuildPropertyLines)" Overwrite="true" WriteOnlyWhenDifferent="true" />
<!-- Make sure it will get cleaned -->
<ItemGroup>
<FileWrites Include="$(IntermediateOutputPath)buildproperties.fs" />
<CompileBefore Include="$(IntermediateOutputPath)buildproperties.fs" />
</ItemGroup>
</Target>
</Project>