protected virtual void AddLinkOptions(TestCaseSandbox sandbox, ManagedCompilationResult compilationResult, LinkerArgumentBuilder builder, TestCaseMetadataProvider metadataProvider) { var caseDefinedOptions = metadataProvider.GetLinkerOptions(sandbox.InputDirectory); builder.AddOutputDirectory(sandbox.OutputDirectory); foreach (var rspFile in sandbox.ResponseFiles) { builder.AddResponseFile(rspFile); } foreach (var inputReference in sandbox.InputDirectory.Files()) { var ext = inputReference.ExtensionWithDot; if (ext == ".dll" || ext == ".exe") { builder.AddReference(inputReference); } } var coreAction = caseDefinedOptions.TrimMode ?? "skip"; foreach (var extraReference in metadataProvider.GetExtraLinkerReferences()) { builder.AddReference(extraReference); builder.AddAssemblyAction(coreAction, extraReference.FileNameWithoutExtension); } builder.ProcessOptions(caseDefinedOptions); builder.ProcessTestInputAssembly(compilationResult.InputAssemblyPath); }
protected virtual void AddLinkOptions(TestCaseSandbox sandbox, ManagedCompilationResult compilationResult, ILCompilerOptionsBuilder builder, TestCaseMetadataProvider metadataProvider) { var caseDefinedOptions = metadataProvider.GetLinkerOptions(sandbox.InputDirectory); builder.AddOutputDirectory(sandbox.OutputDirectory.Combine(compilationResult.InputAssemblyPath.FileNameWithoutExtension + ".obj")); foreach (var rspFile in sandbox.ResponseFiles) { builder.AddResponseFile(rspFile); } foreach (var inputReference in sandbox.InputDirectory.Files()) { var ext = inputReference.ExtensionWithDot; if (ext == ".dll" || ext == ".exe") { if (caseDefinedOptions.AssembliesAction.Contains(("link", inputReference.FileNameWithoutExtension))) { builder.AddLinkAssembly(inputReference); } else { builder.AddReference(inputReference); } } }
protected virtual void AddLinkOptions(TestCaseSandbox sandbox, ManagedCompilationResult compilationResult, LinkerArgumentBuilder builder, TestCaseMetadaProvider metadataProvider) { var caseDefinedOptions = metadataProvider.GetLinkerOptions(sandbox.InputDirectory); builder.AddOutputDirectory(sandbox.OutputDirectory); foreach (var linkXmlFile in sandbox.LinkXmlFiles) { builder.AddLinkXmlFile(linkXmlFile); } foreach (var rspFile in sandbox.ResponseFiles) { builder.AddResponseFile(rspFile); } builder.AddSearchDirectory(sandbox.InputDirectory); foreach (var extraSearchDir in metadataProvider.GetExtraLinkerSearchDirectories()) { builder.AddSearchDirectory(extraSearchDir); } builder.ProcessOptions(caseDefinedOptions); builder.ProcessTestInputAssembly(compilationResult.InputAssemblyPath); }
public ILCompilerTestCaseResult(TestCase testCase, NPath inputAssemblyPath, NPath expectationsAssemblyPath, TestCaseSandbox sandbox, TestCaseMetadataProvider metadataProvider, ManagedCompilationResult compilationResult, TestLogWriter logWriter) { TestCase = testCase; InputAssemblyPath = inputAssemblyPath; ExpectationsAssemblyPath = expectationsAssemblyPath; Sandbox = sandbox; MetadataProvider = metadataProvider; CompilationResult = compilationResult; LogWriter = logWriter; }
public LinkedTestCaseResult(TestCase testCase, NPath inputAssemblyPath, NPath outputAssemblyPath, NPath expectationsAssemblyPath, TestCaseSandbox sandbox, TestCaseMetadaProvider metadaProvider, ManagedCompilationResult compilationResult) { TestCase = testCase; InputAssemblyPath = inputAssemblyPath; OutputAssemblyPath = outputAssemblyPath; ExpectationsAssemblyPath = expectationsAssemblyPath; Sandbox = sandbox; MetadataProvider = metadaProvider; CompilationResult = compilationResult; }
public LinkedTestCaseResult(TestCase testCase, NPath inputAssemblyPath, NPath outputAssemblyPath, NPath expectationsAssemblyPath, TestCaseSandbox sandbox, TestCaseMetadataProvider metadataProvider, ManagedCompilationResult compilationResult, LinkerTestLogger logger, LinkerCustomizations customizations) { TestCase = testCase; InputAssemblyPath = inputAssemblyPath; OutputAssemblyPath = outputAssemblyPath; ExpectationsAssemblyPath = expectationsAssemblyPath; Sandbox = sandbox; MetadataProvider = metadataProvider; CompilationResult = compilationResult; Logger = logger; Customizations = customizations; }
protected virtual void PrepForLink(TestCaseSandbox sandbox, ManagedCompilationResult compilationResult) { }
private LinkedTestCaseResult Link(TestCase testCase, TestCaseSandbox sandbox, ManagedCompilationResult compilationResult, TestCaseMetadataProvider metadataProvider) { var linker = _factory.CreateLinker(); var linkerCustomizations = CustomizeLinker(linker, metadataProvider); var builder = _factory.CreateLinkerArgumentBuilder(metadataProvider); AddLinkOptions(sandbox, compilationResult, builder, metadataProvider); LinkerTestLogger logger = new LinkerTestLogger(); linker.Link(builder.ToArgs(), linkerCustomizations, logger); return(new LinkedTestCaseResult(testCase, compilationResult.InputAssemblyPath, sandbox.OutputDirectory.Combine(compilationResult.InputAssemblyPath.FileName), compilationResult.ExpectationsAssemblyPath, sandbox, metadataProvider, compilationResult, logger, linkerCustomizations)); }
private LinkedTestCaseResult Link(TestCase testCase, TestCaseSandbox sandbox, ManagedCompilationResult compilationResult, TestCaseMetadaProvider metadataProvider) { var linker = _factory.CreateLinker(); var builder = _factory.CreateLinkerArgumentBuilder(); var caseDefinedOptions = metadataProvider.GetLinkerOptions(); builder.AddOutputDirectory(sandbox.OutputDirectory); foreach (var linkXmlFile in sandbox.LinkXmlFiles) { builder.AddLinkXmlFile(linkXmlFile); } builder.AddSearchDirectory(sandbox.InputDirectory); foreach (var extraSearchDir in metadataProvider.GetExtraLinkerSearchDirectories()) { builder.AddSearchDirectory(extraSearchDir); } builder.ProcessOptions(caseDefinedOptions); AddAdditionalLinkOptions(builder, metadataProvider); // TODO: Should be overridable builder.LinkFromAssembly(compilationResult.InputAssemblyPath.ToString()); linker.Link(builder.ToArgs()); return(new LinkedTestCaseResult(testCase, compilationResult.InputAssemblyPath, sandbox.OutputDirectory.Combine(compilationResult.InputAssemblyPath.FileName), compilationResult.ExpectationsAssemblyPath)); }
private void PrepForLink(TestCaseSandbox sandbox, ManagedCompilationResult compilationResult) { var entryPointLinkXml = sandbox.InputDirectory.Combine("entrypoint.xml"); LinkXmlHelpers.WriteXmlFileToPreserveEntryPoint(compilationResult.InputAssemblyPath, entryPointLinkXml); }
private ILCompilerTestCaseResult Link(TestCase testCase, TestCaseSandbox sandbox, ManagedCompilationResult compilationResult, TestCaseMetadataProvider metadataProvider) { var trimmer = _factory.CreateTrimmer(); var builder = _factory.CreateTrimmerOptionsBuilder(metadataProvider); AddLinkOptions(sandbox, compilationResult, builder, metadataProvider); var logWriter = new TestLogWriter(); trimmer.Trim(builder.Options, logWriter); return(new ILCompilerTestCaseResult(testCase, compilationResult.InputAssemblyPath, compilationResult.ExpectationsAssemblyPath, sandbox, metadataProvider, compilationResult, logWriter)); }