Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade AGP and Dependencies #2064

Merged
merged 1 commit into from
Jul 17, 2023
Merged

Upgrade AGP and Dependencies #2064

merged 1 commit into from
Jul 17, 2023

Conversation

omarismail94
Copy link
Contributor

@omarismail94 omarismail94 commented Jul 5, 2023

IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).

Fixes #2072

Description
Upgrade Android Gradle Plugin from 7.1.1 to 8.1.0 to allow us to update our other dependencies, that rely on having a newer AGP. For example, for the new work manager library to work, it needs to compile on SDK level 33, which the AGP 7.1.1 has not been tested on.

Additionally, we were setting the source compilation to Java 8, but in the AGP that we had, it did not respect that and compiled the source files to whatever the Java version Gradle ran on (usually the default installed on the machine). Our code can't compile to Java 8 as the version of the HAPI FHIR libraries stopped supporting Java 8.

With AGP 8, we have had to make a few changes. First we enforce the usage of Java 11 for compilation. If Java 11 does not exist on the machine, Gradle automatically downloads it. We still support backwards compatibility via desugaring. WIth AGP 8, we are required to have the namespace field in the module-level build script, and not in the AndroidManifest.xml file. This means we can delete a bunch of XML files from our codebase.

Finally, in JaCoCo we disable the need to transform the files for dexing when running instrumentation tests. In each version of AGP after 7.1.1, the API to transform files changed, breaking our instrumentation. However. we do not use JaCoCo for instrumentation when running our CI tool, instead, we use Firebase. Locally, we also do not need JaCoCo to run its transformation when running tests.

Please set the JDK version Gradle uses to Java 17
image

Alternative(s) considered
Have you considered any alternatives? And if so, why have you chosen the approach in this PR?

Type
Choose one: (Bug fix | Feature | Documentation | Testing | Code health | Builds | Releases | Other)

Screenshots (if applicable)

Checklist

  • I have read and acknowledged the Code of conduct.
  • I have read the Contributing page.
  • I have signed the Google Individual CLA, or I am covered by my company's Corporate CLA.
  • I have discussed my proposed solution with code owners in the linked issue(s) and we have agreed upon the general approach.
  • I have run ./gradlew spotlessApply and ./gradlew spotlessCheck to check my code follows the style guide of this project.
  • I have run ./gradlew check and ./gradlew connectedCheck to test my changes locally.
  • I have built and run the demo app(s) to verify my change fixes the issue and/or does not break the demo app(s).

@omarismail94 omarismail94 changed the title increase versions Upgrade AGP and Dependencies Jul 13, 2023
@omarismail94 omarismail94 marked this pull request as ready for review July 17, 2023 17:08
@omarismail94 omarismail94 requested review from a team and santosh-pingle as code owners July 17, 2023 17:08
Copy link
Collaborator

@jingtang10 jingtang10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Omar!

buildSrc/build.gradle.kts Show resolved Hide resolved
see if flag fixes things

cC does not work due to class too large

latest and greatest

add java 17

bloody spotless

fix clashing datacapture

bump dependencies

bump github actions java
@omarismail94 omarismail94 merged commit 3d41fed into google:master Jul 17, 2023
@omarismail94 omarismail94 deleted the syncster branch July 17, 2023 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Complete
Development

Successfully merging this pull request may close these issues.

Enforce usage of Java 11 when compiling
3 participants