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

Commitc03b9c1

Browse files
authored
Minor cleanup for Build Task (#3969)
* For FSI on coreclr use ResolutionEnvironment.CompilationAndEvaluation just like on desktop* Trim fsi from buildtasks dll* Put back converter code* We don't support Itanium any longer* Remove Itanium testcase* Separate FSc and FSharpCommandLineBuilder, feedback* Move from Converter To Func<int>
1 parent0c11595 commitc03b9c1

File tree

9 files changed

+208
-285
lines changed

9 files changed

+208
-285
lines changed

‎src/buildfromsource/FSharp.Build/FSharp.Build.fsproj‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@
2121
<CompileInclude="..\..\assemblyinfo\assemblyinfo.FSharp.Build.dll.fs" />
2222
<CompileInclude="..\..\utils\CompilerLocationUtils.fs" />
2323
<CompileInclude="..\..\utils\reshapedreflection.fs" />
24-
<CompileInclude="$(FSharpSourcesRoot)\fsharp\FSharp.Build\Fsc.fsi" />
24+
<CompileInclude="$(FSharpSourcesRoot)\fsharp\FSharp.Build\FSharpCommandLineBuilder.fs" />
2525
<CompileInclude="$(FSharpSourcesRoot)\fsharp\FSharp.Build\Fsc.fs" />
2626
<CompileInclude="$(FSharpSourcesRoot)\fsharp\FSharp.Build\FSharpEmbedResourceText.fs" />
2727
<CompileInclude="$(FSharpSourcesRoot)\fsharp\FSharp.Build\FSharpEmbedResXSource.fs" />
2828
<CompileInclude="$(FSharpSourcesRoot)\fsharp\FSharp.Build\WriteCodeFragment.fs" />
29-
<CompileInclude="$(FSharpSourcesRoot)\fsharp\FSharp.Build\CreateFSharpManifestResourceName.fsi" />
3029
<CompileInclude="$(FSharpSourcesRoot)\fsharp\FSharp.Build\CreateFSharpManifestResourceName.fs" />
3130
<CopyAndSubstituteTextInclude="$(FSharpSourcesRoot)\fsharp\FSharp.Build\Microsoft.FSharp.Targets">
3231
<TargetFilename>Microsoft.FSharp.Targets</TargetFilename>

‎src/fsharp/FSharp.Build-proto/FSharp.Build-proto.fsproj‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,13 @@
2222
<CompileInclude="..\..\utils\CompilerLocationUtils.fs">
2323
<Link>CompilerLocationUtils.fs</Link>
2424
</Compile>
25-
<CompileInclude="..\FSharp.Build\CreateFSharpManifestResourceName.fsi">
26-
<Link>CreateFSharpManifestResourceName.fsi</Link>
27-
</Compile>
2825
<CompileInclude="..\FSharp.Build\CreateFSharpManifestResourceName.fs" >
2926
<Link>CreateFSharpManifestResourceName.fs</Link>
3027
</Compile>
31-
<CompileInclude="..\FSharp.Build\Fsc.fsi">
32-
<Link>Fsc.fsi</Link>
33-
</Compile>
34-
<CompileInclude="..\FSharp.Build\Fsc.fs">
28+
<CompileInclude="..\FSharp.Build\FSharpCommandLineBuilder.fs">
29+
<Link>FSharpCommandLineBuilder.fs</Link>
30+
</Compile>
31+
<CompileInclude="..\FSharp.Build\Fsc.fs">
3532
<Link>Fsc.fs</Link>
3633
</Compile>
3734
<CompileInclude="..\FSharp.Build\FSharpEmbedResourceText.fs">

‎src/fsharp/FSharp.Build/CreateFSharpManifestResourceName.fsi‎

Lines changed: 0 additions & 9 deletions
This file was deleted.

‎src/fsharp/FSharp.Build/FSharp.Build.fsproj‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,16 @@
2020
<HasLceComments>false</HasLceComments>
2121
<InProject>false</InProject>
2222
</FilesToLocalize>
23-
</ItemGroup>
24-
25-
<ItemGroup>
2623
<InternalsVisibleToInclude="VisualFSharp.Unittests" />
27-
</ItemGroup>
28-
29-
<ItemGroup>
3024
<EmbeddedTextInclude="FSBuild.txt" />
3125
<CompileInclude="..\..\assemblyinfo\assemblyinfo.FSharp.Build.dll.fs" />
3226
<CompileInclude="..\..\utils\CompilerLocationUtils.fs" />
3327
<CompileInclude="..\..\utils\reshapedreflection.fs" />
34-
<CompileInclude="Fsc.fsi" />
28+
<CompileInclude="FSharpCommandLineBuilder.fs" />
3529
<CompileInclude="Fsc.fs" />
3630
<CompileInclude="FSharpEmbedResourceText.fs" />
3731
<CompileInclude="FSharpEmbedResXSource.fs" />
3832
<CompileInclude="WriteCodeFragment.fs" />
39-
<CompileInclude="CreateFSharpManifestResourceName.fsi" />
4033
<CompileInclude="CreateFSharpManifestResourceName.fs" />
4134
<CopyAndSubstituteTextInclude="Microsoft.FSharp.Targets">
4235
<TargetFilename>Microsoft.FSharp.Targets</TargetFilename>
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
2+
3+
namespaceMicrosoft.FSharp.Build
4+
5+
openSystem
6+
openSystem.Text
7+
openMicrosoft.Build.Framework
8+
openMicrosoft.Build.Utilities
9+
openInternal.Utilities
10+
11+
[<assembly: System.Runtime.InteropServices.ComVisible(false)>]
12+
[<assembly: System.CLSCompliant(true)>]
13+
do()
14+
15+
typeFSharpCommandLineBuilder()=
16+
17+
// In addition to generating a command-line that will be handed to cmd.exe, we also generate
18+
// an array of individual arguments. The former needs to be quoted (and cmd.exe will strip the
19+
// quotes while parsing), whereas the latter is not. See bug 4357 for background; this helper
20+
// class gets us out of the business of unparsing-then-reparsing arguments.
21+
22+
letbuilder=new CommandLineBuilder()
23+
let mutableargs=[]// in reverse order
24+
let mutablesrcs=[]// in reverse order
25+
26+
/// Return a list of the arguments (with no quoting for the cmd.exe shell)
27+
memberx.CapturedArguments()= List.rev args
28+
29+
/// Return a list of the sources (with no quoting for the cmd.exe shell)
30+
memberx.CapturedFilenames()= List.rev srcs
31+
32+
/// Return a full command line (with quoting for the cmd.exe shell)
33+
overridex.ToString()= builder.ToString()
34+
35+
memberx.AppendFileNamesIfNotNull(filenames:ITaskItem array,sep:string)=
36+
builder.AppendFileNamesIfNotNull(filenames, sep)
37+
// do not update "args", not used
38+
for itemin filenamesdo
39+
lettmp=new CommandLineBuilder()
40+
tmp.AppendSwitchUnquotedIfNotNull("", item.ItemSpec)// we don't want to quote the filename, this is a way to get that
41+
lets= tmp.ToString()
42+
if s<> String.Emptythen
43+
srcs<- tmp.ToString():: srcs
44+
45+
memberx.AppendSwitchIfNotNull(switch:string,values:string array,sep:string)=
46+
builder.AppendSwitchIfNotNull(switch, values, sep)
47+
lettmp=new CommandLineBuilder()
48+
tmp.AppendSwitchUnquotedIfNotNull(switch, values, sep)
49+
lets= tmp.ToString()
50+
if s<> String.Emptythen
51+
args<- s:: args
52+
53+
memberx.AppendSwitchIfNotNull(switch:string,value:string,?metadataNames:string array)=
54+
letmetadataNames= defaultArg metadataNames[||]
55+
builder.AppendSwitchIfNotNull(switch, value)
56+
lettmp=new CommandLineBuilder()
57+
tmp.AppendSwitchUnquotedIfNotNull(switch, value)
58+
letprovidedMetaData=
59+
metadataNames
60+
|> Array.filter(String.IsNullOrWhiteSpace>>not)
61+
if providedMetaData.Length>0then
62+
tmp.AppendTextUnquoted","
63+
tmp.AppendTextUnquoted(providedMetaData|> String.concat",")
64+
lets= tmp.ToString()
65+
if s<> String.Emptythen
66+
args<- s:: args
67+
68+
memberx.AppendSwitchUnquotedIfNotNull(switch:string,value:string)=
69+
assert(switch="")// we only call this method for "OtherFlags"
70+
// Unfortunately we still need to mimic what cmd.exe does, but only for "OtherFlags".
71+
letParseCommandLineArgs(commandLine:string)=// returns list in reverse order
72+
let mutableargs=[]
73+
let mutablei=0// index into commandLine
74+
letlen= commandLine.Length
75+
while i< lendo
76+
// skip whitespace
77+
while i< len&& System.Char.IsWhiteSpace(commandLine, i)do
78+
i<- i+1
79+
if i< lenthen
80+
// parse an argument
81+
letsb=new StringBuilder()
82+
let mutablefinished=false
83+
let mutableinsideQuote=false
84+
while i< len&&not finisheddo
85+
match commandLine.[i]with
86+
|'"'-> insideQuote<-not insideQuote; i<- i+1
87+
| cwhennot insideQuote&& System.Char.IsWhiteSpace(c)-> finished<-true
88+
| c-> sb.Append(c)|> ignore; i<- i+1
89+
args<- sb.ToString():: args
90+
args
91+
builder.AppendSwitchUnquotedIfNotNull(switch, value)
92+
lettmp=new CommandLineBuilder()
93+
tmp.AppendSwitchUnquotedIfNotNull(switch, value)
94+
lets= tmp.ToString()
95+
if s<> String.Emptythen
96+
args<- ParseCommandLineArgs(s)@ args
97+
98+
memberx.AppendSwitch(switch:string)=
99+
builder.AppendSwitch(switch)
100+
args<- switch:: args
101+
102+
memberinternalx.GetCapturedArguments()=
103+
[|
104+
yield! x.CapturedArguments()
105+
yield! x.CapturedFilenames()
106+
|]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp