Configure Eclipse WTP XML formatter for Android Studio-like output#128
Closed
Configure Eclipse WTP XML formatter for Android Studio-like output#128
Conversation
…cement Co-authored-by: adbenitez <24558636+adbenitez@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add Java code formatter with CI enforcement
Add google-java-format via Spotless with CI enforcement
Mar 9, 2026
…udio default Co-authored-by: adbenitez <24558636+adbenitez@users.noreply.github.com>
Copilot
AI
changed the title
Add google-java-format via Spotless with CI enforcement
Switch Java formatter from AOSP (4-space) to Google style (2-space) to match Android Studio
Mar 10, 2026
…e resolved Co-authored-by: adbenitez <24558636+adbenitez@users.noreply.github.com>
Copilot
AI
changed the title
Switch Java formatter from AOSP (4-space) to Google style (2-space) to match Android Studio
Fix Spotless plugin resolution by adding Gradle Plugin Portal to pluginManagement
Mar 10, 2026
Co-authored-by: adbenitez <24558636+adbenitez@users.noreply.github.com>
Copilot
AI
changed the title
Fix Spotless plugin resolution by adding Gradle Plugin Portal to pluginManagement
Add XML auto-formatting to Spotless and fix plugin resolution
Mar 10, 2026
Copilot stopped work on behalf of
adbenitez due to an error
March 11, 2026 13:43
|
To test the changes in this pull request, install this apk: |
- Add spotless/eclipse-wtp-xml.prefs with Eclipse WTP XML formatter config: - splitMultiAttrs=true: each attribute on its own line - indentMultipleAttributes=true: proper indentation of split attributes - indentationChar=space: use spaces instead of tabs - indentationSize=4: 4-space indentation (Android Studio default) - lineWidth=160: prevent unnecessary line wrapping - Update build.gradle to use the new config file - Apply the new formatter to all 378 XML files in the project Co-authored-by: adbenitez <24558636+adbenitez@users.noreply.github.com>
Copilot
AI
changed the title
Add XML auto-formatting to Spotless and fix plugin resolution
Configure Eclipse WTP XML formatter for Android Studio-like output
Mar 11, 2026
Copilot stopped work on behalf of
adbenitez due to an error
March 11, 2026 14:52
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The default Eclipse WTP XML formatter was packing multiple short attributes onto the same line (72-char line width), using tabs for indentation, and splitting or combining attributes arbitrarily — producing inconsistent output that diverged from Android Studio's format.
Changes
spotless/eclipse-wtp-xml.prefs— new Eclipse WTP formatter config:splitMultiAttrs=true: one attribute per lineindentationChar=space+indentationSize=4: 4-space indent (matches Android Studio XML default)lineWidth=160: prevents overly eager line wrappingbuild.gradle— wire config file into theeclipseWtp('xml')stepResult
The formatter is idempotent — re-running
spotlessApplyon already-formatted files produces no changes.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
dl.google.com/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED -Xmx4608m -Dfile.encoding=UTF-8(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Add Java Code Formatter with CI Enforcement
This repository has no automated Java code formatter. We want to add one so that:
main.What to implement
1.
build.gradle— Add the Spotless pluginAdd the Spotless Gradle plugin configured to use google-java-format on all
*.javasource files. The plugin block already has:plugins { id 'com.android.application' version '8.11.1' id 'com.google.gms.google-services' version '4.4.1' }Add Spotless to it:
Then add a
spotlessconfiguration block (outsideandroid {}) inbuild.gradle:spotless { java { target 'src/**/*.java' googleJavaFormat('1.19.2').aosp() // AOSP style = 4-space indent, fits Android codebases removeUnusedImports() trimTrailingWhitespace() endWithNewline() } }2.
gradle.properties— JVM args for google-java-formatgoogle-java-format requires extra JVM
--add-exportsflags when running on JDK 16+ (CI uses JDK 17). Check ifgradle.propertiesalready hasorg.gradle.jvmargs. If it does, append the required flags; if it doesn't, add a new line:3.
.github/workflows/check-format.yml— New lightweight CI workflowCreate a new workflow file that runs
spotlessCheckon every PR and on pushes tomain. It should not compile the native Rust/NDK code (no need for ndk or rust setup) — just check formatting. Use the same Java version (17, temurin) and Gradle caching pattern as the existingpreview-apk.ymlworkflow:4.
scripts/format.sh— Developer helper scriptCreate a small helper script so contributors can format everything locally in one command:
Make it executable (chmod +x).
5.
CONTRIBUTING.md— Document the formatterIn the Coding Conventions section (around line 76), add a note after the existing style guidance explaining:
scripts/format.shor./gradlew spotlessApply.Notes
preview-apk.yml) usesactions/checkout@v5,actions/setup-java@v5,actions/cache@v4— use the same versions for consistency.spotlessChecktask should be a fast, standalone check with no native compilation required..aosp()) uses 4-space indentation which is consistent with Android coding conventions and the existing code style seen in the repository.The following is the prior conversation context from the user's chat exploration (may be truncated):
User: I want to have some code formatter so code can be formatted automatically and code format checked in CI
Assistant: I now have a good picture of the repo. Let me create the PR with a well-tailored setup for Java code formatting.
Assistant: We're waiting for your response to the tool call dialog to continue with creating the pull request.
In the meantime, here's a summary of the plan for adding automated Java formatting to
deltachat/deltachat-android:Plan: Java Code Formatting with google-java-format
The repo is primarily Java (62.8%) with no existing formatter. Here's what will be set up:
1.
build.gradle— Spotless pluginThe Spotless Gradle plugin will be added, configured to use **goo...
This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.