public async Task RestoreAsync(string inputPath) { var inputUri = PathHelper.FilePathToFileUrl(inputPath); var configuration = this.configurationManager.GetConfiguration(inputUri); var sourceFileGrouping = SourceFileGroupingBuilder.Build(this.fileResolver, this.moduleDispatcher, this.workspace, inputUri, configuration); // restore is supposed to only restore the module references that are valid // and not log any other errors await moduleDispatcher.RestoreModules(configuration, moduleDispatcher.GetValidModuleReferences(sourceFileGrouping.ModulesToRestore, configuration)); }
public async Task RestoreAsync(string inputPath) { var inputUri = PathHelper.FilePathToFileUrl(inputPath); var configuration = this.configurationManager.GetConfiguration(inputUri); var sourceFileGrouping = SourceFileGroupingBuilder.Build(this.fileResolver, this.moduleDispatcher, this.workspace, inputUri, configuration); var originalModulesToRestore = sourceFileGrouping.ModulesToRestore; // restore is supposed to only restore the module references that are syntactically valid await moduleDispatcher.RestoreModules(configuration, moduleDispatcher.GetValidModuleReferences(sourceFileGrouping.ModulesToRestore, configuration)); // update the errors based on restore status sourceFileGrouping = SourceFileGroupingBuilder.Rebuild(this.moduleDispatcher, this.workspace, sourceFileGrouping, configuration); LogDiagnostics(GetModuleRestoreDiagnosticsByBicepFile(sourceFileGrouping, originalModulesToRestore)); }
public async Task <Compilation> CompileAsync(string inputPath, bool skipRestore) { var inputUri = PathHelper.FilePathToFileUrl(inputPath); var configuration = this.configurationManager.GetConfiguration(inputUri); var sourceFileGrouping = SourceFileGroupingBuilder.Build(this.fileResolver, this.moduleDispatcher, this.workspace, inputUri, configuration); if (!skipRestore) { // module references in the file may be malformed // however we still want to surface as many errors as we can for the module refs that are valid // so we will try to restore modules with valid refs and skip everything else // (the diagnostics will be collected during compilation) if (await moduleDispatcher.RestoreModules(configuration, moduleDispatcher.GetValidModuleReferences(sourceFileGrouping.ModulesToRestore, configuration))) { // modules had to be restored - recompile sourceFileGrouping = SourceFileGroupingBuilder.Rebuild(moduleDispatcher, this.workspace, sourceFileGrouping, configuration); } } var compilation = new Compilation(this.invocationContext.Features, this.invocationContext.NamespaceProvider, sourceFileGrouping, configuration, new LinterAnalyzer(configuration)); LogDiagnostics(compilation); return(compilation); }