forked from dotnet/fsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFSharpSource.targets
More file actions
383 lines (327 loc) · 23 KB
/
FSharpSource.targets
File metadata and controls
383 lines (327 loc) · 23 KB
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -->
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<RepoRoot>$(MSBuildThisFileDirectory)..\</RepoRoot>
</PropertyGroup>
<PropertyGroup>
<MicroBuildAssemblyFileLanguage>fs</MicroBuildAssemblyFileLanguage>
</PropertyGroup>
<!-- Some unit test assemblies must not have strong names since they reference other assemblies that don't have strong names -->
<!-- These unit test assemblies can't use InternalsVisibleTo into assemblies with strong names. -->
<PropertyGroup Condition="'$(StrongNames)' == 'false'">
<SkipSigning>true</SkipSigning>
<UseOpenSourceSign>false</UseOpenSourceSign>
<SignAssembly>false</SignAssembly>
<DefineConstants>NO_STRONG_NAMES;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<!-- On mono, use test.snk to sign private compiler binaries -->
<PropertyGroup Condition="'$(StrongNames)' != 'false' AND '$(MonoPackaging)' == 'true' AND '$(AssemblyName)' != 'FSharp.Core' AND '$(AssemblyName)' != 'FSharp.Compiler.Interactive.Settings'" >
<AssemblyOriginatorKeyFile>$(FSharpSourcesRoot)\fsharp\test.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
<DefineConstants>STRONG_NAME_FSHARP_COMPILER_WITH_TEST_KEY;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<!-- On proto, use the FSharp.Core assembly version for everything (it only matters we get it right for FSharp.Core), and pass the version flag explicitly if not using MicroBuild -->
<PropertyGroup Condition="'$(Configuration)' == 'Proto'">
<MicroBuildAssemblyVersion>$(FSCoreVersion)</MicroBuildAssemblyVersion>
<OtherFlags>$(OtherFlags) --version:"$(MicroBuildAssemblyVersion)"</OtherFlags>
</PropertyGroup>
<PropertyGroup Condition="'$(UseSourceLink)' == 'true'">
<SourceLink>$(IntermediateOutputPath)source_link.json</SourceLink>
</PropertyGroup>
<!-- We assume MSBuild 15.0 or greater. Note the Mono packaging doesn't actually rely on any specific version of MSBuild any longer except to build the MSBuild task-->
<PropertyGroup>
<DefineConstants>MSBUILD_AT_LEAST_14;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<!-- Disable uwa toolchain nuget package resolve logic. -->
<PropertyGroup>
<NuGetTargets Condition="'$(NuGetTargets)' == ''">false</NuGetTargets>
</PropertyGroup>
<PropertyGroup>
<NugetLocalPackagesDir>$(FSharpSourcesRoot)\..\packages</NugetLocalPackagesDir>
<FsCheckVersion>3.0.0-alpha3</FsCheckVersion>
<FsCheckFullVersion>3.0.0.0</FsCheckFullVersion>
<FsCheckLibDir>$(FSharpSourcesRoot)\..\packages\FsCheck.$(FsCheckVersion)\lib\</FsCheckLibDir>
</PropertyGroup>
<Import Project="FSharpSource.Profiles.targets" />
<PropertyGroup Condition="'$(TargetDotnetProfile)'=='net40'">
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v4.5</TargetFrameworkVersion>
<TargetFrameworkProfile></TargetFrameworkProfile>
<!-- MSbuild works out the assembly references -->
</PropertyGroup>
<PropertyGroup Condition="'$(TargetDotnetProfile)'=='coreclr'">
<TargetProfile>netcore</TargetProfile>
<TargetFrameworkProfile></TargetFrameworkProfile> <!-- We are currently directly referencing corefx assemblies, so profile7 is not really true -->
<TargetFrameworkVersion Condition="'$(TargetFrameworkVersion)' == ''">v5.0</TargetFrameworkVersion>
<ImplicitlyExpandTargetFramework>false</ImplicitlyExpandTargetFramework> <!-- To stop msbuild being helpful and referencing the dlls for the profile -->
<NuGetTargetMoniker>.NETStandard,Version=v1.6</NuGetTargetMoniker>
<PortableNuGetMode>true</PortableNuGetMode>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetDotnetProfile)'=='coreclr' AND '$(DOTNET_PUBLISH_TEST)'=='true' ">
<OutputPath>bin\$(Configuration)\netcoreapp1.0</OutputPath>
<CustomOutputPath>true</CustomOutputPath>
<DOTNET_PUBLISH>true</DOTNET_PUBLISH>
<DOTNET_PUBLISH_PLATFORM>win7-x64</DOTNET_PUBLISH_PLATFORM>
<DOTNET_PUBLISH_PATH>$(FSharpSourcesRoot)\..\tests\testbin\$(Configuration)\coreclr\$(AssemblyName)</DOTNET_PUBLISH_PATH>
<OutputType>Exe</OutputType>
<TargetExt>.dll</TargetExt>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetDotnetProfile)'=='coreclr' AND '$(DOTNET_PUBLISH_COMPILERS)'=='true' ">
<DOTNET_PUBLISH_FSC>true</DOTNET_PUBLISH_FSC>
<DOTNET_PUBLISH_FSC_PATH>$(FSharpSourcesRoot)\..\tests\testbin\$(Configuration)\coreclr\FSC</DOTNET_PUBLISH_FSC_PATH>
<DOTNET_PUBLISH_FSI>true</DOTNET_PUBLISH_FSI>
<DOTNET_PUBLISH_FSI_PATH>$(FSharpSourcesRoot)\..\tests\testbin\$(Configuration)\coreclr\FSC</DOTNET_PUBLISH_FSI_PATH>
</PropertyGroup>
<!-- If building an FSharp.Core for a back version (Mono Debian source builds only), put it in a qualified directory -->
<PropertyGroup>
<TargetFrameworkOutputDirectory Condition="'$(FSharpCoreBackVersion)' == ''">$(TargetDotnetProfile)</TargetFrameworkOutputDirectory>
<TargetFrameworkOutputDirectory Condition="'$(FSharpCoreBackVersion)' == '3.0'">fsharp30\$(TargetDotnetProfile)</TargetFrameworkOutputDirectory>
<TargetFrameworkOutputDirectory Condition="'$(FSharpCoreBackVersion)' == '3.1'">fsharp31\$(TargetDotnetProfile)</TargetFrameworkOutputDirectory>
<TargetFrameworkOutputDirectory Condition="'$(FSharpCoreBackVersion)' == '4.0'">fsharp40\$(TargetDotnetProfile)</TargetFrameworkOutputDirectory>
<TargetFrameworkOutputDirectory>$(TargetDotnetProfile)</TargetFrameworkOutputDirectory>
<IntermediateOutputPath>obj\$(Configuration)\$(TargetFrameworkOutputDirectory)\</IntermediateOutputPath>
</PropertyGroup>
<Choose>
<When Condition="'$(BuildWith)' == 'LKG' AND '$(BUILD_PROTO_WITH_CORECLR_LKG)' == '1'">
<PropertyGroup >
<OutputPath>$(FSharpSourcesRoot)\..\$(Configuration)\$(ProtoFlavour)\bin</OutputPath>
<DotnetSdkVersion>$([System.IO.File]::ReadAllText('$(MSBuildThisFileDirectory)..\DotnetCLIToolsVersion.txt').Trim())</DotnetSdkVersion>
<FSharpNetCoreLkgPath>$(MSBuildThisFileDirectory)..\Tools\dotnet20\sdk\$(DotnetSdkVersion)\FSharp</FSharpNetCoreLkgPath>
<!-- When using coreclr to bootstrap to proto. We acquire the FSharp.Core LKG, targets LKG, the FSharp.Build LKG from the .NET Framework compiler tools LKG package. -->
<FSharpTargetsPath>..\packages\FSharp.Compiler.Tools.4.1.27\tools\Microsoft.FSharp.Targets</FSharpTargetsPath>
<!-- When using coreclr to bootstrap, the compiler binary comes from the coreclr LKG, invoked using corehost.exe -->
<FscToolPath>$(FSharpSourcesRoot)\..\Tools\dotnet20</FscToolPath>
<FscToolExe Condition="'$(OS)' != 'Unix'">dotnet.exe</FscToolExe>
<FscToolExe Condition="'$(OS)' == 'Unix'">dotnet</FscToolExe>
<DotnetFscCompilerPath>$(FSharpNetCoreLkgPath)\fsc.exe</DotnetFscCompilerPath>
</PropertyGroup>
</When>
<When Condition="'$(BuildWith)' == 'LKG' AND '$(BUILD_PROTO_WITH_CORECLR_LKG)' != '1'">
<!-- Use .NET Framework to bootstrap to proto -->
<PropertyGroup >
<OutputPath>$(FSharpSourcesRoot)\..\$(Configuration)\$(ProtoFlavour)\bin</OutputPath>
<FSharpTargetsPath>..\packages\FSharp.Compiler.Tools.4.1.27\tools\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
</When>
<When Condition="'$(BuildWith)' == '' AND '$(TargetDotnetProfile)'=='coreclr'">
<!-- Compiling coreclr with Proto, currently always use a .NET Framework/Mono proto -->
<PropertyGroup>
<OutputPath Condition=" '$(CustomOutputPath)' != 'true' ">$(FSharpSourcesRoot)\..\$(Configuration)\$(TargetFrameworkOutputDirectory)\bin</OutputPath>
<FscToolPath>$(FSharpSourcesRoot)\..\Proto\$(ProtoFlavour)\bin</FscToolPath>
<FscToolExe>fsc.exe</FscToolExe>
<FSharpTargetsPath>..\Proto\$(ProtoFlavour)\bin\Microsoft.Portable.FSharp.targets</FSharpTargetsPath>
</PropertyGroup>
</When>
<Otherwise>
<!-- Compiling net40 with Proto -->
<PropertyGroup>
<OutputPath Condition=" '$(CustomOutputPath)' != 'true' ">$(FSharpSourcesRoot)\..\$(Configuration)\$(TargetFrameworkOutputDirectory)\bin</OutputPath>
<FscToolPath>$(FSharpSourcesRoot)\..\Proto\$(ProtoFlavour)\bin</FscToolPath>
<FscToolExe>fsc.exe</FscToolExe>
<FSharpTargetsPath>..\Proto\$(ProtoFlavour)\bin\Microsoft.FSharp.Targets</FSharpTargetsPath>
</PropertyGroup>
</Otherwise>
</Choose>
<PropertyGroup>
<CompileDependsOn>ValidateBuildTools;$(CompileDependsOn)</CompileDependsOn>
</PropertyGroup>
<Target Name="ValidateBuildTools" Condition="'$(ProjectLanguage)' == 'FSharp'" >
<Message Text="FSharpTargetsPath = $(FSharpTargetsPath)" />
<Message Text="FSharpSourcesRoot = $(FSharpSourcesRoot)" />
<Message Text="FscToolPath = $(FscToolPath)" />
<Message Text="FsiToolPath = $(FsiToolPath)" />
<Message Text="FsLexToolPath = $(FsLexToolPath)" />
<Message Text="FsYaccToolPath = $(FsYaccToolPath)" />
<Message Text="ToolsDir = $(ToolsDir)" />
<Error Text="Expect $(FSharpTargetsPath) to exist" Condition="'!Exists('$(FSharpTargetsPath)')" />
<Error Text="Expect $(FSharpNetCoreLkgPath)\fsc.exe to exist when BUILD_PROTO_WITH_CORECLR_LKG==1" Condition="'$(BUILD_PROTO_WITH_CORECLR_LKG)' == 1 AND !Exists('$(FSharpNetCoreLkgPath)\fsc.exe')" />
<Error Text="Expect $(FscToolPath)\$(FscToolExe) to exist" Condition="!Exists('$(FscToolPath)\$(FscToolExe)')" />
<Error Text="Expect $(DotnetFscCompilerPath) to exist if non-empty" Condition="'$(DotnetFscCompilerPath)' != '' AND !Exists('$(DotnetFscCompilerPath)')" />
<Error Text="Expect $(FsiToolPath)\$(FsiToolExe) to exist" Condition="!Exists('$(FsiToolPath)\$(FsiToolExe)')" />
<Error Text="Expect $(FsLexToolPath)\$(FsLexToolExe) to exist" Condition="!Exists('$(FsLexToolPath)\$(FsLexToolExe)')" />
<Error Text="Expect $(FsYaccToolPath)\$(FsYaccToolExe) to exist" Condition="!Exists('$(FsYaccToolPath)\$(FsYaccToolExe)')" />
</Target>
<Import Condition="'$(ProjectLanguage)' == 'FSharp'" Project="$(FSharpTargetsPath)"/>
<!-- Hook up .NET Core to enable solution refresh of packages -->
<PropertyGroup Condition="'$(TargetDotnetProfile)'=='coreclr'">
<!-- Implicitly needed by packageresolve.targets. Should file a bug for a better error message here -->
<PackagesDir>$(NUGET_PACKAGES)</PackagesDir>
<NuGetToolPath Condition="'$(NuGetToolPath)' == ''">$(FSharpSourcesRoot)\..\.nuget\</NuGetToolPath>
<NuGetConfigCommandLine>-ConfigFile "$(NuGetConfigFile)"</NuGetConfigCommandLine>
<NugetRestoreCommand>"$(NuGetToolPath)NuGet.exe install -OutputDirectory "$(PackagesDir)" -Config "$(NuGetToolPath)..\NuGet.Config"</NugetRestoreCommand>
<DnuRestoreCommand>"$(NuGetToolPath)NuGet.exe" restore -OutputDirectory "$(PackagesDir)" -Config "$(NuGetToolPath)..\NuGet.Config"</DnuRestoreCommand>
<!-- Current version of .NET Core does not support all semantics used in our packages,
so we ignore the pre-calculation in the lock file and calculate asset applicability in the build task -->
<NuGetIngoreLockFile>true</NuGetIngoreLockFile>
</PropertyGroup>
<Import Condition="'$(TargetDotnetProfile)'=='coreclr'" Project="..\Tools\Build.Common.Targets" />
<PropertyGroup>
<RootNamespace></RootNamespace>
<DocumentationFile>$(OutputPath)$(AssemblyName).xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup>
<PackageLicenceUrl Condition="'$(PackageLicenceUrl)' == ''">https://github.com/Microsoft/visualfsharp/blob/master/License.txt</PackageLicenceUrl>
<PackageProjectUrl Condition="'$(PackageProjectUrl)' == ''">https://github.com/Microsoft/visualfsharp</PackageProjectUrl>
<PackageVersion Condition="'$(PackageVersion)' == ''" >$(NuGetPerBuildPreReleaseVersion)</PackageVersion>
<PackageAuthors Condition="'$(PackageAuthors)' == ''" >Microsoft</PackageAuthors>
<PackageTags Condition="'$(PackageTags)' == ''" >Visual F# Compiler FSharp coreclr functional programming</PackageTags>
</PropertyGroup>
<!-- This build step copies files to the output folder while replacing build variables in the text of those file. -->
<PropertyGroup>
<CompileDependsOn>$(CompileDependsOn);CopyAndSubstituteTextFiles</CompileDependsOn>
</PropertyGroup>
<Target
Name="CopyAndSubstituteTextFiles"
Inputs="@(CopyAndSubstituteText)"
Outputs="@(CopyAndSubstituteText->'$(OutDir)%(TargetFilename)')" >
<Exec Command=""$([System.IO.Path]::GetFullPath('$(FsiToolPath)\$(FsiToolExe)'))" --exec "$(MSBuildThisFileDirectory)scripts/subst.fsx" --in:"%(CopyAndSubstituteText.FullPath)" --out:"$(OutDir)%(CopyAndSubstituteText.TargetFilename)" --pattern1:"%(CopyAndSubstituteText.Pattern1)" --replacement1:"%(CopyAndSubstituteText.Replacement1)" --pattern2:"%(CopyAndSubstituteText.Pattern2)" --replacement2:"%(CopyAndSubstituteText.Replacement2)" " Condition="'$(OS)' != 'Unix'" />
<Exec Command="mono $([System.IO.Path]::GetFullPath('$(FsiToolPath)\$(FsiToolExe)')) --exec "$(MSBuildThisFileDirectory)scripts/subst.fsx" --in:"%(CopyAndSubstituteText.FullPath)" --out:"$(OutDir)%(CopyAndSubstituteText.TargetFilename)" --pattern1:"%(CopyAndSubstituteText.Pattern1)" --replacement1:"%(CopyAndSubstituteText.Replacement1)" --pattern2:"%(CopyAndSubstituteText.Pattern2)" --replacement2:"%(CopyAndSubstituteText.Replacement2)" " Condition="'$(OS)' == 'Unix'" />
<!-- Make sure it will get cleaned -->
<CreateItem Include="$(OutDir)%(CopyAndSubstituteText.TargetFilename)">
<Output TaskParameter="Include" ItemName="FileWrites"/>
</CreateItem>
</Target>
<Import Project="$(FSharpSourcesRoot)\scripts\fssrgen.targets" Condition="'$(Configuration)' == 'Proto'" />
<Import Project="Microbuild.Settings.targets" Condition="'$(UseMicroBuild)' == 'true'"/>
<Target Name="dotnetrestore" BeforeTargets="Build" Condition=" '$(TargetDotnetProfile)' == 'coreclr' ">
<Exec Command="$(MSBuildThisFileDirectory)..\.nuget\nuget.exe restore -PackagesDirectory $(PackagesDir) -Config $(MSBuildThisFileDirectory)..\NuGet.Config project.json" />
</Target>
<Target Name="dotnetrestore" BeforeTargets="Build" Condition=" '$(DOTNET_PUBLISH)' == 'true' ">
<SetEnvVar Name="NUGET_PACKAGES" Value="$(NUGET_PACKAGES)" />
<Exec Command="$(MSBuildThisFileDirectory)..\Tools\dotnetcli\dotnet.exe restore --configfile $(MSBuildThisFileDirectory)..\NuGet.Config project.json"/>
</Target>
<Target Name="dotnetpublish" AfterTargets="Build" Condition=" '$(DOTNET_PUBLISH)' == 'true' ">
<SetEnvVar Name="NUGET_PACKAGES" Value="$(NUGET_PACKAGES)" />
<Exec Command="$(MSBuildThisFileDirectory)..\Tools\dotnetcli\dotnet.exe --verbose publish --no-build project.json -r $(DOTNET_PUBLISH_PLATFORM) -c $(Configuration) -o $(DOTNET_PUBLISH_PATH)"/>
</Target>
<Target Name="dotnetpublishfsccompiler" AfterTargets="CopyFilesToOutputDirectory" Condition=" '$(DOTNET_PUBLISH_FSC)' == 'true' ">
<SetEnvVar Name="NUGET_PACKAGES" Value="$(NUGET_PACKAGES)" />
<Exec Command="$(MSBuildThisFileDirectory)..\Tools\dotnetcli\dotnet.exe restore DeployCompiler\fsc\project.json"/>
<Exec Command="$(MSBuildThisFileDirectory)..\Tools\dotnetcli\dotnet.exe --verbose publish --no-build DeployCompiler\fsc\project.json -r $(DOTNET_PUBLISH_PLATFORM) -c $(Configuration) -o $(DOTNET_PUBLISH_FSC_PATH)"/>
</Target>
<Target Name="dotnetpublishfsicompiler" AfterTargets="CopyFilesToOutputDirectory" Condition=" '$(DOTNET_PUBLISH_FSI)' == 'true' ">
<SetEnvVar Name="NUGET_PACKAGES" Value="$(NUGET_PACKAGES)" />
<Exec Command="$(MSBuildThisFileDirectory)..\Tools\dotnetcli\dotnet.exe restore DeployCompiler\fsi\project.json"/>
<Exec Command="$(MSBuildThisFileDirectory)..\Tools\dotnetcli\dotnet.exe --verbose publish --no-build DeployCompiler\fsi\project.json -r $(DOTNET_PUBLISH_PLATFORM) -c $(Configuration) -o $(DOTNET_PUBLISH_FSI_PATH)"/>
</Target>
<Target Name="GenerateSourceLink" BeforeTargets="CoreCompile" Condition="'$(UseSourceLink)' == 'true'">
<PropertyGroup>
<SrcRootDirectory>$([System.IO.Directory]::GetParent($(MSBuildThisFileDirectory.TrimEnd("\"))))</SrcRootDirectory>
<SourceLinkRoot>$(SrcRootDirectory.Replace("\", "\\"))</SourceLinkRoot>
</PropertyGroup>
<Exec Command="git config --get remote.origin.url" ConsoleToMsBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="RemoteUri" />
</Exec>
<!-- https://raw.githubusercontent.com/KevinRansom/visualfsharp/98e8c9a2ca09a36ebd024eb424fc050a831053cd/build.cmd -->
<WriteLinesToFile File="$(IntermediateOutputPath)source_link.json" Overwrite="true" Lines='{"documents": { "$(SourceLinkRoot)\\*" : "$(RemoteUri.Replace(".git", "").Replace("github.com", "raw.githubusercontent.com"))/$(GitHeadSha)/*" }}' />
</Target>
<!-- If BuildVersionFilePath not specified then do nothing -->
<Target Name="CleanVersionFile" Condition ="'$(BuildVersionFilePath)' != '' ">
<PropertyGroup>
<BuildVersionFileDir>$([System.IO.Path]::GetDirectoryName($(BuildVersionFilePath)))</BuildVersionFileDir>
</PropertyGroup>
<RemoveDir Condition="Exists('$(BuildVersionFileDir)')" Directories="$(BuildVersionFileDir)" />
</Target>
<!-- If BuildVersionFilePath not specified then do nothing -->
<Target Name="CreateOrUpdateBuildVersionFile" Condition ="'$(BuildVersionFilePath)' != '' ">
<PropertyGroup>
<BuildVersionFileDir>$([System.IO.Path]::GetDirectoryName($(BuildVersionFilePath)))</BuildVersionFileDir>
<PackageVersionMajor Condition="'$(PackageVersionMajor)' == ''" >$(NuGetPerBuildPreReleaseVersion)</PackageVersionMajor>
<PackageVersionMinor Condition="'$(PackageVersionMinor)' != ''" >$([MSBuild]::Add($(PackageVersionMinor), 1))</PackageVersionMinor>
<PackageVersionMinor Condition="'$(PackageVersionMinor)' == ''" >1</PackageVersionMinor>
</PropertyGroup>
<ItemGroup>
<CurrentVersionLines Include="%3C%3Fxml version=%221.0%22 encoding=%22utf-8%22%3F%3E" />
<CurrentVersionLines Include="%3C!-- This is a generated file. $(VersionSeedSourceComment) Seed Date is $(VersionSeedDate). --%3E" />
<CurrentVersionLines Include="%3CProject xmlns=%22http://schemas.microsoft.com/developer/msbuild/2003%22%3E" />
<CurrentVersionLines Include="%3CPropertyGroup%3E" />
<CurrentVersionLines Include="%3CPackageVersionMajor Condition=%22%27%24(PackageVersionMajor)%27==%27%27%22%3E$(NuGetPerBuildPreReleaseVersion)%3C/PackageVersionMajor%3E" />
<CurrentVersionLines Include="%3CPackageVersionMinor Condition=%22%27%24(PackageVersionMinor)%27==%27%27%22%3E$(PackageVersionMinor)%3C/PackageVersionMinor%3E" />
<CurrentVersionLines Include="%3C/PropertyGroup%3E" />
<CurrentVersionLines Include="%3C/Project%3E" />
</ItemGroup>
<!-- Since by default the file will get dropped at the obj dir, make sure that the dir is created already or else WriteLinesToFile will error. -->
<MakeDir Condition="!Exists('$(BuildVersionFileDir)')" Directories="$(BuildVersionFileDir)" />
<WriteLinesToFile
ContinueOnError="WarnAndContinue"
File="$(BuildVersionFilePath)"
Lines="@(CurrentVersionLines)"
Overwrite="true" />
<!-- Delete old BuildVersion.props files -->
<ItemGroup>
<OldBuildVersionFiles Include="$(BuildVersionFilePath)BuildVersions-*.props" Exclude="$(BuildVersionFilePath)%(BuildVersionFileItem.Filename).props" />
</ItemGroup>
<Delete Files="@(OldBuildVersionFiles)" TreatErrorsAsWarnings="true"/>
</Target>
<UsingTask TaskName="FSharpEmbedResourceText"
AssemblyFile="$(FSharpSourcesRoot)\..\Proto\net40\bin\FSharp.Build.dll"
Condition="'$(Configuration)' != 'Proto'" />
<UsingTask TaskName="FSharpEmbedResXSource"
AssemblyFile="$(FSharpSourcesRoot)\..\Proto\net40\bin\FSharp.Build.dll"
Condition="'$(Configuration)' != 'Proto'" />
<UsingTask TaskName="WriteCodeFragment"
AssemblyFile="$(FSharpSourcesRoot)\..\Proto\net40\bin\FSharp.Build.dll"
Condition="'$(Configuration)' != 'Proto'" />
<Target Name="GenerateFSharpTextResources"
BeforeTargets="GetXlfSources;CoreResGen;PrepareForBuild"
Condition="'$(Configuration)' != 'Proto'">
<MakeDir Directories="$(IntermediateOutputPath)" />
<!-- Generate source for all resx files. -->
<FSharpEmbedResXSource EmbeddedResource="@(EmbeddedResource)" IntermediateOutputPath="$(IntermediateOutputPath)" TargetFramework="$(TargetFramework)">
<Output TaskParameter="GeneratedSource" ItemName="_FsGeneratedResXSource" />
</FSharpEmbedResXSource>
<ItemGroup>
<CompileBefore Include="@(_FsGeneratedResXSource)" />
<FileWrites Include="@(_FsGeneratedResXSource)" />
</ItemGroup>
<!-- Generate resx and source for all txt files. -->
<FSharpEmbedResourceText EmbeddedText="@(EmbeddedText)" IntermediateOutputPath="$(IntermediateOutputPath)">
<Output TaskParameter="GeneratedSource" ItemName="_FsGeneratedTxtSource" />
<Output TaskParameter="GeneratedResx" ItemName="_FsGeneratedResx" />
</FSharpEmbedResourceText>
<ItemGroup>
<CompileBefore Include="@(_FsGeneratedTxtSource)" />
<EmbeddedResource Include="@(_FsGeneratedResx)" />
<FileWrites Include="@(_FsGeneratedTxtSource)" />
<FileWrites Include="@(_FsGeneratedResx)" />
</ItemGroup>
</Target>
<Import Project="..\build\targets\GenerateAssemblyAttributes.targets" />
<Import Project="..\build\targets\GenerateInternalsVisibleTo.targets" />
<UsingTask TaskName="ReplaceFileText" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<InputFilename ParameterType="System.String" Required="true" />
<OutputFilename ParameterType="System.String" Required="true" />
<MatchExpression ParameterType="System.String" Required="true" />
<ReplacementText ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Core" />
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Text.RegularExpressions" />
<Code Type="Fragment" Language="cs">
<![CDATA[
File.WriteAllText(
OutputFilename,
Regex.Replace(File.ReadAllText(InputFilename), MatchExpression, ReplacementText)
);
]]>
</Code>
</Task>
</UsingTask>
<UsingTask TaskName="SetEnvVar" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<Name ParameterType="System.String" Required="true" />
<Value ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Code Type="Fragment" Language="cs">
<![CDATA[
Environment.SetEnvironmentVariable(Name, Value);
]]>
</Code>
</Task>
</UsingTask>
</Project>