Skip to content

Commit

Permalink
Fix the CompilerPluginManager for LS
Browse files Browse the repository at this point in the history
  • Loading branch information
Thevakumar-Luheerathan committed Jul 10, 2024
1 parent 6c996f9 commit fb33eaa
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 fb33eaa

Please sign in to comment.