public CrossDomainHelper(string[] absoluteFilenames, string assemblyName, string compilerOptions) { var compileResult = CompilerUtil.Compile(absoluteFilenames, assemblyName, compilerOptions: compilerOptions); _assemblyUtility = new AssemblyUtility(compileResult.Assembly); _metacomments = compileResult.Metacomments; }
public CrossDomainHelper(string[] absoluteFilenames, string assemblyName, string compilerOptions, string currentMetaRevision) { var compileResult = CompilerUtil.Compile(absoluteFilenames, assemblyName, compilerOptions, currentMetaRevision); _assemblyUtility = new AssemblyUtility(compileResult.Assembly); _metacomments = compileResult.Metacomments; _wasCached = compileResult.WasCached; }
public ComparisonTest( EvaluatorPool pool, IEnumerable <string> filenames, string outputPath, string[] stubbedAssemblies = null, TypeInfoProvider typeInfo = null, AssemblyCache assemblyCache = null, string compilerOptions = "" ) { var started = DateTime.UtcNow.Ticks; OutputPath = outputPath; EvaluatorPool = pool; var extensions = (from f in filenames select Path.GetExtension(f).ToLower()).Distinct().ToArray(); var absoluteFilenames = (from f in filenames select Path.Combine(TestSourceFolder, Portability.NormalizeDirectorySeparators(f))); if (extensions.Length != 1) { throw new InvalidOperationException("Mixture of different source languages provided."); } SourceDirectory = Path.GetDirectoryName(absoluteFilenames.First()); var assemblyNamePrefix = Path.GetDirectoryName(outputPath).Split(new char[] { '\\', '/' }).Last(); var assemblyName = Path.Combine( assemblyNamePrefix, Path.GetFileName(outputPath).Replace(".js", "") ); JSFilenames = null; if (UseAppDomains) { AssemblyAppDomain = AppDomain.CreateDomain("TestAssemblyDomain", null, new AppDomainSetup { ApplicationBase = AppDomain.CurrentDomain.BaseDirectory, }); } else { AssemblyAppDomain = AppDomain.CurrentDomain; } switch (extensions[0]) { case ".exe": case ".dll": var fns = absoluteFilenames.ToArray(); if (fns.Length > 1) { throw new InvalidOperationException("Multiple binary assemblies provided."); } AssemblyUtility = CrossDomainHelper.CreateFromAssemblyPathOnRemoteDomain(AssemblyAppDomain, fns[0], extensions[0] == ".exe").AssemblyUtility; break; case ".js": JSFilenames = absoluteFilenames.ToArray(); Metacomments = null; AssemblyUtility = null; break; default: bool ignore = false; try { var helper = CrossDomainHelper.CreateFromCompileResultOnRemoteDomain(AssemblyAppDomain, absoluteFilenames, assemblyName, compilerOptions, CurrentMetaRevision); Metacomments = helper.Metacomments; AssemblyUtility = helper.AssemblyUtility; CompilationCacheHit = helper.WasCached; } catch (TargetInvocationException exception) { if (exception.InnerException is CompilerNotFoundException) { Assert.Ignore(exception.Message); } else { throw; } } catch (CompilerNotFoundException exception) { Assert.Ignore(exception.Message); } break; } if (typeInfo != null) { typeInfo.ClearCaches(); } StubbedAssemblies = stubbedAssemblies; TypeInfo = typeInfo; AssemblyCache = assemblyCache; var ended = DateTime.UtcNow.Ticks; CompilationElapsed = TimeSpan.FromTicks(ended - started); }
public CrossDomainHelper(string assemblyPath, bool reflectionOnly) { _assemblyUtility = new AssemblyUtility(assemblyPath, reflectionOnly); }