Commit graph

218 commits

Author SHA1 Message Date
Dan Albert
92fe740677 Stop using prebuilt NDK CRT objects.
We don't need the prebuilt versions. The NDK CRT objects are (now)
built from the platform sources and the only difference is that the
NDK CRT objects also include an ELF note that identifies the NDK
version, which isn't helpful for anything built by the platform.

Add a `crt` property to cc_object that allows CRT objects to identify
themselves. CRT objects, unlike other modules, will have a variant
built per-API level they support, rather than just an SDK variant and
a platform variant. This is needed because new CRT objects will rely
on APIs not available in old libcs and old CRT objects will not
support all the features of a modern one.

Test: treehugger
Bug: http://b/159925977
Change-Id: I6595485fa1bfe0ad4945193d344b863f64eec654
2020-08-11 15:06:55 -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
Liz Kammer
cada807a92 Update language to comply with inclusive guidance
Update android_app_set to use word install rather than master for
android_app_sets, this better matches the phrasing used for apex_set.

See https://source.android.com/setup/contribute/respectful-code for
reference

Bug: 161896447
Test: m nothing
Change-Id: I429e7f8b16c42c10ad4d9543110f5ce814a893b1
2020-07-28 15:47:38 -07:00
Liz Kammer
9f9fd02363 Add android app property rename_resources_package
This relands I70a43c2163709afc90262d74f975ce14a556cf55 with a property
to disable renaming of the package in resource files to support
compatibility with packages that would be infeasible to change without
causing failures.

When rename_resources_package is true, uses aapt2 flag to change the
package name encoded in the resources table for override apps.

Test: app_test.go
Bug: 147434671
Change-Id: I3a051ddeb5979f9c0838d176656a1b5cf2677a9b
2020-07-14 19:28:15 +00:00
Ulyana Trafimovich
21b5ffa966 Merge changes from topic "uses-libs-5" am: 8fab5bcce3 am: a4cdcd3796
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1353554

Change-Id: I182197011a993ebc47312131327faefe9d4b17c3
2020-07-02 09:32:32 +00:00
Ulyana Trafimovich
8fab5bcce3 Merge changes from topic "uses-libs-5"
* changes:
  Rewrite construct_context.sh in Python.
  Refactor class loader context generation.
2020-07-02 09:06:27 +00:00
Jaewoong Jung
11c1e0f94d Output apkcerts file for android_app_set.
Soong and Make have no ways to figure out what splits will be outputted
from a given android_app_set, so it's impossible for them to provide
full PACKAGES.$(LOCAL_MODULE).CERTIFICATE entries, which are required to
build a final apkcerts.txt. This change makes extract_apks produce
apkcerts.txt files for each input modules instead. The Make-side
counterpart of this change merges all local apkcerts.txt into a final
one.

Fixes: 160119159
Test: main_test.go
Test: m apkcerts-list
Merged-In: I321e80fd636a955213761f56a3ac64bfe7f7f7c0
Change-Id: I321e80fd636a955213761f56a3ac64bfe7f7f7c0
2020-07-01 10:03:09 -07:00
Ulya Trafimovich
5f364b63b8 Rewrite construct_context.sh in Python.
This allows to reuse SDK version comparison routine from other Python
scripts. With the addition of non-numeric versions comparison has become
more complex, and the deleted shell script did it incorrectly: it used
comparisons like `[[ "S" -lt 28 ]]` which results in "true" as strings
are converted to zero in numeric context. This resulted in adding legacy
libraries to class loader context of apps targeting recent SDK versions.
The error was masked because currently there is only one non-AOSP app
that uses the script (GoogleDialer), and it targets numeric SDK version.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: I26e752e29b5453fd3e29d5dbfbe4d9df9c0a55b7
2020-07-01 09:44:23 +01:00
Jaewoong Jung
e37779d23f Merge "Output apkcerts file for android_app_set." into rvc-dev am: d8f1b81e75
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/12041704

Change-Id: I39f867293f232116148b0a0ced65754cf70465a5
2020-07-01 00:23:47 +00:00
Jaewoong Jung
8bec026e3a Output apkcerts file for android_app_set.
Soong and Make have no ways to figure out what splits will be outputted
from a given android_app_set, so it's impossible for them to provide
full PACKAGES.$(LOCAL_MODULE).CERTIFICATE entries, which are required to
build a final apkcerts.txt. This change makes extract_apks produce
apkcerts.txt files for each input modules instead. The Make-side
counterpart of this change merges all local apkcerts.txt into a final
one.

Fixes: 160119159
Test: main_test.go
Test: m apkcerts-list
Change-Id: I321e80fd636a955213761f56a3ac64bfe7f7f7c0
2020-06-30 10:00:22 -07:00
Jooyung Han
14135e4c26 Merge "apex/apk: enforce min_sdk_version of all deps" am: 14a08f5b28 am: afdc5239b8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1287253

Change-Id: I63074e39f5f319789920e55802d4f7934b556e0a
2020-06-25 01:47:24 +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
f5f663b0c3 Remove most paths from java.TestConfig
Now that tests don't need to specify every path passed to
PathForSource or PathForModuleSrc, remove most of them from
java.TestConfig.  Leave a few that are globbed by lots of tests,
and move a few that are globbed by a single test into the tests.

Bug: 153485543
Test: all soong tests
Change-Id: Ica91d7203a6a7dbca0fd4fed84c78f149b8699e1
Merged-In: Ica91d7203a6a7dbca0fd4fed84c78f149b8699e1
(cherry picked from commit 238c1f3903)
2020-06-15 09:46:31 -07:00
Colin Cross
300b266264 resolve merge conflicts of a73ffc21e0 to rvc-dev-plus-aosp
Test: I solemnly swear I tested this conflict resolution.
Bug: None
Change-Id: Ie8ad8a9e91bf4a86c90060b15dc88f9860539637
2020-06-11 12:12:30 -07:00
Jaewoong Jung
829b7135f3 Use Targets[Android] instead of DeviceArch funcs.
NDK prebuit script doesn't set device arch product variables, and so
causes SupportedAbis to panic.

Fixes: 158673325
Test: app_test.go, apex_test.go
Test: build-ndk-prebuilts.sh
Change-Id: I8331ef5bca12301318510ec9712770fd8d3a26a9
2020-06-10 12:30:51 -07:00
Colin Cross
238c1f3903 Remove most paths from java.TestConfig
Now that tests don't need to specify every path passed to
PathForSource or PathForModuleSrc, remove most of them from
java.TestConfig.  Leave a few that are globbed by lots of tests,
and move a few that are globbed by a single test into the tests.

Test: all soong tests
Change-Id: Ica91d7203a6a7dbca0fd4fed84c78f149b8699e1
2020-06-09 14:38:39 -07:00
Sasha Smundak
c4f0ff1d6c Cherrypick aosp/1318079 and aosp/1324841
Allow apex module to have android_app_set as its constituent.
Fix android_app_set documentation

Fixes: 157166068
Test: treehugger & manual
Change-Id: I9f91f1b761286f489d175eb0772f78f702e8a2d6
Merged-In: I9f91f1b761286f489d175eb0772f78f702e8a2d6
Merged-In: Id9b296d9301902deb463b299413491bc66d58944
2020-06-05 15:39:38 -07:00
Sasha Smundak
18d98bc3e0 Allow apex module to have android_app_set as its constituent.
Fixes: 157166068
Test: treehugger & manual
Change-Id: I9f91f1b761286f489d175eb0772f78f702e8a2d6
2020-06-04 20:25:53 -07:00
Jooyung Han
af7f91fc9d Reland "enforce sdk_version for JNI libs for updatable APKs"
JNI libs for "updatable" APKs or APKs in "updatable" APEXes should set
sdk_version which is equal to or less than APK's min_sdk_version.

In fact, we'd better check if min_sdk_version of JNI libs matches(or is
earlier than) min_sdk_version of the APK. But for now the build system
can't handle sdk_version/min_sdk_version correctly for JNI libs. That's
why sdk_version of JNI libs is enforced to match with min_sdk_version
of APK in this change.

(original commit: 98c4750f39)

Bug: 145796956
Test: m
Merged-In: I08543ccee7dfda0559a1fca108ceb5c28f84943f
Change-Id: I08543ccee7dfda0559a1fca108ceb5c28f84943f
(cherry picked from commit bbc3fb780b)
2020-05-28 23:06:52 +00:00
Liz Kammer
966b2f02fb Add signing lineage for runtime_resource_overlay
Add ability to specify a signing lineage file for
runtime_resource_overlay.

