Commit graph

20458 commits

Author SHA1 Message Date
Nicolas Geoffray
7356fffd6d Add linux_bionic cross compilation for mainline SDKs.
ART requires linux bionic prebuilts.

Bug: 142935992
Test: build-mainline-modules.sh
Merged-In: If0f97e58d2afccbc3f5d0b2e7dabac51330cc5c7
Change-Id: If0f97e58d2afccbc3f5d0b2e7dabac51330cc5c7
(cherry picked from commit 71233e4732)
2020-05-16 12:14:08 +01:00
Nicolas Geoffray
164451c1f0 Support secondary arch for host module exports.
Bug: 142935992
Test: build-aml-prebuilts.sh generate x86 prebuilts

Merged-In: Iec4d8aa59a3ad55583c788f8ec40dd0637e7af33
Change-Id: Iec4d8aa59a3ad55583c788f8ec40dd0637e7af33
(cherry picked from commit abdc8c5501)
2020-05-16 12:14:08 +01:00
Nicolas Geoffray
270916d8ff Add a build script to compile modules and SDKs in AOSP.
Test: build-mainline-modules.sh
Bug: 142935992
Merged-In: I80a9bf8ce03d77705ba677f95b03aeb2ac2451d5
Change-Id: I80a9bf8ce03d77705ba677f95b03aeb2ac2451d5
(cherry picked from commit 90bc3cd304)
2020-05-16 12:07:03 +01:00
Martin Stjernholm
adb189529a Fix special case when appending a visibility rule to //visibility:private.
Test: m nothing
Bug: 151303681
Merged-In: Ibe7e953219e4660c653063e87cb08407a2cb513d
Change-Id: Ibe7e953219e4660c653063e87cb08407a2cb513d
(cherry picked from commit 64aeaaddef)
2020-05-16 12:07:03 +01:00
Martin Stjernholm
f8533bc636 Add explicit visibility on the self package in EffectiveVisibilityRules.
Modules in a package is implicitly visible within the same package.
When making effective visibility rules which work from another location
that visibility needs to be mentioned explicitly. In practice this
allows prebuilts to remain visible to other modules in the source
package when the prebuilts are preferred.

Test: m nothing
Test: m conscrypt-module-sdk, check that the snapshot Soong modules give
  visibility to //external/conscrypt
Bug: 151303681
Merged-In: I404f6e5ca7021974a8c7be5e4d6b4982c050b8a5
Change-Id: I404f6e5ca7021974a8c7be5e4d6b4982c050b8a5
(cherry picked from commit 0641d189d0)
2020-05-16 12:07:03 +01:00
Martin Stjernholm
68e9d96d61 Don't print :__pkg__ for package rules, since that's the default.
To reduce clutter a little.

// Added for rvc-dev. Used this bug as it is the bug that needs all the build changes.
Bug: 155164730

Test: m nothing
Merged-In: I0d2d86f00c3d38e603d6f58c4b1dd9a4170bf819
Change-Id: I0d2d86f00c3d38e603d6f58c4b1dd9a4170bf819
(cherry picked from commit 01407c525a)
2020-05-16 12:06:54 +01:00
Anton Hansson
18a289560d Fix API lint copy command
The space after the backtick prevents it working when copy-pasting it
into the shell.

Test: create lint error => m => cp/pasted command runs successfully
Merged-In: I42b8b60d01dcaed34dbde0390eb1691d656a32cf
Change-Id: I42b8b60d01dcaed34dbde0390eb1691d656a32cf
(cherry picked from commit 3361a294c0)

// Added for rvc-dev. Used this bug as it is the bug that needs all the build changes.
Bug: 155164730
Change-Id: I42b8b60d01dcaed34dbde0390eb1691d656a32cf
2020-05-16 11:03:46 +00:00
Paul Duffin
c91aafb699 Merge "Replace javaLibrary with java.Dependency,android.Module" into rvc-dev 2020-05-16 07:24:18 +00:00
TreeHugger Robot
ff91b3c29a Merge "Add apex_set module." into rvc-dev 2020-05-16 02:37:39 +00:00
Jaewoong Jung
8cf307e754 Add apex_set module.
apex_set takes an .apks file that contains a set of prebuilt apexes with
different configurations. It uses extract_apks to select and install the
best matching one for the current target.

Bug: 153456259
Test: apex_test.go
Test: com.android.media.apks
Change-Id: I1da8bbcf1611b7c580a0cb225856cbd7029cc0a7
Merged-In: I1da8bbcf1611b7c580a0cb225856cbd7029cc0a7
2020-05-16 00:37:36 +00:00
TreeHugger Robot
a91a16b484 Merge "Use system modules for prebuilt SDKs >=30" into rvc-dev 2020-05-15 23:47:29 +00: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
Sasha Smundak
bbf0579ac7 Implement extract_apks
Bug: 152319766
Test: manual and builtin
Change-Id: Ia15d66e86c7bcfd52f5b776173ca1665b68ff438
Merged-In: Ia15d66e86c7bcfd52f5b776173ca1665b68ff438
2020-05-15 10:49:45 -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
Paul Duffin
f299cbefcd Replace javaLibrary with java.Dependency,android.Module
Passes an additional android.Module parameter through to avoid having
to use javaLibrary interface.

Bug: 146586360
Test: m nothing
Merged-In: Ie533c16c753dc9c43171d0223953adea7b2b5ee6
Change-Id: Ie533c16c753dc9c43171d0223953adea7b2b5ee6
(cherry picked from commit 581bbbe8cb)
2020-05-15 17:07:02 +01:00
Colin Cross
db22475ecb Use system modules for prebuilt SDKs >=30
Prebuilt SDKs >=30 now contain core-for-system-modules.jar,
convert them to system modules and use them when compiling against
the SDK to allow using javac -source 1.9 -target 1.9.

Bug: 117069453
Test: TestClasspath
Change-Id: Iebadad5980b952ed91c3ffd56cff1ce1827d3247
2020-05-14 19:51:31 -07:00
Paul Duffin
0f27063a9e Correct module_lib scope name
The module_lib scope should be called module-lib in order to pick up
the latest filegroup. Without it the API lint does not use a baseline
and so reports issues with released and unchangeable APIs.

It is also needed for the correct dist path.

Test: m update-api
Bug: 155164730
Merged-In: I7dbafd7164d5da600ca45c39a7f93a5a40027a1f
Change-Id: I7dbafd7164d5da600ca45c39a7f93a5a40027a1f
(cherry picked from commit 6b836ba566)
2020-05-14 12:16:16 +01:00
Paul Duffin
dd89a28104 java_sdk_library_import: Propagate prefer to child modules
Bug: 155164730
Test: m nothing
Merged-In: Idb06d79baf346ac570beada79880814c5ef6bb50
Change-Id: Idb06d79baf346ac570beada79880814c5ef6bb50
(cherry picked from commit 38b5785e3f)
2020-05-13 23:39:01 +01:00
TreeHugger Robot
fa891cb178 Merge "Use StopServicesSetup to stop/start framework." into rvc-dev 2020-05-13 21:13:50 +00:00
Dan Shi
30ed3d4ce9 Use StopServicesSetup to stop/start framework.
Bug: 155774142
Test: atest VtsHalWifiV1_2TargetTest (update Android.bp with
disable_framework: true)

Change-Id: I5d5326f415352d50ace7f456d29b257d1d769318
Merged-In: I5d5326f415352d50ace7f456d29b257d1d769318
2020-05-13 17:27:56 +00:00
Paul Duffin
080f5ee6f2 java_sdk_library: Add sdk_version for API scopes
Allow the sdk_version against which the stubs for a scope are compiled
to be specified in the module on a per scope basis.

Bug: 155164730
Test: m nothing
Merged-In: I5881e5ee7c2169c30f544882344a60a602dae917
Change-Id: I5881e5ee7c2169c30f544882344a60a602dae917
(cherry picked from commit 87a05a389d)
2020-05-13 18:07:09 +01:00
Paul Duffin
1f4ad0e44d Remove unused Module.visibility() method
Bug: 155787200
Test: m nothing
Merged-In: Iee7a9ab9d816ed1948e2c7cde23f9907cfda337d
Change-Id: Iee7a9ab9d816ed1948e2c7cde23f9907cfda337d
(cherry picked from commit 36c5b8d0b8)
2020-05-13 13:50:34 +01:00
Paul Duffin
31c43e7fb3 Add //visibility:override to allow control over inheritance
Visibility rules can be 'inherited' in one of two ways. Either from
defaults or from a module that called ctx.CreateModule(...).
Previously, in both cases the inheriting module could only append
additional visibility rules to the end of the inherited rules. That
made it impossible to restrict the visibility by removing or ignore
inherited rules.

The //visibility:override rectifies that by allowing the inheriting
module to ignore all the rules that they would have inherited. It can
only go at the beginning of a list of rules specified in a module but
after defaults are applied it can end up in the middle of a list of
rules. In that case it behaves as if all the rules up to and including
the //visibility:override rule were discarded.

It can be used with //visibility:private to override
//visibility:public and vice versa.

Bug: 155787200
Test: m nothing
Merged-In: I8a9c9c5a1bdceaee387c08864ae2b34629e0d46f
Change-Id: I8a9c9c5a1bdceaee387c08864ae2b34629e0d46f
(cherry picked from commit 51084ff6cf)
2020-05-13 13:50:34 +01:00
Paul Duffin
def8a89a22 java_sdk_library: Add framework-modules naming scheme
Matches the naming scheme used by the separate manually created modules
that will be replaced by java_sdk_library's automatically created
components. This will simplify conversion to java_sdk_library as it
will allow developers to concentrate on getting the conversion correct
without also having to worry about name changes. It will also allow the
conversions to be parallelized as many of the references to the
components are in places where conflicts are likely.

Test: m nothing
Bug: 155480189
Merged-In: Ic859a61de155b3e582c17f6ab5e9298f5f4e709a
Change-Id: Ic859a61de155b3e582c17f6ab5e9298f5f4e709a
(cherry picked from commit 6c9c5fc4bc)
2020-05-13 11:29:01 +01:00
Paul Duffin
1c094a01c5 java_sdk_library: Remove some almost single use constants
The constants are only used in one place in the code and in the test.
This change switches the test code to use the apiScope methods to
generate the names and then inlines the constants in those methods. It
makes it easier to see the naming convention.

Test: m nothing
Bug: 155480189
Merged-In: I966e82b8ae67624da168e05f5a2b062b832cb8cd
Change-Id: I966e82b8ae67624da168e05f5a2b062b832cb8cd
(cherry picked from commit dd9d0740fa)
2020-05-13 11:29:01 +01:00
Paul Duffin
1a724e666f java_sdk_library: Delegate component module to naming scheme
Adds a naming scheme abstraction to which the java_sdk_library/import
will delegate the task of creating the names of their component
modules. The naming scheme can be selected in a module definition but
for now the only supported option is "default".

Test: m nothing
Bug: 155480189
Merged-In: I708657661188ea4a14a4dd8c6bc4b46237bbe5e0
Change-Id: I708657661188ea4a14a4dd8c6bc4b46237bbe5e0
(cherry picked from commit 1b1e8069ec)
2020-05-13 11:29:01 +01:00
Paul Duffin
b74ee3e727 java_sdk_library: Extract child module naming to common struct
Extracts the child module naming to the commonToSdkLibraryAndImport
struct so it can be reused by both sdk library source and prebuilt.

Also:
* Makes all child module name generation go through the common struct.
* Renames some of the methods to clarify their purpose and improve
  consistency.

Test: m nothing
Bug: 155480189
Merged-In: I9be9aab07252b491ab292b8847138a93b487cf53
Change-Id: I9be9aab07252b491ab292b8847138a93b487cf53
(cherry picked from commit c3091c8c19)
2020-05-13 11:29:00 +01:00
Paul Duffin
a377e4c85e java_sdk_library: Allow separate api/stubs source modules
The API file for a scope represents the differences between the API
provided by that scope and that provided by the scope that it extends.
On the other hand the stubs source for a scope represents the union of
the API provided by the scope and the scope it extends (all the way
back to public).

Unfortunately, while metalava supports this behavior for scopes that
extend public (e.g. system and test) it does not support this behavior
for scopes that extend others, e.g. module_lib which extends system.
This is because it always assumes that the baseline for the API file
is 'public' and so has no way to defined other baselines.

This change works around that by having separate droidstubs modules to
generate the API and stubs sources for scopes that require different
arguments to generate the API and stubs sources.

Test: m checkapi
Bug: 155164730
Merged-In: Iea7d59852d7aeb503120acf3c44e08eb0d9d07b9
Change-Id: Iea7d59852d7aeb503120acf3c44e08eb0d9d07b9
(cherry picked from commit 0ff08bdb07)
2020-05-13 11:29:00 +01:00
Paul Duffin
153501f661 java_sdk_library: Preserve sdk_version: "none" in snapshot
Test: m nothing
Bug: 156354511
Merged-In: Icf7c20dc109a773430768c1a2d91c674551dbc1b
Change-Id: Icf7c20dc109a773430768c1a2d91c674551dbc1b
(cherry picked from commit 780c5f4715)
2020-05-13 11:29:00 +01:00
Paul Duffin
cd9b6971c4 Allow sdk_version: "none" to be used in prebuilts/
Bug: 156354511
Test: m nothing
Merged-In: Iffce78cbce88a8341146bf19e78acf25fc69f2b0
Change-Id: Iffce78cbce88a8341146bf19e78acf25fc69f2b0
(cherry picked from commit e5c3b85ee5)
2020-05-13 11:27:44 +01:00
Paul Duffin
8986cc947c Enable api_lint in java_sdk_library
Adds api_lint.enabled property to control whether API linting should be
performed.

Test: m checkapi
Bug: 156126315
Merged-In: I87ca5a942228cf6af1a9939f0334d6fc46c39a63
Change-Id: I87ca5a942228cf6af1a9939f0334d6fc46c39a63
(cherry picked from commit 160fe41c39)
2020-05-13 11:27:44 +01:00
TreeHugger Robot
a7a30b63e9 Merge "Add test_mainline_modules to the auto-gen test config(GTest only)." into rvc-dev 2020-05-13 03:20:42 +00:00
Paul Duffin
ece64f6de0 Defer \n quoting generatedContents until creating the ninja rule
Previously, when writing to generatedContents \n characters were
quoted (replaced with \\n) so as to allow them to be preserved through
ninja/rsp/bash and were unquoted (replaced \\n with \n) just before
redirecting to the output file. That meant that any code which wanted
to access the contents for other purposes, e.g. testing had to unquote
\\n.

This change moves the quoting to be part of the code that generates the
ninja rule which simplifies any other code that has to access the
contents.

Without quoting the generated Android.bp files are not formatted
properly, are all on one line and completely unreadable.

Bug: 156286550
Test: m art-module-sdk and check generated Android.bp file to make sure
      it is properly formatted.
