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()
/// as the implementation of IsManagedTool calls this property. See the comment in
/// <see cref="ManagedCompiler.HasToolBeenOverridden"/>.
/// </remarks>
protected
sealed
override
string
ToolName
=>
$"
{
ToolNameWithoutExtension
}
.
{(
CoreClrShim
.
IsRunningOnCoreClr
?
"dll"
:
"exe"
)}
"
;
protected
sealed
override
string
ToolName
=>
$"
{
ToolNameWithoutExtension
}
.
{
ToolExtension
}
"
;
private
static
string
ToolExtension
=>
#if NETCOREAPP2_1
"dll"
;
#elif NET472
"exe"
;
#else
#error Unrecognized framework
#endif
private
static
bool
IsCliHost
(
out
string
pathToDotnet
)
{
if
(
CoreClrShim
.
IsRunningOnCoreClr
)
{
#if NETCOREAPP2_1
pathToDotnet
=
Environment
.
GetEnvironmentVariable
(
"DOTNET_HOST_PATH"
);
return
!
string
.
IsNullOrEmpty
(
pathToDotnet
);
}
else
{
#elif NET472
pathToDotnet
=
null
;
return
false
;
}
#else
#error Unrecognized framework
#endif
}
private
static
string
PrependFileToArgs
(
string
pathToTool
,
string
commandLineArgs
)
...
...
src/Compilers/Shared/BuildServerConnection.cs
浏览文件 @
ebd4e3da
...
...
@@ -374,11 +374,9 @@ internal static bool IsCompilerServerSupported(string tempPath)
internal
static
bool
TryCreateServerCore
(
string
clientDir
,
string
pipeName
)
{
bool
isRunningOnCoreClr
=
CoreClrShim
.
IsRunningOnCoreClr
;
string
expectedPath
;
string
processArguments
;
if
(
isRunningOnCoreClr
)
{
#if NETCOREAPP2_1
// The server should be in the same directory as the client
var
expectedCompilerPath
=
Path
.
Combine
(
clientDir
,
ServerNameCoreClr
);
expectedPath
=
Environment
.
GetEnvironmentVariable
(
"DOTNET_HOST_PATH"
)
??
"dotnet"
;
...
...
@@ -388,9 +386,7 @@ internal static bool TryCreateServerCore(string clientDir, string pipeName)
{
return
false
;
}
}
else
{
#elif NET472
// The server should be in the same directory as the client
expectedPath
=
Path
.
Combine
(
clientDir
,
ServerNameDesktop
);
processArguments
=
$@"""-pipename:
{
pipeName
}
"""
;
...
...
@@ -399,7 +395,9 @@ internal static bool TryCreateServerCore(string clientDir, string pipeName)
{
return
false
;
}
}
#else
#error Unrecognized configuration
#endif
if
(
PlatformInformation
.
IsWindows
)
{
...
...
src/Test/Utilities/Portable/Compilation/RuntimeUtilities.cs
浏览文件 @
ebd4e3da
...
...
@@ -15,6 +15,18 @@ namespace Microsoft.CodeAnalysis.Test.Utilities
/// </summary>
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
)
{
tempDirectory
=
tempDirectory
??
Path
.
GetTempPath
();
...
...
src/Test/Utilities/Portable/TargetFrameworkUtil.cs
浏览文件 @
ebd4e3da
...
...
@@ -5,6 +5,7 @@
using
System.Collections.Immutable
;
using
System.Text
;
using
Microsoft.CodeAnalysis
;
using
Microsoft.CodeAnalysis.Test.Utilities
;
using
static
TestReferences
;
namespace
Roslyn.Test.Utilities
...
...
@@ -55,7 +56,7 @@ public enum TargetFramework
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
...
...
@@ -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
>
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
>
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
>
StandardAndVBRuntimeReferences
=>
CoreClrShim
.
IsRunningOnCoreClr
?
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
>
StandardAndVBRuntimeReferences
=>
RuntimeUtilities
.
IsCoreClrRuntime
?
NetStandard20References
.
Add
(
NetStandard20
.
MicrosoftVisualBasicRef
)
:
Mscorlib46ExtendedReferences
.
Add
(
TestBase
.
MsvbRef_v4_0_30319_17929
);
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
>
GetReferences
(
TargetFramework
tf
)
...
...
src/Test/Utilities/Portable/TestBase.cs
浏览文件 @
ebd4e3da
...
...
@@ -76,7 +76,7 @@ private static MetadataReference GetOrCreateMetadataReference(ref MetadataRefere
LazyThreadSafetyMode
.
PublicationOnly
);
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
(
"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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录