Test: app_test.go
Bug: 153366049
Merged-In: I68286bc0caa9daad6ef74db39f7750924f1d93dd
Change-Id: I68286bc0caa9daad6ef74db39f7750924f1d93dd
2020-05-27 12:18:27 -07:00
TreeHugger Robot
753c739e2f Merge "Add preprocessed property for android_test_import" into rvc-dev 2020-05-27 17:21:19 +00:00
Liz Kammer
3d8779dd6f Merge "Add signing lineage for runtime_resource_overlay" into rvc-dev 2020-05-27 16:39:20 +00:00
David Srbecky
38b2a86091 Merge "Allow the user to explicitly set the java Uncompress_dex property." 2020-05-27 13:45:29 +00:00
TreeHugger Robot
6270b775de Merge "Allow the user to explicitly set the java Uncompress_dex property." into rvc-dev 2020-05-27 04:30:37 +00:00
Paul Duffin
64e6199756 Retry: "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
(cherry picked from commit 859fe961b0)
Change-Id: I760a9ac72856e3a07a497ce40db70c7e70106837
2020-05-25 10:41:20 +01:00
Remi NGUYEN VAN
ed0314270d Revert "Improve tracking of exported sdk libraries"
Revert submission 11569833

Reason for revert:  Broke presubmit: b/157231582
Reverted Changes:
Ia99def91e:Improve tracking of exported sdk libraries
If91b4d106:java_sdk_library: Do not expose stubs implementati...
Id6d76e56c:java_sdk_library: Access outputs using tags

Change-Id: I3a07d412e795df512c430e4d2ed221f4d17e904a
2020-05-25 02:05:07 +00:00
Liz Kammer
7e20ddae4a Add preprocessed property for android_test_import
If set to true, preprocessed indicates that the prebuilt apk is
installable as is and does not need any further processing (e.g.
zipaligning, signing).

(This is a cherry pick.)

Test: app_test.go
Bug: 155412211
Merged-In: If0c27c1e340c1bdb270064f636dc6bf33a0fc949
Change-Id: If0c27c1e340c1bdb270064f636dc6bf33a0fc949
2020-05-21 17:25:52 -07:00
Treehugger Robot
42ada5cff3 Merge "Add preprocessed property for android_test_import" 2020-05-21 22:22:28 +00:00
Liz Kammer
3b70b3fea5 Add preprocessed property for android_test_import
If set to true, preprocessed indicates that the prebuilt apk is
installable as is and does not need any further processing (e.g.
zipaligning, signing).

Test: app_test.go
Bug: 155412211
Change-Id: If0c27c1e340c1bdb270064f636dc6bf33a0fc949
2020-05-21 13:00:46 -07:00
David Srbecky
98c71228f1 Allow the user to explicitly set the java Uncompress_dex property.
ART tests need to explicitly control the compression.

Bug: 157239179
Test: "atest ArtGtestsTarget" with http://go/aog/1302773
Change-Id: I4490aa0a61fa71f830feb6a46dffd8d20fccfc66
2020-05-21 19:02:02 +00:00
David Srbecky
e033cbae40 Allow the user to explicitly set the java Uncompress_dex property.
ART tests need to explicitly control the compression.

Bug: 157239179
Test: "atest ArtGtestsTarget" with http://go/aog/1302773
Change-Id: I4490aa0a61fa71f830feb6a46dffd8d20fccfc66
Merged-In: I4490aa0a61fa71f830feb6a46dffd8d20fccfc66
2020-05-21 19:59:25 +01:00
Paul Duffin
442a475521 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
Merged-In: Ia99def91e9b74d2ed0a777de04b476c00ea0393d
Change-Id: Ia99def91e9b74d2ed0a777de04b476c00ea0393d
(cherry picked from commit 859fe961b0)
2020-05-21 14:53:38 +01: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
Liz Kammer
ff000d65d4 Merge "Add signing linage support for android_app_import" 2020-05-20 15:21:16 +00:00
Liz Kammer
7fe241f623 Add signing lineage for runtime_resource_overlay
Add ability to specify a signing lineage file for
runtime_resource_overlay.

Test: app_test.go
Bug: 153366049
Change-Id: I68286bc0caa9daad6ef74db39f7750924f1d93dd
2020-05-19 16:16:42 -07:00
Liz Kammer
1d5983b0f6 Revert "Use aapt2 flag --rename-resources-package in soong"
This reverts commit 1674f9b4e9.

Reason for revert: Breaks build

Change-Id: I465300eba68b62d65a0c0660b6bc283e4c89253b
2020-05-19 19:15:37 +00:00
Liz Kammer
2497899bb6 Add signing linage support for android_app_import
(This is a cherry pick.)

Test: app_test
Bug: 153366049
Merged-In: I260f198637a1a0f8b3373250413356785c56588a
Change-Id: I260f198637a1a0f8b3373250413356785c56588a
2020-05-19 09:00:25 -07:00
Liz Kammer
1674f9b4e9 Use aapt2 flag --rename-resources-package in soong
This change uses aapt2 flag to change the package name encoded in the
resources table for override apps.

Test: app_test.go
Bug: 147434671
Change-Id: I70a43c2163709afc90262d74f975ce14a556cf55
2020-05-18 15:10:21 -07:00
Liz Kammer
2bc57f6afe Add signing linage support for android_app_import
Test: app_test
Bug: 153366049
Change-Id: I260f198637a1a0f8b3373250413356785c56588a
2020-05-18 10:46:19 -07:00
TreeHugger Robot
3fcdb81cf2 Merge "Don't use SDK variant for vendor JNI libraries" into rvc-dev 2020-05-15 23:45:36 +00:00
Sasha Smundak
4de27a5757 Implement android_app_set module
Bug: 152319766
Test: manual and builtin
Change-Id: Id0877476f9ae23311d92c0b59a9c568140ab4119
Merged-In: Id0877476f9ae23311d92c0b59a9c568140ab4119
2020-05-15 10:49:59 -07:00
Colin Cross
eb03296b57 Don't use SDK variant for vendor JNI libraries
Vendor JNI libraries already have stable APIs enforced by the VNDK,
they shouldn't use SDK variants.

Bug: 156225490
Test: TestJNISDK
Change-Id: I21ba67e8e9fb05016caf5888129adc1a939545c2
Merged-In: I21ba67e8e9fb05016caf5888129adc1a939545c2
(cherry picked from commit c2d24050c5)
2020-05-15 10:13:42 -07:00
Sasha Smundak
a7856c0077 Implement android_app_set module
Bug: 152319766
Test: manual and builtin
Change-Id: Id0877476f9ae23311d92c0b59a9c568140ab4119
2020-05-14 19:01:11 -07:00
Treehugger Robot
dcd0fc4be7 Merge "Add signing certificate lineage support to soong" 2020-05-14 23:11:24 +00:00
Colin Cross
cb1d161666 Merge "Don't use SDK variant for vendor JNI libraries" 2020-05-14 22:59:47 +00:00
Liz Kammer
e2b27f473f Add signing certificate lineage support to soong
(This is a cherry pick.)

Test: app_test
Bug: 153366049
Merged-In: I65a92d6c40057dcc01950991fb7be485de1c9080
Change-Id: I65a92d6c40057dcc01950991fb7be485de1c9080
2020-05-13 14:30:53 -07:00
Colin Cross
c2d24050c5 Don't use SDK variant for vendor JNI libraries
Vendor JNI libraries already have stable APIs enforced by the VNDK,
they shouldn't use SDK variants.

Bug: 156225490
Test: TestJNISDK
Change-Id: I21ba67e8e9fb05016caf5888129adc1a939545c2
2020-05-13 11:10:38 -07:00
Jooyung Han
bbc3fb780b Reland "enforce sdk_version for JNI libs for updatable APKs"
JNI libs for "updatable" APKs or APKs in "updatable" APEXes should set
sdk_version which is equal to or less than APK's min_sdk_version.

In fact, we'd better check if min_sdk_version of JNI libs matches(or is
earlier than) min_sdk_version of the APK. But for now the build system
can't handle sdk_version/min_sdk_version correctly for JNI libs. That's
why sdk_version of JNI libs is enforced to match with min_sdk_version
of APK in this change.

(original commit: 98c4750f39)

Bug: 145796956
Test: m
Change-Id: I08543ccee7dfda0559a1fca108ceb5c28f84943f
2020-05-14 00:19:45 +09:00
Colin Cross
2bdf0da9e7 Merge "Revert "enforce sdk_version for JNI libs for updatable APKs"" 2020-05-13 01:26:25 +00:00
Jooyung Han
cc928d9059 Revert "enforce sdk_version for JNI libs for updatable APKs"
This reverts commit 98c4750f39.

Reason for revert: broken builds

Change-Id: Icd3a9e226ff8ff288b682757cded9f43069ebc5e
2020-05-13 01:22:56 +00:00
Treehugger Robot
1852b586bf Merge "enforce sdk_version for JNI libs for updatable APKs" 2020-05-13 00:57:34 +00:00
TreeHugger Robot
a13aaa7fcf Merge "Add error checking and tests for jni_uses_sdk_apis and jni_uses_platform_apis" into rvc-dev 2020-05-09 21:27:21 +00:00
Colin Cross
1dd9c446be Add error checking and tests for jni_uses_sdk_apis and jni_uses_platform_apis
Check that jni_uses_sdk_apis and jni_uses_platform_apis are consistent
with sdk_version, and add tests that they select the right variant.

