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

Update AGP to 8.0.2 #15447

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Update AGP to 8.0.2 #15447

wants to merge 2 commits into from

Conversation

bekuno
Copy link
Member

@bekuno bekuno commented Mar 10, 2024

Update to the next AGP Version 8.0.x to the highest patch level.

This needs at least gradle 8.0, so switched to 8.0.2.

Further changes where done with the AS "AGP Upgrade Assistant".

  • Update default R8 processing mode The default for the R8 mode in AGP is now full mode, rather than the previous compatibility mode. If your project requires compatibility mode, it needs to be set explicitly in the gradle.properties file.

    Note: No problems seen so far on local tests.

  • Enable buildConfig build feature The default value for buildFeatures.buildConfig is changing, meaning that the Android Gradle Plugin will no longer generate BuildConfig classes by default. This processor adds a directive to preserve the previous behavior of generating BuildConfig classes for all modules; if this project does not use BuildConfig, you can remove the android.defaults.buildfeatures.buildconfig property from the project's gradle.properties file after this upgrade.

    Note: We use the automatic BuildConfig class cgeo.geocaching.BuildConfig. The assistent "Migrate BuildConfig to Gradle Build Files" reconfigures from gradle.properties to build.gradle.

  • Preserve transitive R classes R classes in this project are transitive, pulling in information from their dependencies. The default behaviour in the Android Gradle Plugin is changing; this processor inserts a property in gradle.properties to preserve the current default. You can migrate your project to non-transitive R classes now or later using the "Migrate to Non-Transitive R Classes" action under "Refactor".

    Note: No changes in c:geo using the "Migrate to Non-Transitive R Classes" beside of setting android.nonTransitiveRClass=true.
    Edit: This parameter is the default, so not set.

  • Preserve constant R class values R classes in applications and tests previously used constant values that can be inlined by the java compiler. The default behaviour in the Android Gradle plugin is changing to speed up builds and allow more precise shrinking; this processor inserts a property in gradle.properties to preserve the current default.

    Note: For switching to android.nonFinalResIds=true see https://stackoverflow.com/questions/69120822/resource-ids-will-be-non-final-by-default-in-android-gradle-plugin-version-8-0 I have not checked, if we have such constructs.
    Edit: This was already cleaned up, so we can use the default parameter value = not set.

  • Enable aidl explicitly where needed The default value for buildFeatures.aidl has changed, and some modules in this project appear to be using AIDL. Build files will be modified to explicitly enable AIDL in modules with AIDL sources.

    Note: As the assistent enables this feature, than it should be ok.

Update to the next AGP Version 8.0.x to the highest patch level.

This needs at least gradle 8.0, so switched to 8.0.2.

Further changes where done with the AS "AGP Upgrade Assistant".

- Update default R8 processing mode
  The default for the R8 mode in AGP is now full mode, rather than the previous compatibility mode. If your project requires compatibility mode, it needs to be set explicitly in the gradle.properties file.

  Note: No problems seen so far on local tests.

- Enable buildConfig build feature
  The default value for buildFeatures.buildConfig is changing, meaning that the Android Gradle Plugin will no longer generate BuildConfig classes by default.
  This processor adds a directive to preserve the previous behavior of generating BuildConfig classes for all modules; if this project does not use BuildConfig, you can remove the android.defaults.buildfeatures.buildconfig property from the project's gradle.properties file after this upgrade.

  Note: We use the automatic BuildConfig class cgeo.geocaching.BuildConfig.
        The assistent "Migrate BuildConfig to Gradle Build Files" reconfigures from gradle.properties to build.gradle.

- Preserve transitive R classes
  R classes in this project are transitive, pulling in information from their dependencies.
  The default behaviour in the Android Gradle Plugin is changing; this processor inserts a property in gradle.properties to preserve the current default.
  You can migrate your project to non-transitive R classes now or later using the "Migrate to Non-Transitive R Classes" action under "Refactor".

  Note: No changes in c:geo using the "Migrate to Non-Transitive R Classes" beside of setting android.nonTransitiveRClass=true .

- Preserve constant R class values
  R classes in applications and tests previously used constant values that can be inlined by the java compiler.
  The default behaviour in the Android Gradle plugin is changing to speed up builds and allow more precise shrinking; this processor inserts a property in gradle.properties to preserve the current default.

  Note: For switching to android.nonFinalResIds=true see https://stackoverflow.com/questions/69120822/resource-ids-will-be-non-final-by-default-in-android-gradle-plugin-version-8-0
        I have not checked, if we have such constructs.

- Enable aidl explicitly where needed
  The default value for buildFeatures.aidl has changed, and some modules in this project appear to be using AIDL.
  Build files will be modified to explicitly enable AIDL in modules with AIDL sources.

  Note: As the assistent enables this feature, than it should be ok.
@bekuno bekuno added the CI server / Build tools Issues with our CI server or other build/dev tools label Mar 10, 2024
@bekuno bekuno self-assigned this Mar 10, 2024
@eddiemuc
Copy link
Contributor

-> Note: For switching to android.nonFinalResIds=true see https://stackoverflow.com/questions/69120822/resource-ids-will-be-non-final-by-default-in-android-gradle-plugin-version-8-0 I have not checked, if we have such constructs.

I dimly remember that we changed to non-final resource IDs some time ago (removing many switch statements, heavy work done by @moving-bits ). Shouldn't we be able to turn this on?

@bekuno
Copy link
Member Author

bekuno commented Mar 11, 2024

I dimly remember that we changed to non-final resource IDs some time ago (removing many switch statements, heavy work done by @moving-bits ). Shouldn't we be able to turn this on?

You are completely right.
This was Issue #9283 3 1/2 years ago.

- Preserve transitive R classes

As the "Migrate to Non-Transitive R Classes" was ok, we can remove the parameter, as it uses the default state.

- Preserve constant R class values

As we have alredy done the migration, we can remove the now default value.
@bekuno bekuno mentioned this pull request Mar 11, 2024
@bekuno bekuno added the Do not merge / WIP Not for merging and/or work still in progress label Mar 11, 2024
@bekuno
Copy link
Member Author

bekuno commented Mar 11, 2024

DNM - this PR needs #15449 to be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI server / Build tools Issues with our CI server or other build/dev tools Do not merge / WIP Not for merging and/or work still in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants