Skip to content

Commit 6537d54

Browse files
committed
Enable spotless on all modules
The `./gradlew spotlessApply` command was failing in the `:watchfacepush:validator` and `:identity:credentialmanager` modules due to incorrect path calculations during the format and apply steps. This was caused by ambiguous source directory configurations in their `build.gradle.kts` files, which led to errors like `NoSuchFileException` and `FileAlreadyExistsException`. This commit resolves these issues by explicitly defining the `sourceSets` in the build scripts for the affected modules. This removes the ambiguity and ensures that Gradle and the Spotless plugin can reliably locate the source files. As a result of this fix, the `apply_spotless.yml` GitHub workflow has been simplified to run a single, project-wide `spotlessApply` command. The `.gitignore` has also been updated to correctly ignore all `build` directories.
1 parent d1b418e commit 6537d54

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

.github/workflows/apply_spotless.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,7 @@ jobs:
4242
java-version: '17'
4343

4444
- name: Run spotlessApply
45-
run: ./gradlew :compose:spotlessApply --init-script gradle/init.gradle.kts --no-configuration-cache --stacktrace
46-
47-
- name: Run spotlessApply for Wear
48-
run: ./gradlew :wear:spotlessApply --init-script gradle/init.gradle.kts --no-configuration-cache --stacktrace
49-
50-
- name: Run spotlessApply for Misc
51-
run: ./gradlew :misc:spotlessApply --init-script gradle/init.gradle.kts --no-configuration-cache --stacktrace
52-
53-
- name: Run spotlessApply for XR
54-
run: ./gradlew :xr:spotlessApply --init-script gradle/init.gradle.kts --no-configuration-cache --stacktrace
45+
run: ./gradlew spotlessApply --init-script gradle/init.gradle.kts --no-configuration-cache --stacktrace
5546

5647
- name: Auto-commit if spotlessApply has changes
5748
uses: stefanzweifel/git-auto-commit-action@v5

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/.idea/modules.xml
77
/.idea/workspace.xml
88
.DS_Store
9-
/build
9+
build
1010
/captures
1111
.externalNativeBuild
1212
.idea/*

identity/credentialmanager/build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ android {
3939
buildFeatures {
4040
compose = true
4141
}
42+
sourceSets {
43+
named("main") {
44+
java {
45+
srcDir("src/main/java")
46+
}
47+
}
48+
}
4249
}
4350

4451
dependencies {

watchfacepush/validator/build.gradle.kts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ application {
2626
mainClass.set("com.example.validator.Main")
2727
}
2828

29+
sourceSets {
30+
named("main") {
31+
java {
32+
srcDir("src/main/java")
33+
}
34+
}
35+
}
36+
2937
dependencies {
3038
implementation(libs.validator.push)
3139
}

0 commit comments

Comments
 (0)