-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the intellij plugin when the bundled formatter is used #619
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,8 +19,9 @@ apply plugin: 'org.jetbrains.intellij' | |
|
||
apply plugin: 'com.palantir.external-publish-jar' | ||
|
||
def name = "palantir-java-format" | ||
intellij { | ||
pluginName = "palantir-java-format" | ||
pluginName = name | ||
updateSinceUntilBuild = true | ||
version = "IU-202.6397.94" | ||
plugins = ['java'] | ||
|
@@ -73,8 +74,8 @@ tasks.withType(org.jetbrains.intellij.tasks.PrepareSandboxTask) { | |
dependsOn configurations.runtimeClasspath | ||
|
||
// Also pack the formatter in its own directory | ||
into("${pluginName}/impl") { | ||
from configurations.formatter | ||
into("${name}/impl") { | ||
from configurations.formatter.filter { !configurations.runtimeClasspath.contains(it) } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I remember correctly, I ran into issues where dependencies of the formatter where missing when loading the formatter from the impl directory. Not sure if we have integration tests for this. Can quickly try if the intellij bundled formatter still works after this. Wouldn't be surprised if we can re-add this. I think me removing this filter was mostly a blind guess in trying to fix those issues. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've verified that it works locally. I was worried that I was testing the wrong path, so I renamed the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I need to revalidate using jdk16+ targets though There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Arg, sorry for the merge then! |
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,13 +83,9 @@ private static List<Path> getProvidedImplementationUrls(List<URI> implementation | |
|
||
private static List<Path> getBundledImplementationUrls() { | ||
// Load from the jars bundled with the plugin. | ||
Path pluginPath = PalantirCodeStyleManager.PLUGIN.getPluginPath(); | ||
Path implDir = pluginPath.resolve("impl"); | ||
// Directory appears to have been renamed from 'impl' to 'lib' in recent idea releases | ||
Path pathToUse = Files.isDirectory(implDir) ? implDir : pluginPath.resolve("lib"); | ||
|
||
log.debug("Using palantir-java-format implementation bundled with plugin: {}", pathToUse); | ||
return listDirAsUrlsUnchecked(pathToUse); | ||
Path implDir = PalantirCodeStyleManager.PLUGIN.getPath().toPath().resolve("impl"); | ||
log.debug("Using palantir-java-format implementation bundled with plugin: {}", implDir); | ||
return listDirAsUrlsUnchecked(implDir); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. reverts a change that went in yesterday, which didn't do anything |
||
} | ||
|
||
private static List<Path> getImplementationUrls( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This variable was not resolved, so the current version was no longer included in our plugin!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice find! Interesting that this worked before!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely sure when it broke since it only failed when the idea plugin used a newer version than the repo