Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita16e9f1

Browse files
committed
Towards bootstrapping the compiler with xbuild
Wouldn't it be good if we could build the compiler with xbuild (atleast be able to on Mono 3.0.0). This moves in this direction.The "mono20" and "mono40" target frameworks are removed since we justuse "net20" and "net40" to build.The FSharpSource.targets is adjusted to use lib/bootstrap/4.0 and toalways use the msft.pubkey (as we do with the Makefile build)The CustomCopyLocalFiles and subst.exe stuff is removed to simplify thebuildThe FSharp.SrGen.targets is copied from the LKG directory and adjustedto give the right names to the resource files (don't put the outputs ina target directory)
1 parentb7c1d98 commita16e9f1

File tree

19 files changed

+1087
-173
lines changed

19 files changed

+1087
-173
lines changed
21.5 KB
Binary file not shown.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<!--
2+
***********************************************************************************************
3+
FSharp.PowerPack.targets
4+
5+
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
6+
created a backup copy. Incorrect changes to this file will make it
7+
impossible to load or build your projects from the command-line or the IDE.
8+
9+
PowerPack extended build rules.
10+
11+
Copyright (C) Microsoft Corporation. All rights reserved.
12+
***********************************************************************************************
13+
-->
14+
15+
<Projectxmlns="http://schemas.microsoft.com/developer/msbuild/2003">
16+
<UsingTaskTaskName="FsLex"AssemblyFile="FSharp.PowerPack.Build.Tasks.dll"/>
17+
<UsingTaskTaskName="FsYacc"AssemblyFile="FSharp.PowerPack.Build.Tasks.dll"/>
18+
<!-- <Import Project="Microsoft.FSharp.Targets"/>-->
19+
<PropertyGroup>
20+
<CompileDependsOn>CallFsLex;CallFsYacc;$(CompileDependsOn)</CompileDependsOn>
21+
</PropertyGroup>
22+
23+
<!-- Build FsLex files.-->
24+
<Target
25+
Name="CallFsLex"
26+
Inputs="@(FsLex)"
27+
Outputs="@(FsLex->'$(FsLexOutputFolder)%(Filename).fs')"
28+
Condition="'@(FsLex)'!=''">
29+
30+
<!-- Create the output directory-->
31+
<MakeDirDirectories="$(FsLexOutputFolder)"/>
32+
<!-- Call FsLex-->
33+
<FsLex
34+
InputFile="%(FsLex.Identity)"
35+
OutputFile="$(FsLexOutputFolder)%(FsLex.Filename).fs"
36+
ToolPath="$(FsLexToolPath)"
37+
ToolExe="$(FsLexToolExe)"
38+
OtherFlags="%(FsLex.OtherFlags)"
39+
Unicode="$(FsLexUnicode)">
40+
<!-- Track outputs for 'Clean'-->
41+
<OutputTaskParameter="OutputFile"ItemName="FileWrites"/>
42+
</FsLex>
43+
<!-- Make sure it will get cleaned-->
44+
<CreateItemInclude="$(FsLexOutputFolder)%(FsLex.Filename).fs">
45+
<OutputTaskParameter="Include"ItemName="FileWrites"/>
46+
</CreateItem>
47+
</Target>
48+
49+
<!-- Build FsYacc files.-->
50+
<Target
51+
Name="CallFsYacc"
52+
Inputs="@(FsYacc)"
53+
Outputs="@(FsYacc->'$(FsYaccOutputFolder)%(Filename).fs')"
54+
Condition="'@(FsYacc)'!=''">
55+
56+
<!-- Create the output directory-->
57+
<MakeDirDirectories="$(FsYaccOutputFolder)"/>
58+
<!-- Call FsYacc-->
59+
<FsYacc
60+
InputFile="%(FsYacc.Identity)"
61+
OutputFile="$(FsYaccOutputFolder)%(FsYacc.Filename).fs"
62+
Open="%(FsYacc.Open)"
63+
Module="%(FsYacc.Module)"
64+
OtherFlags="%(FsYacc.OtherFlags)"
65+
ToolPath="$(FsYaccToolPath)"
66+
ToolExe="$(FsYaccToolExe)">
67+
<!-- Track outputs for 'Clean'-->
68+
<OutputTaskParameter="OutputFile"ItemName="FileWrites"/>
69+
</FsYacc>
70+
<!-- Make sure it will get cleaned-->
71+
<CreateItemInclude="$(FsYaccOutputFolder)%(FsYacc.Filename).fs">
72+
<OutputTaskParameter="Include"ItemName="FileWrites"/>
73+
</CreateItem>
74+
</Target>
75+
<ItemGroup>
76+
<AvailableItemNameInclude="FsLex">
77+
<Visible>false</Visible>
78+
</AvailableItemName>
79+
<AvailableItemNameInclude="FsYacc">
80+
<Visible>false</Visible>
81+
</AvailableItemName>
82+
</ItemGroup>
83+
</Project>
84+
85+
86+
9 KB
Binary file not shown.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<!--
2+
***********************************************************************************************
3+
FSharp.SRGen.targets
4+
5+
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
6+
created a backup copy. Incorrect changes to this file will make it
7+
impossible to load or build your projects from the command-line or the IDE.
8+
9+
Copyright (C) Microsoft Corporation. All rights reserved.
10+
***********************************************************************************************
11+
-->
12+
13+
<Projectxmlns="http://schemas.microsoft.com/developer/msbuild/2003">
14+
<UsingTaskTaskName="FsSrGen"AssemblyFile="FSharp.SRGen.Build.Tasks.dll"/>
15+
<PropertyGroup>
16+
<BuildDependsOn>ProcessFsSrGen;$(BuildDependsOn)</BuildDependsOn>
17+
</PropertyGroup>
18+
19+
<!-- Build FsSrGen files.-->
20+
<Target
21+
Name="CallFsSrGen"
22+
Inputs="@(FsSrGen)"
23+
Outputs="@(FsSrGen->'$(IntermediateOutputPath)%(Filename).fs');@(FsSrGen->'%(Filename).resx')"
24+
Condition="'@(FsSrGen)'!=''">
25+
<!-- Create the output directory in case it doesn't exist yet-->
26+
<MakeDirDirectories="$(IntermediateOutputPath)"/>
27+
<!-- Run the tool-->
28+
<FsSrGen
29+
InputFile="%(FsSrGen.FullPath)"
30+
ToolPath="$(FsSrGenToolPath)"
31+
OutputFsFile="$(IntermediateOutputPath)%(FsSrGen.Filename).fs"
32+
<!-- Don't put the resx in the IntermediateOutputPath as the Mono targets ends up naming the resource incorrectly (it ignores ManifestResourceName) -->
33+
OutputResxFile="%(FsSrGen.Filename).resx"
34+
>
35+
</FsSrGen>
36+
</Target>
37+
38+
<!-- Process FsSrGen rules. No'Inputs' and'Outputs' means this rule always runs if there is any @FsSrGen, even if up-to-date. -->
39+
<Target
40+
Name="ProcessFsSrGen"
41+
DependsOnTargets="CallFsSrGen"
42+
Condition="'@(FsSrGen)'!=''">
43+
<!-- Make the outputs magically part of the project -->
44+
<CreateItem Include="$(IntermediateOutputPath)%(FsSrGen.Filename).fs">
45+
<Output TaskParameter="Include" ItemName="CompileBefore"/>
46+
</CreateItem>
47+
<CreateItem Include="%(FsSrGen.Filename).resx"
48+
AdditionalMetadata="ManifestResourceName=%(FsSrGen.Filename)">
49+
<!-- Note AdditionalMetadata above; we need the name in the manifest to be Foo.resources and not e.g. obj.Debug.Foo.resources -->
50+
<Output TaskParameter="Include" ItemName="EmbeddedResource"/>
51+
</CreateItem>
52+
<!-- Add them to the list of things under the IntermediateOutputPath that should be'clean'ed -->
53+
<CreateItem Include="$(IntermediateOutputPath)%(FsSrGen.Filename).fs">
54+
<Output TaskParameter="Include" ItemName="FileWrites"/>
55+
</CreateItem>
56+
<CreateItem Include="%(FsSrGen.Filename).resx">
57+
<Output TaskParameter="Include" ItemName="FileWrites"/>
58+
</CreateItem>
59+
<!-- below, turn off this in VS, so that all90.sln does not take forever to load -->
60+
<Exec Condition="'$(EnsureThereAreNoUnusedFsSrGenResources)'!='false' And'$(BuildingInsideVisualStudio)'!='true'"
61+
Command="$(FSharpSourcesRoot)\..\lkg\FSharp-$(LkgVersion)\bin\FindUnusedResources.exe %(FsSrGen.FullPath) $(FSharpSourcesRoot)" />
62+
</Target>
63+
64+
<ItemGroup>
65+
<AvailableItemName Include="FsSrGen">
66+
<Visible>false</Visible>
67+
</AvailableItemName>
68+
</ItemGroup>
69+
</Project>

‎src/FSharpSource.targets‎

Lines changed: 23 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,29 @@
1010
<TargetFrameworkCondition="'$(TargetFramework)'==''">net40</TargetFramework>
1111
<!-- For .NET 2.0 use a 2.0 proto compiler, otherwise use a 4.0 proto compiler-->
1212
<protoCLIDirCondition="'$(protoCLIDir)' == ''">net40</protoCLIDir>
13-
<LkgVersion>4.0.30319.1</LkgVersion>
13+
<LkgPath>..\lib\bootstrap\4.0</LkgPath>
1414
<FsLexUnicode>true</FsLexUnicode>
1515
<ProjectLanguage>FSharp</ProjectLanguage>
1616
<OtherFlags>$(OtherFlags) --times</OtherFlags>
1717
<NoWarn>$(NoWarn);69;65;54;61;75</NoWarn>
1818
<DebugSymbols>true</DebugSymbols>
1919
</PropertyGroup>
2020

21-
<!-- For .NET 2.0 and 4.0, we use the version in 'source-build-version', initially 2.9.999-->
22-
<!-- For Mono 2.0 and 4.0, we use the same versions as VS2012 (see strong naming below)-->
23-
<!---->
24-
<!-- However FSharp.Core must always use the same version and name as VS, with delay signing, see below-->
25-
<PropertyGroupCondition="'$(AssemblyName)' != 'FSharp.Core'">
26-
<VersionFile>$(FSharpSourcesRoot)\source-build-version</VersionFile>
27-
<VersionFileCondition="'$(TargetFramework)' == 'mono20'">$(FSharpSourcesRoot)\source-build-version-2.3.0.0</VersionFile>
28-
<VersionFileCondition="'$(TargetFramework)' == 'mono40'">$(FSharpSourcesRoot)\source-build-version-4.3.0.0</VersionFile>
29-
</PropertyGroup>
30-
31-
<PropertyGroupCondition="'$(AssemblyName)' == 'FSharp.Core'">
21+
<!-- We use the same versions as VS2012 (see strong naming below)-->
22+
<PropertyGroup>
3223
<VersionFile>$(FSharpSourcesRoot)\source-build-version</VersionFile>
33-
<VersionFileCondition="'$(TargetFramework)' == 'net20' OR '$(TargetFramework)' == 'mono20'">$(FSharpSourcesRoot)\source-build-version-2.3.0.0</VersionFile>
34-
<VersionFileCondition="'$(TargetFramework)' == 'net40' OR '$(TargetFramework)' == 'mono40'">$(FSharpSourcesRoot)\source-build-version-4.3.0.0</VersionFile>
24+
<VersionFileCondition="'$(TargetFramework)' == 'net20'">$(FSharpSourcesRoot)\source-build-version-2.3.0.0</VersionFile>
25+
<VersionFileCondition="'$(TargetFramework)' == 'net40'">$(FSharpSourcesRoot)\source-build-version-4.3.0.0</VersionFile>
3526
</PropertyGroup>
3627

