private void Initialize(RuntimeOptions options, IServiceProvider hostServices, IAssemblyLoadContextAccessor loadContextAccessor, IFileWatcher fileWatcher) { _applicationHostContext = new ApplicationHostContext( hostServices, _projectDirectory, options.PackageDirectory, options.Configuration, _targetFramework); _compilationEngine = _compilationEngineFactory.CreateEngine( new CompilationEngineContext( _applicationHostContext.LibraryManager, _applicationHostContext.ProjectGraphProvider, fileWatcher, _applicationHostContext.ServiceProvider, _targetFramework, options.Configuration)); // Make the root project's library exports available for apps to read. _applicationHostContext.AddService(typeof(ILibraryExporter), _compilationEngine.RootLibraryExporter); _applicationHostContext.AddService(typeof(ICompilationEngine), _compilationEngine); Logger.TraceInformation("[{0}]: Project path: {1}", GetType().Name, _projectDirectory); Logger.TraceInformation("[{0}]: Project root: {1}", GetType().Name, _applicationHostContext.RootDirectory); Logger.TraceInformation("[{0}]: Project configuration: {1}", GetType().Name, _applicationHostContext.Configuration); Logger.TraceInformation("[{0}]: Packages path: {1}", GetType().Name, _applicationHostContext.PackagesDirectory); _project = _applicationHostContext.Project; if (Project == null) { throw new Exception("Unable to locate " + Project.ProjectFileName); } if (options.WatchFiles) { fileWatcher.OnChanged += _ => { _shutdown.RequestShutdownWaitForDebugger(); }; } _applicationHostContext.AddService(typeof(IApplicationShutdown), _shutdown); _applicationHostContext.AddService(typeof(RuntimeOptions), options); if (options.CompilationServerPort.HasValue) { // Change the project reference provider Project.DefaultCompiler = Project.DefaultDesignTimeCompiler; } CallContextServiceLocator.Locator.ServiceProvider = ServiceProvider; // Configure Assembly loaders _loaders.Add(new ProjectAssemblyLoader( loadContextAccessor, _applicationHostContext.ProjectResolver, _compilationEngine)); _loaders.Add(new NuGetAssemblyLoader(loadContextAccessor, _applicationHostContext.NuGetDependencyProvider)); }
public ProjectAssemblyLoader(IAssemblyLoadContextAccessor loadContextAccessor, ICompilationEngine compilationEngine, IEnumerable <ProjectDescription> projects) { _loadContextAccessor = loadContextAccessor; _compilationEngine = compilationEngine; _projects = projects.ToDictionary(p => p.Identity.Name, p => new RuntimeProject(p.Project, p.Framework)); }
public ProjectAssemblyLoader(IAssemblyLoadContextAccessor loadContextAccessor, IProjectResolver projectResolver, ICompilationEngine compilationEngine) { _loadContextAccessor = loadContextAccessor; _compilationEngine = compilationEngine; _projectResolver = projectResolver; }
public ProjectAssemblyLoader(IAssemblyLoadContextAccessor loadContextAccessor, ICompilationEngine compilationEngine, IEnumerable<ProjectDescription> projects) { _loadContextAccessor = loadContextAccessor; _compilationEngine = compilationEngine; _projects = projects.ToDictionary(p => p.Identity.Name, p => new RuntimeProject(p.Project, p.Framework)); }
public RuntimeLoadContext(LibraryManager libraryManager, ICompilationEngine compilationEngine, IAssemblyLoadContext defaultContext) { _projectAssemblyLoader = new ProjectAssemblyLoader(loadContextAccessor: null, compilationEngine: compilationEngine, libraryManager: libraryManager); _packageAssemblyLoader = new PackageAssemblyLoader(loadContextAccessor: null, libraryManager: libraryManager); _defaultContext = defaultContext; }
public ProjectAssemblyLoader(IAssemblyLoadContextAccessor loadContextAccessor, ICompilationEngine compilationEngine, LibraryManager libraryManager) { _loadContextAccessor = loadContextAccessor; _compilationEngine = compilationEngine; _libraryManager = libraryManager; }
public ProjectAssemblyLoader(IAssemblyLoadContextAccessor loadContextAccessor, ICompilationEngine compilationEngine, IEnumerable<ProjectDescription> projects, string configuration) { _loadContextAccessor = loadContextAccessor; _compilationEngine = compilationEngine; _projects = projects.ToDictionary(p => p.Identity.Name, p => new RuntimeProject(p.Project, p.Framework)); _configuration = configuration; var environment = RuntimeEnvironmentHelper.RuntimeEnvironment; }
public ProjectAssemblyLoader(IAssemblyLoadContextAccessor loadContextAccessor, ICompilationEngine compilationEngine, IEnumerable <ProjectDescription> projects, string configuration) { _loadContextAccessor = loadContextAccessor; _compilationEngine = compilationEngine; _projects = projects.ToDictionary(p => p.Identity.Name, p => new RuntimeProject(p.Project, p.Framework)); _configuration = configuration; var environment = RuntimeEnvironmentHelper.RuntimeEnvironment; }
public RuntimeLoadContext(string friendlyName, IEnumerable<LibraryDescription> libraries, ICompilationEngine compilationEngine, IAssemblyLoadContext defaultContext) : base(friendlyName) { // TODO: Make this all lazy // TODO: Unify this logic with default host var projects = libraries.Where(p => p.Type == LibraryTypes.Project) .OfType<ProjectDescription>(); var assemblies = PackageDependencyProvider.ResolvePackageAssemblyPaths(libraries); _projectAssemblyLoader = new ProjectAssemblyLoader(loadContextAccessor: null, compilationEngine: compilationEngine, projects: projects); _packageAssemblyLoader = new PackageAssemblyLoader(loadContextAccessor: null, assemblies: assemblies, libraryDescriptions: libraries); _defaultContext = defaultContext; }
public RuntimeLoadContext(string friendlyName, IEnumerable <LibraryDescription> libraries, ICompilationEngine compilationEngine, IAssemblyLoadContext defaultContext) : base(friendlyName) { // TODO: Make this all lazy // TODO: Unify this logic with default host var projects = libraries.Where(p => p.Type == LibraryTypes.Project) .OfType <ProjectDescription>(); var assemblies = PackageDependencyProvider.ResolvePackageAssemblyPaths(libraries); _projectAssemblyLoader = new ProjectAssemblyLoader(loadContextAccessor: null, compilationEngine: compilationEngine, projects: projects); _packageAssemblyLoader = new PackageAssemblyLoader(loadContextAccessor: null, assemblies: assemblies, libraryDescriptions: libraries); _defaultContext = defaultContext; }