Merged-In: I768c3b96ed08a3daf251730e2a10d9d72338c49a
Change-Id: I768c3b96ed08a3daf251730e2a10d9d72338c49a
(cherry picked from commit 1110827b3f)
2020-05-12 08:04:57 +01:00
Paul Duffin
ddbb19648e Merge changes I4e1861ea,Ic99b7333 into rvc-dev
* changes:
  java_sdk_library: Path extraction from deps depend on tag
  Expand SystemApi annotation for generating system api
2020-05-12 07:02:44 +00:00
easoncylee
2968a58a9a Add test_mainline_modules to the auto-gen test config(GTest only).
To support parameterized mainline modules in Test Mapping, we plan to
add a new parameter called test_mainline_modules in build system to
auto-generate the test config based on the parameter.

For detailed information: go/test-mapping-mainline-gcl
(serach for auto-generated pattern)

Bug: 155238134
Test: add "test_mainline_modules: [some.apk]" to libstatspull_test,
and build the modules, confirm the parameterized option is added
in the test config.

Change-Id: I31d6dfbb71881d7a7026cf2f36ba6ca6a97870ad
Merged-In: I31d6dfbb71881d7a7026cf2f36ba6ca6a97870ad
2020-05-12 08:55:07 +08:00
Artur Satayev
815476347a Merge "Introduce app -deps-info." into rvc-dev 2020-05-11 23:14:47 +00:00
Paul Duffin
5fb8213db6 java_sdk_library: Path extraction from deps depend on tag
Previously, the information that the java_sdk_library extracted from
its child dependencies was determined purely by the type of the
dependency and whether it had a tag of the appropriate type. The actual
tag itself was ignored. That worked but was a little fragile as it
relied on there being no overlap between the types of the dependencies
or if there was overlap on the order in which the dependencies were
processed and the dependency types were checked to ensure that the
correct information was collected.

This change makes the information that is extracted dependent on the
tag that is used. That makes the behavior much more robust and also
simplifes the follow up change which may get the stubs source and API
files from separate droidstubs invocations.

Changes:
* A func field is added to the scopeDependencyTag that is supplied with
  a dependency from which to extract the information and scopePaths
  into which the information will be stored.
* Each scopeDependencyTag instance supplies its own function.
* Various items are renamed to more closely reflect what they actually
  do. e.g. the apiFileTag is renamed to stubsSourceAndApiTag field
  because if provides access to both api file and stubs source.

Test: m checkapi
Bug: 155164730
Merged-In: I4e1861ea67f441f2948a0d7d7053ab0b1169955f
Change-Id: I4e1861ea67f441f2948a0d7d7053ab0b1169955f
(cherry picked from commit c878250d3f)
2020-05-11 23:49:05 +01:00
Paul Duffin
991f262697 Expand SystemApi annotation for generating system api
Metalava apparently normalizes the SystemApi annotation that was
previously used to the form that this change uses so this is
effectively a no-op. However, this does make this code more
self-consistent and also matches the form that is used in the framework
defaults for the mainline modules.

Test: m checkapi
Bug: 155164730
Merged-In: Ic99b7333730ed8b918d8af72ae7bd6a851c2093a
Change-Id: Ic99b7333730ed8b918d8af72ae7bd6a851c2093a
(cherry picked from commit 0d543640d5)
2020-05-11 23:48:52 +01:00
Liz Kammer
12f5ef4005 Merge "Add lineage file to deps for signapk." into rvc-dev 2020-05-11 19:30:31 +00:00
Artur Satayev
d9b503aa85 Introduce app -deps-info.
Similar to APEX-deps-info, app deps info produces two lists with
transitive dependencies.

Bug: 149622332
Test: m NetworkStack-deps-info
Change-Id: Ic6d94df3b7b4be5afe328a0abe768beee1a58362
Merged-In: Ic6d94df3b7b4be5afe328a0abe768beee1a58362
Exempt-From-Owner-Approval: cp from aosp
(cherry picked from commit 1111b84822)
2020-05-11 18:03:07 +01:00
Paul Duffin
b476a1eb50 Merge "Switch java_sdk_library_import to use SetDefaultableHook()" into rvc-dev 2020-05-11 09:39:39 +00:00
Paul Duffin
bf735aa744 Switch java_sdk_library_import to use SetDefaultableHook()
Ensure consistency with java_sdk_library.

Bug: 155295806
Test: m checkapi
Merged-In: I074e7c865b6b52c7bcf568da3342d8772623ce4f
Change-Id: I074e7c865b6b52c7bcf568da3342d8772623ce4f
(cherry picked from commit 6e7ecbf972)
2020-05-11 08:58:39 +01:00
Paul Duffin
077fd650a1 Merge changes Iffdd9f19,Ia4e744c9,Ibafdb6e9,I3df60f0b into rvc-dev
* changes:
  java_sdk_library: Specify visibility of stubs modules
  Retry: Fix snapshot of a host/device cc_library with stubs
  Retry: Adds support for 'ignored-on-host'
  Retry: Detect invalid arch specific properties in snapshot
2020-05-11 07:56:51 +00:00
Paul Duffin
344c4eeda9 java_sdk_library: Specify visibility of stubs modules
Adds two new properties to specify the visibility of the stubs modules
(source and library) created by the java_sdk_library. Excludes
visibility property from being inherited when creating the module so it
can be properly specified by copying across the relevant property.

Test: m checkapi
Bug: 155164730
Merged-In: Iffdd9f191ff0d74646356ac577560cc38efdd790
Change-Id: Iffdd9f191ff0d74646356ac577560cc38efdd790
(cherry picked from commit 4911a89181)
2020-05-10 23:56:52 +01:00
Paul Duffin
129171b6d4 Retry: Fix snapshot of a host/device cc_library with stubs
Change since last attempt: Disable test that breaks on darwin.

Adds a test that fails with unknown property android.stubs.versions
and then fixes that by marking the field from which that property is
created with 'ignored-on-host' and implemented the isHostVariant on
*osTypeSpecificInfo.

Bug: 155628860
Test: m nothing
Merged-In: Ia4e744c9e799d5adaf8a2f761516f568ec363ad4
Change-Id: Ia4e744c9e799d5adaf8a2f761516f568ec363ad4
(cherry picked from commit 7a1f7f32ab)
2020-05-10 23:56:40 +01:00
Paul Duffin
4d125bd8ad Retry: Adds support for 'ignored-on-host'
Adds a filter mechanism that can exclude property values from being
included in the common value extraction. That is needed to prevent the
snapshot mechanism from generating invalid output for properties that
are ignored on host (and have their values cleared) and which are not
tagged with `android:"arch_variant"`.

Changes:
* Updates the documentation of SdkMemberType to explain what effect
  the 'ignored-on-host' tag has.
* Adds some tests for this new mechanism.

Bug: 155628860
Test: m nothing
Merged-In: Ibafdb6e921ba5abe505bd8a91ca5a1d9c9b5d0cb
Change-Id: Ibafdb6e921ba5abe505bd8a91ca5a1d9c9b5d0cb
(cherry picked from commit c459f89fb4)
2020-05-10 23:56:28 +01:00
Paul Duffin
08385bf9ac Retry: Detect invalid arch specific properties in snapshot
Previously, the snapshot code did not know whether a specific property
could be arch specific or not and assumed that they all were which
meant that it could generate snapshots containing arch specific values
for properties that are not arch specific and so would fail when
unpacked.

This change requires arch specific fields in SdkMemberProperties to be
tagged as such using `android:"arch_variant"` (just as in module input
property structures). Any property without that must have properties
that are common across all variants.

Bug: 155628860
Test: m nothing
Merged-In: I3df60f0b53ba02ec2c55a80c7da058eac5909d26
Change-Id: I3df60f0b53ba02ec2c55a80c7da058eac5909d26
(cherry picked from commit 864e1b45db)
2020-05-10 23:56:18 +01: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