style(spotless): centralize and expand formatting config in root build.gradle (#4098)

# Description of Changes

- Removed redundant `spotless` configurations from `app/common`,
`app/core`, and `app/proprietary` modules.
- Consolidated all formatting logic into the root `build.gradle` file.
- Extended Spotless support to include:
  - YAML files (`*.yml`, `*.yaml`)
  - Gradle scripts (`*.gradle`, including nested `app/**/*.gradle`)
- Updated `googleJavaFormatVersion` from `1.27.0` to `1.28.0`.

This change improves maintainability by enforcing consistent formatting
across all modules from a single location. Additionally, it ensures
formatting is applied to Gradle and YAML files, which were previously
unformatted.

---

## Checklist

### General

- [x] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [x] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md)
(if applicable)
- [x] I have performed a self-review of my own code
- [x] My changes generate no new warnings

### Documentation

- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)

### UI Changes (if applicable)

- [ ] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)

### Testing (if applicable)

- [ ] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing)
for more details.
This commit is contained in:
Ludy 2025-08-03 00:14:03 +02:00 committed by GitHub
parent 77a27930b5
commit 9e0f6dd2e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 52 additions and 25 deletions

View File

@ -4,8 +4,7 @@ bootRun {
}
spotless {
java {
target sourceSets.main.allJava
target sourceSets.test.allJava
target 'src/**/java/**/*.java'
googleJavaFormat(googleJavaFormatVersion).aosp().reorderImports(false)
importOrder("java", "javax", "org", "com", "net", "io", "jakarta", "lombok", "me", "stirling")
@ -14,6 +13,18 @@ spotless {
leadingTabsToSpaces()
endWithNewline()
}
yaml {
target '**/*.yml', '**/*.yaml'
trimTrailingWhitespace()
leadingTabsToSpaces()
endWithNewline()
}
format 'gradle', {
target '**/gradle/*.gradle', '**/*.gradle'
trimTrailingWhitespace()
leadingTabsToSpaces()
endWithNewline()
}
}
dependencies {
api 'org.springframework.boot:spring-boot-starter-web'

View File

@ -14,8 +14,7 @@ configurations {
spotless {
java {
target sourceSets.main.allJava
target sourceSets.test.allJava
target 'src/**/java/**/*.java'
googleJavaFormat(googleJavaFormatVersion).aosp().reorderImports(false)
importOrder("java", "javax", "org", "com", "net", "io", "jakarta", "lombok", "me", "stirling")
@ -24,6 +23,18 @@ spotless {
leadingTabsToSpaces()
endWithNewline()
}
yaml {
target '**/*.yml', '**/*.yaml'
trimTrailingWhitespace()
leadingTabsToSpaces()
endWithNewline()
}
format 'gradle', {
target '**/gradle/*.gradle', '**/*.gradle'
trimTrailingWhitespace()
leadingTabsToSpaces()
endWithNewline()
}
}
dependencies {

View File

@ -5,9 +5,8 @@ bootRun {
enabled = false
}
spotless {
java {
target sourceSets.main.allJava
target sourceSets.test.allJava
java {
target 'src/**/java/**/*.java'
googleJavaFormat(googleJavaFormatVersion).aosp().reorderImports(false)
importOrder("java", "javax", "org", "com", "net", "io", "jakarta", "lombok", "me", "stirling")
@ -16,6 +15,18 @@ spotless {
leadingTabsToSpaces()
endWithNewline()
}
yaml {
target '**/*.yml', '**/*.yaml'
trimTrailingWhitespace()
leadingTabsToSpaces()
endWithNewline()
}
format 'gradle', {
target '**/gradle/*.gradle', '**/*.gradle'
trimTrailingWhitespace()
leadingTabsToSpaces()
endWithNewline()
}
}
dependencies {
implementation project(':common')

View File

@ -29,7 +29,7 @@ ext {
springSecuritySamlVersion = "6.5.2"
openSamlVersion = "4.3.2"
commonmarkVersion = "0.25.0"
googleJavaFormatVersion = "1.27.0"
googleJavaFormatVersion = "1.28.0"
tempJrePath = null
}
@ -158,9 +158,9 @@ subprojects {
useJUnitPlatform()
}
tasks.named("processResources") {
dependsOn(rootProject.tasks.writeVersion)
}
tasks.named("processResources") {
dependsOn(rootProject.tasks.writeVersion)
}
if (name == 'stirling-pdf') {
apply plugin: 'org.springdoc.openapi-gradle-plugin'
@ -528,20 +528,14 @@ launch4j {
}
spotless {
java {
target sourceSets.main.allJava
target sourceSets.test.allJava
target project(':common').sourceSets.main.allJava
target project(':common').sourceSets.test.allJava
target project(':proprietary').sourceSets.main.allJava
target project(':proprietary').sourceSets.test.allJava
target project(':stirling-pdf').sourceSets.main.allJava
target project(':stirling-pdf').sourceSets.test.allJava
googleJavaFormat(googleJavaFormatVersion).aosp().reorderImports(false)
importOrder("java", "javax", "org", "com", "net", "io", "jakarta", "lombok", "me", "stirling")
toggleOffOn()
yaml {
target '*.yml', '*.yaml'
trimTrailingWhitespace()
leadingTabsToSpaces()
endWithNewline()
}
format 'gradle', {
target 'build.gradle', 'settings.gradle', 'gradle/*.gradle', 'gradle/**/*.gradle'
trimTrailingWhitespace()
leadingTabsToSpaces()
endWithNewline()