Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
fsharp
提交
ac1ff661
F
fsharp
项目概览
dotNET Platform
/
fsharp
11 个月 前同步成功
通知
0
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
fsharp
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
ac1ff661
编写于
4月 17, 2022
作者:
E
Eugene Auduchinok
提交者:
GitHub
4月 17, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TcConfig: calc target framework directories once (#13001)
上级
be1cbb7f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
82 addition
and
77 deletion
+82
-77
src/fsharp/CompilerConfig.fs
src/fsharp/CompilerConfig.fs
+82
-77
未找到文件。
src/fsharp/CompilerConfig.fs
浏览文件 @
ac1ff661
...
...
@@ -934,6 +934,86 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
#
endif
None
,
data
.
legacyReferenceResolver
.
Impl
.
HighestInstalledNetFrameworkVersion
()
let
makePathAbsolute
path
=
ComputeMakePathAbsolute
data
.
implicitIncludeDir
path
let
targetFrameworkDirectories
=
try
[
// Check if we are given an explicit framework root - if so, use that
match
clrRootValue
with
|
Some
x
->
let
clrRoot
=
makePathAbsolute
x
yield
clrRoot
let
clrFacades
=
Path
.
Combine
(
clrRoot
,
"Facades"
)
if
FileSystem
.
DirectoryExistsShim
(
clrFacades
)
then
yield
clrFacades
|
None
->
// "there is no really good notion of runtime directory on .NETCore"
#
if
NETSTANDARD
let
runtimeRoot
=
Path
.
GetDirectoryName
(
typeof
<
Object
>.
Assembly
.
Location
)
#
else
let
runtimeRoot
=
System
.
Runtime
.
InteropServices
.
RuntimeEnvironment
.
GetRuntimeDirectory
()
#
endif
let
runtimeRootWithoutSlash
=
runtimeRoot
.
TrimEnd
(
'
/
'
,
'\\'
)
let
runtimeRootFacades
=
Path
.
Combine
(
runtimeRootWithoutSlash
,
"Facades"
)
let
runtimeRootWPF
=
Path
.
Combine
(
runtimeRootWithoutSlash
,
"WPF"
)
match
data
.
resolutionEnvironment
with
|
LegacyResolutionEnvironment
.
CompilationAndEvaluation
->
// Default compilation-and-execution-time references on .NET Framework and Mono, e.g. for F# Interactive
//
// In the current way of doing things, F# Interactive refers to implementation assemblies.
yield
runtimeRoot
if
FileSystem
.
DirectoryExistsShim
runtimeRootFacades
then
yield
runtimeRootFacades
// System.Runtime.dll is in /usr/lib/mono/4.5/Facades
if
FileSystem
.
DirectoryExistsShim
runtimeRootWPF
then
yield
runtimeRootWPF
// PresentationCore.dll is in C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF
match
data
.
FxResolver
.
GetFrameworkRefsPackDirectory
()
with
|
Some
path
when
FileSystem
.
DirectoryExistsShim
(
path
)
->
yield
path
|
_
->
()
|
LegacyResolutionEnvironment
.
EditingOrCompilation
_
->
#
if
ENABLE_MONO_SUPPORT
if
runningOnMono
then
// Default compilation-time references on Mono
//
// On Mono, the default references come from the implementation assemblies.
// This is because we have had trouble reliably using MSBuild APIs to compute DotNetFrameworkReferenceAssembliesRootDirectory on Mono.
yield
runtimeRoot
if
FileSystem
.
DirectoryExistsShim
runtimeRootFacades
then
yield
runtimeRootFacades
// System.Runtime.dll is in /usr/lib/mono/4.5/Facades
if
FileSystem
.
DirectoryExistsShim
runtimeRootWPF
then
yield
runtimeRootWPF
// PresentationCore.dll is in C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF
// On Mono we also add a default reference to the 4.5-api and 4.5-api/Facades directories.
let
runtimeRootApi
=
runtimeRootWithoutSlash
+
"-api"
let
runtimeRootApiFacades
=
Path
.
Combine
(
runtimeRootApi
,
"Facades"
)
if
FileSystem
.
DirectoryExistsShim
runtimeRootApi
then
yield
runtimeRootApi
if
FileSystem
.
DirectoryExistsShim
runtimeRootApiFacades
then
yield
runtimeRootApiFacades
else
#
endif
// Default compilation-time references on .NET Framework
//
// This is the normal case for "fsc.exe a.fs". We refer to the reference assemblies folder.
let
frameworkRoot
=
data
.
legacyReferenceResolver
.
Impl
.
DotNetFrameworkReferenceAssembliesRootDirectory
let
frameworkRootVersion
=
Path
.
Combine
(
frameworkRoot
,
targetFrameworkVersionValue
)
yield
frameworkRootVersion
let
facades
=
Path
.
Combine
(
frameworkRootVersion
,
"Facades"
)
if
FileSystem
.
DirectoryExistsShim
facades
then
yield
facades
match
data
.
FxResolver
.
GetFrameworkRefsPackDirectory
()
with
|
Some
path
when
FileSystem
.
DirectoryExistsShim
(
path
)
->
yield
path
|
_
->
()
]
with
e
->
errorRecovery
e
range0
;
[]
member
_.
fsiMultiAssemblyEmit
=
data
.
fsiMultiAssemblyEmit
member
x
.
FxResolver
=
data
.
FxResolver
member
x
.
primaryAssembly
=
data
.
primaryAssembly
...
...
@@ -1079,81 +1159,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
// This call can fail if no CLR is found (this is the path to mscorlib)
member
tcConfig
.
GetTargetFrameworkDirectories
()
=
use
unwindBuildPhase
=
PushThreadBuildPhaseUntilUnwind
BuildPhase
.
Parameter
try
[
// Check if we are given an explicit framework root - if so, use that
match
tcConfig
.
clrRoot
with
|
Some
x
->
let
clrRoot
=
tcConfig
.
MakePathAbsolute
x
yield
clrRoot
let
clrFacades
=
Path
.
Combine
(
clrRoot
,
"Facades"
)
if
FileSystem
.
DirectoryExistsShim
(
clrFacades
)
then
yield
clrFacades
|
None
->
// "there is no really good notion of runtime directory on .NETCore"
#
if
NETSTANDARD
let
runtimeRoot
=
Path
.
GetDirectoryName
(
typeof
<
Object
>.
Assembly
.
Location
)
#
else
let
runtimeRoot
=
System
.
Runtime
.
InteropServices
.
RuntimeEnvironment
.
GetRuntimeDirectory
()
#
endif
let
runtimeRootWithoutSlash
=
runtimeRoot
.
TrimEnd
(
'
/
'
,
'\\'
)
let
runtimeRootFacades
=
Path
.
Combine
(
runtimeRootWithoutSlash
,
"Facades"
)
let
runtimeRootWPF
=
Path
.
Combine
(
runtimeRootWithoutSlash
,
"WPF"
)
match
tcConfig
.
resolutionEnvironment
with
|
LegacyResolutionEnvironment
.
CompilationAndEvaluation
->
// Default compilation-and-execution-time references on .NET Framework and Mono, e.g. for F# Interactive
//
// In the current way of doing things, F# Interactive refers to implementation assemblies.
yield
runtimeRoot
if
FileSystem
.
DirectoryExistsShim
runtimeRootFacades
then
yield
runtimeRootFacades
// System.Runtime.dll is in /usr/lib/mono/4.5/Facades
if
FileSystem
.
DirectoryExistsShim
runtimeRootWPF
then
yield
runtimeRootWPF
// PresentationCore.dll is in C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF
match
tcConfig
.
FxResolver
.
GetFrameworkRefsPackDirectory
()
with
|
Some
path
when
FileSystem
.
DirectoryExistsShim
(
path
)
->
yield
path
|
_
->
()
|
LegacyResolutionEnvironment
.
EditingOrCompilation
_
->
#
if
ENABLE_MONO_SUPPORT
if
runningOnMono
then
// Default compilation-time references on Mono
//
// On Mono, the default references come from the implementation assemblies.
// This is because we have had trouble reliably using MSBuild APIs to compute DotNetFrameworkReferenceAssembliesRootDirectory on Mono.
yield
runtimeRoot
if
FileSystem
.
DirectoryExistsShim
runtimeRootFacades
then
yield
runtimeRootFacades
// System.Runtime.dll is in /usr/lib/mono/4.5/Facades
if
FileSystem
.
DirectoryExistsShim
runtimeRootWPF
then
yield
runtimeRootWPF
// PresentationCore.dll is in C:\Windows\Microsoft.NET\Framework\v4.0.30319\WPF
// On Mono we also add a default reference to the 4.5-api and 4.5-api/Facades directories.
let
runtimeRootApi
=
runtimeRootWithoutSlash
+
"-api"
let
runtimeRootApiFacades
=
Path
.
Combine
(
runtimeRootApi
,
"Facades"
)
if
FileSystem
.
DirectoryExistsShim
runtimeRootApi
then
yield
runtimeRootApi
if
FileSystem
.
DirectoryExistsShim
runtimeRootApiFacades
then
yield
runtimeRootApiFacades
else
#
endif
// Default compilation-time references on .NET Framework
//
// This is the normal case for "fsc.exe a.fs". We refer to the reference assemblies folder.
let
frameworkRoot
=
tcConfig
.
legacyReferenceResolver
.
Impl
.
DotNetFrameworkReferenceAssembliesRootDirectory
let
frameworkRootVersion
=
Path
.
Combine
(
frameworkRoot
,
tcConfig
.
targetFrameworkVersion
)
yield
frameworkRootVersion
let
facades
=
Path
.
Combine
(
frameworkRootVersion
,
"Facades"
)
if
FileSystem
.
DirectoryExistsShim
facades
then
yield
facades
match
tcConfig
.
FxResolver
.
GetFrameworkRefsPackDirectory
()
with
|
Some
path
when
FileSystem
.
DirectoryExistsShim
(
path
)
->
yield
path
|
_
->
()
]
with
e
->
errorRecovery
e
range0
;
[]
targetFrameworkDirectories
member
tcConfig
.
ComputeLightSyntaxInitialStatus
filename
=
use
unwindBuildPhase
=
PushThreadBuildPhaseUntilUnwind
BuildPhase
.
Parameter
...
...
@@ -1193,8 +1199,7 @@ type TcConfig private (data: TcConfigBuilder, validate: bool) =
yield
tcConfig
.
fsharpBinariesDir
]
member
tcConfig
.
MakePathAbsolute
path
=
let
result
=
ComputeMakePathAbsolute
tcConfig
.
implicitIncludeDir
path
result
makePathAbsolute
path
member
_.
ResolveSourceFile
(
m
,
filename
,
pathLoadedFrom
)
=
data
.
ResolveSourceFile
(
m
,
filename
,
pathLoadedFrom
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录