Skip to content
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

Merged
merged 3 commits into from
Jan 12, 2022

Conversation

carterkozak
Copy link
Contributor

==COMMIT_MSG==
Fix the intellij plugin when the bundled formatter is used
==COMMIT_MSG==

@carterkozak carterkozak requested a review from fawind January 12, 2022 16:17
@changelog-app
Copy link

changelog-app bot commented Jan 12, 2022

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Fix the intellij plugin when the bundled formatter is used

Check the box to generate changelog(s)

  • Generate changelog entry

@policy-bot policy-bot bot requested a review from ferozco January 12, 2022 16:17
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);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverts a change that went in yesterday, which didn't do anything

@@ -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") {
Copy link
Contributor Author

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!

Copy link
Contributor

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!

Copy link
Contributor Author

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

into("${pluginName}/impl") {
from configurations.formatter
into("${name}/impl") {
from configurations.formatter.filter { !configurations.runtimeClasspath.contains(it) }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fawind you removed this .filter { !configurations.runtimeClasspath.contains(it) } in #562, do you recall why? It seems beneficial to dedup jars, no?

Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 impl directory, restarted my IDE, and it failed to find the formatter impl

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to revalidate using jdk16+ targets though

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arg, sorry for the merge then!

@bulldozer-bot bulldozer-bot bot merged commit b65eada into develop Jan 12, 2022
@bulldozer-bot bulldozer-bot bot deleted the ckozak/fix_plugin_distribution branch January 12, 2022 16:37
@svc-autorelease
Copy link
Collaborator

Released 2.12.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants