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

incompatible_use_aapt2_by_default: Enable Bazel to use aapt2 by default #6907

Closed
jin opened this issue Dec 13, 2018 · 10 comments
Closed

incompatible_use_aapt2_by_default: Enable Bazel to use aapt2 by default #6907

jin opened this issue Dec 13, 2018 · 10 comments
Assignees
Labels
incompatible-change Incompatible/breaking change P1 I'll work on this now. (Assignee required) team-Android Issues for Android team

Comments

@jin
Copy link
Member

jin commented Dec 13, 2018

Tracking issue for the incompatible change to switch Bazel to use aapt2 by default.

FR issue: #4103

To switch between aapt versions, Bazel uses the following in order of precedence:

  1. Value of --android_aapt flag.
  2. Value of aapt_version attribute in the android_binary and android_local_test target.
  3. --incompatible_use_aapt2_by_default: false -> aapt, true -> aapt2.

To resolve issues when migrating your app to build with aapt2, see https://developer.android.com/studio/command-line/aapt2#aapt2_changes

@jin jin added the incompatible-change Incompatible/breaking change label Dec 13, 2018
@jin jin self-assigned this Dec 13, 2018
@jin jin added the team-Android Issues for Android team label Dec 13, 2018
bazel-io pushed a commit that referenced this issue Dec 14, 2018
… for enabling aapt2 by default in Bazel.

FR Ref: #4103
IC Ref: #6907

RELNOTES: New incompatible change flag for defaulting to aapt2 in Android builds: `--incompatible_use_aapt2_by_default`. To build with aapt2 today, pass the flag `--incompatible_use_aapt2_by_default=true` or `--android_aapt=aapt2`, or set the `aapt_version`  to `aapt2` on your `android_binary` or `android_local_test` target.
PiperOrigin-RevId: 225593174
@jin
Copy link
Member Author

jin commented Dec 14, 2018

The flag is now in master.

@jin
Copy link
Member Author

jin commented Dec 17, 2018

The incompatible change flag is expected to enter Bazel 0.22.

@dslomov dslomov changed the title --incompatible_use_aapt2_by_default: Enable Bazel to use aapt2 by default incompatible_use_aapt2_by_default: Enable Bazel to use aapt2 by default Jan 11, 2019
@dslomov
Copy link
Contributor

dslomov commented Jan 11, 2019

when are you planning to flip the flag?

@jin
Copy link
Member Author

jin commented Jan 11, 2019

@dslomov 0.23.

@jin
Copy link
Member Author

jin commented Feb 1, 2019

Updated plan to flip the flag in 0.24. We are delaying this by one release because of a pending bug fix in 0.23 for android_local_test targets to correctly recognize the aapt version selection.

@jin
Copy link
Member Author

jin commented Feb 15, 2019

Discovered an issue where building an android_library with --android_aapt=aapt2 causes Bazel to still register an resource validation action that uses aapt.

@jin jin added the P1 I'll work on this now. (Assignee required) label Feb 19, 2019
@katre
Copy link
Member

katre commented Mar 1, 2019

This issue was tagged as "breaking-change-0.24" but does not appear ready to be flipped in the 0.24.0 release. If this is incorrect please comment on that issue and discuss with me.

@jin
Copy link
Member Author

jin commented Mar 1, 2019

@katre Thanks for updating, and yes, it's still blocked on an internal change.

@dkelmer
Copy link
Contributor

dkelmer commented Apr 3, 2019

Seems like the flag still wasn't flipped for 0.25. Changing to 0.26

@jin
Copy link
Member Author

jin commented Jun 19, 2019

This flag is scheduled to be flipped on August 1st / after the baseline for Bazel 0.29, the end of the current stability window.

bazel-io pushed a commit that referenced this issue Jun 20, 2019
… depend on it at analysis time.

Now, the incompatible change flag is in effect for the parts of the Android rules which select the version based on the --android_aapt config value.

If the version is still `auto` after resolution of the --android_aapt flag and aapt_version attribute, default to aapt.

#6907

RELNOTES: None.
PiperOrigin-RevId: 254259050
siberex pushed a commit to siberex/bazel that referenced this issue Jul 4, 2019
… depend on it at analysis time.

Now, the incompatible change flag is in effect for the parts of the Android rules which select the version based on the --android_aapt config value.

If the version is still `auto` after resolution of the --android_aapt flag and aapt_version attribute, default to aapt.

bazelbuild#6907

RELNOTES: None.
PiperOrigin-RevId: 254259050
irengrig pushed a commit to irengrig/bazel that referenced this issue Jul 15, 2019
… depend on it at analysis time.

Now, the incompatible change flag is in effect for the parts of the Android rules which select the version based on the --android_aapt config value.

If the version is still `auto` after resolution of the --android_aapt flag and aapt_version attribute, default to aapt.

bazelbuild#6907

RELNOTES: None.
PiperOrigin-RevId: 254259050
bazel-io pushed a commit that referenced this issue Aug 7, 2019
*** Reason for rollback ***

Broke Android build on Windows
#9102

*** Original change description ***

Default Bazel to use aapt2 and fix native tests to use aapt2.

This CL sets --incompatible_use_aapt2_by_default=true and --android_aapt=aapt2. It also adds aapt2 to the mock SDK for Android analysis and integration tests.

For the tests that assume and depend on AAPT, we explicitly pin them to use AAPT.

Fixes #6907
Fixes #4103

RELNOTES: Bazel Android builds now use aapt2 by default. To revert to aapt, set `--an...

***

ROLLBACK_OF=261424350

RELNOTES: None
PiperOrigin-RevId: 262099198
luca-digrazia pushed a commit to luca-digrazia/DatasetCommitsDiffSearch that referenced this issue Sep 4, 2022
…t depend on it at analysis time.

    Now, the incompatible change flag is in effect for the parts of the Android rules which select the version based on the --android_aapt config value.

    If the version is still `auto` after resolution of the --android_aapt flag and aapt_version attribute, default to aapt.

    bazelbuild/bazel#6907

    RELNOTES: None.
    PiperOrigin-RevId: 254259050
luca-digrazia pushed a commit to luca-digrazia/DatasetCommitsDiffSearch that referenced this issue Sep 4, 2022
…g for enabling aapt2 by default in Bazel.

    FR Ref: bazelbuild/bazel#4103
    IC Ref: bazelbuild/bazel#6907

    RELNOTES: New incompatible change flag for defaulting to aapt2 in Android builds: `--incompatible_use_aapt2_by_default`. To build with aapt2 today, pass the flag `--incompatible_use_aapt2_by_default=true` or `--android_aapt=aapt2`, or set the `aapt_version`  to `aapt2` on your `android_binary` or `android_local_test` target.
    PiperOrigin-RevId: 225593174
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
incompatible-change Incompatible/breaking change P1 I'll work on this now. (Assignee required) team-Android Issues for Android team
Projects
None yet
Development

No branches or pull requests

6 participants