-
Notifications
You must be signed in to change notification settings - Fork 789
/
FSharpBuild.Directory.Build.targets
162 lines (135 loc) · 8.4 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<Project>
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" Condition="'$(DISABLE_ARCADE)' != 'true'"/>
<Import Project="eng\targets\Imports.targets" Condition="'$(DISABLE_ARCADE)' != 'true'"/>
<Import Project="eng\targets\NuGet.targets" Condition="'$(DISABLE_ARCADE)' != 'true'"/>
<Import Project="FSharp.Profiles.props" />
<PropertyGroup>
<DefineConstants Condition="'$(Configuration)'=='release'">$(DefineConstants);Release</DefineConstants>
<DefineConstants Condition="'$(Configuration)'=='debug'">$(DefineConstants);Debug</DefineConstants>
</PropertyGroup>
<ItemDefinitionGroup>
<NoneSubstituteText>
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
<Pattern1></Pattern1>
<Pattern2></Pattern2>
<Pattern3></Pattern3>
<Replacement1></Replacement1>
<Replacement2></Replacement2>
<Replacement3></Replacement3>
<_ReplacementText></_ReplacementText>
<IncludeInVsix>false</IncludeInVsix>
<Link></Link>
<SubDir></SubDir>
</NoneSubstituteText>
</ItemDefinitionGroup>
<Target Name="NoneSubstituteTextFiles"
Inputs="@(NoneSubstituteText)"
Outputs="@(NoneSubstituteText->'$(IntermediateOutputPath)%(Filename)%(Extension)')"
BeforeTargets="AssignTargetPaths;BeforeBuild;GenerateFSharpTextResources">
<ItemGroup>
<NoneSubstituteText Update="@(NoneSubstituteText)">
<__TargetFilePath>$(IntermediateOutputPath)%(Subdir)%(Filename)%(Extension)</__TargetFilePath>
<__TargetFileName>%(Filename)%(Extension)</__TargetFileName>
<_ReplacementText>$([System.IO.File]::ReadAllText('%(FullPath)'))</_ReplacementText>
</NoneSubstituteText>
<NoneSubstituteText Update="@(NoneSubstituteText)">
<_ReplacementText Condition="'%(Pattern1)' != ''">$([System.Text.RegularExpressions.Regex]::Replace('%(_ReplacementText)', '%(Pattern1)', '%(Replacement1)'))</_ReplacementText>
</NoneSubstituteText>
<NoneSubstituteText Update="@(NoneSubstituteText)">
<_ReplacementText Condition="'%(Pattern2)' != ''">$([System.Text.RegularExpressions.Regex]::Replace('%(_ReplacementText)', '%(Pattern2)', '%(Replacement2)'))</_ReplacementText>
</NoneSubstituteText>
<NoneSubstituteText Update="@(NoneSubstituteText)">
<_ReplacementText Condition="'%(Pattern3)' != ''">$([System.Text.RegularExpressions.Regex]::Replace('%(_ReplacementText)', '%(Pattern3)', '%(Replacement3)'))</_ReplacementText>
</NoneSubstituteText>
</ItemGroup>
<MakeDir Directories="$(IntermediateOutputPath)" Condition="!Exists('$(IntermediateOutputPath)')" />
<WriteLinesToFile File="%(NoneSubstituteText.__TargetFilePath)" Lines="%(NoneSubstituteText._ReplacementText)" Overwrite="true" WriteOnlyWhenDifferent="true" />
<ItemGroup>
<None Include="%(NoneSubstituteText.__TargetFilePath)" CopyToOutputDirectory="%(NoneSubstituteText.CopyToOutputDirectory)" Condition="'%(NoneSubstituteText.SubDir)'==''" />
<_NoneWithTargetPath Include="%(NoneSubstituteText.__TargetFilePath)" CopyToOutputDirectory="%(NoneSubstituteText.CopyToOutputDirectory)" TargetPath="%(SubDir)%(__TargetFileName)" Condition="'%(NoneSubstituteText.SubDir)'!=''"/>
<FileWrites Include="%(NoneSubstituteText.__TargetFilePath)" Condition="'%(NoneSubstituteText.__TargetFileName)' != 'App.config'" />
<Content Include="%(NoneSubstituteText.__TargetFilePath)" CopyToOutputDirectory="Always" IncludeInVsix="true" Link="%(NoneSubstituteText.Link)" Condition="'%(NoneSubstituteText.IncludeInVsix)'=='true'" />
</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>
<CompileBefore Include="$(IntermediateOutputPath)buildproperties.fs" />
<FsGeneratedSource Include="$(IntermediateOutputPath)buildproperties.fs" />
<FileWrites Include="$(IntermediateOutputPath)buildproperties.fs" />
</ItemGroup>
</Target>
<!-- SDK targets override -->
<PropertyGroup Condition="'$(Configuration)' != 'Proto' AND '$(DisableCompilerRedirection)'!='true' AND Exists('$(ProtoOutputPath)')">
<FSharpBuildAssemblyFileOverride>$(ProtoOutputPath)\fsc\FSharp.Build.dll</FSharpBuildAssemblyFileOverride>
</PropertyGroup>
<UsingTask TaskName="FSharpEmbedResourceText" AssemblyFile="$(FSharpBuildAssemblyFileOverride)" Override="true" Condition="'$(Configuration)' != 'Proto' AND '$(DisableCompilerRedirection)'!='true' AND Exists('$(ProtoOutputPath)')" />
<UsingTask TaskName="FSharpEmbedResXSource" AssemblyFile="$(FSharpBuildAssemblyFileOverride)" Override="true" Condition="'$(Configuration)' != 'Proto' AND '$(DisableCompilerRedirection)'!='true' AND Exists('$(ProtoOutputPath)')" />
<Target Name="BeforeResGen"
Inputs="@(EmbeddedResource->'$(IntermediateOutputPath)%(Filename)%(Extension)')"
Outputs="@(EmbeddedResource->'$(IntermediateOutputPath)resources\%(Filename)%(Extension)')"
Condition="'$(Configuration)' != 'Proto' and '$(Language)'=='F#' and '$(DisableCompilerRedirection)' != 'true' ">
<MakeDir Directories="$(IntermediateOutputPath)" Condition="!Exists('$(IntermediateOutputPath)')" />
<MakeDir Directories="$(IntermediateOutputPath)resources\" Condition="!Exists('$(IntermediateOutputPath)resources\')" />
<SubstituteText EmbeddedResources="@(EmbeddedResource)">
<Output TaskParameter="CopiedFiles" ItemName="CopiedFiles" />
</SubstituteText>
<ItemGroup>
<IntermediateFiles Include="$(IntermediateOutputPath)\*.resx" />
<IntermediateResourcesFiles Include="$(IntermediateOutputPath)resources\*.resx" />
</ItemGroup>
<!-- IntermediateFiles Hashes -->
<GetFileHash Files="@(IntermediateFiles)">
<Output
TaskParameter="Items"
ItemName="IntermediateFilesHashes" />
</GetFileHash>
<Hash ItemsToHash="@(IntermediateFilesHashes->'%(FileHash)')">
<Output TaskParameter="HashResult" PropertyName="IntermediateFilesHash" />
</Hash>
<!-- CopiedFilesForHash Hashes -->
<GetFileHash Files="@(IntermediateResourceFilesForHash)">
<Output
TaskParameter="Items"
ItemName="IntermediateResourceFilesHashes" />
</GetFileHash>
<Hash ItemsToHash="@(IntermediateResourceFilesHashes->'%(FileHash)')">
<Output TaskParameter="HashResult" PropertyName="IntermediateResourceFilesHash" />
</Hash>
<!-- Update EmbeddedResources -->
<ItemGroup Condition="'$(IntermediateFilesHash)' != '$(IntermediateResourceFilesHash)'">
<EmbeddedResource Remove="@(EmbeddedResource)"/>
<EmbeddedResource Include="@(CopiedFiles)"/>
</ItemGroup>
<Copy SourceFiles="@(CopyVsixResources)" DestinationFolder="$(IntermediateOutputPath)\resources\Resources" Condition="'$(IntermediateFilesHash)' != '$(IntermediateResourceFilesHash)'" />
</Target>
<PropertyGroup>
<CoreBuildDependsOn>$(CoreBuildDependsOn);PrefixRepoToReleaseNotes</CoreBuildDependsOn>
</PropertyGroup>
<Target Name="PrefixRepoToReleaseNotes"
AfterTargets="InitializeSourceControlInformationFromSourceControlManager"
BeforeTargets="InitializeStandardNuspecProperties"
Condition="'$(IsPackable)'=='true'">
<PropertyGroup>
<_GitUrl>https://github.com/dotnet/fsharp</_GitUrl>
<PackageReleaseNotes>$(_GitUrl)$(PackageReleaseNotes)</PackageReleaseNotes>
</PropertyGroup>
</Target>
</Project>