Commit graph

12 commits

Author SHA1 Message Date
Spandan Das
68684bea79 Move manifest generation logic into static_java_library.mk
Previously a manifest file would be generated for static_java_library.mk
and package_internal.mk. For pacakge_internal.mk, this would cause
cryptic errors like b/188612215#2

With this CL, a manifest file would only be generated for java_library
with need_compile_res == true. The advantages are
1. No redundant generation for java_library with need_compile_res == false
(i.e. modules that do not require aapt2)
2. Force devs to provide manifest for android_app, and not silently
generating one for them

Bug: 188652897
Test: TH
Test: m nothing in tv-dev, car-dev

Change-Id: I69a23e373f1b4ac1569ae5b1d36067bfc0dadc05
2022-01-06 18:47:57 +00:00
Colin Cross
85f2b4a680 Don't set LOCAL_SDK_RES_VERSION to current if LOCAL_SDK_VERSION is core_current
Removing AAPT1 support removed the distinction between unset
LOCAL_USE_AAPT2 and LOCAL_USE_AAPT2 := true, which enabled the
LCOAL_SDK_RES_VERSION setting for some modules that had previously
bypassed it because of LOCAL_USE_AAPT2 := true.  The workaround
was too broad, it shouldn't apply if LOCAL_SDK_VERSION is already
set to *current.  In particular, if it is core_current to disable
using framework-res.apk completely, then LOCAL_SDK_RES_VERSION
must not be set to current.

Fixes: 130782219
Test: atest android.server.wm.PrereleaseSdkTest
Change-Id: I250d65b1ef66e591f2c9779580df4cc3f0f2b028
2019-04-18 11:14:58 -07:00
Colin Cross
e6210f6eb2 Remove AAPT1 support
AAPT2 is used everywhere now, remove support for AAPT1.  Also
removes dpi_specific_apk.mk, it was never updated to use AAPT2
and has been generating bad APKs (resource ID mismatch between
the dex files and the resources) since AAPT2 was made the default
in May 2018 (I9b67fd2a9b3234798b2aac879b5242c2097b3863).

Bug: 80450981
Test: m checkbuild
Change-Id: I2ff768897360ff866dbae5562455bab22be270f7
Merged-In: I2ff768897360ff866dbae5562455bab22be270f7
2019-04-17 16:50:30 -07:00
Colin Cross
a27f42aa5d Consolidate sdk version handling
Share the logic that converts LOCAL_SDK_VERSION, LOCAL_MIN_SDK_VERSION
and the global config values into minSdkVersion, targetSdkVersion,
and compileSdkVersion.

Test: m checkbuild
Change-Id: Id038673662b23cffc9e57978ac55a3f35ef8237a
2019-02-07 08:55:48 -08:00
Colin Cross
5b89ec4d42 Revert "Revert "Use AAPT2 by default""
This reverts commit 777cf2c450.

Reason for revert: manifest merger is used for libraries forced to aapt2 now

Bug: 79481102
Test: m checkbuild
Change-Id: I9b67fd2a9b3234798b2aac879b5242c2097b3863
2018-05-25 11:34:13 -07:00
Colin Cross
d45079a9ff Add minSdkVersion to default manifests
If the default manifest that doesn't set minSdkVersion is passed to
manifest merger along with a library manifest that does, it will fail
with:
.../DefaultManifest.xml Error:
	uses-sdk:minSdkVersion 1 cannot be smaller than version 14 declared in library ...

Translate LOCAL_MIN_SDK_VERSION or LOCAL_SDK_VERSION to minSdkVersion
in DefaultManifest.xml.

Bug: 79481102
Test: m checkbuild
Change-Id: I4d792d48612e6a1111e05a9e4a71bb4d87eae1ad
2018-05-23 16:35:40 -07:00
Colin Cross
71c5b95aa6 Support LOCAL_STATIC_JAVA_AAR_LIBRARIES with aapt2
LOCAL_STATIC_JAVA_AAR_LIBRARIES are slightly different from
LOCAL_STATIC_ANDROID_LIBRARIES, due to b/78447299 the
AndroidManifest.xml from ANDROID libraries are ignored.
Temporarily add support for LOCAL_STATIC_JAVA_AAR_LIBRARIES
when using LOCAL_USE_AAPT2 := true, treating them the same
as LOCAL_STATIC_ANDROID_LIBRARIES except that they are
merged by android_manifest.xml

Bug: 78447299
Bug: 79481102
Test: m FORCE_AAPT2=true checkbuild
Change-Id: Ia6210810c1ea6e776be97ae1c9a586b5de844125
2018-05-23 13:39:15 -07:00
Jeff Gaston
777cf2c450 Revert "Use AAPT2 by default"
This reverts commit ba7699fb9a.

Reason for revert: Broke boot tests on walleye and taimen

Bug: 80142285
Change-Id: Ida54a0b875147420e6e9c0af41b14af50f6397e3
2018-05-22 23:13:41 +00:00
Colin Cross
ba7699fb9a Use AAPT2 by default
Switch to using AAPT2 by default.  Can be disabled globally with
FORCE_AAPT2=false or per-module with LOCAL_USE_AAPT2 := false.

Bug: 79481102
Test: m checkbuild
Change-Id: I35719f708fa3bcc1d54721e62ac9cc8780f7cbbe
2018-05-22 01:21:55 +00:00
Colin Cross
282065ab15 Don't always filter out --auto-add-overlay
There are some cases where --auto-add-overlay is added for legitimite
reasons, for example in RROs.  Only filter it out from modules that
were using --extra-packages for support library modules.

Test: m FORCE_AAPT2=true java
Change-Id: I165fa577f2204ecbc57e71f946db3f346568ad81
2018-05-17 10:16:04 -07:00
Colin Cross
d443244fbf Allow modules to override FORCE_AAPT2=true with LOCAL_USE_AAPT2 := false
Bug: 79481102
Test: m java FORCE_AAPT2=true
Change-Id: Iece2158dc887a249eb51086b2497b170b5879979
2018-05-15 15:28:22 -07:00
Colin Cross
2029903b64 Allow forcing AAPT2 on
Building with FORCE_AAPT2=true will turn on AAPT2 for all modules
unless they set LOCAL_USE_AAPT2 := false.  The build system will
attempt to rewrite common AAPT patterns into AAPT2 patterns,
including removing --extra-packages for support library packages,
removing LOCAL_RESOURCE_DIR point to support library resources,
adding a default empty manifest file if it doesn't exist, and
converting LOCAL_STATIC_JAVA_AAR_LIBRARIES to
LOCAL_STATIC_ANDROID_LIBRARIES.

Bug: 79481102
Test: m checkbuild
Change-Id: I8d9d55fe4d5d5c965c64b0407efe74e0afc35c3a
2018-05-11 02:23:20 +00:00