public DesignTimeAssemblyLoadContextFactory(Project project, IApplicationEnvironment appEnv, ICache cache, ICacheContextAccessor cacheContextAccessor, INamedCacheDependencyProvider namedDependencyProvider) { _project = project; _appEnv = appEnv; _cache = cache; _cacheContextAccessor = cacheContextAccessor; _namedDependencyProvider = namedDependencyProvider; }
public FSharpCompiler( ICache cache, ICacheContextAccessor cacheContextAccessor, INamedCacheDependencyProvider namedDependencyProvider, IApplicationEnvironment environment, IServiceProvider services) { _cache = cache; _cacheContextAccessor = cacheContextAccessor; _namedDependencyProvider = namedDependencyProvider; _environment = environment; _services = services; }
public ApplicationContext(IServiceProvider services, ICache cache, ICacheContextAccessor cacheContextAccessor, INamedCacheDependencyProvider namedDependencyProvider, int id) { _hostServices = services; _appEnv = (IApplicationEnvironment)services.GetService(typeof(IApplicationEnvironment)); _cache = cache; _cacheContextAccessor = cacheContextAccessor; _namedDependencyProvider = namedDependencyProvider; Id = id; }
public FSharpProjectCompiler( ICache cache, ICacheContextAccessor cacheContextAccessor, INamedCacheDependencyProvider namedCacheProvider, IApplicationEnvironment environment, IServiceProvider services) { _compiler = new FSharpCompiler( cache, cacheContextAccessor, namedCacheProvider, environment, services); }
public RoslynCompiler(ICache cache, ICacheContextAccessor cacheContextAccessor, INamedCacheDependencyProvider namedDependencyProvider, IAssemblyLoadContextFactory loadContextFactory, IFileWatcher watcher, IServiceProvider services) { _cache = cache; _cacheContextAccessor = cacheContextAccessor; _namedDependencyProvider = namedDependencyProvider; _loadContextFactory = loadContextFactory; _watcher = watcher; _services = services; }
public InternalRoslynCompiler(ICache cache, ICacheContextAccessor cacheContextAccessor, INamedCacheDependencyProvider namedDependencyProvider, IAssemblyLoadContextFactory loadContextFactory, IFileWatcher watcher, IApplicationEnvironment environment, IServiceProvider services) { _cache = cache; _cacheContextAccessor = cacheContextAccessor; _namedDependencyProvider = namedDependencyProvider; _loadContextFactory = loadContextFactory; _watcher = watcher; _environment = environment; _services = services; }
public RoslynProjectCompiler( ICache cache, ICacheContextAccessor cacheContextAccessor, INamedCacheDependencyProvider namedCacheProvider, IAssemblyLoadContext loadContext, IApplicationEnvironment environment, IServiceProvider services) { _compiler = new RoslynCompiler( cache, cacheContextAccessor, namedCacheProvider, loadContext, environment, services); }
public RoslynProjectReferenceProvider( ICache cache, ICacheContextAccessor cacheContextAccessor, INamedCacheDependencyProvider namedCacheProvider, IAssemblyLoadContextFactory loadContextFactory, IFileWatcher watcher, IServiceProvider services) { _compiler = new RoslynCompiler( cache, cacheContextAccessor, namedCacheProvider, loadContextFactory, watcher, services); }
public ConnectionContext(IDictionary <int, ApplicationContext> contexts, IServiceProvider services, ICache cache, ICacheContextAccessor cacheContextAccessor, INamedCacheDependencyProvider namedDependencyProvider, ProcessingQueue queue, string hostId) { _contexts = contexts; _services = services; _cache = cache; _cacheContextAccessor = cacheContextAccessor; _namedDependencyProvider = namedDependencyProvider; _queue = queue; _hostId = hostId; }
public RoslynCompiler(ICache cache, ICacheContextAccessor cacheContextAccessor, INamedCacheDependencyProvider namedDependencyProvider, IAssemblyLoadContext loadContext, IFileWatcher watcher, IApplicationEnvironment environment, IServiceProvider services) { _cache = cache; _cacheContextAccessor = cacheContextAccessor; _namedDependencyProvider = namedDependencyProvider; _loadContext = loadContext; _watcher = watcher; _environment = environment; _services = services; }
public ConnectionContext(IDictionary<int, ApplicationContext> contexts, IServiceProvider services, ICache cache, ICacheContextAccessor cacheContextAccessor, INamedCacheDependencyProvider namedDependencyProvider, ProcessingQueue queue, string hostId) { _contexts = contexts; _services = services; _cache = cache; _cacheContextAccessor = cacheContextAccessor; _namedDependencyProvider = namedDependencyProvider; _queue = queue; _hostId = hostId; }
public FSharpProjectCompiler( ICache cache, ICacheContextAccessor cacheContextAccessor, INamedCacheDependencyProvider namedCacheProvider, IAssemblyLoadContextFactory loadContextFactory, IFileWatcher watcher, IApplicationEnvironment environment, IServiceProvider services) { _compiler = new FSharpCompiler( cache, cacheContextAccessor, namedCacheProvider, loadContextFactory, watcher, environment, services); }
public PostSharpProjectCompiler( ICache cache, ICacheContextAccessor cacheContextAccessor, INamedCacheDependencyProvider namedCacheProvider, IAssemblyLoadContext loadContext, IApplicationEnvironment environment, IServiceProvider services) { _services = services; _compiler = new RoslynCompiler( cache, cacheContextAccessor, namedCacheProvider, loadContext, environment, services); _cache = cache; _workingDirectory = cache.Get <string>("PostSharp.Dnx.WorkingDirectory", cacheContext => Path.Combine(Path.GetTempPath(), "PostSharp.Dnx", Guid.NewGuid().ToString())); Task.Run(() => PurgeWorkingDirectories()); CreateWorkingDirectory(); }
public PostSharpProjectCompiler( ICache cache, ICacheContextAccessor cacheContextAccessor, INamedCacheDependencyProvider namedCacheProvider, IAssemblyLoadContext loadContext, IApplicationEnvironment environment, IServiceProvider services) { _services = services; _compiler = new RoslynCompiler( cache, cacheContextAccessor, namedCacheProvider, loadContext, environment, services); _cache = cache; _workingDirectory = cache.Get<string>("PostSharp.Dnx.WorkingDirectory", cacheContext => Path.Combine(Path.GetTempPath(), "PostSharp.Dnx", Guid.NewGuid().ToString())); Task.Run(() => PurgeWorkingDirectories()); CreateWorkingDirectory(); }
public RoslynCompiler(ICache cache, ICacheContextAccessor cacheContextAccessor, INamedCacheDependencyProvider namedDependencyProvider, IAssemblyLoadContext loadContext, IApplicationEnvironment environment, IServiceProvider services) { _cache = cache; _cacheContextAccessor = cacheContextAccessor; _namedDependencyProvider = namedDependencyProvider; _loadContext = loadContext; _environment = environment; _services = services; _assemblyMetadataFactory = fileReference => { return(_cache.Get <AssemblyMetadata>(fileReference.Path, ctx => { ctx.Monitor(new FileWriteTimeCacheDependency(fileReference.Path)); return fileReference.CreateAssemblyMetadata(); })); }; }
public RoslynCompiler(ICache cache, ICacheContextAccessor cacheContextAccessor, INamedCacheDependencyProvider namedDependencyProvider, IAssemblyLoadContext loadContext, IApplicationEnvironment environment, IServiceProvider services) { _cache = cache; _cacheContextAccessor = cacheContextAccessor; _namedDependencyProvider = namedDependencyProvider; _loadContext = loadContext; _environment = environment; _services = services; _assemblyMetadataFactory = fileReference => { return _cache.Get<AssemblyMetadata>(fileReference.Path, ctx => { ctx.Monitor(new FileWriteTimeCacheDependency(fileReference.Path)); return fileReference.CreateAssemblyMetadata(); }); }; }
public ApplicationHostContext(IServiceProvider serviceProvider, string projectDirectory, string packagesDirectory, string configuration, FrameworkName targetFramework, ICache cache, ICacheContextAccessor cacheContextAccessor, INamedCacheDependencyProvider namedCacheDependencyProvider, IAssemblyLoadContextFactory loadContextFactory = null) { ProjectDirectory = projectDirectory; Configuration = configuration; RootDirectory = Runtime.ProjectResolver.ResolveRootDirectory(ProjectDirectory); ProjectResolver = new ProjectResolver(ProjectDirectory, RootDirectory); FrameworkReferenceResolver = new FrameworkReferenceResolver(); _serviceProvider = new ServiceProvider(serviceProvider); PackagesDirectory = packagesDirectory ?? NuGetDependencyResolver.ResolveRepositoryPath(RootDirectory); var referenceAssemblyDependencyResolver = new ReferenceAssemblyDependencyResolver(FrameworkReferenceResolver); NuGetDependencyProvider = new NuGetDependencyResolver(PackagesDirectory, RootDirectory); var gacDependencyResolver = new GacDependencyResolver(); ProjectDepencyProvider = new ProjectReferenceDependencyProvider(ProjectResolver); var unresolvedDependencyProvider = new UnresolvedDependencyProvider(); DependencyWalker = new DependencyWalker(new IDependencyProvider[] { ProjectDepencyProvider, NuGetDependencyProvider, referenceAssemblyDependencyResolver, gacDependencyResolver, unresolvedDependencyProvider }); LibraryExportProvider = new CompositeLibraryExportProvider(new ILibraryExportProvider[] { new ProjectLibraryExportProvider(ProjectResolver, ServiceProvider), referenceAssemblyDependencyResolver, gacDependencyResolver, NuGetDependencyProvider }); LibraryManager = new LibraryManager(targetFramework, configuration, DependencyWalker, LibraryExportProvider, cache); AssemblyLoadContextFactory = loadContextFactory ?? new RuntimeLoadContextFactory(ServiceProvider); namedCacheDependencyProvider = namedCacheDependencyProvider ?? NamedCacheDependencyProvider.Empty; // Default services _serviceProvider.Add(typeof(IApplicationEnvironment), new ApplicationEnvironment(Project, targetFramework, configuration)); _serviceProvider.Add(typeof(IFileWatcher), NoopWatcher.Instance); _serviceProvider.Add(typeof(ILibraryManager), LibraryManager); // Not exposed to the application layer _serviceProvider.Add(typeof(ILibraryExportProvider), LibraryExportProvider, includeInManifest: false); _serviceProvider.Add(typeof(IProjectResolver), ProjectResolver, includeInManifest: false); _serviceProvider.Add(typeof(NuGetDependencyResolver), NuGetDependencyProvider, includeInManifest: false); _serviceProvider.Add(typeof(ProjectReferenceDependencyProvider), ProjectDepencyProvider, includeInManifest: false); _serviceProvider.Add(typeof(ICache), cache, includeInManifest: false); _serviceProvider.Add(typeof(ICacheContextAccessor), cacheContextAccessor, includeInManifest: false); _serviceProvider.Add(typeof(INamedCacheDependencyProvider), namedCacheDependencyProvider, includeInManifest: false); _serviceProvider.Add(typeof(IAssemblyLoadContextFactory), AssemblyLoadContextFactory, includeInManifest: false); var compilerOptionsProvider = new CompilerOptionsProvider(ProjectResolver); _serviceProvider.Add(typeof(ICompilerOptionsProvider), compilerOptionsProvider); }
public ProjectHostContext(IServiceProvider serviceProvider, string projectDirectory, string packagesDirectory, string[] sourcePaths, string configuration, FrameworkName targetFramework, ICache cache, ICacheContextAccessor cacheContextAccessor, INamedCacheDependencyProvider namedCacheDependencyProvider, IAssemblyLoadContextFactory loadContextFactory = null) { ProjectDirectory = projectDirectory; Configuration = configuration; RootDirectory = Microsoft.Framework.Runtime.ProjectResolver.ResolveRootDirectory(ProjectDirectory); ProjectResolver = new ProjectResolver(ProjectDirectory, RootDirectory, sourcePaths); FrameworkReferenceResolver = new FrameworkReferenceResolver(); _serviceProvider = new ServiceProvider(serviceProvider); PackagesDirectory = packagesDirectory ?? NuGetDependencyResolver.ResolveRepositoryPath(RootDirectory); var referenceAssemblyDependencyResolver = new ReferenceAssemblyDependencyResolver(FrameworkReferenceResolver); NuGetDependencyProvider = new NuGetDependencyResolver(PackagesDirectory, RootDirectory); var gacDependencyResolver = new GacDependencyResolver(); ProjectDepencyProvider = new ProjectReferenceDependencyProvider(ProjectResolver); var unresolvedDependencyProvider = new UnresolvedDependencyProvider(); DependencyWalker = new DependencyWalker(new IDependencyProvider[] { ProjectDepencyProvider, NuGetDependencyProvider, referenceAssemblyDependencyResolver, gacDependencyResolver, unresolvedDependencyProvider }); LibraryExportProvider = new CompositeLibraryExportProvider(new ILibraryExportProvider[] { new ProjectLibraryExportProvider(ProjectResolver, ServiceProvider), referenceAssemblyDependencyResolver, gacDependencyResolver, NuGetDependencyProvider }); LibraryManager = new LibraryManager(targetFramework, configuration, DependencyWalker, LibraryExportProvider, cache); AssemblyLoadContextFactory = loadContextFactory ?? new AssemblyLoadContextFactory(ServiceProvider); var sourceCodeService = new SourceTextService(cache); var provider = new RoslynProjectReferenceProvider(cache, cacheContextAccessor, namedCacheDependencyProvider, loadContextFactory, _serviceProvider.GetService <IFileWatcher>(), _serviceProvider); // Default services _serviceProvider.Add(typeof(IApplicationEnvironment), new ApplicationEnvironment(Project, targetFramework, configuration)); _serviceProvider.Add(typeof(ILibraryExportProvider), LibraryExportProvider, includeInManifest: false); _serviceProvider.Add(typeof(IProjectResolver), ProjectResolver); _serviceProvider.Add(typeof(IFileWatcher), NoopWatcher.Instance); _serviceProvider.Add(typeof(NuGetDependencyResolver), NuGetDependencyProvider, includeInManifest: false); _serviceProvider.Add(typeof(ProjectReferenceDependencyProvider), ProjectDepencyProvider, includeInManifest: false); _serviceProvider.Add(typeof(ILibraryManager), LibraryManager); _serviceProvider.Add(typeof(ICache), cache); _serviceProvider.Add(typeof(ICacheContextAccessor), cacheContextAccessor); _serviceProvider.Add(typeof(INamedCacheDependencyProvider), namedCacheDependencyProvider, includeInManifest: false); _serviceProvider.Add(typeof(IAssemblyLoadContextFactory), AssemblyLoadContextFactory); _serviceProvider.Add(typeof(IProjectReferenceProvider), provider); _serviceProvider.Add(typeof(ISourceTextService), sourceCodeService); }
public CompilationCache() { CacheContextAccessor = new CacheContextAccessor(); Cache = new Cache(CacheContextAccessor); NamedCacheDependencyProvider = new NamedCacheDependencyProvider(); }
public ApplicationHostContext(IServiceProvider serviceProvider, string projectDirectory, string packagesDirectory, string configuration, FrameworkName targetFramework, ICache cache, ICacheContextAccessor cacheContextAccessor, INamedCacheDependencyProvider namedCacheDependencyProvider, IAssemblyLoadContextFactory loadContextFactory = null, bool skipLockFileValidation = false) { ProjectDirectory = projectDirectory; Configuration = configuration; RootDirectory = Runtime.ProjectResolver.ResolveRootDirectory(ProjectDirectory); ProjectResolver = new ProjectResolver(ProjectDirectory, RootDirectory); FrameworkReferenceResolver = new FrameworkReferenceResolver(); _serviceProvider = new ServiceProvider(serviceProvider); PackagesDirectory = packagesDirectory ?? NuGetDependencyResolver.ResolveRepositoryPath(RootDirectory); var referenceAssemblyDependencyResolver = new ReferenceAssemblyDependencyResolver(FrameworkReferenceResolver); NuGetDependencyProvider = new NuGetDependencyResolver(new PackageRepository(PackagesDirectory)); var gacDependencyResolver = new GacDependencyResolver(); ProjectDepencyProvider = new ProjectReferenceDependencyProvider(ProjectResolver); var unresolvedDependencyProvider = new UnresolvedDependencyProvider(); var projectName = PathUtility.GetDirectoryName(ProjectDirectory); Project project; if (ProjectResolver.TryResolveProject(projectName, out project)) { Project = project; } else { throw new InvalidOperationException( string.Format("Unable to resolve project '{0}' from {1}", projectName, ProjectDirectory)); } var projectLockJsonPath = Path.Combine(ProjectDirectory, LockFileReader.LockFileName); var lockFileExists = File.Exists(projectLockJsonPath); var validLockFile = false; if (lockFileExists) { var lockFileReader = new LockFileReader(); var lockFile = lockFileReader.Read(projectLockJsonPath); validLockFile = lockFile.IsValidForProject(Project); if (validLockFile || skipLockFileValidation) { NuGetDependencyProvider.ApplyLockFile(lockFile); DependencyWalker = new DependencyWalker(new IDependencyProvider[] { ProjectDepencyProvider, NuGetDependencyProvider, referenceAssemblyDependencyResolver, gacDependencyResolver, unresolvedDependencyProvider }); } } if ((!validLockFile && !skipLockFileValidation) || !lockFileExists) { // We don't add NuGetDependencyProvider to DependencyWalker // It will leave all NuGet packages unresolved and give error message asking users to run "dnu restore" DependencyWalker = new DependencyWalker(new IDependencyProvider[] { ProjectDepencyProvider, referenceAssemblyDependencyResolver, gacDependencyResolver, unresolvedDependencyProvider }); } LibraryExportProvider = new CompositeLibraryExportProvider(new ILibraryExportProvider[] { new ProjectLibraryExportProvider(ProjectResolver, ServiceProvider), referenceAssemblyDependencyResolver, gacDependencyResolver, NuGetDependencyProvider }); LibraryManager = new LibraryManager(targetFramework, configuration, DependencyWalker, LibraryExportProvider, cache); AssemblyLoadContextFactory = loadContextFactory ?? new RuntimeLoadContextFactory(ServiceProvider); namedCacheDependencyProvider = namedCacheDependencyProvider ?? NamedCacheDependencyProvider.Empty; // Default services _serviceProvider.Add(typeof(IApplicationEnvironment), new ApplicationEnvironment(Project, targetFramework, configuration)); _serviceProvider.Add(typeof(ILibraryManager), LibraryManager); _serviceProvider.TryAdd(typeof(IFileWatcher), NoopWatcher.Instance); // Not exposed to the application layer _serviceProvider.Add(typeof(ILibraryExportProvider), LibraryExportProvider, includeInManifest: false); _serviceProvider.Add(typeof(IProjectResolver), ProjectResolver, includeInManifest: false); _serviceProvider.Add(typeof(NuGetDependencyResolver), NuGetDependencyProvider, includeInManifest: false); _serviceProvider.Add(typeof(ProjectReferenceDependencyProvider), ProjectDepencyProvider, includeInManifest: false); _serviceProvider.Add(typeof(ICache), cache, includeInManifest: false); _serviceProvider.Add(typeof(ICacheContextAccessor), cacheContextAccessor, includeInManifest: false); _serviceProvider.Add(typeof(INamedCacheDependencyProvider), namedCacheDependencyProvider, includeInManifest: false); _serviceProvider.Add(typeof(IAssemblyLoadContextFactory), AssemblyLoadContextFactory, includeInManifest: false); var compilerOptionsProvider = new CompilerOptionsProvider(ProjectResolver); _serviceProvider.Add(typeof(ICompilerOptionsProvider), compilerOptionsProvider); }