-
Notifications
You must be signed in to change notification settings - Fork 55
Intellij uses the native image from .gradle/palantir-java-formatter-caches
#1306
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
base: develop
Are you sure you want to change the base?
Conversation
Generate changelog in
|
…/palantir-java-format into cr/fix-missing-native-image-dir
adding |
import java.util.Comparator; | ||
import java.util.stream.Stream; | ||
|
||
public final class FileUtils { |
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.
same as in gradle-jdks
|
||
private static Logger logger = Logging.getLogger(PalantirJavaFormatIdeaPlugin.class); | ||
|
||
public static URI copyToCacheDir(URI srcUri) { |
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.
similar to the logic in gradle-jdks https://github.com/palantir/gradle-jdks/blob/develop/gradle-jdks-setup/src/main/java/com/palantir/gradle/jdks/setup/GradleJdkInstallationSetup.java#L114 with a few modification eg. not copying a directory, but a file
|
||
Optional<Configuration> nativeImplConfiguration = maybeGetNativeImplConfiguration(rootProject); | ||
|
||
configureLegacyIdea(rootProject, implConfiguration, nativeImplConfiguration); |
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.
Removed the configureLegacyIdea
logic completely. I see that we did that in gradle-idea-configuration
as well but happy to bring it back if you think this might be problematic for some usecases.
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.
let's drop it!
if (!Boolean.getBoolean("idea.active")) { | ||
return; | ||
} |
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 am not sure here - do we still need to check the idea.active
and run this when the idea
plugin is applied ?
return Path.of(Optional.ofNullable(System.getenv("GRADLE_USER_HOME")) | ||
.orElseGet(() -> System.getenv("HOME") + "/.gradle")); |
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 think we can use project.getGradle().getGradleUserHomeDir()
instead
TaskProvider<UpdatePalantirJavaFormatIdeaXmlFile> updatePalantirJavaFormatIpr = rootProject | ||
.getTasks() | ||
.register("updatePalantirJavaFormatIpr", UpdatePalantirJavaFormatIdeaXmlFile.class, task -> { | ||
task.getOutputFile().set(rootProject.file(rootProject.getName() + ".ipr")); | ||
task.getShouldCreateOutputIfAbsent().set(false); | ||
}); |
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.
do we still need this? I don't have any .ipr
files in my directories anymore
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 think we could probably drop the old way now. We've had the huge warning via baseline for ages now, and it's super deprecated.
TaskProvider<UpdateWorkspaceXmlFile> updateWorkspaceIwsXml = rootProject | ||
.getTasks() | ||
.register("updateWorkspaceIwsXml", UpdateWorkspaceXmlFile.class, task -> { | ||
task.getOutputFile().set(rootProject.file(rootProject.getName() + ".iws")); | ||
task.getShouldCreateOutputIfAbsent().set(false); | ||
}); |
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.
similarly here, isn't this just the idea
logic?
Before this PR
Unused artifact transforms are cleaned up by Gradle every 7 days. This could lead to situation - if people do not refresh the Gradle project in Intellij - where the formatter would fail to run because:
internal slack thread here
After this PR
~/.gradle/palantir-java-formatter-caches
).==COMMIT_MSG==
Intellij uses the native image from
.gradle/palantir-java-formatter-caches
==COMMIT_MSG==
Possible downsides?