Skip to content

Commit

Permalink
Merge pull request #43076 from Thevakumar-Luheerathan/fix-ballerina-l…
Browse files Browse the repository at this point in the history
…ang-iss-43060

Fix the CompilerPluginManager for LS
  • Loading branch information
Dilhasha committed Jul 24, 2024
2 parents fa02493 + fb33eaa commit de5060e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ private CompilerPluginManager(PackageCompilation compilation,
}

static CompilerPluginManager from(PackageCompilation compilation) {
// Skip initialization if the compiler plugins are already initialized for the project
if (!compilation.packageContext().project().compilerPluginContexts().isEmpty()) {
List<CompilerPluginContextIml> compilerPluginContexts =
compilation.packageContext().project().compilerPluginContexts();
return new CompilerPluginManager(compilation, compilerPluginContexts);
}
// TODO We need to update the DependencyGraph API. Right now it is a mess
PackageResolution packageResolution = compilation.getResolution();
ResolvedPackageDependency rootPkgNode = new ResolvedPackageDependency(
Expand Down Expand Up @@ -191,10 +197,6 @@ private static List<Package> getDirectDependencies(ResolvedPackageDependency roo

private static List<CompilerPluginContextIml> initializePlugins(List<CompilerPluginInfo> compilerPlugins,
PackageCompilation compilation) {
// Skip initialization if the compiler plugins are already initialized for the project
if (!compilation.packageContext().project().compilerPluginContexts().isEmpty()) {
return compilation.packageContext().project().compilerPluginContexts();
}
List<CompilerPluginContextIml> compilerPluginContexts = new ArrayList<>(compilerPlugins.size());
for (CompilerPluginInfo compilerPluginInfo : compilerPlugins) {
CompilerPluginCache pluginCache =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,8 @@ private Package createNewPackage() {
this.project.setCurrentPackage(new Package(newPackageContext, this.project));
if (isOldDependencyGraphValid(oldPackage, this.project.currentPackage())) {
this.project.currentPackage().packageContext().getResolution(oldResolution);
} else {
this.project.compilerPluginContexts().clear();
}
CompilationOptions offlineCompOptions = CompilationOptions.builder().setOffline(true).build();
offlineCompOptions = offlineCompOptions.acceptTheirs(project.currentPackage().compilationOptions());
Expand Down

0 comments on commit de5060e

Please sign in to comment.