37-
<!-- For .NET 2.0 and 4.0, we use test-signed binaries, apart from FSharp.Core. We do this because there's no point creating Microsoft-named binaries.-->
38-
<!---->
39-
<!-- For Mono 2.0 and 4.0, we sign with the Microsoft key and use delay-signing.-->
28+
<!-- We sign with the Microsoft key and use delay-signing.-->
4029
<!-- These can then be signed with the special mono.snk (we don't do this as part of this build,-->
4130
<!-- but it can be done manually later, e.g. on the target machine). This is how the Mono team build the binaries-->
4231
<!-- at github.com/fsharp/fsharp and how they are shipped with Mono-->
4332
<!---->
4433
<!-- However FSharp.Core must use the Microsoft key name, otherwise the compiler can't load type provider components.-->
45-
<PropertyGroupCondition="('$(Configuration)'=='Debug' OR '$(Configuration)'=='Release') AND ('$(TargetFramework)' == 'net20' OR '$(TargetFramework)' == 'net40')">
46-
<DefineConstants>STRONG_NAME_FSHARP_COMPILER_WITH_TEST_KEY;$(DefineConstants)</DefineConstants>
47-
<OtherFlagsCondition="'$(AssemblyName)' == 'FSharp.Core'">$(OtherFlags) --delaysign+ --keyfile:$(FSharpSourcesRoot)\fsharp\msft.pubkey</OtherFlags>
48-
<OtherFlagsCondition="'$(AssemblyName)' != 'FSharp.Core'">$(OtherFlags) --keyfile:$(FSharpSourcesRoot)\fsharp\test.snk</OtherFlags>
49-
<StrongNames>true</StrongNames>
50-
</PropertyGroup>
5134