Bug: 154665579
Test: app_test.go
Change-Id: I544a4f881ba16dacd7e74cd480c095091b3cf667
Merged-In: I544a4f881ba16dacd7e74cd480c095091b3cf667
(cherry picked from commit 3c007704c7)
2020-05-08 20:30:27 -07:00
Colin Cross
3c007704c7 Add error checking and tests for jni_uses_sdk_apis and jni_uses_platform_apis
Check that jni_uses_sdk_apis and jni_uses_platform_apis are consistent
with sdk_version, and add tests that they select the right variant.

Bug: 154665579
Test: app_test.go
Change-Id: I544a4f881ba16dacd7e74cd480c095091b3cf667
2020-05-08 16:55:14 -07:00
Liz Kammer
70dd74dde7 Add signing certificate lineage support to soong
Test: app_test
Bug: 153366049

Change-Id: I65a92d6c40057dcc01950991fb7be485de1c9080
2020-05-08 09:50:42 -07:00
Jooyung Han
98c4750f39 enforce sdk_version for JNI libs for updatable APKs
JNI libs for "updatable" APKs or APKs in "updatable" APEXes should set
sdk_version which is equal to or less than APK's min_sdk_version.

In fact, we'd better check if min_sdk_version of JNI libs matches(or is
earlier than) min_sdk_version of the APK. But for now the build system
can't handle sdk_version/min_sdk_version correctly for JNI libs. That's
why sdk_version of JNI libs is enforced to match with min_sdk_version
of APK in this change.

Bug: 145796956
Test: m
Change-Id: Iee7e09dd25bd139d84d50f6a77836b4068c78ea9
2020-05-06 13:54:34 +09:00
Colin Cross
2a5fb91370 Merge changes from topic "sdk_version_variant" into rvc-dev
* changes:
  Add sdk mutator for native modules
  Require apps built against the SDK to use JNI built against the NDK
2020-05-02 01:41:18 +00:00
Songchun Fan
4b25e319e6 Revert "[soong] new field in Android.bp to request APK signing V4"
This reverts commit 17d69e3484.

Reason for revert: This new field is not useful without dependencies in aosp

Test: builds
Change-Id: I87bd820cd6dbc5274ce3d28c4578381718aa805d
Merged-In: I70d6f7dc751510311b03e245b2189a76b395a49c
2020-05-01 11:29:36 -07:00
Jaewoong Jung
32335f90b1 Merge "Add defaults support to runtime_resource_overlay." 2020-04-30 17:43:37 +00:00
Roshan Pius
4df2bc76d5 soong: Add support for override_runtime_resource_overlay
Bug: 154960712
Test: go test ./... -test.v -run TestOverrideAndroidApp
(cherry-picked from ag/11270710)

Change-Id: I8ca9d173b6ab7f9306c83c2b434107111aa2ca88
Merged-In: I8ca9d173b6ab7f9306c83c2b434107111aa2ca88
2020-04-29 09:01:51 -07:00
Roshan Pius
016159dfe4 Merge "soong: Add support for override_runtime_resource_overlay" into rvc-dev 2020-04-28 22:09:15 +00:00
Jaewoong Jung
bf13546f54 Add defaults support to runtime_resource_overlay.
(This is a cherry-pick change.)

Bug: 154956723
Test: app_test.go
Change-Id: Ida29035ef45ec188c95a07a8bccaaa77eea486d7
Merged-In: Ida29035ef45ec188c95a07a8bccaaa77eea486d7
2020-04-28 20:49:17 +00:00
Roshan Pius
b830796ca4 soong: Add support for override_runtime_resource_overlay
Bug: 154960712
Test: go test ./... -test.v -run TestOverrideAndroidApp
Change-Id: I8ca9d173b6ab7f9306c83c2b434107111aa2ca88
2020-04-28 13:08:55 -07:00
Artur Satayev
785afdb04c Merge "Do not allow updatable apps without min_sdk_version." into rvc-dev 2020-04-28 12:05:38 +00:00
Jaewoong Jung
bf5ed2d676 Merge "Add overrides to runtime_resource_overlay" 2020-04-28 01:19:50 +00:00
Jaewoong Jung
ad0177b1fb Add overrides to runtime_resource_overlay
(This is a cherry-pick change.)

Bug: 154928457
Test: app_test.go
Change-Id: Ia52bb9fd18c22b1a02d7b36afd41561cec0473f0
Merged-In: Ia52bb9fd18c22b1a02d7b36afd41561cec0473f0
2020-04-27 16:44:33 -07:00
Colin Cross
01fd7ccbc7 Add sdk mutator for native modules
Compiling native modules against the NDK disables platform features
like ASAN.  For anything shipped on the system image there is no
reason to compile against the NDK.  Add a new mutator to Soong that
creates a platform and an SDK variant for modules that set
sdk_version, and ignore sdk_version for the platform variant.  The
SDK variant will be used for embedding in APKs that may be installed
on older platforms.  Apexes use their own variants that enforce
backwards compatibility.

Test: sdk_test.go
Test: TestJNIPackaging
Bug: 149591340
Change-Id: I7d72934aaee2e1326cc0ba5f29f51f14feec4521
Merged-In: I7d72934aaee2e1326cc0ba5f29f51f14feec4521
(cherry picked from commit 82e192c3ae)
2020-04-27 14:45:05 -07:00
Colin Cross
1c93c299fb Require apps built against the SDK to use JNI built against the NDK
Apps that expect to run on older platforms should use JNI libraries
that will also run on older platforms.  Require that apps that set
sdk_version have jni_libs modules that also set sdk_version, or
set jni_uses_platform_apis: true to bypass the check.

Fixes: 149591057
Test: app_test.go
Change-Id: I76b9b45fb5773bc4dfc10520108f4f3578723909
Merged-In: I76b9b45fb5773bc4dfc10520108f4f3578723909
2020-04-27 14:45:05 -07:00
Artur Satayev
1196210718 Do not allow updatable apps without min_sdk_version.
All updatable modules are expected to declare their earliest platform
version they support.

Bug: 153539598
Test: m
Change-Id: I6243d276e5ab25a1007187ad34789ca1b4cc87bf
Merged-In: I6243d276e5ab25a1007187ad34789ca1b4cc87bf
Exempt-From-Owner-Approval: cherry-pick from aosp
(cherry picked from commit f40fc858a2)
2020-04-27 18:35:40 +00:00
Artur Satayev
f40fc858a2 Do not allow updatable apps without min_sdk_version.
All updatable modules are expected to declare their earliest platform
version they support.

Bug: 153539598
Test: m
Change-Id: I6243d276e5ab25a1007187ad34789ca1b4cc87bf
2020-04-27 16:26:31 +01:00
Jaewoong Jung
062ed7eaa1 Add defaults support to runtime_resource_overlay.
Bug: 154956723
Test: app_test.go
Change-Id: Ida29035ef45ec188c95a07a8bccaaa77eea486d7
2020-04-26 15:17:39 -07:00
Jaewoong Jung
bfc6ac0096 Add overrides to runtime_resource_overlay
Bug: 154928457
Test: app_test.go
Change-Id: Ia52bb9fd18c22b1a02d7b36afd41561cec0473f0
2020-04-24 15:22:40 -07:00
Artur Satayev
0f43edcfc7 Merge "Check updatable APKs compile against managed SDKs." into rvc-dev 2020-04-16 13:34:39 +00:00
Artur Satayev
e5ac15a1b7 Check updatable APKs compile against managed SDKs.
As a follow up, this property will be set to APKs participating in mainline program.

Bug: 153333044
Test: m
Change-Id: I6ea2f3c1d26992259e4e9e6a6d8cecf091d39c43
Merged-In: I6ea2f3c1d26992259e4e9e6a6d8cecf091d39c43
(cherry picked from commit 2db1c3f1c4)
Exempt-From-Owner-Approval: clean cherry-pick
2020-04-16 13:34:13 +00:00
Artur Satayev
2db1c3f1c4 Check updatable APKs compile against managed SDKs.
As a follow up, this property will be set to APKs participating in mainline program.

Bug: 153333044
Test: m
Change-Id: I6ea2f3c1d26992259e4e9e6a6d8cecf091d39c43
2020-04-15 12:06:13 +01:00
Jaewoong Jung
fe3c7f6261 Add libs properties to runtime_resource_overlay.
(This is a cherry-pick change.)

Test: app_test.go
Test: Converted an existing RRO module.
Bug: 148788111
Change-Id: I723c7175760da019d38893e54f236c45f4c973ea
Merged-In: I723c7175760da019d38893e54f236c45f4c973ea
2020-04-10 16:29:40 -07:00
Jaewoong Jung
ca095d786a Add libs properties to runtime_resource_overlay.
Test: app_test.go
Test: Converted an existing RRO module.
Bug: 148788111
Change-Id: I723c7175760da019d38893e54f236c45f4c973ea
2020-04-10 07:05:07 -07:00
Colin Cross
ff550f3e13 Merge "Revert^2 "Add sdk mutator for native modules"" 2020-04-08 18:29:30 +00:00
Colin Cross
c511bc50dc Revert^2 "Add sdk mutator for native modules"
f8e80229fe

Change-Id: Ic30ab6b844684bfc3e8ece5a1913980d5fbf8de2
2020-04-07 16:50:32 +00:00
Colin Cross
d66b121000 Merge "Revert "Add sdk mutator for native modules"" 2020-04-07 04:25:34 +00:00
Colin Cross
f8e80229fe Revert "Add sdk mutator for native modules"
Revert submission 1242911-sdk_version_variant

Reason for revert: b/153394225
Reverted Changes:
Ife99745fb:Use libnativewindow for platform variant of libagq...
I1bae84c43:Use libnativewindow for platform variant of androi...
I6e6021ed3:Use stl to depend on libc++
Ife99745fb:Use libnativewindow for platform variant of libRSS...
I2c9f439b9:Fix static dependency on libprotobuf-cpp-lite-ndk
Iff2aff9cf:Set sdk_version for cc_genrules used by modules wi...
I7d72934aa:Add sdk mutator for native modules
Ief378a007:Use sdk variant of Soong modules when LOCAL_SDK_VE...

Bug: 149591340
Change-Id: I798fa902c779469c6382b6699351e5d12bf14785
Fixes: 153394225
2020-04-07 04:21:21 +00:00
Colin Cross
f5d6756a35 Merge "Add sdk mutator for native modules" 2020-04-07 01:52:11 +00:00
Songchun Fan
17d69e3484 [soong] new field in Android.bp to request APK signing V4
If "v4_signature: true" is set, the v4 signature file,
named [outputApkFile].idsig
will be generated along side the outputApkFile.

Test: m nothing
Test: atest PackageManagerShellCommandIncrementalTest
BUG: 149354175
Change-Id: Ie84725a15406f96f65042ea9909460e4eb34d57f
Merged-In: Ie84725a15406f96f65042ea9909460e4eb34d57f
2020-04-04 12:37:45 -07:00
Colin Cross
82e192c3ae Add sdk mutator for native modules
Compiling native modules against the NDK disables platform features
like ASAN.  For anything shipped on the system image there is no
reason to compile against the NDK.  Add a new mutator to Soong that
creates a platform and an SDK variant for modules that set
sdk_version, and ignore sdk_version for the platform variant.  The
SDK variant will be used for embedding in APKs that may be installed
on older platforms.  Apexes use their own variants that enforce
backwards compatibility.

Test: sdk_test.go
Test: TestJNIPackaging
Bug: 149591340
Change-Id: I7d72934aaee2e1326cc0ba5f29f51f14feec4521
2020-04-01 16:09:05 -07:00
Songchun Fan
688de9af5d [soong] new field in Android.bp to request APK signing V4
If "v4_signature: true" is set, the v4 signature file,
named [outputApkFile].idsig
will be generated along side the outputApkFile.

Test: m nothing
Test: atest PackageManagerShellCommandIncrementalTest
BUG: 149354175
Change-Id: Ie84725a15406f96f65042ea9909460e4eb34d57f
2020-03-25 17:12:20 -07:00
Colin Cross
094cde4430 Require apps built against the SDK to use JNI built against the NDK
Apps that expect to run on older platforms should use JNI libraries
that will also run on older platforms.  Require that apps that set
sdk_version have jni_libs modules that also set sdk_version, or
set jni_uses_platform_apis: true to bypass the check.

Fixes: 149591057
Test: app_test.go
Change-Id: I76b9b45fb5773bc4dfc10520108f4f3578723909
2020-02-21 14:54:31 -08:00
Colin Cross
f28329de73 Move NDK test modules into cc/testing.go
Move the NDK modules defined in app_test.go into cc/testing.go in
preparation for using sdk_version: "current" in more tests.

Test: all soong tests
Change-Id: I80bc31225fb4562fce42781219cefbbd6affae06
2020-02-19 18:59:15 -08: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
387ad5c576 Merge "Add rules to handle asset resources." 2020-02-05 22:24:39 +00:00
Jaewoong Jung
78ec5d8d6c Export the cert path for runtime_resource_overlay.
Fixes: 119811120
Test: app_test.go
Test: Converted and built IconPackFilledSystemUIOverlay
Change-Id: I3f7eae3127996773c5abf9f9bdb9d57a198ddaa3
2020-01-31 10:39:40 -08:00
Jaewoong Jung
f0f747c949 Do not remove RRO resources
Resource configs should not be deduped when building RROs since it
would be impossible to override some resource configs with the same
value as the default config. Also, aapt2 removes resources that do not
have default configurations. If an overlay attempts to overlay a
non-default configuration without overlaying the default, the resource
will be removed and the value will not be overlaid at all.

