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

Commitce42420

Browse files
committed
Look for fsc.exe alongside FSharp.Build.dll
1 parentd637edf commitce42420

File tree

6 files changed

+20
-8
lines changed

6 files changed

+20
-8
lines changed

‎src/fsharp/FSharp.Build/Fsc.fs‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,12 @@ type [<Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:Iden
137137
let mutabletreatWarningsAsErrors:bool=false
138138
let mutablewarningsAsErrors:string=null
139139
let mutabletoolPath:string=
140-
match FSharpEnvironment.BinFolderOfDefaultFSharpCompiler()with
140+
// We expect to find an fsc.exe next to FSharp.Build.dll. Note FSharp.Build.dll
141+
// is not in the GAC, at least on Windows.
142+
letlocationOfThisDll=
143+
try Some(System.IO.Path.GetDirectoryName(typeof<FscCommandLineBuilder>.Assembly.Location))
144+
with_-> None
145+
match FSharpEnvironment.BinFolderOfDefaultFSharpCompiler(locationOfThisDll)with
141146
| Some s-> s
142147
| None->""
143148
let mutableversionFile:string=null

‎src/fsharp/Salsa/salsa.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,7 @@ module internal Salsa =
667667
// we look in the same directory as the Unit Tests assembly.
668668
lettargetsFileFolder=
669669
if useInstalledTargets
670-
then Option.get Internal.Utilities.FSharpEnvironment.BinFolderOfDefaultFSharpCompiler
670+
then Option.get(Internal.Utilities.FSharpEnvironment.BinFolderOfDefaultFSharpCompiler(None))
671671
else System.AppDomain.CurrentDomain.BaseDirectory
672672

673673
letsb=new System.Text.StringBuilder()

‎src/fsharp/build.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4473,7 +4473,7 @@ module private ScriptPreprocessClosure =
44734473
letisInteractive=(codeContext= CodeContext.Evaluation)
44744474
letisInvalidationSupported=(codeContext= CodeContext.Editing)
44754475

4476-
lettcConfigB= TcConfigBuilder.CreateNew(Internal.Utilities.FSharpEnvironment.BinFolderOfDefaultFSharpCompiler().Value,true(* optimize for memory*), projectDir, isInteractive, isInvalidationSupported)
4476+
lettcConfigB= TcConfigBuilder.CreateNew(Internal.Utilities.FSharpEnvironment.BinFolderOfDefaultFSharpCompiler(None).Value,true(* optimize for memory*), projectDir, isInteractive, isInvalidationSupported)
44774477
BasicReferencesForScriptLoadClosure|> List.iter(fun f->tcConfigB.AddReferencedAssemblyByPath(range0,f))// Add script references
44784478
tcConfigB.resolutionEnvironment<-
44794479
match codeContextwith

‎src/fsharp/unittests/TestLib.LanguageService.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ type LanguageServiceBaseTests() =
355355
[<TestFixtureSetUp>]
356356
memberthis.TestFixtureSetUp()=
357357
ApproveAllMockTypeProviders()
358-
match Internal.Utilities.FSharpEnvironment.BinFolderOfDefaultFSharpCompilerwith
358+
match Internal.Utilities.FSharpEnvironment.BinFolderOfDefaultFSharpCompiler(None)with
359359
| Some(folder)->
360360
letfscPath= Path.Combine(folder,"fsc.exe")
361361
System.Diagnostics.Debug.Assert(File.Exists(fscPath), sprintf"Path to fsc.exe (%s) does not exist. Unittests will surely fail. Is Unittest.exe.config stale?" fscPath)

‎src/fsharp/vs/IncrementalBuild.fs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1673,7 +1673,7 @@ module internal IncrementalFSharpBuild =
16731673

16741674
/// Create a type-check configuration
16751675
lettcConfigB=
1676-
letdefaultFSharpBinariesDir= Internal.Utilities.FSharpEnvironment.BinFolderOfDefaultFSharpCompiler().Value
1676+
letdefaultFSharpBinariesDir= Internal.Utilities.FSharpEnvironment.BinFolderOfDefaultFSharpCompiler(None).Value
16771677

16781678
// see also fsc.fs:runFromCommandLineToImportingAssemblies(), as there are many similarities to where the PS creates a tcConfigB
16791679
lettcConfigB=

‎src/utils/CompilerLocationUtils.fs‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module internal FSharpEnvironment =
3030
#if SILVERLIGHT
3131
letGet32BitRegistryStringValueViaPInvoke(_subKey:string)=
3232
None
33-
letBinFolderOfDefaultFSharpCompiler=
33+
letBinFolderOfDefaultFSharpCompiler(pathProbe)=
3434
Some""
3535
#else
3636

@@ -211,14 +211,17 @@ module internal FSharpEnvironment =
211211
// otherwise look in the standard place
212212
"/usr"]
213213

214+
letsafeExists f=(try File.Exists(f)with_->false)
215+
216+
214217
// The default location of FSharp.Core.dll and fsc.exe based on the version of fsc.exe that is running
215218
// Used for
216219
// - location of design-time copies of FSharp.Core.dll and FSharp.Compiler.Interactive.Settings.dll for the default assumed environment for scripts
217220
// - default ToolPath in tasks in FSharp.Build.dll (for Fsc tasks)
218221
// - default F# binaries directory in service.fs (REVIEW: check this)
219222
// - default location of fsi.exe in FSharp.VS.FSI.dll
220223
// - default location of fsc.exe in FSharp.Compiler.CodeDom.dll
221-
letBinFolderOfDefaultFSharpCompiler()=
224+
letBinFolderOfDefaultFSharpCompiler(probePoint:string option)=
222225
// Check for an app.config setting to redirect the default compiler location
223226
// Like fsharp-compiler-location
224227
try
@@ -229,6 +232,11 @@ module internal FSharpEnvironment =
229232
| Some_-> result
230233
| None->
231234

235+
// Look in the probePoint if given, e.g. look for a compiler alongside of FSharp.Build.dll
236+
match probePointwith
237+
| Some pwhen safeExists(Path.Combine(p,"fsc.exe"))|| safeExists(Path.Combine(p,"Fsc.exe"))-> Some p
238+
|_->
239+
232240
// On windows the location of the compiler is via a registry key
233241
letkey20=@"Software\Microsoft\FSharp\2.0\Runtime\v4.0"
234242
letkey40=@"Software\Microsoft\FSharp\3.0\Runtime\v4.0"
@@ -265,7 +273,6 @@ module internal FSharpEnvironment =
265273
letresult=
266274
BackupInstallationProbePoints|> List.tryPick(fun x->
267275
//printfn "Resolution" "BinFolderOfDefaultFSharpCore: Probing %s" x
268-
letsafeExists f=(try File.Exists(f)with_->false)
269276
letfile f= Path.Combine(Path.Combine(x,"bin"),f)
270277
letexists f= safeExists(file f)
271278
match(if exists"fsc"&& exists"fsi"then tryFsharpiScript(file"fsi")else None)with

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp