Skip to content

Commit 22fc113

Browse files
committed
Revert "Pinvoke testing (#6594)"
This reverts commit 028e1df.
1 parent 4ab75a7 commit 22fc113

24 files changed

+79
-347
lines changed

eng/Build.ps1

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ param (
4646
[switch]$warnAsError = $true,
4747
[switch][Alias('test')]$testDesktop,
4848
[switch]$testCoreClr,
49-
[switch]$testFSharpCompiler,
5049
[switch]$testFSharpQA,
5150
[switch]$testFSharpCore,
5251
[switch]$testVs,
@@ -78,7 +77,6 @@ function Print-Usage() {
7877
Write-Host " -testAll Run all tests"
7978
Write-Host " -testDesktop Run tests against full .NET Framework"
8079
Write-Host " -testCoreClr Run tests against CoreCLR"
81-
Write-Host " -testFSharpCompiler Run F# Compiler unit tests"
8280
Write-Host " -testFSharpQA Run F# Cambridge tests"
8381
Write-Host " -testFSharpCore Run FSharpCore unit tests"
8482
Write-Host " -testVs Run F# editor unit tests"
@@ -281,16 +279,16 @@ try {
281279
}
282280

283281
if ($testFSharpCore) {
282+
Write-Host "Environment Variables"
283+
Get-Childitem Env:
284284
TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $desktopTargetFramework
285285
TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Core.UnitTests\FSharp.Core.UnitTests.fsproj" -targetFramework $coreclrTargetFramework
286286
}
287287

288-
if ($testFSharpCompiler) {
289-
TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" -targetFramework $desktopTargetFramework
290-
TestUsingNUnit -testProject "$RepoRoot\tests\FSharp.Compiler.UnitTests\FSharp.Compiler.UnitTests.fsproj" -targetFramework $coreclrTargetFramework
291-
}
292288

293289
if ($testVs) {
290+
Write-Host "Environment Variables"
291+
Get-Childitem Env:
294292
TestUsingNUnit -testProject "$RepoRoot\vsintegration\tests\GetTypesVS.UnitTests\GetTypesVS.UnitTests.fsproj" -targetFramework $desktopTargetFramework
295293
TestUsingNUnit -testProject "$RepoRoot\vsintegration\tests\UnitTests\VisualFSharp.UnitTests.fsproj" -targetFramework $desktopTargetFramework
296294
}

src/fsharp/CompileOps.fs

Lines changed: 30 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2141,7 +2141,6 @@ type TcConfigBuilder =
21412141

21422142
/// When false FSI will lock referenced assemblies requiring process restart, false = disable Shadow Copy false (*default*)
21432143
mutable shadowCopyReferences: bool
2144-
mutable useSdkRefs: bool
21452144

21462145
/// A function to call to try to get an object that acts as a snapshot of the metadata section of a .NET binary,
21472146
/// and from which we can read the metadata. Only used when metadataOnly=true.
@@ -2281,7 +2280,6 @@ type TcConfigBuilder =
22812280
exename = None
22822281
copyFSharpCore = CopyFSharpCoreFlag.No
22832282
shadowCopyReferences = false
2284-
useSdkRefs = true
22852283
tryGetMetadataSnapshot = (fun _ -> None)
22862284
internalTestSpanStackReferring = false
22872285
noConditionalErasure = false
@@ -2749,7 +2747,6 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
27492747
member x.emitDebugInfoInQuotations = data.emitDebugInfoInQuotations
27502748
member x.copyFSharpCore = data.copyFSharpCore
27512749
member x.shadowCopyReferences = data.shadowCopyReferences
2752-
member x.useSdkRefs = data.useSdkRefs
27532750
member x.tryGetMetadataSnapshot = data.tryGetMetadataSnapshot
27542751
member x.internalTestSpanStackReferring = data.internalTestSpanStackReferring
27552752
member x.noConditionalErasure = data.noConditionalErasure
@@ -2798,11 +2795,6 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
27982795
if Directory.Exists runtimeRootWPF then
27992796
yield runtimeRootWPF // PresentationCore.dll is in C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF
28002797

2801-
match getFrameworkRefsPackDirectory with
2802-
| Some path when Directory.Exists(path) ->
2803-
yield path
2804-
| _ -> ()
2805-
28062798
| ResolutionEnvironment.EditingOrCompilation _ ->
28072799
#if ENABLE_MONO_SUPPORT
28082800
if runningOnMono then
@@ -2865,14 +2857,13 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
28652857
///
28662858
/// Returning true may mean that the file is locked and/or placed into the
28672859
/// 'framework' reference set that is potentially shared across multiple compilations.
2868-
member tcConfig.IsSystemAssembly (filename: string) =
2869-
try
2870-
FileSystem.SafeExists filename &&
2860+
member tcConfig.IsSystemAssembly (filename: string) =
2861+
try
2862+
FileSystem.SafeExists filename &&
28712863
((tcConfig.GetTargetFrameworkDirectories() |> List.exists (fun clrRoot -> clrRoot = Path.GetDirectoryName filename)) ||
2872-
(systemAssemblies.Contains (fileNameWithoutExtension filename)) ||
2873-
isInReferenceAssemblyPackDirectory filename)
2864+
(systemAssemblies.Contains(fileNameWithoutExtension filename)))
28742865
with _ ->
2875-
false
2866+
false
28762867

28772868
// This is not the complete set of search paths, it is just the set
28782869
// that is special to F# (as compared to MSBuild resolution)
@@ -3515,15 +3506,18 @@ type TcAssemblyResolutions(tcConfig: TcConfig, results: AssemblyResolution list,
35153506
TcConfig.TryResolveLibsUsingMSBuildRules (tcConfig, assemblyList, rangeStartup, ResolveAssemblyReferenceMode.ReportErrors)
35163507
TcAssemblyResolutions(tcConfig, resolved, unresolved @ knownUnresolved)
35173508

3518-
static member GetAllDllReferences (tcConfig: TcConfig) = [
3509+
3510+
static member GetAllDllReferences (tcConfig: TcConfig) =
3511+
[
35193512
let primaryReference = tcConfig.PrimaryAssemblyDllReference()
3513+
yield primaryReference
35203514

35213515
if not tcConfig.compilingFslib then
35223516
yield tcConfig.CoreLibraryDllReference()
35233517

35243518
let assumeDotNetFramework = primaryReference.SimpleAssemblyNameIs("mscorlib")
3525-
if tcConfig.framework then
3526-
for s in defaultReferencesForScriptsAndOutOfProjectSources assumeDotNetFramework tcConfig.useSdkRefs do
3519+
if tcConfig.framework then
3520+
for s in defaultReferencesForScriptsAndOutOfProjectSources assumeDotNetFramework do
35273521
yield AssemblyReference(rangeStartup, (if s.EndsWith(".dll", StringComparison.OrdinalIgnoreCase) then s else s+".dll"), None)
35283522

35293523
if tcConfig.useFsiAuxLib then
@@ -4558,14 +4552,8 @@ type TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAssemblyResolu
45584552

45594553
// Note: TcImports are disposable - the caller owns this object and must dispose
45604554
let frameworkTcImports = new TcImports(tcConfigP, tcResolutions, None, None)
4561-
4562-
// Fetch the primaryAssembly from the referenced assemblies otherwise
4563-
let primaryAssemblyReference =
4564-
let path = frameworkDLLs |> List.tryFind(fun dll -> String.Compare(Path.GetFileNameWithoutExtension(dll.resolvedPath), tcConfig.primaryAssembly.Name, StringComparison.OrdinalIgnoreCase) = 0)
4565-
match path with
4566-
| Some p -> AssemblyReference(range0, p.resolvedPath, None)
4567-
| None -> tcConfig.PrimaryAssemblyDllReference()
4568-
4555+
4556+
let primaryAssemblyReference = tcConfig.PrimaryAssemblyDllReference()
45694557
let primaryAssemblyResolution = frameworkTcImports.ResolveAssemblyReference(ctok, primaryAssemblyReference, ResolveAssemblyReferenceMode.ReportErrors)
45704558
let! primaryAssem = frameworkTcImports.RegisterAndImportReferencedAssemblies(ctok, primaryAssemblyResolution)
45714559
let primaryScopeRef =
@@ -4580,7 +4568,7 @@ type TcImports(tcConfigP: TcConfigProvider, initialResolutions: TcAssemblyResolu
45804568
let! _assemblies = frameworkTcImports.RegisterAndImportReferencedAssemblies (ctok, tcResolutions.GetAssemblyResolutions())
45814569

45824570
// These are the DLLs we can search for well-known types
4583-
let sysCcus =
4571+
let sysCcus =
45844572
[| for ccu in frameworkTcImports.GetCcusInDeclOrder() do
45854573
//printfn "found sys ccu %s" ccu.AssemblyName
45864574
yield ccu |]
@@ -4925,8 +4913,8 @@ module private ScriptPreprocessClosure =
49254913
filename: string, codeContext,
49264914
useSimpleResolution, useFsiAuxLib,
49274915
basicReferences, applyCommandLineArgs,
4928-
assumeDotNetFramework, useSdkRefs,
4929-
tryGetMetadataSnapshot, reduceMemoryUsage) =
4916+
assumeDotNetFramework, tryGetMetadataSnapshot,
4917+
reduceMemoryUsage) =
49304918

49314919
let projectDir = Path.GetDirectoryName filename
49324920
let isInteractive = (codeContext = CodeContext.CompilationAndEvaluation)
@@ -4941,7 +4929,7 @@ module private ScriptPreprocessClosure =
49414929
applyCommandLineArgs tcConfigB
49424930

49434931
match basicReferences with
4944-
| None -> (basicReferencesForScriptLoadClosure useFsiAuxLib useSdkRefs assumeDotNetFramework) |> List.iter(fun f->tcConfigB.AddReferencedAssemblyByPath(range0, f)) // Add script references
4932+
| None -> (basicReferencesForScriptLoadClosure useFsiAuxLib assumeDotNetFramework) |> List.iter(fun f->tcConfigB.AddReferencedAssemblyByPath(range0, f)) // Add script references
49454933
| Some rs -> for m, r in rs do tcConfigB.AddReferencedAssemblyByPath(m, r)
49464934

49474935
tcConfigB.resolutionEnvironment <-
@@ -4954,10 +4942,8 @@ module private ScriptPreprocessClosure =
49544942
// Indicates that there are some references not in basicReferencesForScriptLoadClosure which should
49554943
// be added conditionally once the relevant version of mscorlib.dll has been detected.
49564944
tcConfigB.implicitlyResolveAssemblies <- false
4957-
tcConfigB.useSdkRefs <- useSdkRefs
4958-
49594945
TcConfig.Create(tcConfigB, validate=true)
4960-
4946+
49614947
let ClosureSourceOfFilename(filename, m, inputCodePage, parseRequired) =
49624948
try
49634949
let filename = FileSystem.GetFullPathShim filename
@@ -5126,12 +5112,11 @@ module private ScriptPreprocessClosure =
51265112
/// Given source text, find the full load closure. Used from service.fs, when editing a script file
51275113
let GetFullClosureOfScriptText
51285114
(ctok, legacyReferenceResolver, defaultFSharpBinariesDir,
5129-
filename, sourceText, codeContext,
5130-
useSimpleResolution, useFsiAuxLib, useSdkRefs,
5115+
filename, sourceText,
5116+
codeContext, useSimpleResolution, useFsiAuxLib,
51315117
lexResourceManager: Lexhelp.LexResourceManager,
51325118
applyCommmandLineArgs, assumeDotNetFramework,
51335119
tryGetMetadataSnapshot, reduceMemoryUsage) =
5134-
51355120
// Resolve the basic references such as FSharp.Core.dll first, before processing any #I directives in the script
51365121
//
51375122
// This is tries to mimic the action of running the script in F# Interactive - the initial context for scripting is created
@@ -5141,7 +5126,7 @@ module private ScriptPreprocessClosure =
51415126
CreateScriptTextTcConfig(legacyReferenceResolver, defaultFSharpBinariesDir,
51425127
filename, codeContext, useSimpleResolution,
51435128
useFsiAuxLib, None, applyCommmandLineArgs, assumeDotNetFramework,
5144-
useSdkRefs, tryGetMetadataSnapshot, reduceMemoryUsage)
5129+
tryGetMetadataSnapshot, reduceMemoryUsage)
51455130

51465131
let resolutions0, _unresolvedReferences = GetAssemblyResolutionInformation(ctok, tcConfig)
51475132
let references0 = resolutions0 |> List.map (fun r->r.originalReference.Range, r.resolvedPath) |> Seq.distinct |> List.ofSeq
@@ -5150,8 +5135,7 @@ module private ScriptPreprocessClosure =
51505135
let tcConfig =
51515136
CreateScriptTextTcConfig(legacyReferenceResolver, defaultFSharpBinariesDir, filename,
51525137
codeContext, useSimpleResolution, useFsiAuxLib, Some references0,
5153-
applyCommmandLineArgs, assumeDotNetFramework, useSdkRefs,
5154-
tryGetMetadataSnapshot, reduceMemoryUsage)
5138+
applyCommmandLineArgs, assumeDotNetFramework, tryGetMetadataSnapshot, reduceMemoryUsage)
51555139

51565140
let closureSources = [ClosureSource(filename, range0, sourceText, true)]
51575141
let closureFiles, tcConfig = FindClosureFiles(closureSources, tcConfig, codeContext, lexResourceManager)
@@ -5177,15 +5161,15 @@ type LoadClosure with
51775161
/// A temporary TcConfig is created along the way, is why this routine takes so many arguments. We want to be sure to use exactly the
51785162
/// same arguments as the rest of the application.
51795163
static member ComputeClosureOfScriptText
5180-
(ctok, legacyReferenceResolver, defaultFSharpBinariesDir,
5181-
filename: string, sourceText: ISourceText, codeContext, useSimpleResolution: bool,
5182-
useFsiAuxLib, useSdkRefs, lexResourceManager: Lexhelp.LexResourceManager,
5183-
applyCommmandLineArgs, assumeDotNetFramework, tryGetMetadataSnapshot, reduceMemoryUsage) =
5164+
(ctok, legacyReferenceResolver, defaultFSharpBinariesDir,
5165+
filename: string, sourceText:ISourceText, codeContext, useSimpleResolution: bool,
5166+
useFsiAuxLib, lexResourceManager: Lexhelp.LexResourceManager,
5167+
applyCommmandLineArgs, assumeDotNetFramework, tryGetMetadataSnapshot, reduceMemoryUsage): LoadClosure =
51845168

51855169
use unwindBuildPhase = PushThreadBuildPhaseUntilUnwind BuildPhase.Parse
51865170
ScriptPreprocessClosure.GetFullClosureOfScriptText
51875171
(ctok, legacyReferenceResolver, defaultFSharpBinariesDir, filename, sourceText,
5188-
codeContext, useSimpleResolution, useFsiAuxLib, useSdkRefs, lexResourceManager,
5172+
codeContext, useSimpleResolution, useFsiAuxLib, lexResourceManager,
51895173
applyCommmandLineArgs, assumeDotNetFramework, tryGetMetadataSnapshot, reduceMemoryUsage)
51905174

51915175
/// Analyze a set of script files and find the closure of their references.
@@ -5194,7 +5178,8 @@ type LoadClosure with
51945178
lexResourceManager: Lexhelp.LexResourceManager) =
51955179
use unwindBuildPhase = PushThreadBuildPhaseUntilUnwind BuildPhase.Parse
51965180
ScriptPreprocessClosure.GetFullClosureOfScriptFiles (ctok, tcConfig, files, codeContext, lexResourceManager)
5197-
5181+
5182+
51985183

51995184
//----------------------------------------------------------------------------
52005185
// Initial type checking environment
@@ -5494,4 +5479,4 @@ let TypeCheckClosedInputSet (ctok, checkForErrors, tcConfig, tcImports, tcGlobal
54945479

54955480
// Existing public APIs delegate to newer implementations
54965481
let GetFSharpCoreLibraryName () = getFSharpCoreLibraryName
5497-
let DefaultReferencesForScriptsAndOutOfProjectSources assumeDotNetFramework = defaultReferencesForScriptsAndOutOfProjectSources assumeDotNetFramework false
5482+
let DefaultReferencesForScriptsAndOutOfProjectSources assumeDotNetFramework = defaultReferencesForScriptsAndOutOfProjectSources assumeDotNetFramework

src/fsharp/CompileOps.fsi

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,6 @@ type TcConfigBuilder =
361361
mutable exename: string option
362362
mutable copyFSharpCore: CopyFSharpCoreFlag
363363
mutable shadowCopyReferences: bool
364-
mutable useSdkRefs: bool
365364

366365
/// A function to call to try to get an object that acts as a snapshot of the metadata section of a .NET binary,
367366
/// and from which we can read the metadata. Only used when metadataOnly=true.
@@ -372,7 +371,6 @@ type TcConfigBuilder =
372371

373372
/// Prevent erasure of conditional attributes and methods so tooling is able analyse them.
374373
mutable noConditionalErasure: bool
375-
376374
}
377375

