firebase-android-sdk icon indicating copy to clipboard operation
firebase-android-sdk copied to clipboard

replace sherter plugin with spotless

Open thatfiredev opened this issue 1 year ago • 16 comments

Opening the project with Android Studio Flamingo (Java 17) shows the following error:

Execution failed for task ':buildSrc:verifyGoogleJavaFormat'.
> Problems: syntax errors

It seems to be due to the fact that the sherter plugin has issues with Java 17: https://github.com/sherter/google-java-format-gradle-plugin/issues/72

Also, sherter is no longer maintained: https://github.com/sherter/google-java-format-gradle-plugin/issues/57#issuecomment-782886280

This PR migrates away from sherter to spotless

List of changes:

  • Update the GH Actions workflows to use JDK 17
  • Replace the sherter plugin with the spotless plugin - now being used to format both Java (google-java-format) and Kotlin (ktfmt with googleStyle)
  • Update the README with new formatting instructions
  • Run ./gradlew :spotlessApply to fix formatting

thatfiredev avatar Apr 13 '23 00:04 thatfiredev

Release note changes

No release note changes were detected. If you made changes that should be present in the next release, ensure you've added an entry in the appropriate CHANGELOG.md file(s).

github-actions[bot] avatar Apr 13 '23 00:04 github-actions[bot]

1 Warning
:warning: Did you forget to add a changelog entry? (Add the 'no-changelog' label to the PR to silence this warning.)

Generated by :no_entry_sign: Danger

google-oss-bot avatar Apr 13 '23 00:04 google-oss-bot

buildSrc Test Results

33 tests   33 :heavy_check_mark:  1m 12s :stopwatch:   7 suites    0 :zzz:   7 files      0 :x:

Results for commit e1d93965.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Apr 13 '23 00:04 github-actions[bot]

Unit Test Results

0 files   - 2  0 suites   - 2   0s :stopwatch: -19s 0 tests  - 1  0 :heavy_check_mark:  - 1  0 :zzz: ±0  0 :x: ±0  0 runs   - 2  0 :heavy_check_mark:  - 2  0 :zzz: ±0  0 :x: ±0 

Results for commit e1d93965. ± Comparison against base commit da631d23.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Apr 13 '23 01:04 github-actions[bot]

Size Report 1

Affected Products

No changes between base commit (7375cab) and merge commit (c01d22c).

Test Logs

google-oss-bot avatar Apr 13 '23 01:04 google-oss-bot

Coverage Report 1

Affected Products

No changes between base commit (da631d2) and merge commit (7c38e0e).

Test Logs

google-oss-bot avatar Apr 13 '23 01:04 google-oss-bot

Startup Time Report 1

The report is too large (117,075 chars) to be displayed on GitHub. Please check this report on GCS.

google-oss-bot avatar Apr 13 '23 01:04 google-oss-bot

Never heard of spotless, looks nice! Seems like spotless also supports kotlin, could it be used across for both languages so we don't need to remember 2 different commands as we do now?

rlazo avatar Apr 14 '23 14:04 rlazo

@rlazo Great idea! I'll update the PR

thatfiredev avatar Apr 14 '23 14:04 thatfiredev

@rlazo I have made the changes but CI is failing with an error from crashlytics-ndk:

Cannot create variant 'android-aidl' after dependency configuration ':firebase-crashlytics-ndk:debugApiElements' has been resolved

Some solutions online suggest upgrading to the latest AGP. 😅 I feel like that's going to be an even bigger change, I see it's already being done in #4754 How should we proceed here?

thatfiredev avatar Apr 25 '23 16:04 thatfiredev

Yeah, updating to the latest AGP and gradle is going to take time. That PR you linked was an early exploration, and it's very outdated at this point.

So, as it stands, we would need to upgrade everything together (gradle, agp, and spotless)?

rlazo avatar Apr 25 '23 21:04 rlazo

That's what it seems like.

But I noticed that the first commit in this PR (a484b0ec22d87147b80575bf57e30ab0080bf8fe) built successfully (except for some failures from flaky tests), I will try to isolate that commit in a separate PR. Hopefully it will fix the Android Studio build errors for product teams before we upgrade to AGP 8.

thatfiredev avatar Apr 26 '23 10:04 thatfiredev

we've made several improvements in the code since we last explored this idea. Could you give it another try @thatfiredev ?

rlazo avatar Aug 10 '23 15:08 rlazo

Hello, thanks for working on this. This is currently a blocker for external contributions to the Firebase Android SDK because the default JDK of Android Studio is now 17, so the Gradle sync process fails with the mentioned error.

svenjacobs avatar Oct 17 '23 09:10 svenjacobs

@svenjacobs Thanks for the nudge, I totally forgot about this PR. Let me try to get it into a mergeable state.

thatfiredev avatar Oct 24 '23 14:10 thatfiredev

Is this pr not planning to merge yet? This problem has plagued my team

imaiya avatar Dec 08 '23 08:12 imaiya