Skip to content

Commit 729ccc0

Browse files
committed
Rename native formatter property from palantir to openjavaformat
1 parent 474299b commit 729ccc0

7 files changed

Lines changed: 16 additions & 9 deletions

File tree

‎README.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,9 @@ every name below — for its Gradle projects and directories as well as for what
273273
| Gradle plugin IDs | `com.palantir.java-format`, `-idea`, `-spotless`, `-provider` | `dev.openjavaformat.java-format`, `-idea`, `-spotless`, `-provider` |
274274
| IntelliJ plugin ID | `palantir-java-format` | `open-java-format` |
275275
| Eclipse plugin bundle | `palantir-java-format-eclipse-plugin` | `open-java-format-eclipse-plugin` |
276+
| CLI style flag | `--palantir`, `-palantir` | `--ojf`, `-ojf` |
277+
| Formatter style | `PALANTIR` | `OJF` |
278+
| Native formatter Gradle property | `palantir.native.formatter` | `openjavaformat.native.formatter` |
276279
| Java packages | `com.palantir.javaformat.*` | **unchanged in 2.x** |
277280
| Version numbers | `2.x` | **the same `2.x`** |
278281

@@ -590,8 +593,8 @@ Upstream [PR 1211](https://github.com/palantir/palantir-java-format/pull/1211) s
590593
support. To use the Java 21 formatting capabilities, ensure that either:
591594

592595
- the Gradle daemon and the IntelliJ Project SDK are set to Java 21
593-
- or the gradle property `palantir.native.formatter=true` is set. This runs the formatter as a
594-
native image, independent of the Gradle daemon / IntelliJ project JDK version.
596+
- or the gradle property `openjavaformat.native.formatter=true` is set. This runs the formatter
597+
as a native image, independent of the Gradle daemon / IntelliJ project JDK version.
595598

596599
### Native image formatter
597600

‎gradle-open-java-format/src/main/java/com/palantir/javaformat/gradle/NativeImageSupport.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ private boolean isNativeImageSupported() {
4848

4949
private boolean isNativeFlagEnabled() {
5050
return getProviderFactory()
51-
.gradleProperty("palantir.native.formatter")
51+
.gradleProperty("openjavaformat.native.formatter")
5252
.map(Boolean::parseBoolean)
5353
.orElse(false)
5454
.get();

‎gradle-open-java-format/src/test/java/com/palantir/javaformat/gradle/PalantirJavaFormatIdeaPluginTest.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class PalantirJavaFormatIdeaPluginTest {
4848
private Path projectDir;
4949

5050
@ParameterizedTest(name = "extraGradleProperties={0}")
51-
@ValueSource(strings = {"", "palantir.native.formatter=true"})
51+
@ValueSource(strings = {"", "openjavaformat.native.formatter=true"})
5252
void idea_configures_xml_files(String extraGradleProperties) throws IOException {
5353
GradleTestProject project = new GradleTestProject(projectDir)
5454
.plugins("dev.openjavaformat.java-format-idea", "idea")
@@ -83,7 +83,7 @@ void idea_configures_xml_files(String extraGradleProperties) throws IOException
8383

8484
assertThat(allOptions).anyMatch(o -> "implementationClassPath".equals(o.name()));
8585

86-
if (extraGradleProperties.contains("palantir.native.formatter=true")) {
86+
if (extraGradleProperties.contains("openjavaformat.native.formatter=true")) {
8787
assertThat(allOptions).anyMatch(o -> "nativeImageClassPath".equals(o.name()));
8888
}
8989

‎gradle-open-java-format/src/test/java/com/palantir/javaformat/gradle/PalantirJavaFormatPluginTest.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class PalantirJavaFormatPluginTest {
4646
delimiter = '|',
4747
value = {
4848
" | Using the Java-based formatter",
49-
"palantir.native.formatter=true | Using the native-image formatter"
49+
"openjavaformat.native.formatter=true | Using the native-image formatter"
5050
})
5151
void formatDiff_updates_only_lines_changed_in_git_diff(String extraGradleProperties, String expectedOutput)
5252
throws IOException, InterruptedException {

‎gradle-open-java-format/src/test/java/com/palantir/javaformat/gradle/PalantirJavaFormatSpotlessPluginTest.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ class PalantirJavaFormatSpotlessPluginTest {
4949
@CsvSource(
5050
delimiter = '|',
5151
value = {
52-
" | 21 | Using the Java-based formatter",
53-
"palantir.native.formatter=true | 21 | Using the Java-based formatter"
52+
" | 21 | Using the Java-based formatter",
53+
"openjavaformat.native.formatter=true | 21 | Using the Java-based formatter"
5454
})
5555
void formats_with_spotless_when_spotless_is_applied(
5656
String extraGradleProperties, String javaVersion, String expectedOutput) {

‎gradle.properties‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ org.gradle.jvmargs=--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAME
66
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \
77
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
88
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
9+
10+
# Read by the upstream com.palantir.java-format plugin that formats this repository (applied in
11+
# build.gradle), so it keeps the upstream name. The fork's own Gradle plugin reads
12+
# openjavaformat.native.formatter instead.
913
palantir.native.formatter=true
1014

1115
# Where Gradle looks for JDKs. Auto-detection only reads JAVA_HOME, and CI overwrites that with

‎open-java-format-idea-plugin/src/main/java/com/palantir/javaformat/intellij/PalantirJavaFormatConfigurable.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public void disposeUIResources() {}
128128

129129
private static String isUsingNativeImage(PalantirJavaFormatSettings settings) {
130130
if (settings.getNativeImageClassPath().isPresent()) {
131-
return "Native image formatter (`palantir.native.formatter` gradle property is enabled)";
131+
return "Native image formatter (`openjavaformat.native.formatter` gradle property is enabled)";
132132
} else {
133133
return "(Default setup) Java-based formatter";
134134
}

0 commit comments

Comments
 (0)