378376
static member Initial: TcConfigBuilder
@@ -396,9 +394,11 @@ type TcConfigBuilder =
396394
member RemoveReferencedAssemblyByPath: range * string -> unit
397395
member AddEmbeddedSourceFile: string -> unit
398396
member AddEmbeddedResource: string -> unit
399-
397+
400398
static member SplitCommandLineResourceInfo: string -> string * string * ILResourceAccess
401399

400+
401+
402402
[<Sealed>]
403403
// Immutable TcConfig
404404
type TcConfig =
@@ -531,8 +531,6 @@ type TcConfig =
531531

532532
member copyFSharpCore: CopyFSharpCoreFlag
533533
member shadowCopyReferences: bool
534-
member useSdkRefs: bool
535-
536534
static member Create: TcConfigBuilder * validate: bool -> TcConfig
537535

538536
/// Represents a computation to return a TcConfig. Normally this is just a constant immutable TcConfig,
@@ -803,7 +801,7 @@ type LoadClosure =
803801
//
804802
/// A temporary TcConfig is created along the way, is why this routine takes so many arguments. We want to be sure to use exactly the
805803
/// same arguments as the rest of the application.
806-
static member ComputeClosureOfScriptText: CompilationThreadToken * legacyReferenceResolver: ReferenceResolver.Resolver * defaultFSharpBinariesDir: string * filename: string * sourceText: ISourceText * implicitDefines:CodeContext * useSimpleResolution: bool * useFsiAuxLib: bool * useSdkRefs: bool * lexResourceManager: Lexhelp.LexResourceManager * applyCompilerOptions: (TcConfigBuilder -> unit) * assumeDotNetFramework: bool * tryGetMetadataSnapshot: ILReaderTryGetMetadataSnapshot * reduceMemoryUsage: ReduceMemoryFlag -> LoadClosure
804+
static member ComputeClosureOfScriptText: CompilationThreadToken * legacyReferenceResolver: ReferenceResolver.Resolver * defaultFSharpBinariesDir: string * filename: string * sourceText: ISourceText * implicitDefines:CodeContext * useSimpleResolution: bool * useFsiAuxLib: bool * lexResourceManager: Lexhelp.LexResourceManager * applyCompilerOptions: (TcConfigBuilder -> unit) * assumeDotNetFramework: bool * tryGetMetadataSnapshot: ILReaderTryGetMetadataSnapshot * reduceMemoryUsage: ReduceMemoryFlag -> LoadClosure
807805

808806
/// Analyze a set of script files and find the closure of their references. The resulting references are then added to the given TcConfig.
809807
/// Used from fsi.fs and fsc.fs, for #load and command line.

0 commit comments

Comments
 (0)