Bug: 146227008
Fixes: 119811120
Test: app_test.go
Change-Id: I834a58b18d1e74a0f6b3de3d0523009788787e42
2020-01-24 10:35:52 -08: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
3998234d8c Overwrite test-file-name in test config.
If the install apk name is different than the module name, use
test_config_fixer to update the test-file-name value in the config.

Test: app_test.go
Fixes: 147375216
Change-Id: I2141eeebbb3552995400b45634712306673fd812
2020-01-17 06:08:12 -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
Jaewoong Jung
7c5bd835d0 Keep signatures of presigned prebuilt test apps.
Skip the JNI uncompress step for presigned prebuilt test apps. They
don't need it, and they can invalidate the signature. Also, fix the
install partition of prebuilt test apps.

Fixes: 143472191
Test: app_test.go
Test: Converted CtsShimPrivUpgradePrebuilt to bp and checked the
final output apk signature.

Change-Id: Ied7d3576b5db4de40a9ca9e388336229d07212f5
2020-01-15 14:33:32 +00:00
Peter Collingbourne
ddd27246ee Merge "Reland "Also package recursive jni_libs deps of android_apps as well as direct deps." with bug fix." 2019-12-18 23:29:58 +00:00
Colin Cross
98be1bb00f Move filesystem into Config
The filesystem object was available through ModuleContext.Fs(), but
gives too much access to the filesystem without enforicing correct
dependencies.  In order to support sandboxing the soong_build
process move the filesystem into the Config.  The next change will
make it private.

Bug: 146437378
Test: all Soong tests
Change-Id: I5d3ae9108f120fd335b21efd612aefa078378813
2019-12-18 08:19:10 -08:00
Peter Collingbourne
ad84f975d2 Reland "Also package recursive jni_libs deps of android_apps as well as direct deps." with bug fix.
This time, exclude NDK libraries instead of LLNDK libraries from the
package. This is necessary because there are libraries such as libvndksupport
which are LLNDK but are not accessible to apps.

Original commit message:
> Previously, android_app targets for which a.shouldEmbedJnis(ctx) = true
> (e.g. CtsSelinuxTargetSdk25TestCases) would need to specify all of their
> recursive library dependencies, including for example libc++ when depending
> on the platform libc++. This means unnecessary churn when we add a new
> dependency to libc++ (e.g. libunwind [1]). To avoid the churn and allow
> jni_libs clauses to be simplified, make the build system search for the
> recursive dependencies and automatically include them.
>
> This change allows us to remove code that was previously adding NDK libc++
> as a special case, as it is now covered by the generic code.
>
> Also fix some improper quoting that was exposed as a result of this change
> causing more files to be packaged than before.
>
> [1] https://android-review.googlesource.com/q/topic:%22libunwind-so%22

Bug: 144430859
Test: atest CtsAppOpsTestCases
Test: atest FrameworksNetSmokeTests
Change-Id: I8311ede0b44d7e50b9f272912ead8ef07e82b074
2019-12-17 16:55:20 -08:00
Lorenzo Colitti
2973c1106f Revert "Also package recursive jni_libs deps of android_apps as well as direct deps."
This reverts commit 6f907ad3dd.

Reason for revert: Broke FrameworksNetSmokeTests

Bug: 146456945
Change-Id: Ibef7bb80c532e70cfcfb974f51a99ed25437a343
2019-12-18 00:15:07 +00:00
Peter Collingbourne
6f907ad3dd Also package recursive jni_libs deps of android_apps as well as direct deps.
Previously, android_app targets for which a.shouldEmbedJnis(ctx) = true
(e.g. CtsSelinuxTargetSdk25TestCases) would need to specify all of their
recursive library dependencies, including for example libc++ when depending
on the platform libc++. This means unnecessary churn when we add a new
dependency to libc++ (e.g. libunwind [1]). To avoid the churn and allow
jni_libs clauses to be simplified, make the build system search for the
recursive dependencies and automatically include them.

This change allows us to remove code that was previously adding NDK libc++
as a special case, as it is now covered by the generic code.

Also fix some improper quoting that was exposed as a result of this change
causing more files to be packaged than before.

[1] https://android-review.googlesource.com/q/topic:%22libunwind-so%22

Bug: 144430859
Change-Id: I3d6fbcce75bc108a982eb7483992a4b202056339
2019-12-16 15:20:09 -08:00