提交 a87dc1c8 编写于 作者: J jaredpar

This removes the scripting dependency from the Open directory by applying the following changes:

     1. Removes the project reference to CommonScritpingTests.  This just existed to ensure the ReflectionEmit emmiter was present in the binaries directory.  Our main infrastructure already guarantees this by virtue of building all projects.
     2. Make the Emmiter load code tolerant of the ReflectionEmit Emitter not being present in binaries.  This is the case when building the Open directory only via OSS.
 (changeset 1396895)
上级 51e291ef
......@@ -59,11 +59,6 @@
<Project>{B501A547-C911-4A05-AC6E-274A50DFF30E}</Project>
<Name>CSharpCodeAnalysis</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\..\..\Closed\Scripting\Test\CommonScriptingTest.csproj">
<Project>{2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}</Project>
<Name>CommonScriptingTest</Name>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<ItemGroup Label="File References">
<Reference Include="..\..\..\..\..\packages\System.Reflection.Metadata.1.0.18-beta\lib\portable-net45+win8\System.Reflection.Metadata.dll" />
......
......@@ -58,11 +58,6 @@
<Project>{B501A547-C911-4A05-AC6E-274A50DFF30E}</Project>
<Name>CSharpCodeAnalysis</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\..\..\Closed\Scripting\Test\CommonScriptingTest.csproj">
<Project>{2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}</Project>
<Name>CommonScriptingTest</Name>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<ItemGroup Label="File References">
<Reference Include="..\..\..\..\..\packages\System.Reflection.Metadata.1.0.18-beta\lib\portable-net45+win8\System.Reflection.Metadata.dll" />
......
......@@ -54,11 +54,6 @@
<Project>{B501A547-C911-4A05-AC6E-274A50DFF30E}</Project>
<Name>CSharpCodeAnalysis</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\..\..\Closed\Scripting\Test\CommonScriptingTest.csproj">
<Project>{2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}</Project>
<Name>CommonScriptingTest</Name>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<ItemGroup Label="File References">
<Reference Include="..\..\..\..\..\packages\System.Collections.Immutable.1.1.33-beta\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll" />
......
......@@ -72,11 +72,6 @@
<Name>CSharpCodeAnalysis</Name>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\..\..\..\..\..\Closed\Scripting\Test\CommonScriptingTest.csproj">
<Project>{2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}</Project>
<Name>CommonScriptingTest</Name>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<CodeAnalysisRuleSet>..\..\..\..\..\build\TestProjectRules.ruleset</CodeAnalysisRuleSet>
......
......@@ -60,11 +60,6 @@
<Project>{7FE6B002-89D8-4298-9B1B-0B5C247DD1FD}</Project>
<Name>CompilerTestResources</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\..\..\Closed\Scripting\Test\CommonScriptingTest.csproj">
<Project>{2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}</Project>
<Name>CommonScriptingTest</Name>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<ItemGroup Label="File References">
<Reference Include="Microsoft.CodeAnalysis.Test.Resources.Proprietary, Version=0.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
......
......@@ -56,11 +56,6 @@
<Project>{2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6}</Project>
<Name>BasicCodeAnalysis</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\..\..\Closed\Scripting\Test\CommonScriptingTest.csproj">
<Project>{2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}</Project>
<Name>CommonScriptingTest</Name>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<ItemGroup Label="File References">
<Reference Include="..\..\..\..\..\packages\System.Reflection.Metadata.1.0.18-beta\lib\portable-net45+win8\System.Reflection.Metadata.dll" />
......
......@@ -52,11 +52,6 @@
<Project>{2523D0E6-DF32-4A3E-8AE0-A19BFFAE2EF6}</Project>
<Name>BasicCodeAnalysis</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\..\..\Closed\Scripting\Test\CommonScriptingTest.csproj">
<Project>{2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}</Project>
<Name>CommonScriptingTest</Name>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<ItemGroup Label="File References">
<Reference Include="..\..\..\..\..\packages\System.Reflection.Metadata.1.0.18-beta\lib\portable-net45+win8\System.Reflection.Metadata.dll" />
......
......@@ -69,11 +69,6 @@
<Name>BasicCodeAnalysis</Name>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
<ProjectReference Include="..\..\..\..\..\..\Closed\Scripting\Test\CommonScriptingTest.csproj">
<Project>{2DAE4406-7A89-4B5F-95C3-BC5472CE47CE}</Project>
<Name>CommonScriptingTest</Name>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
......
......@@ -39,18 +39,36 @@ static CommonTestBase()
if (emitSection != null)
{
var methodElements = emitSection.Elements("method");
emitters = new Emitter[methodElements.Count()];
var builder = ImmutableArray.CreateBuilder<Emitter>(methodElements.Count());
int i = 0;
foreach (var method in methodElements)
{
var asm = Assembly.Load(method.Attribute("assembly").Value);
emitters[i] = (Emitter)Delegate.CreateDelegate(typeof(Emitter),
asm.GetType(method.Attribute("type").Value),
method.Attribute("name").Value);
Emitter emitter;
try
{
var asm = Assembly.Load(method.Attribute("assembly").Value);
emitter = (Emitter)Delegate.CreateDelegate(typeof(Emitter),
asm.GetType(method.Attribute("type").Value),
method.Attribute("name").Value);
}
catch
{
// It is possible and OK for an emitter to fail to load. This is in fact expected
// when only the Open directory is built (as is the case in Github). When this happens
// the ReflectionEmitter won't be present. In that case we use the single available
// Emitter
continue;
}
builder.Add(emitter);
}
i++;
if (builder.Count == 0)
{
throw new Exception("Unable to load any emitter");
}
emitters = builder.ToImmutableArray();
}
}
}
......@@ -80,7 +98,7 @@ static CommonTestBase()
bool collectEmittedAssembly,
bool verify);
private static Emitter[] emitters;
private static readonly ImmutableArray<Emitter> emitters;
internal CompilationVerifier CompileAndVerify(
string source,
......@@ -178,7 +196,7 @@ static CommonTestBase()
sourceSymbolValidator(module, emitOptions);
}
if (emitters == null || emitters.Length == 0)
if (emitters.IsDefaultOrEmpty)
{
throw new InvalidOperationException(
@"You must specify at least one Emitter.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册