Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lwm1986
roslyn
提交
ebd4e3da
R
roslyn
项目概览
lwm1986
/
roslyn
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
roslyn
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
ebd4e3da
编写于
12月 17, 2018
作者:
J
Jared Parsons
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix multi-target
Use multi-target instead of reflection
上级
98a1f741
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
55 addition
and
37 deletion
+55
-37
src/Compilers/Core/MSBuildTask/ManagedToolTask.cs
src/Compilers/Core/MSBuildTask/ManagedToolTask.cs
+19
-12
src/Compilers/Shared/BuildServerConnection.cs
src/Compilers/Shared/BuildServerConnection.cs
+18
-20
src/Test/Utilities/Portable/Compilation/RuntimeUtilities.cs
src/Test/Utilities/Portable/Compilation/RuntimeUtilities.cs
+12
-0
src/Test/Utilities/Portable/TargetFrameworkUtil.cs
src/Test/Utilities/Portable/TargetFrameworkUtil.cs
+5
-4
src/Test/Utilities/Portable/TestBase.cs
src/Test/Utilities/Portable/TestBase.cs
+1
-1
未找到文件。
src/Compilers/Core/MSBuildTask/ManagedToolTask.cs
浏览文件 @
ebd4e3da
...
@@ -80,21 +80,28 @@ protected sealed override string GenerateFullPathToTool()
...
@@ -80,21 +80,28 @@ protected sealed override string GenerateFullPathToTool()
/// as the implementation of IsManagedTool calls this property. See the comment in
/// as the implementation of IsManagedTool calls this property. See the comment in
/// <see cref="ManagedCompiler.HasToolBeenOverridden"/>.
/// <see cref="ManagedCompiler.HasToolBeenOverridden"/>.
/// </remarks>
/// </remarks>
protected
sealed
override
string
ToolName
protected
sealed
override
string
ToolName
=>
$"
{
ToolNameWithoutExtension
}
.
{
ToolExtension
}
"
;
=>
$"
{
ToolNameWithoutExtension
}
.
{(
CoreClrShim
.
IsRunningOnCoreClr
?
"dll"
:
"exe"
)}
"
;
private
static
string
ToolExtension
=>
#if NETCOREAPP2_1
"dll"
;
#elif NET472
"exe"
;
#else
#error Unrecognized framework
#endif
private
static
bool
IsCliHost
(
out
string
pathToDotnet
)
private
static
bool
IsCliHost
(
out
string
pathToDotnet
)
{
{
if
(
CoreClrShim
.
IsRunningOnCoreClr
)
#if NETCOREAPP2_1
{
pathToDotnet
=
Environment
.
GetEnvironmentVariable
(
"DOTNET_HOST_PATH"
);
pathToDotnet
=
Environment
.
GetEnvironmentVariable
(
"DOTNET_HOST_PATH"
);
return
!
string
.
IsNullOrEmpty
(
pathToDotnet
);
return
!
string
.
IsNullOrEmpty
(
pathToDotnet
);
#elif NET472
}
pathToDotnet
=
null
;
else
return
false
;
{
#else
pathToDotnet
=
null
;
#error Unrecognized framework
return
false
;
#endif
}
}
}
private
static
string
PrependFileToArgs
(
string
pathToTool
,
string
commandLineArgs
)
private
static
string
PrependFileToArgs
(
string
pathToTool
,
string
commandLineArgs
)
...
...
src/Compilers/Shared/BuildServerConnection.cs
浏览文件 @
ebd4e3da
...
@@ -374,32 +374,30 @@ internal static bool IsCompilerServerSupported(string tempPath)
...
@@ -374,32 +374,30 @@ internal static bool IsCompilerServerSupported(string tempPath)
internal
static
bool
TryCreateServerCore
(
string
clientDir
,
string
pipeName
)
internal
static
bool
TryCreateServerCore
(
string
clientDir
,
string
pipeName
)
{
{
bool
isRunningOnCoreClr
=
CoreClrShim
.
IsRunningOnCoreClr
;
string
expectedPath
;
string
expectedPath
;
string
processArguments
;
string
processArguments
;
if
(
isRunningOnCoreClr
)
#if NETCOREAPP2_1
{
// The server should be in the same directory as the client
// The server should be in the same directory as the client
var
expectedCompilerPath
=
Path
.
Combine
(
clientDir
,
ServerNameCoreClr
);
var
expectedCompilerPath
=
Path
.
Combine
(
clientDir
,
ServerNameCoreClr
);
expectedPath
=
Environment
.
GetEnvironmentVariable
(
"DOTNET_HOST_PATH"
)
??
"dotnet"
;
expectedPath
=
Environment
.
GetEnvironmentVariable
(
"DOTNET_HOST_PATH"
)
??
"dotnet"
;
processArguments
=
$@"""
{
expectedCompilerPath
}
"" ""-pipename:
{
pipeName
}
"""
;
processArguments
=
$@"""
{
expectedCompilerPath
}
"" ""-pipename:
{
pipeName
}
"""
;
if
(!
File
.
Exists
(
expectedCompilerPath
))
if
(!
File
.
Exists
(
expectedCompilerPath
))
{
return
false
;
}
}
else
{
{
// The server should be in the same directory as the client
return
false
;
expectedPath
=
Path
.
Combine
(
clientDir
,
ServerNameDesktop
);
}
processArguments
=
$@"""-pipename:
{
pipeName
}
"""
;
#elif NET472
// The server should be in the same directory as the client
expectedPath
=
Path
.
Combine
(
clientDir
,
ServerNameDesktop
);
processArguments
=
$@"""-pipename:
{
pipeName
}
"""
;
if
(!
File
.
Exists
(
expectedPath
))
if
(!
File
.
Exists
(
expectedPath
))
{
{
return
false
;
return
false
;
}
}
}
#else
#error Unrecognized configuration
#endif
if
(
PlatformInformation
.
IsWindows
)
if
(
PlatformInformation
.
IsWindows
)
{
{
...
...
src/Test/Utilities/Portable/Compilation/RuntimeUtilities.cs
浏览文件 @
ebd4e3da
...
@@ -15,6 +15,18 @@ namespace Microsoft.CodeAnalysis.Test.Utilities
...
@@ -15,6 +15,18 @@ namespace Microsoft.CodeAnalysis.Test.Utilities
/// </summary>
/// </summary>
public
static
partial
class
RuntimeUtilities
public
static
partial
class
RuntimeUtilities
{
{
internal
static
bool
IsDesktopRuntime
=>
#if NET472
true
;
#elif NETCOREAPP2_1
false
;
#elif NETSTANDARD2_0
throw
new
PlatformNotSupportedException
();
#else
#error Unsupported configuration
#endif
internal
static
bool
IsCoreClrRuntime
=>
!
IsDesktopRuntime
;
internal
static
BuildPaths
CreateBuildPaths
(
string
workingDirectory
,
string
sdkDirectory
=
null
,
string
tempDirectory
=
null
)
internal
static
BuildPaths
CreateBuildPaths
(
string
workingDirectory
,
string
sdkDirectory
=
null
,
string
tempDirectory
=
null
)
{
{
tempDirectory
=
tempDirectory
??
Path
.
GetTempPath
();
tempDirectory
=
tempDirectory
??
Path
.
GetTempPath
();
...
...
src/Test/Utilities/Portable/TargetFrameworkUtil.cs
浏览文件 @
ebd4e3da
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
using
System.Collections.Immutable
;
using
System.Collections.Immutable
;
using
System.Text
;
using
System.Text
;
using
Microsoft.CodeAnalysis
;
using
Microsoft.CodeAnalysis
;
using
Microsoft.CodeAnalysis.Test.Utilities
;
using
static
TestReferences
;
using
static
TestReferences
;
namespace
Roslyn.Test.Utilities
namespace
Roslyn.Test.Utilities
...
@@ -55,7 +56,7 @@ public enum TargetFramework
...
@@ -55,7 +56,7 @@ public enum TargetFramework
public
static
class
TargetFrameworkUtil
public
static
class
TargetFrameworkUtil
{
{
public
static
MetadataReference
StandardCSharpReference
=>
CoreClrShim
.
IsRunningOnCoreClr
?
NetStandard20
.
MicrosoftCSharpRef
:
TestBase
.
CSharpDesktopRef
;
public
static
MetadataReference
StandardCSharpReference
=>
RuntimeUtilities
.
IsCoreClrRuntime
?
NetStandard20
.
MicrosoftCSharpRef
:
TestBase
.
CSharpDesktopRef
;
/*
/*
* ⚠ Dev note ⚠: properties in TestBase are backed by Lazy<T>. Avoid changes to the following properties
* ⚠ Dev note ⚠: properties in TestBase are backed by Lazy<T>. Avoid changes to the following properties
...
@@ -78,10 +79,10 @@ public static class TargetFrameworkUtil
...
@@ -78,10 +79,10 @@ public static class TargetFrameworkUtil
public
static
ImmutableArray
<
MetadataReference
>
Mscorlib461ExtendedReferences
=>
ImmutableArray
.
Create
<
MetadataReference
>(
Net461
.
mscorlibRef
,
Net461
.
SystemRef
,
Net461
.
SystemCoreRef
,
Net461
.
SystemValueTupleRef
,
Net461
.
SystemRuntimeRef
);
public
static
ImmutableArray
<
MetadataReference
>
Mscorlib461ExtendedReferences
=>
ImmutableArray
.
Create
<
MetadataReference
>(
Net461
.
mscorlibRef
,
Net461
.
SystemRef
,
Net461
.
SystemCoreRef
,
Net461
.
SystemValueTupleRef
,
Net461
.
SystemRuntimeRef
);
public
static
ImmutableArray
<
MetadataReference
>
NetStandard20References
=>
ImmutableArray
.
Create
<
MetadataReference
>(
NetStandard20
.
NetStandard
,
NetStandard20
.
MscorlibRef
,
NetStandard20
.
SystemRuntimeRef
,
NetStandard20
.
SystemCoreRef
,
NetStandard20
.
SystemDynamicRuntimeRef
);
public
static
ImmutableArray
<
MetadataReference
>
NetStandard20References
=>
ImmutableArray
.
Create
<
MetadataReference
>(
NetStandard20
.
NetStandard
,
NetStandard20
.
MscorlibRef
,
NetStandard20
.
SystemRuntimeRef
,
NetStandard20
.
SystemCoreRef
,
NetStandard20
.
SystemDynamicRuntimeRef
);
public
static
ImmutableArray
<
MetadataReference
>
WinRTReferences
=>
ImmutableArray
.
Create
(
TestBase
.
WinRtRefs
);
public
static
ImmutableArray
<
MetadataReference
>
WinRTReferences
=>
ImmutableArray
.
Create
(
TestBase
.
WinRtRefs
);
public
static
ImmutableArray
<
MetadataReference
>
StandardReferences
=>
CoreClrShim
.
IsRunningOnCoreClr
?
NetStandard20References
:
Mscorlib46ExtendedReferences
;
public
static
ImmutableArray
<
MetadataReference
>
StandardReferences
=>
RuntimeUtilities
.
IsCoreClrRuntime
?
NetStandard20References
:
Mscorlib46ExtendedReferences
;
public
static
ImmutableArray
<
MetadataReference
>
StandardAndCSharpReferences
=>
StandardReferences
.
Add
(
StandardCSharpReference
);
public
static
ImmutableArray
<
MetadataReference
>
StandardAndCSharpReferences
=>
StandardReferences
.
Add
(
StandardCSharpReference
);
public
static
ImmutableArray
<
MetadataReference
>
StandardAndVBRuntimeReferences
=>
CoreClrShim
.
IsRunningOnCoreClr
?
NetStandard20References
.
Add
(
NetStandard20
.
MicrosoftVisualBasicRef
)
:
Mscorlib46ExtendedReferences
.
Add
(
TestBase
.
MsvbRef_v4_0_30319_17929
);
public
static
ImmutableArray
<
MetadataReference
>
StandardAndVBRuntimeReferences
=>
RuntimeUtilities
.
IsCoreClrRuntime
?
NetStandard20References
.
Add
(
NetStandard20
.
MicrosoftVisualBasicRef
)
:
Mscorlib46ExtendedReferences
.
Add
(
TestBase
.
MsvbRef_v4_0_30319_17929
);
public
static
ImmutableArray
<
MetadataReference
>
StandardCompatReferences
=>
CoreClrShim
.
IsRunningOnCoreClr
?
NetStandard20References
:
Mscorlib40References
;
public
static
ImmutableArray
<
MetadataReference
>
StandardCompatReferences
=>
RuntimeUtilities
.
IsCoreClrRuntime
?
NetStandard20References
:
Mscorlib40References
;
public
static
ImmutableArray
<
MetadataReference
>
DefaultVbReferencs
=>
ImmutableArray
.
Create
(
TestBase
.
MscorlibRef
,
TestBase
.
SystemRef
,
TestBase
.
SystemCoreRef
,
TestBase
.
MsvbRef
);
public
static
ImmutableArray
<
MetadataReference
>
DefaultVbReferencs
=>
ImmutableArray
.
Create
(
TestBase
.
MscorlibRef
,
TestBase
.
SystemRef
,
TestBase
.
SystemCoreRef
,
TestBase
.
MsvbRef
);
public
static
ImmutableArray
<
MetadataReference
>
GetReferences
(
TargetFramework
tf
)
public
static
ImmutableArray
<
MetadataReference
>
GetReferences
(
TargetFramework
tf
)
...
...
src/Test/Utilities/Portable/TestBase.cs
浏览文件 @
ebd4e3da
...
@@ -76,7 +76,7 @@ private static MetadataReference GetOrCreateMetadataReference(ref MetadataRefere
...
@@ -76,7 +76,7 @@ private static MetadataReference GetOrCreateMetadataReference(ref MetadataRefere
LazyThreadSafetyMode
.
PublicationOnly
);
LazyThreadSafetyMode
.
PublicationOnly
);
public
static
MetadataReference
[]
LatestVbReferences
=>
s_lazyLatestVbReferences
.
Value
;
public
static
MetadataReference
[]
LatestVbReferences
=>
s_lazyLatestVbReferences
.
Value
;
public
static
readonly
AssemblyName
RuntimeCorLibName
=
CoreClrShim
.
IsRunningOnCoreClr
public
static
readonly
AssemblyName
RuntimeCorLibName
=
RuntimeUtilities
.
IsCoreClrRuntime
?
new
AssemblyName
(
"netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"
)
?
new
AssemblyName
(
"netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51"
)
:
new
AssemblyName
(
"mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
);
:
new
AssemblyName
(
"mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录