Пример #1
0
        public CompilationEngine(
            CompilationCache compilationCache, 
            CompilationEngineContext context)
        {
            _context = context;
            RootLibraryExporter = new LibraryExporter(_context.LibraryManager, this, _context.TargetFramework, _context.Configuration);
            _compilerLoadContext = new Lazy<IAssemblyLoadContext>(() =>
            {
                var factory = (IAssemblyLoadContextFactory)_context.Services.GetService(typeof(IAssemblyLoadContextFactory));

                // Ensure this compilation engine is in the service provider
                var services = new ServiceProvider(_context.Services);
                services.Add(typeof(ICompilationEngine), this);
                return factory.Create(services);
            });

            CompilationCache = compilationCache;

            // Register compiler services
            // TODO(anurse): Switch to project factory model to avoid needing to do this.
            _context.AddService(typeof(ICache), CompilationCache.Cache);
            _context.AddService(typeof(ICacheContextAccessor), CompilationCache.CacheContextAccessor);
            _context.AddService(typeof(INamedCacheDependencyProvider), CompilationCache.NamedCacheDependencyProvider);
            _context.AddService(typeof(IFileWatcher), context.FileWatcher);
        }
Пример #2
0
        public CompilationEngineContext(IApplicationEnvironment applicationEnvironment,
                                        IAssemblyLoadContext defaultLoadContext,
                                        CompilationCache cache) :
            this(applicationEnvironment, defaultLoadContext, cache, NoopWatcher.Instance, new ProjectGraphProvider())
        {

        }
Пример #3
0
 public CompilationEngineContext(IApplicationEnvironment applicationEnvironment,
                                 IRuntimeEnvironment runtimeEnvironment,
                                 IAssemblyLoadContext defaultLoadContext,
                                 CompilationCache cache)
     : this(applicationEnvironment, runtimeEnvironment, defaultLoadContext, cache, NoopWatcher.Instance)
 {
 }
Пример #4
0
 public ConnectionContext(IDictionary<int, ApplicationContext> contexts,
                          IServiceProvider services,
                          ProcessingQueue queue,
                          ProtocolManager protocolManager,
                          string hostId)
 {
     _contexts = contexts;
     _services = services;
     _queue = queue;
     _hostId = hostId;
     _protocolManager = protocolManager;
     _cache = new CompilationCache();
 }
Пример #5
0
        public CompilationEngineContext(IApplicationEnvironment applicationEnvironment,
                                        IRuntimeEnvironment runtimeEnvironment,
                                        IAssemblyLoadContext defaultLoadContext,
                                        CompilationCache cache)
        {
            ApplicationEnvironment = applicationEnvironment;
            RuntimeEnvironment = runtimeEnvironment;
            DefaultLoadContext = defaultLoadContext;
            CompilationCache = cache;

            // Register compiler services
            AddCompilationService(typeof(IApplicationEnvironment), ApplicationEnvironment);
            AddCompilationService(typeof(ICache), CompilationCache.Cache);
            AddCompilationService(typeof(ICacheContextAccessor), CompilationCache.CacheContextAccessor);
            AddCompilationService(typeof(INamedCacheDependencyProvider), CompilationCache.NamedCacheDependencyProvider);
        }
Пример #6
0
        public CompilationEngineContext(IApplicationEnvironment applicationEnvironment,
                                        IAssemblyLoadContext defaultLoadContext,
                                        CompilationCache cache,
                                        IFileWatcher fileWatcher,
                                        IProjectGraphProvider projectGraphProvider)
        {
            ApplicationEnvironment = applicationEnvironment;
            DefaultLoadContext = defaultLoadContext;
            ProjectGraphProvider = projectGraphProvider;
            CompilationCache = cache;
            FileWatcher = fileWatcher;

            // Register compiler services
            AddCompilationService(typeof(IFileWatcher), FileWatcher);
            AddCompilationService(typeof(IApplicationEnvironment), ApplicationEnvironment);
            AddCompilationService(typeof(ICache), CompilationCache.Cache);
            AddCompilationService(typeof(ICacheContextAccessor), CompilationCache.CacheContextAccessor);
            AddCompilationService(typeof(INamedCacheDependencyProvider), CompilationCache.NamedCacheDependencyProvider);
        }
Пример #7
0
 public CompilationEngineFactory(CompilationCache cache)
 {
     CompilationCache = cache;
 }