public void Launch(string pipelineConfigurationFilePath) { if (!fileSystem.File.Exists(pipelineConfigurationFilePath)) { throw new InvalidOperationException($"Pipeline configuration file not found: {pipelineConfigurationFilePath}."); } PipelineWorkspaceManagersWrapper workspaces = new PipelineWorkspaceManagersWrapper( this.initialWorkspaceManager.CreateAdHocClone(), this.outputWorkspaceManager); var typeLoader = new AggregateTypeLoader(); var assemblyLoadContext = new CustomAssemblyLoadContext(typeLoader); typeLoader.AddResolver(new DefaultTypeLoader()); typeLoader.AddResolver(new ProjectReferenceTypeLoader(workspaces.ProcessingWorkspace, this.fileSystem, assemblyLoadContext)); typeLoader.AddResolver(new WorkspaceTypeLoader(workspaces.ProcessingWorkspace, assemblyLoadContext)); if (this.additionalTypeLoader != null) { typeLoader.AddResolver(this.additionalTypeLoader); } var trackingTypeLoader = new TrackingTypeLoaderWrapper(typeLoader, this.fileSystem, assemblyLoadContext); trackingTypeLoader.AttachAssemblyResolveHandler(); var basePath = this.fileSystem.Path.GetDirectoryName(this.fileSystem.Path.GetFullPath(pipelineConfigurationFilePath)); var builderProvider = this.GetBuilderProvider(workspaces, basePath); var pipelineBuilder = new PipelineBuilder( builderProvider, workspaces, basePath, this.fileSystem, trackingTypeLoader, this.logger); var pipeline = pipelineBuilder.Build(JObject.Parse(this.fileSystem.File.ReadAllText(pipelineConfigurationFilePath))); this.ExecutePipeline(pipeline); this.SaveOutputs(this.outputStorageHandler, pipeline.GetOutputs()); }
public void CanConstructPipeine() { var fileSystem = new Mock <IFileSystem>(MockBehavior.Strict).Object; var logger = new Mock <ILogger>(MockBehavior.Loose).Object; var basePath = "z:\\fakepath"; var workspaceManager = new WorkspaceManager(TestWorkspaceFactory.GetWorkspace()); PipelineWorkspaceManagersWrapper workspaces = new PipelineWorkspaceManagersWrapper(workspaceManager, workspaceManager); BuilderRegistry builders = new BuilderRegistry(); builders.Register <ICodeFileDestination>(new WorkspaceCodeFileDestinationBuilder(workspaces)); builders.Register <ICodeFileSelector>(new CodeFileSelectorBuilder()); var config = JObject.Parse(Resources.IntegrationTestConfig01); var subject = new PipelineBuilder(builders, workspaces, basePath, fileSystem, new DefaultTypeLoader(), logger); var result = subject.Build(config); result.Should().NotBeNull(); var pipeline = result as CodeGenerationPipeline; pipeline.InputCodeStreamProvider.Should().NotBeNull(); pipeline.PipelineEnvironment.Should().NotBeNull(); pipeline.Batches.Should().NotBeNull(); pipeline.Batches.Count.Should().Be(1); pipeline.Batches[0].Shadow.Should().NotBeNull(); pipeline.Batches[0].Shadow.Count.Should().Be(1); pipeline.Batches[0].Shadow[0].Language.Should().Be("CSharp"); pipeline.Batches[0].Shadow[0].Filter.Should().NotBeNull(); pipeline.Batches[0].Shadow[0].Filter.Should().BeOfType <WorkspaceCodeFileLocationFilter>(); }