Skip to content

Replace palantir's Gradle plugins with plain Gradle - #97

Open
abashev wants to merge 8 commits into
mainfrom
remove-palantir-build-plugins
Open

abashev wants to merge 8 commits into
mainfrom
remove-palantir-build-plugins

Conversation

@abashev

@abashev abashev commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

The build applied a dozen plugins from palantir's Gradle tooling, several of them there only for palantir's own CI and bots, and the Gradle and IDEA plugins we publish carried two palantir libraries. This replaces them with buildSrc conventions, the plain upstream plugins and a little code of our own, and drops the rest. Nothing from palantir is left in the build or in what we ship, apart from the package names.

Supersedes the Dependabot bumps #96 (gradle-baseline-error-prone) and #2 (gradle-guide): both plugins are gone.

What replaces what

Before After
baseline-error-prone, baseline-null-away, suppressible-error-prone, gradle-guide open-java-format.error-prone-conventions: net.ltgt.errorprone 5.1.1 and net.ltgt.nullaway 3.2.0 running Error Prone 2.50.0, NullAway 0.14.2 and Picnic's error-prone-support 0.30.0
gradle-baseline-java: toolchains, javac flags, JUnit wiring open-java-format.java-conventions, in plain Gradle DSL
baseline's Checkstyle with its configuration in .baseline/checkstyle Gradle's checkstyle plugin on Checkstyle 14.3.0, configuration in Gradle's default config/checkstyle
com.palantir.java-format 2.98.0 our released dev.openjavaformat.java-format 2.98.0.5
gradle-git-version git describe, the command it ran
com.palantir.gradle.utils:platform buildSrc's open-java-format.native-platform for the image name, and NativePlatform in the Gradle plugin
gradle-idea-configuration, which the Gradle plugin applied to list the open-java-format IDEA plugin in .idea/externalDependencies.xml UpdateExternalDependenciesXmlFile, next to the tasks that already write .idea/open-java-format.xml and workspace.xml
failure-reports, idea-language-injector, jakarta-package-alignment, the .baseline/ IDE templates, the bot configs nothing

Worth a look

  • Error Prone. The checks vfs-s3 makes build-breaking are listed in the convention, commented out until the code is fixed: switched on, they find about 370 issues (JUnitMethodDeclaration 206, StaticImport 84, LexicographicalAnnotationListing 46, ...). Warnings stay warnings, NullAway's among them.
  • Checkstyle runs in check but checks nothing yet: custom-suppressions.xml suppresses every check, as it did upstream, where the task had also been disabled since 2019. Without it there are 560 findings in 82 files. JavadocStyle is gone because Checkstyle 13.9.0 removed it.
  • The IDEA plugin's javac. The IntelliJ Platform plugin defaults javac to --release, which javac refuses next to the --add-exports of jdk.compiler that every module gets. baseline hid that; open-java-format-idea-plugin/build.gradle now unsets the convention.
  • Formatting. Our formatter lays out text blocks differently from upstream 2.98.0, so formatDiff reshaped the one statement this touches in PalantirJavaFormatSpotlessPluginTest.
  • Version. git describe --dirty ignores untracked files, which gradle-git-version's git status --porcelain counted.
  • Native platforms. The Gradle plugin now lists the published platforms exactly: the five classifiers on Maven Central. Before, any glibc Linux and any macOS counted, so a 32-bit x86 JVM went looking for an image that does not exist. The Linux branch, ldd --version to tell glibc from musl, only runs on CI's ubuntu jobs, in the native module's configuration and in NativePlatformTest.reads_the_platform_of_the_jvm_running_gradle.
  • The IDEA plugin zip loses four jars of palantir's gradle-utils it bundled without using them.
  • Required IDEA plugin. As before, .idea/externalDependencies.xml is written only when idea.active is set, keeps the other required plugins and keeps a higher min-version for ours. The task is updateExternalDependenciesXml, not palantir's updateExternalDepsXml, so a build that applies palantir's plugin as well gets both tasks instead of a clash. The ideaConfiguration extension the Gradle plugin used to create is gone.

Checked

  • ./gradlew build on JDK 21, after merging main.
  • Every task's settings before and after removing baseline: toolchains, --release, encoding, javac arguments, test JVM arguments and system properties, archive settings. They are identical except javac's 2g heap, which never applied with fork=false.
  • :gradle-open-java-format:test: 51 tests, NativePlatformTest's 20 and RequiredIdeaPluginTest among them. With -PnativeImage=true on GraalVM 25, all 60, including the native-only PalantirJavaFormatIdeaPluginTest, whose path through the IDEA plugin this touches.
  • formatDiff through the released plugin and its native image on macOS aarch64.
  • Six dummy binaries passed in with -PnativeImages get the classifiers and extensions already on Maven Central.
  • buildPlugin: the IDEA plugin zip has no palantir jars.

The build no longer applies anything from palantir's Gradle tooling.
What it used to get from there is now written out in two buildSrc
convention plugins, or comes from the plain upstream plugins:

- open-java-format.error-prone-conventions runs Error Prone 2.50.0
  through net.ltgt.errorprone and net.ltgt.nullaway, with NullAway and
  Picnic's error-prone-support, in place of baseline-error-prone,
  baseline-null-away, suppressible-error-prone and gradle-guide, which
  applied suppressible-error-prone itself. The checks vfs-s3 makes
  build-breaking are listed there, commented out until the code is
  fixed.
- open-java-format.java-conventions sets what gradle-baseline-java did:
  the Java 21 toolchain, tests on -PjavaRuntime, the JUnit wiring, the
  javac flags and Checkstyle. The IntelliJ Platform plugin defaults
  javac to --release, which javac refuses alongside the --add-exports
  of jdk.compiler; baseline hid that, and the IDEA plugin's build now
  unsets it.
- Checkstyle's configuration moves from .baseline/checkstyle to
  Gradle's default config/checkstyle and runs on Checkstyle 14.3.0,
  without JavadocStyle, which Checkstyle 13.9.0 removed.
  custom-suppressions.xml still suppresses every check, as upstream.
- The released dev.openjavaformat.java-format 2.98.0.5 formats the
  repository instead of com.palantir.java-format, which needed Spotless
  on the classpath once baseline no longer brought it.
- The version comes from git describe, the same command
  gradle-git-version ran. failure-reports, idea-language-injector and
  jakarta-package-alignment go without replacement, and so do the
  configuration files of palantir's bots: bulldozer, changelog,
  excavator and revapi.
.baseline/ held what palantir's baseline-idea and baseline-eclipse
plugins copied into IDE settings: copyright notices, Eclipse JDT
preferences with their Checkstyle hookup, and the IntelliJ code style.
Neither plugin is applied any more and nothing else reads these files;
Checkstyle's configuration already lives in config/checkstyle.
The benchmarks build kept upstream's Spotless configuration commented
out, to come back with baseline-format. baseline is gone and nothing in
the build applies Spotless; dev.openjavaformat.java-format formats the
repository. What the block said still matters, so a comment keeps it:
the symlinked test input must not be formatted.
open-java-format-native put com.palantir.gradle.utils:platform on its
buildscript classpath for two things: the <os>_<arch> part of the image
name, and whether a collected binary is a Windows .exe. The new buildSrc
plugin open-java-format.native-platform works out the first with the
same names (macos, windows, linux-glibc or linux-musl from ldd --version;
x86-64, aarch64, x86) and sets it as nativePlatform. The extension now
comes from the .exe suffix the file name pattern already matched.

The image here is still open-java-format-macos_aarch64, and six dummy
binaries passed in with -PnativeImages get the classifiers and
extensions already published on Maven Central.
The IDEA plugin declared com.palantir.gradle.utils:platform without
using it: nothing in its sources, nor in the jdk-bootstrap and SPI
modules it bundles, refers to the library. Dropping it takes four jars
out of the plugin zip: platform, exec, providers and
safe-exec-commandline.
The Gradle plugin used com.palantir.gradle.utils:platform, at run time
in the builds it is applied to, to decide whether a native image exists
for the machine and which classifier to resolve. NativePlatform now does
that itself: os.name, os.arch and, on Linux, ldd --version to tell glibc
from musl, read through Gradle's ProviderFactory as before, with the
names open-java-format-native publishes its images under and buildSrc's
open-java-format.native-platform gives the ones the build produces.

The published platforms are listed exactly: the five classifiers on
Maven Central. Before, any glibc Linux and any macOS counted, so a
32-bit x86 JVM went on to look for an image that does not exist.

NativePlatformTest pins those classifiers and extensions, the spellings
of os.arch, glibc against musl, ldd running only on Linux, and the
refusal of platforms it cannot name. One test asks Gradle for the
platform of the JVM running it, which on CI's Linux jobs runs the real
ldd. The plugin no longer depends on platform, exec, providers and
safe-exec-commandline.
The Gradle plugin applied palantir's gradle-idea-configuration for one
thing: when IntelliJ syncs the project, list the open-java-format IDEA
plugin in .idea/externalDependencies.xml, so that IntelliJ offers to
install it. UpdateExternalDependenciesXmlFile does that now, the way the
plugin already edits open-java-format.xml and workspace.xml, through
XmlUtils and ConfigureJavaFormatterXml. As before it runs only when
idea.active is set, keeps the other required plugins, and keeps a higher
min-version for this one; versions compare numerically. Its task name
differs from palantir's updateExternalDepsXml, so a build that applies
that plugin as well gets both tasks rather than a clash.

The plugin no longer creates the ideaConfiguration extension, and its
dependencies lose gradle-idea-configuration.

ConfigureJavaFormatterXmlTest covers the XML: a new file, other required
plugins, and a min-version that is missing, lower, equal or higher.
RequiredIdeaPluginTest runs a build without idea.active and one with it.
It is a class of its own because PalantirJavaFormatIdeaPluginTest needs
the native image and runs only in CI's native jobs; with
-PnativeImage=true that one passes as well.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant