Commit graph

201 commits

Author SHA1 Message Date
Ulya Trafimovich
21a7375205 Allow non-SDK Java libraries to masquerade as <uses-library>.
Extend usesLibraryProperties with a boolean is_uses_lib property and
move these properties from java.AndroidApp to java.Module to allow
java.Library modules set the new propery and be recognized as
<uses-library> by Soong.

Bug: 132357300
Test: lunch cf_x86_phone-userdebug && m
Change-Id: I01cd5e0da3dd543c1c0597249d37d0914b213ca7
2020-09-01 17:45:39 +01:00
Ulya Trafimovich
fc24ad3d4e Propagate transitive SDK Java library dependencies to dexpreopt.
For some dependencies, like stubs, the SDK library may not be found at
build time (either because the implementation library is not among the
dependencies of the dexpreopted module, or because it's part of a
prebuilt, or because it's missing from the build altogether). In such
cases dexpreopt is useless, because dex2oat does not have access to the
full classpath (unless the &-classpath is used). Therefore do not
dexpreopt in such cases.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: If289088cfd103011ccb16165e95a97b30fd31b81
2020-08-27 11:47:15 +01:00
Ulya Trafimovich
4b6d4c12cc Propagate transitive <uses-library> dependencies through static libraries.
Bug: 163037089
Test: lunch aosp_cf_x86-userdebug && m nothing
Test: added testcase in Soong
Change-Id: I943d497d779ca218a16e7208029189a1a69086c1
2020-08-20 12:34:42 +01:00
Ulya Trafimovich
31e444e101 Collect paths to transitive SDK Java library dependencies.
Previously only the names were collected, and later used in the
manifest_fixer to add missing <uses-library> entries to the manifest.
Now we also need to collect build-time and on-device paths, to be used
in class loader context for dexpreopt. This commit only collects paths,
but does not pass them to dexpreopt yet.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: I34b229ee68f16ba215ba03770feadb4d890ec2bf
2020-08-19 13:51:21 +01:00
Jeongik Cha
6df337255c Merge "Introduce AlwaysUsePrebuiltSdks" 2020-08-10 00:51:56 +00:00
Colin Cross
205e91183e Merge libs/ directory of imported aars into classes.jar
AARs can provide extra classes in the libs/ directory that should
be treated the same as classes.jar, merge them into a single jar
when extracting the AAR.

Bug: 162892721
Test: m androidx.appsearch_appsearch
Change-Id: I92bf46f47ce5f3dce16c42197c15ed256304fda2
2020-08-07 14:07:23 -07:00
Jeongik Cha
816a23a50d Introduce AlwaysUsePrebuiltSdks
Instead of UnbundledBuild, use AlwaysUsePrebuiltSdks
to determine if java modules needs to be built against prebuilt sdks.
And rename UnbundledBuildUsePrebuiltSdks to AlwaysUsePrebuiltSdks to
express its behavior more correctly.(It can be orthgonal to "Unbundled")

Bug: 160390776
Test: TARGET_BUILD_UNBUNDLED_IMAGE=true m vendorimage

Change-Id: I0be7265c1959d8774c295372cd7a9250169f6df9
2020-08-07 12:15:52 +09:00
Colin Cross
d783bbbace Use unzip -DD
We put reproducible timestamps in zip files so that the artifacts
are consistent, but that leads to old timestamps in the output
directory if they are unzipped as part of the build.  Use
unzip -DD when unzipping to update the timestamps.

Bug: 161015009
Test: touch -d 2020-01-01 ref; find $OUT/system -not -newer ref
Change-Id: I70407a627cb070e24be510faa6a774e3d9eae3a8
2020-07-12 05:37:46 +00:00
Jooyung Han
749dc69af1 apex/apk: enforce min_sdk_version of all deps
Enforce min_sdk_version for every payload dependency of updatable
APEX/APKs.

android.CheckMinSdkVersion() calls ApexModule.ShouldSupportSdkVersion
for every transitive dependency from APEX/APK modules to see if it
meets the min_sdk_version requirements.

The common implementation for apex/android_app is provided in
android/apex.go.

Bug: 145796956
Bug: 152655956
Bug: 153333044
Test: m nothing
Change-Id: I4a947dc94026df7cebd552b6e8ccdb4cc1f67170
2020-06-24 02:00:33 +09:00
Colin Cross
014489c1e6 Add support for running Android lint on java and android modules.
Add a rule that runs Android lint on each java and android module
and produces reports in xml, html and text formats.

Bug: 153485543
Test: m out/soong/.intermediates/packages/apps/Settings/Settings-core/android_common/lint-report.html
Change-Id: I5a530975b73ba767fef45b257d4f9ec901a19fcb
2020-06-16 15:44:16 -07:00
Colin Cross
ce6734e666 Consolidate adding common java properties
Use a method to add the properties that are present on all java modules.

Bug: 153485543
Test: m checkbuild
Change-Id: I7803b15eb0de810c8ab8d4b9acf2511935a26fb6
2020-06-15 18:16:10 -07:00
Ulya Trafimovich
9f3052cd78 Fix on-device paths to used libraries in dexpreopt.
Test: lunch aosp_cf_x86_phone-userdebug && m
Test: Cherry-pick in internal master and check that on-device path to
    com.google.android.dialer.support.jar now is on /product partition
    (as it should be) and not on /system:
    $ oatdump \
        --instruction-set=x86 \
        --oat-file=out/target/product/vsoc_x86/product/priv-app/GoogleDialer/oat/x86/GoogleDialer.odex \
      | grep '^classpath' \
      | grep -o '[^[]*com.google.android.dialer.support.jar'
    /product/framework/com.google.android.dialer.support.jar

Bug: 132357300
Change-Id: Idf279ac713b9b29ff3a29f1b072bc1d57f48db26
2020-06-10 14:53:36 +01:00
Ulyana Trafimovich
5539e7b568 Revert^2 "Rename DexJar interface method to DexJarBuildPath."
This reverts commit b0dc851ff4.

Reason for revert: relanding original change. Build failures were
  caused by a race with another CL: https://r.android.com/1320920

Test: lunch aosp_cf_x86_phone-userdebug && m
Change-Id: Ic9016582dae7773b4d4f84a63425f1ef7a5d061f
2020-06-04 17:20:38 +01:00
Ulyana Trafimovich
b0dc851ff4 Revert "Rename DexJar interface method to DexJarBuildPath."
This reverts commit 562c240185.

Reason for revert: breaks `lunch full-eng && m checkbuild`.

Change-Id: Id7c7d6240d98afaf8edd49b6c96cd05534b784cc
2020-06-04 10:37:36 +00:00
Ulya Trafimovich
562c240185 Rename DexJar interface method to DexJarBuildPath.
This is a prerequisite change before adding DexJarInstallPath.

Test: lunch aosp_cf_phone-userdebug && m
Change-Id: I033e08b8bb06c0a844a6bbbfcdc48ce33e9c95cf
2020-06-03 11:40:45 +01:00
Jooyung Han
5ab5856db3 Merge "apex: Make android_library support APEX variants" 2020-05-21 12:02:39 +00:00
Jooyung Han
acc7bbebe4 apex: Make android_library support APEX variants
The android_library module type can be used within an android_app that
can itself be added to an apex but android_library does not call
android.InitApexModule(module) and so it does not support apex variants
and so is treated as if it cannot be part of an APEX even though it
actually is.

Now, android_library supports AEPX variants.

Due to this change, the whilelist for apex_available got bigger.

Exempt-From-Owner-Approval: cherry-pick from internal

Bug: 156978407
Test: m
Merged-In: I3a21d653fe9c4159e3a89791fe1a8597865eeae6
Change-Id: I3a21d653fe9c4159e3a89791fe1a8597865eeae6
(cherry picked from commit bd133b1bdc)
2020-05-21 12:01:54 +00:00
Paul Duffin
859fe961b0 Improve tracking of exported sdk libraries
The build tracks the java_sdk_library/_import modules that are
referenced by libraries so that it can ensure that any Android app that
includes code that depends on one of those modules has the appropriate
<uses-library> entry in their manifest.

Unfortunately, there were a couple of issues with that:
1) It only tracks direct references to the java_sdk_library module
   itself, e.g. android.test.mock. Direct references to the stubs
   module, e.g. android.test.mock.stubs were not tracked. Making it
   possible for Android apps to reference libraries which would not be
   available at runtime.
2) The logic for determining whether something was a java_sdk_library
   was repeated in a number of places making it difficult to allow
   java_sdk_library/_import instances to determine whether they should
   be treated as an Android shared library.
3) It tracks (and could use) even those java_sdk_library instances
   which do not represent a shared library, e.g. the ones that set
   api_only: true. While this change will simplifty fixing that the
   actual issue will be fixed in a follow up change.

Changes:
* Added EmbeddableSdkLibraryComponent and embedded it into
  java_sdk_library/_import, java_library and java_import. It provides
  the common code to minimize duplication. It contains an
  SdkLibraryToImplicitlyTrack field that if set will cause any
  references to the containing module to add the SdkLibraryParent to
  the list of implicit sdk libraries being tracked.
* Changed code that assumed that anything that implemented
  SdkLibraryDependency required tracking to use the
  OptionalImplicitSdkLibrary() method to get the optional name of the
  sdk library to track. That will allow a follow up change to return
  nil from that method to exclude an sdk library from being tracked.
* Moved SdkLibraryDependency from java.go to sdk_library.go as that is
  a better place for it to be.
* Changed the stubs java_library/java_import creation code to initialize
  the SdkLibraryToImplicitlyTrack field with the name of the creating
  module.
* Initialized the SdkLibraryToImplicitlyTrack field in the
  java_sdk_library/_import so that direct references to them will be
  tracked too.
* Added tests to verify that direct access to the .stubs child of both
  java_sdk_library and java_sdk_library_import are tracked properly.

Test: atest CtsProviderTestCases - which relies on android.test.mock
      being implicitly tracked to verify that I had not broken
	  anything. Used aapt2 dump badging to read the manifest.
	  m nothing - to run the new tests which failed before fixing the
	  code.
Bug: 156723295
Change-Id: Ia99def91e9b74d2ed0a777de04b476c00ea0393d
2020-05-21 10:39:32 +01:00
Treehugger Robot
2f94e85f14 Merge "Allow for setting a logging_parent for an Android App." 2020-02-18 22:57:31 +00:00
Baligh Uddin
5b16dfb39a Allow for setting a logging_parent for an Android App.
Unit test: go test ./... -test.v -run TestOverrideAndroidApp
Unit test: python manifest_fixer_test.py

BUG: 148198056
Change-Id: Ib5ff235d2a93e88b86aec1c0b16327ea938a094d
2020-02-18 09:37:56 -08:00
Jaewoong Jung
3aff5787e2 Simple refactoring of prefix related functions.
Rename the two prefix-in-list funcs so that their usages are clearer.
Also find and replace all the code that essentially does either.

This introduces additional loops in some places, but I think the added
readability and simplicity outweighs the performance degradation, which
should be negligible anyway.

Test: m nothing
Test: TreeHugger
Change-Id: I37e2276ca0c815105ed0031f23c0b1264b480e4f
2020-02-14 14:33:49 -08:00
Jaewoong Jung
387ad5c576 Merge "Add rules to handle asset resources." 2020-02-05 22:24:39 +00:00
Jiyong Park
6a927c4e6a Abstract sdk_version string using sdkSpec type
The value format that sdk_version (and min_sdk_version, etc.) can have
has consistently evolved and is quite complicated. Furthermore, with the
Mainline module effort, we are expected to have more sdk_versions like
'module-app-current', 'module-lib-current', etc.

The goal of this change is to abstract the various sdk versions, which
are currently represented in string and is parsed in various places,
into a type called sdkSpec, so that adding new sdk veresions becomes
easier than before.

The sdk_version string is now parsed in only one place 'SdkSpecFrom', in
which it is converted into the sdkSpec struct. The struct type provides
several methods that again converts sdkSpec into context-specific
information such as the effective version number, etc.

Bug: 146757305
Bug: 147879031
Test: m
Change-Id: I252f3706544f00ea71c61c23460f07561dd28ab0
2020-01-25 21:56:43 +09:00
Jaewoong Jung
9befb0c326 Add runtime_resource_overlay.
Fixes: 119811120
Test: app_test.go
Test: Converted and built IconPackFilledSystemUIOverlay
Change-Id: I71841148c25f820ba829f751a201d2c771c8bd20
2020-01-23 14:24:41 -08:00
Jaewoong Jung
6431ca7a3a Add rules to handle asset resources.
AAPT2 ignores assets in overlay resource inputs, so separate rules are
required to extract and merge assets from dependencies.

Test: app_test.go
Test: Added assets to Settings-core for testing
Test: Confirmed Settings.apk contains them with this change.
Fixes: 146655310
Change-Id: Iab8bc61b719541dae64f0e3502bc9cb45a353687
2020-01-16 12:19:49 -08:00
Jiyong Park
618922e510 jacoco correctly gathers info from APK-in-APEX
This change fixes a bug that jacoco-report-classes-all.jar does not
include info for APK-in-APEX such as the MediaProvider apk in
com.android.mediaprovider APEX.

Firstly, LOCAL_SOONG_JACOCO_REPORT_CLASSES_JAR is correctly set also for
the APKs included in APEXes. Secondly, the Make modules for the embedded
APKs are now built with soong_app_prebuilt.mk to correctly import the
jacoco file into the Make world.

Bug: 147296855
Test: execute the following command in internal master.
$ choosecombo cf_x86_phone userdebug
$ NINJA_ARGS="-t path out/target/product/vsoc_x86/jacoco-report-classes-all.jar out/target/common/obj/ETC/MediaProvider.com.android.mediaprovider_intermediates/jacoco-report-classes.jar" EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true m
The result shows that there is a path as follows:
out/target/product/vsoc_x86/jacoco-report-classes-all.jar
out/target/product/vsoc_x86/apex/com.android.mediaprovider/priv-app/MediaProvider/MediaProvider.apk
out/target/product/vsoc_x86/obj/ETC/MediaProvider.com.android.mediaprovider_intermediates/package.apk
out/target/common/obj/ETC/MediaProvider.com.android.mediaprovider_intermediates/jacoco-report-classes.jar

Change-Id: I52d11534a34eb35219bfafca4453e75a1b701c0e
2020-01-08 14:49:31 +09:00
Paul Duffin
f9b1da0fcb Dedup registration code for module types and singletons
The registration of module types and singletons is duplicated between
init() functions that register them for use in the build runtime and
test context creation code that registers them for testing.

This is a proof of concept for a mechanism that will allow the code
to be shared. It defines a RegistrationContext interface that is
implemented by both the TestContext and the new initRegistrationContext
type. An instance of the the latter is available through the
InitRegistrationContext variable.

The intent is that the registration of the module types and singleton
types will be extracted from the init() function into a separate
function that takes a RegistrationContext parameter. That method is
called from init() passing in the InitRegistrationContext and from a
test passing in the TestContext. Something like this:

  func init() {
    RegisterBuildComponents(android.InitRegistrationContext)
  }

  func RegisterBuildComponents(ctx android.RegistrationContext) {
    ctx.RegisterModuleType(....)
    ....
  }

A test would do something like this:

  ctx := android.NewTestContext()
  RegisterBuildComponents(ctx)

Test: m nothing
Change-Id: I97173cabb6d6cf7ce98fdb5f73418438b1997b35
2019-12-19 10:09:53 +00:00
Artur Satayev
9cf4669bc4 Add exported_plugins to java.Library.
The behaviour is similar to go/be#java_library.exported_plugins. Plugins added to exported_plugins of library X are not applied to the library itself, but rather to libraries that directly depend on the library X.

Test: m checkbuild
Bug: 139740873
Change-Id: I4042bd482ad9cb12d6fbaac51f039d38b1b7a428
2019-11-26 19:05:26 +00:00
Jeongik Cha
2cc570dc63 Enforce hidden apis usage in product(soong)
Only if PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE is set,
every app and java library in product cannot use hidden APIs anymore.

checkSdkVersion() checks if sdk_version of app and library is narrow enough,
checkLinkType() checks every library that app links agianst

Bug: 132780927
Test: m
Test: set PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE, and check whether build
error occurs.
Change-Id: Ic630503b875040f730feda4fef826ed6d71da111
2019-11-06 19:42:42 +09:00
Colin Cross
ec90e44ce7 Merge changes Icfd32d0a,Icc9ff4d4,Ieee07502,I559eeb1f,Iaf2a6f6d, ...
* changes:
  Use java language 1.9 for sdk_version: "current"
  Remove special case for sdk_version: "none"
  Use system modules for turbine
  Make javaVersion an enum
  Move TestConfig sdk versions forward
  Split java 8 and 9 classpaths in TestClasspath
2019-10-29 21:08:33 +00:00
Sasha Smundak
541056c3fa Add dont_merge_manifests attribute to android_test
Bug: 122332514
Test: treehugger, convert cts/tests/tests/content
Change-Id: Ib66fcafd7c31913402cd390dfecce292b1817729
2019-10-28 15:55:58 -07:00
Colin Cross
1e7438524b Make javaVersion an enum
Remove the hardcoded checks against "1.9" by making javaVersion
an enum and implementing javaVersion.usesJavaModules().

Test: TestClasspath
Change-Id: I559eeb1f45880bb8177269c6d977ee4dfbadce57
2019-10-28 14:55:03 -07:00
Paul Duffin
e25c644f1e Add system_modules to droidstubs
This allows droidstubs to use the same system modules to create the
stubs that will be used to compile them. It improves consistency and
avoids droidstubs having to duplicate the libraries that make up the
system modules on its libs property.

Adds systemModules() to the sdkContext which allows consistent error
checking behavior between droidstubs and java_library.

Bug: 142534789
Test: m checkbuild
Change-Id: Ib2006906d9528a900f16851f50b62152ffb51a1b
2019-10-11 16:38:14 +01:00
Luca Stefani
fd89882a37 Make additional manifests transitive
Test: m, additional_manifests is now transitive
Change-Id: I3134c5e942959fe762024602fd833ec4a4312d2c
2019-09-10 22:47:53 +02:00
Jiyong Park
b7c639e0b3 Prepare to be able to put framework-res in srcs
This change introduces two changes required to put
framework-res explicitly in srcs property, without relying on the build
system to specially add framework-res as a dependency to
framework-minus-apex, etc.

1) R.java and Manifest.java generated from aapt were packaged to the file
R.jar directly under the gen directory. With this change, the file
becomes android/R.srcjar under the gen directory.

2) android_app module now overrides OutputFileProducer interface so that
it can recognize "{.aapt.srcjar}" tag to reference the generated srcjar file.

Being able to put framework-res in srcs allows us to pass all the source
files (both in the source tree and the ones generates) via a filegroup.
Previously, the source files could only be passed via the java_library
module type. This caused a circular dependency problem when the java
library was used as an input (src_libs) of the droiddoc module. Using
filegroup eliminates the circular dependency.

Bug: 70046217
Test: m

Merged-In: I9ab6116bcc6fa3da60933d427575463b05ae69b4
(cherry picked from commit 94f37f33ed)
Change-Id: I9ab6116bcc6fa3da60933d427575463b05ae69b4
2019-08-29 13:57:32 +09:00
changho.shin
b5432b7a3d Add 'Additional_manifest' property to merge other manifests
This is equivalent to 'LOCAL_FULL_LIBS_MANIFEST_FILES' in Make.

Fixes: 123374442
Test: m -j
Change-Id: Ic4b40a08f2454687c74949020598651acea3b2dd
2019-08-13 08:30:00 +00:00
Treehugger Robot
e65d84c84c Merge "Enforce hidden api usage in vendor (soong)" 2019-07-01 02:06:57 +00:00
Jeongik Cha
6bd33c13bb Enforce hidden api usage in vendor (soong)
From aosp/588578, if vendor app doesn't fill sdk_version, build scirpt overwrites system_current to sdk_version.
But there is no similar enforcement in soong.

So, as make does, sdkVersion() returns "system_current" if it is device-specific or soc-specific module. and sdk_version is not filled.

Test: pass soong test
Bug: 132780927

Change-Id: I69bb3d7bfcf7c27c2db4d0efbe046f9c7879b4bc
2019-06-28 14:56:59 +09:00
Jaewoong Jung
50c744e916 Merge changes from topic "apex_notice"
* changes:
  Embed NOTICE output as an APEX asset.
  Optionally embed NOTICE files in apks.
2019-06-25 16:41:16 +00:00
Jaewoong Jung
5b425e2e20 Optionally embed NOTICE files in apks.
If embed_notices or ALWAYS_EMBED_NOTICES is set, collect NOTICE files
from all dependencies of the android_app, merge them with the app's own
one (if exists), transform it to HTML, gzip it, and put it as an asset
in the final APK output.

Bug: 135460391
Test: app_test.go
Change-Id: I52d92e2fd19b3f5f396100424665c5cc344190d8
2019-06-24 19:10:22 -07:00
Paul Duffin
5c2f963a1d Remove the no_framework_libs property
Corrects an error message that refers to no_framework_libs.

Removes any tests that use no_framework_libs:true where possible as
there are duplicate tests for sdk_version:"core_platform". Otherwise,
switches them over to use sdk_version:"core_platform".

Bug: 134566750
Test: m droid
Change-Id: I41abe1a49f5c744e3393ca9cdf0c41888f810c9f
2019-06-24 16:03:56 +01:00
Colin Cross
a0ba2f5858 Allow passing --legacy in aaptflags
--legacy will soon no longer be passed by default to all aapt2
compiles.  Allow it to be specified in aaptflags by passing it to
aapt2 compile when it is present and filtering it out from the
flags passed to aapt2 link.

Bug: 135597368
Test: m java
Change-Id: Ib65d1a9b7c32ae4ff5ab6f58e66aedfb5f296712
2019-06-22 12:59:27 -07:00
Paul Duffin
a3d0986cfc Remove the no_standard_libs property
Corrects an error message that refers to no_standard_libs.

Removes any tests that use no_standard_libs:true where possible as
there are duplicate tests for sdk_version:"none". Otherwise, switches
them over to use sdk_version:"none".

The androidmk mapping from LOCAL_NO_STANDARD_LIBRARIES to
no_standard_libs has also been removed. There was little point in
updating the tool to map it through to sdk_version:"none" as there are
only a couple of places where it is used, in art's test running mk
targets and in some unbundled packages to work around some limitation
in .mk based build.

Bug: 134566750
Test: m droid
Change-Id: I6413c9b1fe3e63b93753a6a017d2981e32b7e013
2019-06-17 11:21:39 +01:00
Paul Duffin
250e6198d4 Make sdkDep/decodeSdkDep the source of truth about the sdk
Previously, different parts of the build used different sources of
information about the SDK (i.e. the default libraries) against which
a Java module aimed at the device was built. Some used the sdk_version
property, others used the no_standard_libs or no_framework_libs, some
used a combination of all three.

That lead to inconsistent handling in the code, e.g. some parts treated
no_standard_libs: true as implying no_framework_libs: true and others
did not, and also in the build files, e.g. some modules specified
no_framework_libs: true and sdk_version: "system_current" which makes
no sense, or no_standard_libs: true and sdk_version: "core_current"
which are inconsistent.

This is the first step in a refactoring to simplify the sdk selection
process by replacing the no_standard_libs/no_framework_libs properties
with some extra options for the sdk_version property. This change
consists of:
1) Extra functions sdkContext to access the no_standard_libs and
   no_framework_libs properties.
2) Extra field/functions in sdkDep to store and access the value of
   no_standard_libs/no_framework_libs.
3) Changes to decodeSdkDep(...) to pass the values of the no_...
   properties through to the returned sdkDep.
4) Change all code that accesses the no_... properties directly to
   call decodeSdkDep(...) to get an sdkDep object and then accessing
   the values of the no_... properties from there.

The accessor functions on sdkDep are called has...() rather than
no...() as most callers of the methods invert the value anyway and
!no...() is harder to reason about than has...().

The hasFrameworkLibs() function returns true if and only if
no_standard_libs and no_framework_libs are false. That is consistent
with all but one usage of the no_framework_libs property and that is
not affected by it.

Bug: 134566750
Test: m droid
Change-Id: I196e3304e8bd802fb154e897397b0dd337f868e2
Exempt-From-Owner-Approval: Colin has already given +2 modulo some
    minor nits and this blocking other changes.
2019-06-13 15:16:32 +01:00
Treehugger Robot
588857b418 Merge "Refactor .aar resource compilation" 2019-06-11 04:03:51 +00:00
Jaewoong Jung
c27ab6678b Touch up manifest if there's no source code.
The new package manager behavior requires packages without source code
to have an application element with hasCode attribute set to false in
their manifest. With this change, Soong can now automatically insert one
for codeless apps.

Test: app_test.go, manifest_fixer_test.py
Fixes: 124375490
Change-Id: Ied89a8d07c63805ab910859a4f7c45fc1c60bb73
2019-06-03 10:51:42 -07:00
Dan Willemsen
304cfec778 Refactor .aar resource compilation
Instead of extracting the aar, and passing the res directory to another rule
(along with a dependency to a different known file), don't keep the
extracted res directory, and pass the aar directly to the resource
compliation rule, which will extract just the res directory.

I need this for my RBE experiments, where non-listed output files won't
exist in other rules.

Test: m
Change-Id: I99074381052cbcebb6a402484abae9ab2e40284f
2019-05-29 16:54:43 -07:00
Colin Cross
5446e88657 Add <uses-library> tags for SDK libraries to AndroidManifest.xml
Port I4e7a9bdc5bf845af85168abf55f8063900bacc72 and
Ieb7c1429077aaf6899e214a217d9455d95dbfea6 from Make to Soong to
support adding <uses-library> tags to AndroidManifest.xml for
transitive java_sdk_library dependencies and android.test.base
and android.test.mock.

Fixes: 133306356
Test: m checkbuild
Change-Id: I23763bb689c474d25d04a418df1c46e7f0d807af
2019-05-24 13:39:26 +00:00
Colin Cross
0c4ce21615 Track sources for srcjars across modules
Robolectric coverage needs a srcjar that sometimes needs to
include sources of dependencies.  Track the arguments and
dependencies necessary to jar the sources.

Test: TestIncludeSrcs
Change-Id: I9979d2b8350923a2237e743c232e6e548f54ba3b
2019-05-06 14:22:26 -07:00
Sasha Smundak
6ad772597d Fix use_embedded_native_libs handling for android_test
`use_embedded_native_libs: true` should cause
`--extract-native-libs=false` be added to the manifest_fixer invocation,
and it was not happening.
There are also minor naming improvements.

Bug: 117618214
Test: treehugger and 'atest CtsDynamicLinkerTestCases' after
cts/tests/tests/dynamic_linker has been converted to Android.bp.

Change-Id: I93ec2aed3f3b185d320e56b1b4eebb71339b81ee
2019-05-01 13:16:22 -07:00
Colin Cross
aa1c6f1f5a Pass --remove-tools-declarations to manifest merger
Manifest merger needs --remove-tools-declarations to match
Gradle behavior.

Bug: 112607039
Test: m checkbuild
Change-Id: Id93bcaeaf03770a4acd2e1fdf44e418f55540dd3
2019-04-24 14:41:04 -07:00
Colin Cross
90c25c6893 Don't use merged manifest for android_library modules
Don't use the merged manifest for android_library modules.  We
still have to run manifest merger for android_library modules
because Make can't handle transitive dependencies, so it will
continue to merge the manifests at each library, and then merge
the manifests of direct dependencies into the final application.

Bug: 113294940
Test: m checkbuild
Change-Id: Ia8f9f910bd0a134730ddf2d542460eeddbc0a075
2019-04-24 14:40:14 -07:00
Colin Cross
109328714f Allow codename.fingerprint format for targetSdkVersion
Use codename.fingerprint format for targetSdkVersion if it is unset
in the manifest and UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT=true.

Test: manual
Bug: 130541924
Change-Id: I4e3b1274cc32038b00b292dc6d67559eb320e9e4
2019-04-18 16:05:37 -07:00
Colin Cross
1001a7971a Rename jetifier property and add it to androidmk
Rename jetifier_enabled to jetifier since there are no users
yet and it is more consistent with the rest of the Soong
properties.  Also add it to androidmk translation.

Fixes: 123524520
Test: androidmk_test.go
Change-Id: Ib4c688cf3cb171a822ddf7dd49467522c4c1276c
2019-03-22 15:25:30 +00:00
Anton Hansson
53c88448fd Separate device and product overlays
This change adds book-keeping of whether an overlay came from
DEVICE_PACKAGE_OVERLAYS or PRODUCT_PACKAGE_OVERLAYS. This is
later used when writing the output to soong_app_prebuilt.mk, to
use either LOCAL_SOONG_[DEVICE|PRODUCT]_RRO_PACKAGES depending
on the original source.

This change is intended to be a noop on its own, but allows a
follow-up make change to customize the location of the auto-generated
RRO packages.

Bug: 127758779
Test: verify noop on presubmit targets
Change-Id: Ib24fe1d05be132c360dd6966f7c83968c9939f77
2019-03-21 11:25:46 +00:00
Colin Cross
8a49795df1 Replace ctx.ExpandSources with android.PathsForModuleSrc
Move the logic from ctx.ExpandSources into android.PathsForModuleSrc
and ctx.ExpandSource into android.PathForModuleSrc, and deprecate
them.  When combined with the pathDepsMutator this will let all
properties that take source paths also take filegroups or genrule
outputs, as long as they are tagged with `android:"path"`.

Test: All soong tests
Change-Id: I01625e76b5da19240e9649bf26a014eeeafcab8f
2019-03-20 19:36:13 +00:00
Colin Cross
e560c4aabc Support package_splits
Pass the package_splits list from the property to aapt2 as
--split arguments, sign the extra outputs, install them, and
add them as extra output files for SourceFileProducer.

Bug: 127921149
Test: TestAppSplits
Change-Id: Id94a53ae6a8a68ec81e98abba2fefc9c23feaa7a
2019-03-19 23:33:47 +00:00
Colin Cross
27b922f53e Annotate paths and deprecate ExtractSource(s)Deps
Add `android:"path"` to all properties that take paths to source
files, and remove the calls to ExtractSource(s)Deps, the
pathsDepsMutator will add the necessary SourceDepTag dependency.

Test: All soong tests
Change-Id: I488ba1a5d680aaa50b04fc38acf693e23c6d4d6d
2019-03-07 18:36:35 +00:00
Colin Cross
0b9f31fb08 Replace *Escape with *EscapeList
Follow the change to blueprint to make *Escape take and return a string
and add *EscapeList that take and return slices of strings.  Fix up
a few places that were unnecessarily converting a string to a slice
and back to a string.

Test: m nothing
Change-Id: I3fa87de175522205f36544ef76aa2f04aef1b936
2019-03-04 18:11:53 +00:00
Colin Cross
a592e3eae9 Support passing resource zips to aapt2
A zip of resources provides an easy way to pass generated resources
to aapt2.

Bug: 74574557
Test: m FrameworksCoreTests
Change-Id: Ie4b1391521a27727694d03e42462b40d775614f8
2019-02-20 18:12:41 +00:00
Anton Hansson
b245abd5a7 Remove workaround for dupe RRO dirs
All the apps suffering from the duplicate resource directory
problem have been fixed.

Bug: 124035856
Test: make previously failing products
Change-Id: Iecdcdb3d4dab514d7f620876996d25f199d4bcfe
2019-02-19 13:55:15 +00:00
David Brazdil
d25060aa2d Set usesNonSdkApi in manifest when Platform_apis=true
The Platform_apis field in CompilerDeviceProperties currently has no
effect. Unify the behaviour with make and run manifest_fixer.py to
encode the information in the manifest. This is used to exempt
bundled apps and platform tests from hidden API access checks without
having a fixed whitelist of packages.

Bug: 113315999
Bug: 124671117
Test: m UbSystemUiJankTests && \
      aapt d xmltree \
      target/product/taimen/data/app/UbSystemUiJankTests/UbSystemUiJankTests.apk \
      AndroidManifest.xml | grep usesNonSdkApi
Change-Id: I20c392d91ee6275ef8139fbeb5b9700385abbc80
2019-02-18 19:21:02 +00:00
Colin Cross
bec8530972 Fix resource overlay order for static libraries
If a static library has static library dependencies then all resources
need to be moved to an overlay to maintain the correct ordering so
that a static library resource overlays the same resource in a
dependency.

Also fix the ordering of transitive static dependencies, a direct
dependency should override a transitive dependency.

Expand TestEnforceRRO to include a transitive static library and
verify both the direct resources and overlays, and rename it to
TestAndroidResources.

Bug: 124108931
Test: TestAndroidResources
Change-Id: I355f835a2ffb728af28aa208d951794c609e7409
2019-02-14 03:35:21 +00:00
Colin Cross
1b16b0e031 Add module type docs to the java package
Add some overview of the java module types so that we have something
to display in the autogenerated docs.

Bug: 67909957
Test: m soong_docs
Change-Id: I3594dd550f8272f4418f3ea12cded4083674809b
2019-02-13 18:39:40 +00:00
Colin Cross
46abdad46a Add support for use_embedded_dex in Soong
When use_embedded_dex is set, store the dex uncompressed in the
APK and set the android:useEmbeddedDex="true" attribute in the
manifest.

Test: m checkbuild
Change-Id: Iea6e7ed19599830ac72392ef93f9c98957df1cce
2019-02-08 15:25:17 +00:00
Colin Cross
e4246abd7f Make manifest and APK agree on uncompressed native libs
Only put uncompressed native libs in an APK if the min_sdk_version
supports it (>= 23, Marshmallow), and set
android:extractNativeLibs="false" in the AndroidManifest.xml so
that the platform won't extract them anyways.

Bug: 117618214
Test: m checkbuild
Change-Id: I760017e48bf3c6b618aabde0982df45995765d48
2019-02-08 15:24:47 +00:00
Anton Hansson
129b9ceeb1 Workaround dupe resource directories
A few apps are co-located with libraries they depend on statically,
and because it's not possible to specify "no resource_dirs", they
both end up depending on the same resources, leading to downstream
problems for RRO generation.

Workaround the problem by de-duping the RRO paths for a single app
for now.

Bug: 124035856
Bug: 123510624
Test: make with enforce_rro == *
Change-Id: I251f123eb4280ed72e1ccd2212cb5f3e746e645d
2019-02-08 07:55:00 +00:00
Colin Cross
0ddae7fddd Allow disabling implicit resource_dirs and asset_dirs
Specifying [] for resource_dirs or asset_dirs will prevent using
the default "res" or "assets" directories.

Test: TestResourceDirs
Bug: 124035856
Change-Id: I96e38ac1319260db43950299a8b1774da68ea85e
2019-02-08 00:24:01 +00:00
Colin Cross
f24a22a98a Move hiddenapi singleton rules to Soong
Move the rules that build hiddenapi-stubs-flags.txt,
hiddenapi-flags.csv and hiddenapi-greylist.csv into Soong.

Bug: 123645297
Test: m checkbuild
Test: m UNSAFE_DISABLE_HIDDEN_API_FLAGS=true
Change-Id: I90bf58710f6153ee8565994f799d3ec5699bc7fa
2019-02-06 11:23:40 -08:00
Colin Cross
c1c3755b39 Export RRO resource dirs from static android_library dependencies
RRO dirs from static android_library dependencies should be
included in the final module.

Bug: 123510624
Test: TestEnforceRRO
Change-Id: I28c45e139b187894a4ebc43d573eab5ea1be9861
2019-02-06 10:18:38 +00:00
Colin Cross
f57c57825e Fix aar rules
aar files should build to the module out directory, not the root of
the out directory.  Also give the rules a description so they get a
better status line.

Test: m out/soong/.intermediates/frameworks/base/packages/SystemUI/SystemUI-core/android_common/SystemUI-core.aar
Change-Id: Ie8de0421427985c466d909f83c8e0146f7e0bea8
2019-01-25 13:29:12 -08:00
Colin Cross
1f367bfe8b Add a flag to allow unbundled builds to build SDKs from source
Mainline modules are tightly coupled to the platform, and should
build against the current SDK from source and not prebuilts. Add
a flag UNBUNDLED_BUILD_SDKS_FROM_SOURCE to specify that a
TARGET_BUILD_APPS build should build the current SDK instead of
using the prebuilts.

Bug: 121194841
Bug: 121231426
Test: no change to out/build-aosp_sailfish.ninja
Test: forrest unbundled build
Test: forrest master apps build
Test: forrest mainline modules build
Change-Id: I45a40a335483dae2fe192721df9b31bdbab97ee5
2018-12-18 22:46:24 -08:00
Colin Cross
43f08db29e Dexpreopt soong modules inside soong
Port the dexpreopt logic from Make to the dexpreopt package in Soong,
and use it to dexpreopt Soong modules.  The same package is also
compiled into the dexpreopt_gen binary to generate dexpreopt scripts
for Make modules.

This relands Ib67e2febf9ed921f06e8a86b9ec945c80dff35eb and
I462182638bd57b1367b5bfb0718e975c11ae66f7, along with multiple fixes
to depsfile generation in dexpreopt_gen that caused .odex files for
modules in defined make to be missing dependencies on boot.art, and
a fix to not dexpreopt and strip tests.

Bug: 119412419
Bug: 120273280
Test: no differences to dexpreopt outputs on aosp_sailfish system/,
      only expected changes to dexpreopt outputs on system_other
      (.vdex files for privileged Soong modules no longer incorrectly
      contain .dex contents).
Test: OUT_DIR=$PWD/out m
Test: NINJA_ARGS="-t deps out/target/product/sailfish/obj/APPS/Contacts_intermediates/dexpreopt.zip" m
Change-Id: I6bb2c971cee65d2338839753aa0d84939f335b1b
2018-12-15 19:07:54 -08:00
Colin Cross
4ff85ebeb7 Revert "Dexpreopt soong modules inside soong"
This reverts commit 29ff88741e.

Test: none
Bug: 119412419
2018-12-14 11:49:58 -08:00
Colin Cross
29ff88741e Dexpreopt soong modules inside soong
Port the dexpreopt logic from Make to the dexpreopt package in Soong,
and use it to dexpreopt Soong modules.  The same package is also
compiled into the dexpreopt_gen binary to generate dexpreopt scripts
for Make modules.

Bug: 119412419
Bug: 120273280
Test: no differences to dexpreopt outputs on aosp_sailfish system/,
      only expected changes to dexpreopt outputs on system_other
      (.vdex files for privileged Soong modules no longer incorrectly
      contain .dex contents).
Change-Id: Ib67e2febf9ed921f06e8a86b9ec945c80dff35eb
2018-12-13 15:53:54 +00:00
Colin Cross
42308aa174 Fix resources in unbundled builds without sdk_version set
Unbundled builds can be performed on modules that don't have
sdk_version set if they are in a platform checkout that has
framework-res.  Don't skip calling decodeSdkDep in unbundled
builds.

Bug: 117295826
Test: tapas PackageInstaller && m
Change-Id: I3de093cea05670e0b65e99820c07592973b90b3d
2018-11-14 21:44:17 -08:00
Dan Willemsen
419290aba9 Support setting target_sdk_version separately from sdk_version
Before this change, if targetSdkVersion wasn't set in the
AndroidManifest.xml, we'd set it to the sdk_version from the Android.bp.

But there are cases where you want to compile against a later SDK, but
target an earlier one (especially if you depend on libraries that need
to be compiled against more recent SDKs, like androidx).

Test: build APK with different target_sdk_version.
Change-Id: Iaed36b522955a374a049ef331158cc8fc5798ad2
2018-10-31 21:37:34 -07:00
Dan Willemsen
72be5901eb Add aapt_include_all_resources
The equivalent of Make's LOCAL_AAPT_INCLUDE_ALL_RESOURCES.

Test: build LatinIME with Soong
Change-Id: Ib76bea5f28e365b59fa9477b9bceabb84012ff8e
2018-10-29 23:49:46 +00:00
Colin Cross
4b964c00a6 Fix instrumentation_for to match LOCAL_INSTRUMENTATION_FOR
The value from instrumentation_for should not go to
aapt2 link --rename-instrumentation-target-package, that should
be the equivalent of LOCAL_MANIFEST_INSTRUMENTATION_FOR.  That
property is never used in Make, so it is left unimplemented in
Soong.

Add the module listed in instrumentation_for as a shared library
for javac, but don't import its resources.

Bug: 117804211
Test: m checkbuild
Change-Id: I7f035dc0ecb964a3ca391ae1ca2b87cb0f6a7cec
2018-10-18 23:54:38 +00:00
Colin Cross
48de9a4ef5 Make more java modules defaultable
Make java_import, android_library and android_library_import modules
defaultable, and add some missing property structs to java_defaults.
Also use InitJavaModule everywhere.

Test: m checkbuild
Change-Id: I981875bbec5d1f87bae73f36a385e0b77c56c368
2018-10-03 14:31:10 -07:00
Colin Cross
42d48b7b8b Enforce dependencies have right architecture
ctx.AddDependency will succeed if the named dependency only has a
single variant, even if that variant is the wrong architecture.
Use ctx.AddVariationDependency(nil, ...) instead, which requires
that all variations of the calling module match the dependency.

Bug: 112707915
Test: no change to out/soong/build.ninja
Test: using a device dependency in a host java module is an error
Change-Id: I70b661a57d4412eb63b8c9841febfb756e9e025d
2018-08-30 16:31:02 +00:00
Nan Zhang
4c819fb590 Add jetifier support in Soong.
This is a blocker for droiddoc targets migration under vendor/.

Test: N/A
Bug: b/72552006
Change-Id: If85a0917c1ac0d88b9d5b488216a638b4dabd39f
2018-08-29 11:37:32 -07:00
Colin Cross
4aaa84af86 Fix overlaying android resources from static libraries
Match the make logic for combining app resources with static library
resources.

Bug: 112822358
Test: app_test.go
Test: aapt2 dump resources $OUT/system/priv-app/SystemUIGoogle/SystemUIGoogle.apk | grep -A1 ' string/config_systemUIVendorServiceComponent'
Change-Id: I565404e7ffb726dab952c72ab23600d6f2ee4ad4
2018-08-21 15:53:46 -07:00
Colin Cross
331a1213b0 Don't pass resources to r8
R8 complains when it gets dex files in the input jar, but some tests
use dex files or dex jars as resources.  Keep resources separate
from classes until after r8 has been run.

Test: java_test.go
Test: m checkbuild
Change-Id: I1d9164d60d6b054ebb138648da07d80ee769177f
2018-08-16 17:03:56 -07:00
Colin Cross
1b6a3cfea4 Set targetSdkVersion in manifest_fixer
If targetSdkVersion is not set in the manifest, set it to the
value it was implicitly using before changing minSdkVersion.
Requires passing --library to manifest_fixer.py to distinguish
between apps, where the implicit value was set by aapt2 to
current, or libraries where the implicit value was 1.
Fixes cases where the manifest does not specify targetSdkVersion
and was inheriting the minSdkVersion value until manifest merger
started merging a lower targetSdkVersion value from a library.

Bug: 111347801
Test: manifest_fixer_test.py
Change-Id: I8fcf0c5f452707565ba1808f6fe552ffed055c47
2018-07-26 11:09:24 -07:00
Colin Cross
31656958d6 Use manifest merger in Soong
Move the manifest merger config to Soong, and use it to merge
manifests of static dependencies of android_library and android_app
modules.

Bug: 110848854
Test: m checkbuild
Change-Id: Ib89e1f1a52a8b76157e4e0348baf42800412df0d
Merged-In: Ib89e1f1a52a8b76157e4e0348baf42800412df0d
Merged-In: I5d055ce63b8371db500f8868fb73ab3604b8c24a
2018-07-11 19:46:38 +00:00
Colin Cross
9ae1b927d4 Don't install java libraries by default
Very few java libraries need to be installed, most are statically
included in other modules.  Device modules that are not installed
also don't need to be dexed, saving checkbuild time.  Change the
default for java_library to not be installed, and allow libraries
that should be installed to specify installed: true.  This makes
java_libary and java_library_static identical.  It also simplifies
some corner cases when converting from Make to Soong if a module
is built for the host (which doesn't differentiate between static
and non-static/installable) and statically for the device, which
couldn't be represented in a single java_library in soong.

Bug: 110885583
Test: m checkbuild, compare presubmit target files
Change-Id: Idc0841c39a17cebd7bac3559c9408596d167a393
2018-07-11 05:35:59 +00:00
Colin Cross
479884c93d Add min_sdk_version to android_library_import modules
pom2bp now inserts a min_sdk_version into android_library_import
modules.

Bug: 110848854
Test: m checkbuild
Change-Id: I1396eabd8bfa02755c829ddac03022ffb7a5673e
2018-07-10 13:46:58 -07:00
Colin Cross
73ea6a3cf1 Don't install android_library modules
Skip dexing and installing android_library modules, the platform
can't load them directly anyways.

Test: m checkbuild
Change-Id: I4940569f0deb0eefbe52ac1bee6a32a8b2a2c5be
2018-07-10 14:54:24 +00:00
Colin Cross
83bb3167f6 Add support for min_sdk_version
Add min_sdk_version properties and use it for aapt2
--min-sdk-version and --target-sdk-version flags.  Add an sdkContext
interface that any function that needs an sdk version can take in
order to get the values for the current module.

Bug: 110848854
Test: m checkbuild
Change-Id: Ic69f1f935d8b865ec77689350407df08bfac5925
2018-07-09 12:42:01 -07:00
Jiyong Park
1be9691910 Export SDK library names
java_library, java_import, and android_library export SDK library names
that they are using directly or indirectly via its dependencies. When
building an apk, the manifest fixer uses the SDK lib names to
automatically add <uses-library> tags.

The SDK lib names are exported to the make world via
LOCAL_EXPORT_SDK_LIBRARIES flag.

Bug: 77575606
Test: m -j
Change-Id: I4fe606eb7ed23843c58eebe6a324405fe1da34e5
2018-06-20 12:13:33 +09:00
Colin Cross
86a60ae6fa Add core-lambda-stubs to classpath
Add core-lambda-stubs to the bootclasspath for modules with no
sdk_version or with sdk_version: "current", and to the classpath
for modules that specify a specific sdk_version number.  Use the
prebuilt sdk-core-lambda-stubs when using a prebuilt SDK.

Fixes compiling modules with lambdas against the SDK.

This reapplies I5e700f2dd86f1a6b84b7a55dd9bfe21a448d3fb6 with fixes
and tests for unbundled builds.

Bug: 80428539
Test: java_test.go
Change-Id: Ib7aaeebb93137270d7336a7293a08ed7064a3184
2018-05-30 16:47:00 +00:00
Colin Cross
10f7c4a268 Export manifest to Make
I5d439353d46ba6659ec8d16967693d2b9e62ab5a will need the manifests
from android libraries to merge into modules that reference them
with LOCAL_STATIC_ANDROID_LIBRARIES.

Bug: 3434784
Test: m checkbuild
Change-Id: I47b9def5b9c2ecc423550eb8a988cce96038a81e
2018-05-24 15:24:12 -07:00
Colin Cross
bfd347dc82 Pass platform version name as --version-name for framework-res.apk
framework-res.apk should get the platform version name ("9") as
--version-name, not the SDK version ("28").  It will get copied
to compileSdkVersionCodename in APKs compiled against it.

Bug: 78324052
Test: aapt dump badging $OUT/system/framework/framework-res.apk | grep -i version
Change-Id: I34a601cb2c14f66199066e7d598862108da0b950
Merged-In: I34a601cb2c14f66199066e7d598862108da0b950
(cherry picked from commit b691e24d89)
2018-05-09 15:56:46 -07:00
Colin Cross
66f78820e1 Regenerate R.java files from LOCAL_STATIC_ANDROID_LIBRARIES
If a static android library lib1 has static_libs: ["lib2"] then the
R.class files for packages in lib2 will be merged into the jar for
lib1.  If an app has lib1 in its static_libs it will get the R.class
files from lib2 through lib1, instead of regenerating the R.java
files with numbering that matches the resource table of the app.

Pass transtive static android library dependencies on the aapt2
command line so that aapt2 will always regenerate the R.java
constants for those packages.

Also extract the packages that have R.java files after each aapt2
invocation.  This is not necessary for Soong, but is passed to
make to let it force regenerating the packages using
--extra-packages.

Bug: 78300023
Test: m checkbuild
Change-Id: I0f3444af44d2a9f370d1f156c908972f8cc3a1ee
2018-05-02 13:11:01 -07:00
Colin Cross
89c31581a5 Use and export proguard flags from static dependencies
Export proguard flags from Android library modules, and use them
from static dependencies in Android apps when running proguard.
Also export them to Make.

Unlike Make, which concatentates all the exported flags from
dependencies, Soong dedups exported flags files.

Bug: 73724997
Test: m checkbuild
Change-Id: I8f86fecb09cbc591832ce67e8ecef551a6600349
2018-04-30 16:03:43 -07:00
Colin Cross
402d5e0919 Don't use AppsDefaultVersionName for framework-res.apk
Some builds set AppsDefaultVersionName() to include the build
number ("P-123456").  aapt2 copies the version name of
framework-res into app manifests as compileSdkVersionCodename,
which confuses things if it contains the build number.  Use the
DefaultAppTargetSdk ("P") instead.

Bug: 78324052
Test: m TARGET_BUILD_WITH_APPS_VERSION_NAME=true Dialer
      aapt dump badging $OUT/system/priv-app/Dialer/Dialer.apk | grep compile
      shows compileSdkVersionCodename=P
Change-Id: If67f40aae1066d4ff3bf97da1b2de2e1e250ad9c
2018-04-25 15:09:20 -07:00
Colin Cross
e78dcd313c Remove product-specific flags from android_library modules
Static android libraries should not get the product-specific
flags.

Bug: 73724997
Test: m checkbuild
Change-Id: I89e8c0a3fb788b18ee6603e9d21c9b9a5275f42f
2018-04-19 15:28:21 -07:00
Colin Cross
d09b0b653b Fix aapt2 --min-sdk-version after finalized SDK
aapt2 --min-sdk-version was using AppsDefaultVersionName(), which
is OMR1 for a non-finalized SDK, but 8.1.0 after finalization.
Add PlatformSdkCodename() for non-finalized SDKs, use it for
DefaultAppTargetSdk(), and pass it for aapt2 --min-sdk-version.

Bug: 78224641
Test: TestAppSdkVersion in app_test.go
Change-Id: I622eaf92f8a940f79007c2a579536da325700b06
2018-04-18 12:39:25 -07:00
Colin Cross
a97c5d3f08 Add support for android_library modules
Add support for compiling android_library modules into AARs,
and refactor app support on top of it.

Bug: 73724997
Test: app_test.go
Change-Id: I1dfac5fffe577c6680bc4709147b2061eb7d819c
2018-04-16 15:24:47 -07:00
Colin Cross
fabb608b27 Soong AAR prebuilt support
Add support for android_library_import modules that take an
aar file.

Bug: 73724997
Test: m checkbuild
Change-Id: I670b56f0a3b7501d9478a6064a04d0cb9c1bb611
2018-02-22 14:54:47 -08:00