52-
<PropertyGroupCondition="('$(Configuration)'=='Debug' OR '$(Configuration)'=='Release') AND ('$(TargetFramework)' == 'mono20' OR '$(TargetFramework)' == 'mono40')">
35+
<PropertyGroupCondition="'$(Configuration)'=='Debug' OR '$(Configuration)'=='Release'">
5336
<DefineConstants>STRONG_NAME_AND_DELAY_SIGN_FSHARP_COMPILER_WITH_MSFT_KEY;$(DefineConstants)</DefineConstants>
5437
<OtherFlags>$(OtherFlags) --delaysign+ --keyfile:$(FSharpSourcesRoot)\fsharp\msft.pubkey</OtherFlags>
5538
<StrongNames>true</StrongNames>
@@ -80,6 +63,10 @@
8063
<DefineConstants>DEBUG;NO_STRONG_NAMES;$(DefineConstants)</DefineConstants>
8164
</PropertyGroup>
8265

66+
<PropertyGroup>
67+
<DefineConstants>MONO;$(DefineConstants)</DefineConstants>
68+
</PropertyGroup>
69+
8370
<!-- Always qualify the IntermediateOutputPath by the TargetFramework if any exists-->
8471
<PropertyGroup>
8572
<IntermediateOutputPath>obj\$(Configuration)\$(TargetFramework)\</IntermediateOutputPath>
@@ -102,14 +89,15 @@
10289
<OtherFlags>$(OtherFlags) --simpleresolution</OtherFlags>
10390
</PropertyGroup>
10491

105-
<PropertyGroupCondition="'$(TargetFramework)'=='net40' or '$(TargetFramework)'=='mono40'">
92+
<PropertyGroupCondition="'$(TargetFramework)'=='net40'">
10693
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
10794
<DefineConstants>$(DefineConstants);FX_ATLEAST_40</DefineConstants>
10895
<DefineConstants>$(DefineConstants);FX_ATLEAST_35</DefineConstants>
10996
<DefineConstants>$(DefineConstants);BE_SECURITY_TRANSPARENT</DefineConstants>
11097
<DefineConstants>$(DefineConstants);QUERIES_IN_FSLIB</DefineConstants>
11198
<DefineConstants>$(DefineConstants);PUT_TYPE_PROVIDERS_IN_FSCORE;</DefineConstants>
11299
<DefineConstants>$(DefineConstants);FX_ATLEAST_LINQ</DefineConstants>
100+
<DefineConstants>$(DefineConstants);FX_NO_BIGINT_CULTURE_PARSE</DefineConstants>
113101
<TargetFrameworkProfile></TargetFrameworkProfile>
114102
<!-- MSbuild works out the assembly references-->
115103
</PropertyGroup>
@@ -445,40 +433,26 @@
445433

446434

447435

448-
<ImportProject="..\Proto\$(protoCLIDir)\bin\Microsoft.FSharp-proto.Targets"
449-
Condition="'$(BuildWith)' == ''
450-
AND '$(ProjectLanguage)' == 'FSharp'"/>
451-
<ImportProject="$(MSBuildExtensionsPath32)\FSharp\1.0\Microsoft.FSharp.Targets"
452-
Condition="'$(BuildWith)' == 'LKG' AND
453-
'$(ProjectLanguage)' == 'FSharp' AND
454-
!Exists('$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll')" />
455-
<ImportProject="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets"
456-
Condition="'$(BuildWith)' == 'LKG'
457-
AND '$(ProjectLanguage)' == 'FSharp'
458-
AND Exists('$(MSBuildBinPath)\Microsoft.Build.Tasks.v4.0.dll')
459-
AND Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')" />
460-
<ImportProject="$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets"
461-
Condition="'$(BuildWith)' == 'LKG'
462-
AND '$(ProjectLanguage)' == 'FSharp'
463-
AND Exists('$(MSBuildBinPath)\Microsoft.Build.Tasks.v4.0.dll')
464-
AND (!Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets'))
465-
AND (Exists('$(MSBuildExtensionsPath32)\..\Microsoft F#\v4.0\Microsoft.FSharp.Targets'))" />
436+
<ImportProject="..\Proto\$(protoCLIDir)\bin\Microsoft.FSharp-proto.targets"
437+
Condition="'$(BuildWith)' == '' AND '$(ProjectLanguage)' == 'FSharp'"/>
438+
<ImportProject="$(LkgPath)\Microsoft.FSharp.targets"
439+
Condition="'$(BuildWith)' == 'LKG' AND '$(ProjectLanguage)' == 'FSharp'" />
466440
<ImportProject="Silverlight\$(SilverlightVersion)\FSharpSource.Silverlight.Common.targets"
467441
Condition="'$(TargetFramework)'=='sl3' or '$(TargetFramework)'=='sl4' or '$(TargetFramework)'=='sl5' or '$(TargetFramework)'=='sl5-compiler'"/>
468442

469443
<!-- Reference an existing FSI.EXE for use from within MSBuild-->
470444
<PropertyGroup>
471-
<FsSrGenToolPath>$(FSharpSourcesRoot)\..\lkg\FSharp-$(LkgVersion)\bin</FsSrGenToolPath>
472-
<FsLexToolPath>$(FSharpSourcesRoot)\..\lkg\FSharp-$(LkgVersion)\bin</FsLexToolPath>
473-
<FsYaccToolPath>$(FSharpSourcesRoot)\..\lkg\FSharp-$(LkgVersion)\bin</FsYaccToolPath>
445+
<FsSrGenToolPath>$(FSharpSourcesRoot)\$(LkgPath)\..\2.0</FsSrGenToolPath>
446+
<FsLexToolPath>$(FSharpSourcesRoot)\$(LkgPath)\..\2.0</FsLexToolPath>
447+
<FsYaccToolPath>$(FSharpSourcesRoot)\$(LkgPath)\..\2.0</FsYaccToolPath>
474448
<FsLexToolExe>fslex.exe</FsLexToolExe>
475449
<FsYaccToolExe>fsyacc.exe</FsYaccToolExe>
476450
</PropertyGroup>
477451

478452

479453
<PropertyGroup>
480454
<!-- Hook compilation phase to do custom work-->
481-
<CompileDependsOn>ValidateConfiguration;$(CompileDependsOn);CustomCopyLocalFiles</CompileDependsOn>
455+
<CompileDependsOn>ValidateConfiguration;$(CompileDependsOn)</CompileDependsOn>
482456
<RootNamespace></RootNamespace>
483457
<DocumentationFile>$(OutputPath)$(AssemblyName).xml</DocumentationFile>
484458
<EnsureThereAreNoUnusedFsSrGenResources>false</EnsureThereAreNoUnusedFsSrGenResources>
@@ -489,30 +463,13 @@
489463
Text="Configuration '$(Configuration)' is not one of the supported configurations: Debug, Release, Proto"
490464
Condition="'$(Configuration)'!='Release' and '$(Configuration)'!='Debug' and '$(Configuration)'!='Proto'"/>
491465
<Error
492-
Text="TargetFramework '$(TargetFramework)' is not one of the supported configurations: 'empty', net20, net40,mono20, mono40,sl3-wp, sl5, sl5-compiler"
466+
Text="TargetFramework '$(TargetFramework)' is not one of the supported configurations: 'empty', net20, net40, sl3-wp, sl5, sl5-compiler"
493467
Condition="! ('$(TargetFramework)' == 'net40' or
494468
'$(TargetFramework)' == 'net20' or
495-
'$(TargetFramework)' == 'mono40' or
496-
'$(TargetFramework)' == 'mono20' or
497469
'$(TargetFramework)' == 'sl5' or
498470
'$(TargetFramework)' == 'sl5-compiler' or
499471
'$(TargetFramework)' == 'sl3-wp')"/>
500472
</Target>
501473

502-
<!-- This build step copies files to the output folder while replacing build variables in the text of
503-
those file.-->
504-
<Target
505-
Name="CustomCopyLocalFiles"
506-
Inputs="@(CustomCopyLocal)"
507-
Outputs="@(CustomCopyLocal->'$(OutDir)%(TargetFilename)')"
508-
Condition="'$(targetCLIDir)'!='Silverlight/4.0/'"
509-
>
510-
<ExecCommand="$(FSharpSourcesRoot)\fsharp\FSharp.Build\subst.exe {LkgVersion} $(LkgVersion) {BuildSuffix}&quot;$(FsBuildSuffix)&quot; {FSharpTargetsDir} unused&quot;%(CustomCopyLocal.FullPath)&quot;&gt; $(OutDir)%(CustomCopyLocal.TargetFilename)"/>
511-
<!-- Make sure it will get cleaned-->
512-
<CreateItemInclude="$(OutDir)%(CustomCopyLocal.TargetFilename)">
513-
<OutputTaskParameter="Include"ItemName="FileWrites"/>
514-
</CreateItem>
515-
</Target>
516-
517-
<ImportProject="..\lkg\FSharp-$(LkgVersion)\bin\FSharp.SRGen.targets" />
474+
<ImportProject="$(LkgPath)\..\2.0\FSharp.SRGen.targets" />
518475
</Project>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp