Commit graph

17 commits

Author SHA1 Message Date
Colin Cross
5bcb2fc9a9 Move manifest merger config to Soong
Bug: 110848854
Test: m checkbuild
Change-Id: Id9a8b4c02ade275eefc32bf72710430e889cd554
Merged-In: Id9a8b4c02ade275eefc32bf72710430e889cd554
Merged-In: Ib20aa4849978283f1da1ce601b28199fc0183e05
2018-07-11 09:43:04 -07:00
Colin Cross
375d9618f6 Merge "Merge LOCAL_STATIC_ANDROID_LIBRARIES manifests" 2018-06-20 23:24:52 +00:00
Jiyong Park
1cf8ee619b Export SDK library names
A java module exports SDK library names that it is using directly or
indirectly via its dependencies. Manifest fixer uses the SDK lib names
to automatically add <uses-library> tags for the apk.

The SDK library names are exported via exported-sdk-libs file in make.
From Soong, they are exported via LOCAL_EXPORT_SDK_LIBRARIES flag.

Bug: 77575606
Test: m -j

Change-Id: I4e7a9bdc5bf845af85168abf55f8063900bacc72
2018-06-20 11:50:06 +09:00
Colin Cross
2d61e47f88 Revert "Revert "Inject minSdkVersion from the build system""
This reverts commit 4cd1a75d17.

PackageParser no longer treats minSdkVersion=Q as targetSdkVersion=Q
when targetSdkVersion is set to a number.

Bug: 110167203
Bug: 110353795
Change-Id: Ib44743e4c49e59cd29a57af1bf885090e380b1b6
2018-06-18 20:18:37 +00:00
Colin Cross
4cd1a75d17 Revert "Inject minSdkVersion from the build system"
This reverts commit fae93680fa.

Bug: 110167203
Bug: 110353795
Change-Id: I14c71aec5a54ef055fc8d2b3560754c81f3d68ba
2018-06-18 18:35:00 +00:00
Colin Cross
16f1dbc43c Merge LOCAL_STATIC_ANDROID_LIBRARIES manifests
Pass LOCAL_STATIC_ANDROID_LIBRARIES to ManifestMerger, and copy
manifests for prebuilts AARs and static android libraries to
$(intermediates.COMMON)/manifest/AndroidManifest.xml.

Bug: 78447299
Test: m java
Change-Id: I02ac29d3445fcd591101ff0ce215e60dd0997224
Merged-In: I02ac29d3445fcd591101ff0ce215e60dd0997224
Merged-In: Ib20aa4849978283f1da1ce601b28199fc0183e05
2018-06-16 07:55:41 -07:00
Colin Cross
fae93680fa Inject minSdkVersion from the build system
Add a script that can inject a <uses-sdk minSdkVersion=""> into
AndroidManifest.xml files.  This will help with merging
LOCAL_STATIC_ANDROID_LIBRARIES, because ManifestMerger treats
a missing minSdkVersion as minSdkVersion=1 and throws errors
if libraries use a larger minSdkVersion.  It will also help
with cases where an app has a manifest that specifies an old
minSdkVersion, but the build system is compiling the app in
a way that is not compatibile with old devices, for example
using a newer dex format.

Bug: 110167203
Test: m java
Change-Id: Ia60d462e8af9e93c57d75f423207fa8d221b1347
2018-06-14 14:38:54 -07:00
Colin Cross
1d46e8abb4 Add LOCAL_DONT_MERGE_MANIFESTS
Some modules have manifests that ManifestMerger doesn't like, and
don't need manifest merging.  Skip manifest merger if
LOCAL_DONT_MERGE_MANIFESTS is set.

Bug: 78447299
Test: m checkbuild
Change-Id: If1a58253c62e0194a6acfd79930b9bb10978abe5
2018-06-14 14:38:54 -07:00
Colin Cross
e1b4f302e5 Move merged AndroidManifest.xml file to manifest subdirectory
Some modules generate their own custom AndroidManifest.xml file
to $(intermediates.COMMON)/AndroidManifest.xml file.  Move the
build system's location to
$(intermediates.COMMON)/manifest/AndroidManifest.xml.

This location will also be used later for finding manifest files
from LOCAL_STATIC_ANDROID_LIBRARIES dependencies.

Bug: 78447299
Test: m checkbuild
Change-Id: I345f079bdd191451333b38d882418f2f7150b1e9
Merged-In: I345f079bdd191451333b38d882418f2f7150b1e9
(cherry picked from commit 00a6348e7dfa4fafc308ab92d8e7d06dcfcd01ba)
2018-06-14 14:38:54 -07:00
Colin Cross
5c1a27f30f Use implicit output for prebuilt aar manifests
Remove my_full_libs_manifest_deps by making AndroidManifest.xml an
implicit output of the prebuilt aar unzipping rule.

Bug: 78447299
Test: m checkbuild
Change-Id: I26934d16fd646d45bf57c9527dbb191112cb627b
Merged-In: I26934d16fd646d45bf57c9527dbb191112cb627b
(cherry picked from commit 2b5829e1a6)
2018-06-13 12:34:51 -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
Colin Cross
710a41358a Upgrade to ManifestMerger2
Switch to using ManifestMerger2 from
prebuilts/gradle-plugin/com/android/tools/build/manifest-merger/26.0.0-beta2/manifest-merger-26.0.0-beta2.jar

Bug: 36005379
Test: m -j checkbuild
Change-Id: I83bd3f95778e93796d06f063aa7c61d2a63b117b
Merged-In: I83bd3f95778e93796d06f063aa7c61d2a63b117b
(cherry picked from commit e76e8021eb)
2017-09-18 21:03:23 +00:00
Ying Wang
e295c3df68 AAPT2: library resource compilation
- Switch to static library's package-res.apk as the link artifact.
- For prebuilt AAR file, build package-res.apk using aapt2's "--dir"
  option.
- New LOCAL variables:
  LOCAL_USE_AAPT2: a module can opt-in with "LOCAL_USE_AAPT2 := true".
  LOCAL_STATIC_ANDROID_LIBRARIES: static Java libraries with compiled
                   resources.
  LOCAL_SHARED_ANDROID_LIBRARIES: shared Java libraries with compiled
                   resources.

Bug: 25958912
Change-Id: I4be2d1e8137555986338c2583cb39b0c97391751
2016-02-26 10:44:56 -08:00
Ying Wang
dd71c85a45 Support to build with AAPT2
To build with AAPT2, set "USE_AAPT2=true".
TODO: Support split apks and generated resources from other than renderscript.

Bug: 25958912
Change-Id: I19b1a038824ce5b2a3d3ffadbce3173c845193fc
2016-01-25 22:41:43 -08:00
Ying Wang
12f4497565 Strip LOCAL_STATIC_JAVA_AAR_LIBRARIES
Change-Id: I0a0c4fe0cdd9c162976ef5f4c4709d400fde2d5a
2015-05-27 15:14:28 -07:00
Ying Wang
2902d4585f Add support for prebuilt AARs.
- You can give a .aar as source file to a prebuilt static Java library
  module. The build system will set up dependencies and rules to extract
  classes.jar and other resource files.
- To build against a prebuilt AAR module, use:
  LOCAL_STATIC_JAVA_AAR_LIBRARIES := <module names of aar prebuilt AARs>
  The build system will set up rules to merge the library's
  AndroidManifest.xml with the main AndroidManifest.xml, add the AAR's
  resource dirs and link/merge the AAR's classes.jar.

Bug: 18168693
Change-Id: Ic2c1d20572a93bd98dbc72f8a39e26b459e442c2
(cherry picked from commit e9dd9f2bfc)
2014-12-17 22:27:26 +00:00
Ying Wang
dc7fee9fbf Set up rules to merge AndroidManifest.xmls
Now you can merge the library manifest files to the main app's
AndroidManifest.xml with LOCAL_FULL_LIBS_MANIFEST_FILES.
LOCAL_FULL_LIBS_MANIFEST_FILES is a list of paths relative to the top of
the source tree.

Bug: 12907528
Change-Id: I16a347c83dfb6fbbb7d5d40284b7c65aa682fdd2
2014-02-05 18:24:45 -08:00