Commit graph

1901 commits

Author SHA1 Message Date
Paul Duffin
e602918294 Restrict SdkMemberTypes that can be used with sdk/sdk_snapshot
By default SdkMemberTypes are only supported on module_exports module
type. Support for sdk module type has to be explicitly specified.

The java_header_libs, native_shared_libs and stubs_sources are
supported on sdk. The latter is required to provide the stubs source
for an API specified in java_header_libs as they should be kept in
sync.

Bug: 146341462
Test: m nothing
Change-Id: I19b9e60792780a797458d4a9e489506602b13144
2019-12-31 15:08:59 +00:00
Paul Duffin
1b82e6a108 Add support for java_test in sdk
Adds java_test_import module type for use by the sdk snapshot and
adds java_tests property to the sdk and sdk_snapshot module type.

This is needed for the conscrypt test sdk.

Bug: 143678475
Test: m nothing
Change-Id: Ied4c56c978dac2f92a9b3bc34b3235d7eeba2fd3
2019-12-31 15:08:59 +00:00
Paul Duffin
235ffffbdc java_sdk_library: construct droidstubs args as []string
Bug: 145998881
Test: m checkbuild
Change-Id: Id3eb99577200a807050dbf86f47816a2476c3d9c
2019-12-31 15:08:33 +00:00
Jooyung Han
624058e6a5 Dedup generating xml file for java_sdk_library
Permission XML file for java_sdk_library is generated by
java_sdk_library itself now.

And, build rule is switched to android.WriteFile since "echo -e" is
not supported from build server. (-e is printed to output)

Bug: 145474221
Test: m com.android.cronet and check its permissions xml file
     also, m org.chromium.net.cronet.xml (created dynamically)
Change-Id: Iffb119151c49bc4fe6c4386fa267cca193f37dbc
2019-12-26 12:20:24 +00:00
Paul Duffin
e2bc36f12c Merge "Generate .srcjar for prebuilt_stubs_sources" 2019-12-23 13:32:08 +00:00
Mathew Inwood
4d0c19c271 Singleton build rule for merged compat config.
This creates a single build artifact with all compat config from the build.

Test: m out/soong/compat_config/merged_compat_config.xml
Bug: 144927670

Change-Id: Ie60575469c22c201cf1f4d4c187c03c7212dd26b
2019-12-20 13:55:12 +00:00
Mathew Inwood
431b8a2fdd Merge "Update build rule for updated script." 2019-12-20 09:33:42 +00:00
Paul Duffin
9b478b0831 Generate .srcjar for prebuilt_stubs_sources
Changes prebuilt_stubs_sources to generate a .srcjar from its input
instead of just exposing the srcs it is given. This ensures that it can
be used as a drop in replacement for a droidstubs module.

Updates the test for prebuilt_stubs_sources to be more representative
of the actual use made of it by sdk snapshot which outputs a directory
not a glob pattern. Added some documentation of the
prebuilts_stubs_sources srcs property to make it clear that it is
supposed to be a set of directories.

Extracts common code from sdk/testing.go for normalizing path/paths
for testing.

Bug: 143678475
Test: m conscrypt-module-sdk conscrypt-module-host-sdk conscrypt-module-test-sdk
      unzip those in place of external/conscrypt
	  build core-current-stubs-source which expects it to provide a .srcjar.
Change-Id: I8204a022557a9b0b45e19eac79ecba98ff95213d
2019-12-20 08:13:45 +00:00
Treehugger Robot
120d73fe4f Merge "Support java_sdk_library as java_libs of apex" 2019-12-20 05:16:31 +00:00
Jooyung Han
58f26aba4e Support java_sdk_library as java_libs of apex
When a java_sdk_library module is added, both impl jar and permission
xml files are packaged together.

For example, when a java_sdk_library "foo" is listed, following two
entries will be in an APEX package.

/javalibs/foo.jar
/etc/permissions/foo.xml

Bug: 145474221
Test: m com.android.cronet
      deapexer list com.android.cronet.apex

Change-Id: If5883c02255e9309f20810b1532d3fbe73bf4e95
2019-12-20 08:50:34 +09:00
Paul Duffin
d686791c16 Improve cc tests by adding sanitizer mutators
This fixes an issue that arises when deduping cc build component
registration code.

The sanitize_runtime_deps and sanitize_runtime post deps mutators were
not previously added when running cc tests. That meant the tests were
not actually testing the same behavior as at runtime.

Adding the mutators breaks the TestFuzzTarget test as the mutator adds
libclang_rt.ubsan_standalone-aarch64-android as a dependency of libc++
and the former is not available.

This fixes the test by adding the missing dependency as a cc prebuilt
shared library.

Test: m checkbuild
Bug: 146540677
Change-Id: Ie13c7e6fcefef7d9cb1cc5364be3dc563ce40de5
2019-12-19 19:19:40 +00:00
Paul Duffin
0c4979bbdf Dedup prebuilt mutator registration
Test: m checkbuild
Bug: 146540677
Change-Id: I9f8a11adf61fe6f352ec1eabc7c5bac332348ba2
2019-12-19 19:19:40 +00:00
Paul Duffin
77980a8bb9 Dedup registration for cc default test config
The cc.GatherRequiredDepsForTest() method returns some default module
definitions that are required when using cc module types like
cc_library. Previously, the registration of the module types and
mutators needed to process those default definitions was duplicated
in the test config initialization.

This change removes that duplicated code and replaces it with calls
to cc.RegisterRequiredBuildComponentsForTest(ctx) which registers all
the required build components.

Test: m checkbuild
Bug: 146540677
Change-Id: I80b6913c5691ff164ce9d308b9e1da24940f2d42
2019-12-19 19:19:40 +00:00
Paul Duffin
a48f758d84 Dedup prebuilt apis module type/mutator registration
Test: m checkbuild
Bug: 146540677
Change-Id: If5d6fdace2574df6314fbcf6441838cd11df58ae
2019-12-19 19:19:40 +00:00
Paul Duffin
43dc1cc2bc Dedup system modules and sdk library module type registration
Test: m checkbuild
Bug: 146540677
Change-Id: I982fcb8d723e8e2f7679434051ddc427d4fbd7be
2019-12-19 19:19:40 +00:00
Paul Duffin
b0f850784a Dedup java genrule module type registration
Test: m checkbuild
Bug: 146540677
Change-Id: I17f24fe145b4bb453e82aabaecc9c251f2b9769b
2019-12-19 19:19:40 +00:00
Paul Duffin
884363e782 Dedup droiddoc module type registration
Some tests were changed as they were using the wrong name for the
droiddoc_exported_dir module type.

Test: m checkbuild
Bug: 146540677
Change-Id: If57404760d2df3757c93e237696359355cf0c96e
2019-12-19 19:19:40 +00:00
Jiyong Park
f3273c5587 Merge "Add updatable_media_stub to framework" 2019-12-19 18:04:54 +00:00
Lingfeng Yang
18577fe8fb Merge "Revert "Consistently use either "boot" or "apex" boot image as the default."" 2019-12-19 17:24:27 +00:00
Lingfeng Yang
54191fae42 Revert "Consistently use either "boot" or "apex" boot image as the default."
This reverts commit 48b3b3c71f.

Reason for revert: breaks emulator

BUG: 146558375

Change-Id: I2af3d11ad9a014b0d73a73540bc814f245bc6418
2019-12-19 16:41:40 +00:00
Treehugger Robot
65b174c9c7 Merge "Dedup registration code for module types and singletons" 2019-12-19 15:38:25 +00:00
Ulyana Trafimovich
13c929e32e Merge "Consistently use either "boot" or "apex" boot image as the default." 2019-12-19 10:22:01 +00: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
Mathew Inwood
0dd06f6ff2 Update build rule for updated script.
The script now expects flags for filenames and no longer
just writes to stdout. Write full merged config too.

Test: m libcore-platform-compat-config
Change-Id: Ia524a8c271725665772c9543baecd4f494ee86f1
2019-12-19 08:27:33 +00:00
Mathew Inwood
b4cc0206bb Merge "Merge multiple compat_config.xml's." 2019-12-19 08:11:09 +00:00
Treehugger Robot
aa21599d5d Merge "Revert submission 1194828-revert-1191937-art_apex_available-DWXQGTKMAR" 2019-12-19 05:05:35 +00:00
Treehugger Robot
0cbb31e9e7 Merge "Create public stub for platform's sysprop_library" 2019-12-19 03:23:01 +00:00
Jiyong Park
231d056d50 Add updatable_media_stub to framework
The module framework is now a build-only library whose purpose is to
provide hidden APIs from the non-updatable part of the platform and APIs
from the modules. Merging updatable_media_stub to framework, like the
stub libraries from other modules.

As a result, updatable_media_stub can be removed from DefaultLibraries.

Bug: N/A
Test: m

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

Merged-In: I7f80716119ad6ac627e5666def9fe17112dcde3b
(cherry picked from commit 4c258d282b)
Change-Id: I7f80716119ad6ac627e5666def9fe17112dcde3b
2019-12-19 11:57:47 +09:00
Jiyong Park
4ed468c1af Revert submission 1194828-revert-1191937-art_apex_available-DWXQGTKMAR
Reason for revert: relanding with fix
Reverted Changes:
Ic4119368c:Revert submission 1191937-art_apex_available
Ia084976bb:Revert submission 1191937-art_apex_available
Iada86226d:Revert submission 1191937-art_apex_available
Ic76735eac:Revert submission 1191937-art_apex_available
I1eb30e355:Revert submission 1191937-art_apex_available
Icaf95d260:Revert submission 1191937-art_apex_available
Ie8bace4be:Revert submission 1191937-art_apex_available
I8961702cf:Revert submission 1191937-art_apex_available
I39316f9ef:Revert submission 1191937-art_apex_available
I522a7e83b:Revert submission 1191937-art_apex_available
I8b9424976:Revert submission 1191937-art_apex_available
I48b998629:Revert submission 1191937-art_apex_available

Change-Id: I95cef82fa5dfaba5b7044cf274ce59ab954b8f2b
2019-12-19 02:11:10 +00:00
Joseph Murphy
e734db5e98 Merge "Revert submission 1191937-art_apex_available" 2019-12-19 01:20:03 +00:00
Joseph Murphy
4752219db3 Revert submission 1191937-art_apex_available
Original Commit Message:
"""
Rename modules that are APEX-only

The renamed modules are only available for APEXes, but not for the
platform. Use the <module_name>.<apex_name> syntax to correctly install
the APEX variant of the modules.
"""

Reason for revert: Build Cop - Breaks about 15 AOSP targets, with high confidence due to these changes being the only non-robot changes in those builds.

Reverted Changes:
I190ce2d10:Use apex_available property
I990e0a67e:Use apex_available property
I0d1295683:Revert "Avoid duplicated classes for boot dex jars...
I5fb725403:Find the jar libraries in APEX from the correct pa...
I322b1efcc:Rename modules that are APEX-only
Ifa2bd0f8f:Use apex_available property
Iac6533177:Use apex_available property
Ie999602c6:Use apex_available property
I2a3d73397:Use apex_available property
Ic91bcbb9a:Use apex_available property
Ia6c324eed:Use apex_available property
I964d0125c:Use apex_available property

Change-Id: I48b998629b0676cd7353e6844fd87585e0e42989
2019-12-19 01:06:24 +00:00
Inseob Kim
ac1e986c55 Create public stub for platform's sysprop_library
Java modules using SystemAPI can now link against platform owned
sysprop_library with public stub. This allows modules to use platform's
public sysprops (which should be regarded as an API) without any hidden
API usages, if using dynamic linking and boot class path.

This doesn't affect any vendor or odm owned sysprop_library.

Bug: 141246285
Bug: 145167888
Test: m
Change-Id: I99824fb24a75cc8282211c2ad6c6296ae9fca393
2019-12-19 09:35:23 +09:00
Jiyong Park
ead014b8f9 Merge "Revert "Avoid duplicated classes for boot dex jars"" 2019-12-19 00:21:43 +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
Mathew Inwood
2471c086ac Merge multiple compat_config.xml's.
Previously, the compat configs from static dependencies were all written
to compat/compat_config.xml, putting at the mercy of jar file merging and
so potentially losing some config.

Now the annotation processor writes a compat_config.xml for each Java
class that exports config, we we merge them together here with a new
tool.

Test: m
Change-Id: I28c12ff648a01aaad214701fca4f09743638b11b
2019-12-18 16:34:04 +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
Ulya Trafimovich
48b3b3c71f Consistently use either "boot" or "apex" boot image as the default.
Previous CL Ia9b34aa92ebb1b4de96ea0f8f290d798be19b2cf introduced
asymmetry in handling "boot" and "apex" boot images: in JIT-zygote
experiment, though the "apex" boot image was installed, the "boot"
boot image was still used for generating dexpreopt configs.

It is unclear why this asymmetry was needed at that point; it seems
incorrect to use different boot images for dexpreopting and for
installing on device. After recent changes the asymmetry started
breaking walleye_jitzygote-userdebug on git_rvc-release, because APK
dexpreopt commands refer to inexistent boot image files.

Test: lunch aosp_walleye-userdebug && m
Test: cherry-pick CL in internal, walleye_jitzygote-userdebug boots

Change-Id: Id877c10269cf79caf6ae74b1dc169a31e6a2211b
2019-12-18 16:09:39 +00:00
Yan Yan
fa2ac9f6e9 Merge "Enable covergae for ike.jar which will be in mainline module IPsec(IKE)" 2019-12-18 01:22:12 +00: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
Joseph Murphy
9fd9b92d51 Merge "Revert "Also package recursive jni_libs deps of android_apps as well as direct deps."" 2019-12-18 00:23:36 +00: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
evitayan
13b0d51ffb Enable covergae for ike.jar which will be in mainline module IPsec(IKE)
Enable jacoco for ike.jar to set up code coverage. ike will be
shipped in mainline module com.android.ipsec

Bug: 146012420
Test: m EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true SKIP_BOOT_JARS_CHECK=true WITH_DEXPREOPT=false
Change-Id: I886551d980c0d9651b11c80051f17609bb3531d8
2019-12-17 15:23:38 -08:00
Jaewoong Jung
f192d55382 Declare manifest as input to test config fixer.
It needs to be an implicit input for it to work consistently.

Test: m GooglePermissionControllerUnitTests
Bug: 145011263
Change-Id: Ib71d768e750faa5b577652e79a18d05929bde52f
2019-12-17 14:22:19 -08:00
Peter Collingbourne
ff8cb1e69e Merge "Also package recursive jni_libs deps of android_apps as well as direct deps." 2019-12-17 20:51:18 +00:00
Jiyong Park
a92fbb3b72 Revert "Avoid duplicated classes for boot dex jars"
This reverts commit 2812df4edb.

This is no longer required as we have
I6463ebc59cf7fd861b812999d7a79c387bbb3335.

hostdex files are available even when the module doesn't have
"//apex_available:platform"

Bug: 128708192
Test: m
Change-Id: I0d1295683222bc9cdbb82630e61ab3421c717daf
2019-12-17 20:35:42 +09:00
Treehugger Robot
7cf4b5de6b Merge "hostdex:true modules are available for platform" 2019-12-17 06:02:05 +00:00
Treehugger Robot
97e09d0dee Merge "Avoid duplicated classes for boot dex jars" 2019-12-17 05:14:25 +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
Treehugger Robot
bd0624304e Merge "Use empty string for core image variant" 2019-12-16 20:54:32 +00:00
Jaewoong Jung
9b1084f9b9 Merge "Optionally overwrite package value in test config." 2019-12-16 17:10:18 +00:00
Jiyong Park
b02bb40f33 hostdex:true modules are available for platform
Java libraries with hostdex: true are available for the platform even if
it doesn't have "//apex_available:platform" in the apex_available
property. Note that the java libraries are still prevented from being
installed to the device.

Bug: 128708192
Test: m

Change-Id: I6463ebc59cf7fd861b812999d7a79c387bbb3335
2019-12-16 15:19:13 +09:00
Jiyong Park
2812df4edb Avoid duplicated classes for boot dex jars
When a boot classpath java library is directly or indirectly included in
APEXes, multiple variant of the library exist. When running the
hiddenapi tool, we need to eliminate the duplication, otherwise the tool
will complain.

Previously, we simply choose the platform variant of the java library
among the multiple variants. However, if the java library is marked not
available for the platform (i.e. "//apex_available:platform" is not in
the apex_available property), the platform variant does not exist and
thus it is not fed into the hiddenapi tool, which causes missing
references in the tool.

To solve the problem, the platform variant is selected only for the java
libs that are available for the platform. For those libs that are not
available for the platform, we choose one variant of it using a
heuristic; skip testing APEXes and choose com.android.art.release among
the com.android.art.* variants.

Bug: 128708192
Test: m

Change-Id: I33bf297eb3029696ae3504a011486210708fb2c2
2019-12-16 15:19:13 +09:00
Colin Cross
7113d20774 Use empty string for core image variant
Use the empty string for the core image variant so that modules
added to imageMutator do not change their build directory.

Bug: 142286466
Test: m checkbuild
Change-Id: Ida4534d9a4d6176236aaa480fed359ce27acfaa1
Merged-In: Ida4534d9a4d6176236aaa480fed359ce27acfaa1
(cherry picked from commit 72d685ee7f45e5393be44ae4159edf083ac918de)
2019-12-13 20:44:36 -08:00
Paul Duffin
255f18e584 Decouple addition of new sdk member types from sdk code
Previously, adding a new SdkMemberType would require adding a new
sdkMemberListProperty instance to the sdkMemberListProperties as well
as adding a new property into the sdkProperties struct. They are
potential sources of conflict and couple the sdk code with all the
packages that add members to it. This change switched to a
registration model that allows each package to register its sdk
member types decoupling them from the sdk code.

Adds an SdkPropertyName() method to SdkMemberType that specifies the
name of the property to use in the sdk/sdk_snapshot. Also provides
an SdkMemberTypeBase struct to be used by providers of SdkMemberType
implementations.

SdkMemberType instances are registered using the
RegisterSdkMemberType() func which sorts the registered instances
by their SdkPropertyName() to ensure the behavior is consistent and
not affected by order of registration.

When creating a new sdk module a dynamicSdkMemberTypes instance is
created that contains the following:

* A properties struct is created dynamically that contains a field for
  each registered SdkMemberType, corresponding to that type's
  SdkPropertyName().

* A list of sdkMemberListProperty instances is also created, one for
  each registered SdkMemberType.

The dynamicSdkMemberTypes instance is cached using a key that uniquely
identifies the set of registered types just in case new types are
registered after one has been created, e.g. by tests.

Bug: 142918168
Test: m checkbuild
Change-Id: I4bf2bf56a2a49025aa41454048bc1e8ccc6baca2
2019-12-13 20:07:33 +00:00
Treehugger Robot
aafc04ea5c Merge "AndroidMk for the hostdex library has separate AndroidMkEntries" 2019-12-12 03:24:03 +00:00
Treehugger Robot
8ce3c2c8df Merge "AndroidMkEntries() returns multiple AndroidMkEntries structs" 2019-12-12 03:23:06 +00:00
Ulyana Trafimovich
3fae7662ee Revert "Use boot image extension for framework libraries."
This reverts commit 4d2eeed0da.

Reason for revert: breaks avd/avd_boot_health_check test
  on cf_x86_phone-userdebug_coverage on branch rvc-release
  (the device fails to boot).

Test: m
Test: aosp_walleye-userdebug boots

Bug: 145749668

Exempt-From-Owner-Approval: revert

Change-Id: Ie1d93a200222e26461c1bcd384fdb69b7351e259
2019-12-11 18:29:19 +00:00
Jiyong Park
55bd98b2d9 AndroidMk for the hostdex library has separate AndroidMkEntries
Previously, the -hostdex library was emitted using the ExtraFooters.
Now, it has its own AndroidMkEntries, which can be returned together
with the AndroidMkEntries for the main library.

Bug: 128708192
Test: m
Change-Id: Ic9eb0d3839572ed340ccbc5fc6c4b54241e1cb24
2019-12-11 17:27:07 +09:00
Jiyong Park
0b0e1b9804 AndroidMkEntries() returns multiple AndroidMkEntries structs
AndroidMkEntries now returns multiple AndroidMkEntires so that a module
can emit multiple Make modules if needed.

Bug: 128708192
Test: m

Change-Id: I56b6f76d22943b80329951c5acb80a1b932441ad
2019-12-11 17:25:27 +09:00
Treehugger Robot
4858e41719 Merge "Add system_ext_specific" 2019-12-10 01:28:45 +00:00
Treehugger Robot
455e3a089d Merge "Move/dedupe some host path functions in package_ctx.go." 2019-12-09 23:20:16 +00:00
Martin Stjernholm
7260d066ea Move/dedupe some host path functions in package_ctx.go.
These functions don't need a PackageContext object.

Test: m
Bug: 145934348
Change-Id: Ia1da2c76cbad292f9ca79617199b2b5b6b265568
2019-12-09 22:04:21 +00:00
Paul Duffin
9d8d609fcd Pass SdkMember to AddPrebuiltModule instead of the name
This is needed for a follow up change that makes sure that the
prebuilt modules have the same visibility as the source modules.

Bug: 143678475
Test: m conscrypt-module-sdk
Change-Id: I9461c8c094ab19ee9ececb5e5fd50565789f2fa2
2019-12-09 13:28:36 +00:00
Treehugger Robot
667039f404 Merge "Cleanup java.DefaultsFactory()" 2019-12-07 08:52:21 +00:00
Treehugger Robot
8cda6d93de Merge "Support header and implementation jars in sdk" 2019-12-07 08:52:09 +00:00
Colin Cross
ae6c5207cc Move ImageMutator after archMutator
Move the ImageMutator to be registered just after the archMutator
in preparation for moving it between osMutator and archMutator.
Requries updating variants in a few tests that now run the
ImageMutator.

Bug: 142286466
Test: no change to build.ninja
Test: all soong tests
Change-Id: Ia9d2a7bc0e225bedec3c9a83ea04f471a931bf47
2019-12-06 12:37:14 -08:00
Treehugger Robot
f3c24c12ef Merge "Link type checking for java_library" 2019-12-06 18:59:48 +00:00
Ulyana Trafimovich
a4f02412a1 Merge "Pass correct --image argument to oatdump." 2019-12-06 16:55:39 +00:00
Paul Duffin
4735766ef8 Cleanup java.DefaultsFactory()
This function took a props varargs parameter but it was only ever
called with no parameters. The props parameter meant it could not be
used directly with RegisterModuleType() so the defaultsFactory() func
was added which simply called through to DefaultsFactory().

Removing the props varargs parameter allowed it to be used directly
with RegisterModuleType() and so the defaultsFactory() could be
removed.

This was needed because a follow up change adds a test in another
package that uses java_defaults and so it needs the factory method
(defaultsFactory()) to be exported.

Test: m nothing
Change-Id: I33d5c4d4ce8f349b1e6fc706d5e9656faf303b4f
2019-12-06 16:13:58 +00:00
Paul Duffin
a0dbf43a82 Support header and implementation jars in sdk
Add a new java_header_libs property that exports header jars (as
java_libs currently does) and switch java_libs to export implementation
jars instead.

Refactors implementation of the existing library sdk member type so
both properties can be supported from common code as they differ only
on the jar being exported.

Bug: 143678475
Test: m nothing
Change-Id: I04642122f72d083bbdfd3290624f957b71ee8875
2019-12-06 16:13:58 +00:00
Jeongik Cha
e403e9e8dc Link type checking for java_library
Link type checking for java_library has not been working unintentionally.
So turn on link type checking for these types.

And also add tests for link type checking.

Bug: 145799020
Test: cherry-pick aosp/1182522 and check if build fails
Test: m nothing and there is no error(soong unittest)

Change-Id: Ifc347f657885de1028ac0076ddd103c0387b597a
2019-12-07 00:45:02 +09:00
Ulya Trafimovich
163664a548 Pass correct --image argument to oatdump.
This was broken after CL:
  Ida40dfae8c83bf7c2e737d5c7ea418e1197ad826
..which split boot image into primary and extension.
The argument to oatdump was not updated properly.

The old form before the split was:

  --image=out/soong/generic_x86/dex_bootjars/system/framework/boot.art

The new form after the split is:

  --image=out/soong/generic_x86/dex_artjars/apex/com.android.art/javalib/boot.art:out/soong/generic_x86/dex_bootjars/system/framework/boot-framework.art

Test: lunch aosp_x86-userdebug && m dump-oat

Test: Manually inspect build command to make sure correct image
  location is used:

  $ fgrep -e 'oatdump' $ANDROID_BUILD_TOP/out/soong/build.ninja | egrep -e '--image[^ ]*' -o
  --image=out/soong/generic_x86/dex_artjars/apex/com.android.art/javalib/boot.art:out/soong/generic_x86/dex_bootjars/system/framework/boot-framework.art

Change-Id: I54a5146c404aefb6eaeadbe3e9363db935ecad86
2019-12-06 13:42:21 +00:00
Paul Duffin
1387957727 Parameterize the sdk member processing
Extracts the type specific functionality into the SdkMemberType
interface which has to be implemented by each module type that can
be added as a member of the sdk. It provides functionality to add
the required dependencies for the module type, check to see if a
resolved module is the correct instance and build the snapshot.

The latter was previously part of SdkAware but was moved because
it has to be able to process multiple SdkAware variants so delegating
it to a single instance did not make sense.

The custom code for handling each member type specific property,
e.g. java_libs, has been replaced with common code that processes
a list of sdkMemberListProperty struct which associates the
property (name and getter) with the SdkMemberType and a special
DependencyTag which is passed to the SdkMemberType when it has to add
dependencies.

The DependencyTag contains a reference to the appropriate
sdkMemberListProperty which allows the resolved dependencies to be
grouped by type.

Previously, the dependency collection methods would ignore a module if
it was an unsupported type because they did not have a way of
determining which property it was initially listed in. That meant it
was possible to add say a droidstubs module to the java_libs property
(and because they had the same variants) it would work as if it was
added to the stubs_sources property. Or alternatively, a module of an
unsupported type could be added to any property and it would just be
ignored.

However, the DependencyTag provides information about which property
a resolved module was referenced in and so it can detect when the
resolved module is of the wrong type and report an error. That check
identified a bug in one of the tests where the sdk referenced a
java_import module (which is not allowed in an sdk) instead of a
java_library module (which is allowed). That test was fixed as part
of this.

A list of sdkMemberListProperty structs defines the member properties
supported by the sdk and are processed in order to ensure consistent
behaviour.

The resolved dependencies are grouped by type and each group is then
processed in defined order. Within each type dependencies are grouped
by name and encapsulated behind an SdkMember interface which includes
the name and the list of variants.

The Droidstubs and java.Library types can only support one variant and
will fail if given more.

The processing for the native_shared_libs property has been moved into
the cc/library.go file so the sdk package code should now have no type
specific information in it apart from what is if the list of
sdkMemberListProperty structs.

Bug: 143678475
Test: m conscrypt-module-sdk
Change-Id: I10203594d33dbf53441f655aff124f9ab3538d87
2019-12-06 12:16:59 +00:00
Calin Juravle
af7c2fcb71 Merge "Export art dexpreopt image zip file" 2019-12-05 22:11:28 +00:00
Jaewoong Jung
e5cd4e10a0 Optionally overwrite package value in test config.
If package_name is set for an android_test module, package names in its
AndroidTest.xml config need to be updated too.

Test: test_config_fixer_test.py
Fixes: 145011263
Change-Id: I52f17ef1d1902364b9bcfec4f6e246bd655dbf09
2019-12-05 11:17:09 -08:00
Treehugger Robot
5f9e5244c5 Merge "Remove passing -forceprocessing flag to R8" 2019-12-05 08:56:38 +00:00
Colin Cross
31bf00dac3 Export art dexpreopt image zip file
Test: m  out/target/product/generic_arm64/boot.zip
Bug: 144491400
Change-Id: I84342703ac614e072b0cde8c6f5597dc8cffbc65
2019-12-04 16:50:52 -08:00
Sundong Ahn
0d7dff48f5 Add system_ext_specific
The system_ext partition was created. So if java_sdk_library module is
installed to system_ext partition, .xml and .jar install path must be
changed to system_ext.

Bug: 143440787
Test: add system_ext_specific to java_sdk_module && make -j && check
system_ext parition

Change-Id: Ie0d0df426d4aa96ac89eb4215e7376eea3f03f54
2019-12-04 04:00:21 +00:00
Ulya Trafimovich
4d2eeed0da Use boot image extension for framework libraries.
This patch splits the system boot image in two parts:

  - The ART boot image. This is the primary boot image that is
    included in the ART apex and contains dexpreopted Core Libraries.

  - The framweork boot image extension. It depends on the ART boot
    image and contains framework libraries.

The third "apex" boot image (used in the JIT-zygote experiment)
remains unchanged; it is a monolithic primary boot image that
contains both libcore and framework libraries.

Dexpreopting of APKs now uses the framework boot image extension
(which in turn pulls in the ART boot image as a dependency).

Test: m
Test: phone boots:
    lunch aosp_walleye-userdebug && m \
        && adb reboot bootloader && fastboot flashall -w

Bug: b/119800099

Exempt-From-Owner-Approval: rebased after getting approval.

Change-Id: Ida40dfae8c83bf7c2e737d5c7ea418e1197ad826
2019-12-03 13:59:25 +00:00
Paul Duffin
e63106a08c Merge "Add model to represent generated snapshot .bp file" 2019-12-03 10:07:10 +00:00
Treehugger Robot
f6739a65dd Merge "Link type will be check in android_library also" 2019-12-03 03:41:21 +00:00
Roshan Pius
ccc26ef316 soong: Align update boot jar variable with system_server jar
Use apex:jar pair values for updatable boot jars to align with
updatable system_server values.

Test: Compiles & flashed device. Ensured that the bootclasspath & system_server class
paths remain the same.

Change-Id: I1d6dfe3325d9091b7c724458be4e6471f9086666
2019-12-02 08:37:57 -08:00
Paul Duffin
b645ec8e34 Add model to represent generated snapshot .bp file
Having each module type generate the contents of the snapshot's .bp
file results in lots of duplicated code. This adds an intermediate
model for use by the module types and then generates the .bp file
contents from that.

This not only removes the duplicated formatting code but it also
allows consistent handling of shared properties such as name further
reducing duplication. It also makes it possible to duplicate the
versioned and unversioned prebuilt modules from the same model.

Extracts generatedContents from generatedFile to allow the contents
to be populated without creating an output file, for testing.

Cleans up unused code.

Bug: 143678475
Test: m nothing
Change-Id: If21b84db0ef3fdfb5dc11ea0973ce6cb73603ea3
2019-12-02 12:59:38 +00:00
Treehugger Robot
bf857716a1 Merge "Dedup code for generating prebuilt_stubs_sources in snapshot" 2019-11-27 16:21:41 +00:00
Ulyana Trafimovich
565b52610f Merge "Revert^2 "Do not dexpreopt system server jars from updatable modules."" 2019-11-27 12:45:34 +00:00
Ulyana Trafimovich
f2cb7e959b Revert^2 "Do not dexpreopt system server jars from updatable modules."
This reverts commit 01f6b0a656.

Reason for revert: Build failure is not reproducible.
Forrest build on the same build ID 6033773 and same target
cf_x86_phone-userdebug_coverage finished successfully.

Change-Id: I5077f8332aa0b8037e324b89d41f35b86b8cf216
2019-11-27 12:29:50 +00:00
Søren Gjesse
8e505e3f01 Remove passing -forceprocessing flag to R8
R8 ignores the flag

Test: m -j
Change-Id: Ie394dfc24bb5632717d23e9ab4ad03b6cc1feb19
2019-11-27 12:40:07 +01:00
Treehugger Robot
a75606be1e Merge "Fix incorrect install path for priv-app prebuilt" 2019-11-27 09:20:15 +00:00
Treehugger Robot
4a692427f7 Merge "Add exported_plugins to java.Library." 2019-11-27 00:52:46 +00:00
Paul Duffin
b1a8813520 Dedup code for generating prebuilt_stubs_sources in snapshot
Removes duplicated code for generating a versioned and non-versioned
form of the prebuilt_stubs_sources module in the snapshot.

Bug: 143678475
Test: m nothing

Change-Id: Ic431b6fcb6f3c7c85f1a04cb6f087424aaf0cffa
2019-11-26 22:30:27 +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
Paul Duffin
50e7900744 Dedup code for generating java_import in snapshot
Removes duplicated code for generating a versioned and non-versioned
form of the java_import module in the snapshot.

Bug: 143678475
Test: m nothing and check output for dummy sdk
Change-Id: Ia8d05c3bf9ef79953a817b168dd9d59f2af2d2ce
2019-11-26 16:19:36 +00:00
Ulyana Trafimovich
9d8dab57a5 Merge "Revert "Do not dexpreopt system server jars from updatable modules."" 2019-11-26 13:07:48 +00:00
Ulyana Trafimovich
01f6b0a656 Revert "Do not dexpreopt system server jars from updatable modules."
This reverts commit 61c325ebcc.

Reason for revert: broken build git_master/cf_x86_phone-userdebug_coverage (likely caused by these changes).

Exempt-From-Owner-Approval: revert.

Change-Id: I88ddd3af3a6c4ffdaa1fbb881d965356c5c75ad3
2019-11-26 13:06:38 +00:00
Ulyana Trafimovich
40227e55be Merge "Do not dexpreopt system server jars from updatable modules." 2019-11-26 10:18:02 +00:00
Colin Cross
4b49b768a2 Make TestContext.RegisterModuleType take an android.ModuleFactory
Avoid having to pass ModuleFactoryAdaptor to every call to
RegisterModuleType in a test by wrapping RegisterModuleType.

Test: all soong tests
Change-Id: If8847d16487de0479cc3020b728256922b3cadba
2019-11-25 10:59:44 -08:00
Paul Duffin
62835fd85f Merge changes Ie274263a,I45993324
* changes:
  Adds droidstubs support to sdk module
  Simplify building an SDK snapshot from the command line
2019-11-25 17:32:53 +00:00
Ulya Trafimovich
61c325ebcc Do not dexpreopt system server jars from updatable modules.
Test: m

Test: The list of updatable system server jars is empty now,
  so I tested that the filer works with a manual experiment:
  - temporarily add ethernet-service to PRODUCT_UPDATABLE_SYSTEM_SERVER_JARS
  - m nothing
  - fgrep -e 'ethernet-service' $ANDROID_BUILD_TOP/out/soong/build.ninja | grep dexpreopt
  - expect empty output (no dexpreopt command is generated)

Change-Id: I0b231e823d5a5a97632daa2b5eb7be3e06782004
2019-11-25 16:36:57 +00:00
Paul Duffin
9154718303 Adds droidstubs support to sdk module
Adds stubs_sources property to sdk and unzips the droidstubs srcjar
into the snapshot directory.

Adds an UnzipToSnapshot method to the SnapshotBuilder which creates
a rule that uses zip2zip to repackage the supplied zip content into a
temporary zip file that matches what the required snapshot structure.
e.g. if the supplied zip contains foo/Foo.java and that needs to be in
the snapshot directory java/foo/stubs then it will create a zip that
contains java/foo/stubs/foo/Foo.java.

The temporary zip that is the output of that rule is added to the
zipsToMerge field for merging later.

If the zipsToMerge is empty then the snapshot zip is created as
before. Otherwise, a temporary zip file is created. That is then
merged with the other zip files in zipsToMerge to create the final
snapshot zip.

Adds prebuilt_stubs_sources for use by the generated .bp module.

Bug: 143678475
Test: added conscrypt sdk module and attempted to build it
Change-Id: Ie274263af3a08e36a73c61c0dbf0c341fd6967e2
2019-11-22 20:52:59 +00:00
Roshan Pius
9b51a4078a soong: Support system_server jars from apexes
Allow system_server jars delivered via apex. Regular system_server
jars are located in /system/framework folder. But, jars delivered via
apex are mounted at /apex/<module_name>/javalib.

Bug: 144722612
Bug: 141785760
Test: Compiles
Change-Id: Ia40bb91d2e05b2601a52eac28a985fe2d8da3481
2019-11-22 12:47:11 -08:00
Kyeongkab.Nam
c49971469f Fix incorrect install path for priv-app prebuilt
Dexpreopted files for privleged app prebuilt(android_app_import) are
installed wrongly to /system/app.
To fix this issue, install path is changed to /system/priv-app
in the case that "privileged" flag is true.

Bug: 144945646
Test: build and check dexpreopted files of privileged app are
      installed to /system/priv-app

Change-Id: Iec140119f58179a3eb0feeff7af2699fcc855fe7
2019-11-22 13:36:21 +09:00
Treehugger Robot
a21e9ddcf8 Merge "Fix test app and helper installation dirs." 2019-11-21 23:20:16 +00:00
Jaewoong Jung
326a9417ce Fix test app and helper installation dirs.
Fixes: 143902486
Test: app_test.go + m CtsIsolatedSplitApp
Change-Id: I3e1b8bf14cb9f440a6d8b0d2ac65525f00470cb8
2019-11-21 10:41:00 -08:00
Artur Satayev
c5b4f99104 Pass hiddenapi-greylist-max-q.txt to greylist generator.
Bug: 137350495
Test: m, manual inspection of out/soong/hiddenapi/hiddenapi-flags.csv
Change-Id: I67227307ec08ab56a385980eceacaab1b985eb49
Merged-In: I67227307ec08ab56a385980eceacaab1b985eb49
2019-11-20 10:46:16 +00:00
Jaewoong Jung
26dedd36ed Add override_android_test.
This change also adds instrumentation_target_package to android_test, so
that the target package name in a test manifest can be easily
overridden.

Fixes: 134624457
Test: app_test.go
Change-Id: Ib8dd703da0038ac76210c92d79e133e37c718122
2019-11-15 15:06:06 -08:00
Treehugger Robot
0f568b1237 Merge "Refactor sdk update mechanism" 2019-11-15 15:19:13 +00:00
Treehugger Robot
bc196606c3 Merge changes Ibcc1096e,I21ac2441
* changes:
  Install AndroidApp only when needed
  Reland: JNI lib is always embedded for APKs in APEX
2019-11-15 00:10:05 +00:00
Paul Duffin
0e0cf1dca5 Refactor sdk update mechanism
Creates a SnapshotBuilder and GeneratedSnapshotFile interfaces to allow
the java library snapshot work to be moved into the java package.

Test: m -j60 checkbuild
Change-Id: I857167616026149d5e85885621b53876b419ba9b
2019-11-14 17:49:02 +00:00
Jiyong Park
8ba50f953d Install AndroidApp only when needed
When an android_app is (directly or transitively) included in an APEX,
multiple variants of the app is created. The problem was that all the
variants were unconditionally installed to the device, which resulted in
duplicated targets. Fixing the problem by not installing the app when it
is included in APEX.

Bug: 144387414
Bug: 144135069
Test: m
Test: OUT_DIR=out DIST_DIR=out/dist build/soong/scripts/build-ndk-prebuilts.sh
Change-Id: Ibcc1096e30bc55a70ddc592490805f447e185eae
2019-11-14 00:39:53 +09:00
Jiyong Park
52cd06fc73 Reland: JNI lib is always embedded for APKs in APEX
If a JNI lib is depended on by an APK that is included in an APEX, the
lib is embedded inside the APK.

This change also fixes a bug that APKs are not mutated for APEXes.

Bug: 144135069
Test: m (apex_test.go amended)
Change-Id: I21ac24412b30c05afc03385655c6b196130dffe3
2019-11-14 00:39:47 +09:00
Sam Saccone
f9e10f9443 Merge "Revert submission" 2019-11-13 15:24:50 +00:00
Sam Saccone
e3c22f7a3f Revert submission
Reason for revert: b/144387414
Fixes: b/144387414
Change-Id: I21e15a4d149a5a8fefd0f84010600cb41b59db95
2019-11-13 15:24:11 +00:00
Jooyung Han
18020eabc4 make ApexProperties defaultable
ApexPropreties are added in InitApexModule() and they are supposed to be
defaultable. To be defaultable, InitApexModule() should be called before
InitDefaultableModule().

Bug: 144332048
Test: m (soong test added)
Change-Id: I6c90ed3b66a086292a4c0ecb37c61f83769e62bd
2019-11-13 05:52:57 +00:00
Treehugger Robot
d006779e3e Merge "JNI lib is always embedded for APKs in APEX" 2019-11-13 02:25:25 +00:00
Pete Gillin
31d57588c9 Merge changes I0d679648,I31542e7f
* changes:
  Remove the EXPERIMENTAL_USE_OPENJDK11_TOOLCHAIN option.
  Add a new option OVERRIDE_JLINK_VERSION_NUMBER.
2019-11-11 11:59:36 +00:00
Pete Gillin
a7a3d64a36 Remove the EXPERIMENTAL_USE_OPENJDK11_TOOLCHAIN option.
Previously, this setting environment variable to false reverted to an
OpenJDK 9 toolchain. This change removes that option.

Test: m core-all-system-modules
Test: zcat out/verbose.log.gz | grep 'prebuilts/jdk/jdk[0-9]*'
Test: EXPERIMENTAL_USE_OPENJDK11_TOOLCHAIN=false m core-all-system-modules (fails)
Bug: 131683177
Change-Id: I0d679648e1236925ce3ef7e1652379127e846b00
2019-11-11 11:03:58 +00:00
Ulyana Trafimovich
b21ed4281e Merge "Revert^4 "Package dexpreopt artifacts for libcore jars in the ART apex."" 2019-11-11 10:30:12 +00:00
Treehugger Robot
5666126133 Merge "Rearrange import order" 2019-11-11 04:57:09 +00:00
Jiyong Park
d237ad6d71 JNI lib is always embedded for APKs in APEX
If a JNI lib is depended on by an APK that is included in an APEX, the
lib is embedded inside the APK.

This change also fixes a bug that APKs are not mutated for APEXes.

Bug: 144135069
Test: m (apex_test.go amended)
Change-Id: Icf490d2701a7ede8bcad7e671fc72be9c8d7c01e
2019-11-11 12:40:09 +09:00
Treehugger Robot
80df439072 Merge "Enforce hidden apis usage in product(soong)" 2019-11-11 02:05:16 +00:00
Jeongik Cha
28df257fea Rearrange import order
Bug: 132780927
Test: m
Change-Id: I4b2c40bb0fb3dd5ff31f65811a6fef28e946f028
2019-11-11 10:46:36 +09:00
Treehugger Robot
c70d3c3cf6 Merge "APEX now correctly tracks jni_lib dependencies" 2019-11-09 13:53:08 +00:00
Ulyana Trafimovich
de534414b3 Revert^4 "Package dexpreopt artifacts for libcore jars in the ART apex."
This reverts commit bf0e47648a.

Reason for revert: coverage build with EMMA_INSTRUMENT_FRAMEWORK=true
is fixed by inspecting the environment variable and not generating
boot image in case it is set.

Dexpreopt artifacts for the libcore part of the boot class path are
now packaged in the ART apex. The system image still contains
dexpreopt artifacts for the full set of boot class path libraries
(both libcore and framework); the libcore part will be removed and
boot image extension will be used in a follow-up CL.

Since this is specific to the ART apex and makes no sense for other
apexes, the implementation adds a boolean flag "is ART apex" rather
than a new apex module property.

Build rules for the new set of dexpreopt artifacts are created using
a new variant of the global boot image config. Previously we had two
variants: "default" (for the system image) and "apex" (for the
JIT-zygote experiment). This patch adds a third "art" variant.

Test: m
Test: m art/build/apex/runtests.sh

Bug: 144091989
Change-Id: I113c0d39222d6d697cb62cd09d5010607872fc2b
2019-11-08 12:48:53 +00:00
Pete Gillin
a2affbbb00 Add a new option OVERRIDE_JLINK_VERSION_NUMBER.
This is a counterpart to the existing OVERRIDE_ANDROID_JAVA_HOME,
which is not very useful by itself in a Java module world. All jlink
commands will fail if a user sets OVERRIDE_ANDROID_JAVA_HOME without
setting OVERRIDE_JLINK_VERSION_NUMBER to the corresponding value
(unless they happen to be specifying a different OpenJDK 11
toolchain).

Test: OVERRIDE_ANDROID_JAVA_HOME=my-jdk10 OVERRIDE_JLINK_VERSION_NUMBER=10 m core-all-system-modules (with an OpenJDK 10 toolchain symlinked at my-jdk10 just for testing)
Test: zcat out/verbose.log.gz | grep 'jmod create'
Bug: 131683177
Change-Id: I31542e7f46303bba538d998171a3efe6d0215c7b
2019-11-08 12:34:07 +00:00
Paul Duffin
13a9dd604b Remove unnecessary constraint on previous_api
The constraint requires the previous_api property to be specified
unless validating nullness. However, there is no reason within the
Soong code why that should be.

The only use of previous_api is as the argument to the metalava
--migrate-nullness option which is only added when previous_api is
specified. So, there is no reason in the Soong code for the
constraint.

Metalava also does not require the --migrate-nullness option to be
specified unless validating nullness. So, there is no reason in
metalava for the constraint.

It is therefore safe to remove the constraint.

Bug: 142113521
Test: m checkbuild
Change-Id: I189071e215e928fdf43a39a03d540732743b7a32
2019-11-08 08:23:14 +00:00
Jiyong Park
8be103b04c APEX now correctly tracks jni_lib dependencies
Bug: 144135069
Test: m (apex_test.go amended)
Change-Id: If9dde4e2e62c2642267dbcac68bab76a032682c0
2019-11-08 15:53:48 +09:00
Jaewoong Jung
722b63c4c2 Merge "Install signed split apks." 2019-11-08 01:12:06 +00:00
Jaewoong Jung
5a49881eea Install signed split apks.
This fixes a bug where unsigned split apks were installed instead of
their signed counterparts.

Fixes: 140795853
Test: app_test.go
Test: m Split && apksigner verify --print-certs
Change-Id: I12cdbcaff9932b6388f920d7e03301d687c3bfdb
2019-11-07 14:16:38 -08:00
Colin Cross
eae43b858f Merge "Silence dep-ann warnings" 2019-11-07 21:46:46 +00:00
Ulyana Trafimovich
d4f1febbc3 Merge "Revert^3 "Package dexpreopt artifacts for libcore jars in the ART apex."" 2019-11-07 16:24:31 +00:00
Ulyana Trafimovich
bf0e47648a Revert^3 "Package dexpreopt artifacts for libcore jars in the ART apex."
Reason for revert: breaks the coverage build.
Exempt-From-Owner-Approval: revert

Change-Id: I4c3db7b085b101738813a7f3da6f0078bbaa587b
2019-11-07 16:23:47 +00:00
Colin Cross
759a577961 Merge "Fix turbine classpath arguments" 2019-11-07 15:03:28 +00:00
Ulyana Trafimovich
98774cfe5d Merge "Revert^2 "Package dexpreopt artifacts for libcore jars in the ART apex."" 2019-11-07 14:20:43 +00:00
Pete Gillin
72813feb12 Merge "Switch to an OpenJDK 11 toolchain by default." 2019-11-07 11:13:39 +00:00
Ulyana Trafimovich
66b3e99649 Revert^2 "Package dexpreopt artifacts for libcore jars in the ART apex."
This reverts commit 24babe3a66.

Build failures are fixed after reworking the patch:

  - 'missing dependencies' on aosp-master-art branch is fixed by
    disabling profile generation in case default profile is not
    found (it is part of framework absent in aosp-master-art)

  - invalid dex2oat invocation should no longer happen after
    disabling dexpreopt on targets that do not use default ART config
    (fixed in CL If2d4fe2cdcb6a81c7c6d730d18c2b681a74fb0b7)

Dexpreopt artifacts for the libcore part of the boot class path are
now packaged in the ART apex. The system image still contains
dexpreopt artifacts for the full set of boot class path libraries
(both libcore and framework); the libcore part will be removed and
boot image extension will be used in a follow-up CL.

Since this is specific to the ART apex and makes no sense for other
apexes, the implementation adds a boolean flag "is ART apex" rather
than a new apex module property.

Build rules for the new set of dexpreopt artifacts are created using
a new variant of the global boot image config. Previously we had two
variants: "default" (for the system image) and "apex" (for the
JIT-zygote experiment). This patch adds a third "art" variant.

Bug: 143594594
Bug: 143593500

Test: m
Test: m com.android.art deapexer \
    && find $ANDROID_BUILD_TOP -type f -name 'com.android.art.*.apex \
        | xargs deapexer | grep boot \
    Expect to find javalib/$ARCH/boot*.{art,oat,vdex} files.
Test: m art/build/apex/runtests.sh

Change-Id: Ib37acaec8401bd23c8d547dadf773565406ef448
2019-11-07 10:34:45 +00:00
Colin Cross
c2557d1d56 Fix turbine classpath arguments
We were passing "--classpath foo.jar --classpath bar.jar" to turbine,
it now wants (and may always have expected?)
"--classpath foo.jar bar.jar".

Test: m checkbuild
Change-Id: Ib7e0ca64a34e236110f7b785d6a0fb51ed75567e
2019-11-07 02:05:06 +00:00
Colin Cross
c228a7046f Silence dep-ann warnings
Silence the dep-ann warnings until there is an effort to do
something about them.

Test: m framework-minus-apex doesn't print dep-ann warnings.
Change-Id: Ic172e840dded4564fecfb91e96cba0c54358e20a
2019-11-07 00:19:54 +00:00
Jaewoong Jung
c6f22282ff Merge "Call shouldEmbedJnis only when needed." 2019-11-06 21:50:05 +00:00
Ramy Medhat
75c82fb518 Merge "Run non-RBE supported actions in the local pool when USE_RBE is set." 2019-11-06 18:36:18 +00:00
Adrian Roos
109f64766e Merge "API Lint: Archive lint errors" 2019-11-06 12:35:55 +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
Jaewoong Jung
9a9d0361bf Call shouldEmbedJnis only when needed.
Test: app_test.go
Change-Id: I4351b0ba5e1e7c89f16b4c891fcfbabb5c90c8c8
2019-11-05 20:13:26 -08:00
Ramy Medhat
dd0418a4d4 Run non-RBE supported actions in the local pool when USE_RBE is set.
Bug: 143938974
Test: ran CTS build at -j500 successfully.
Change-Id: I55074bd67308cd716972e24fb56a20bc393d5d9d
2019-11-05 22:57:35 +00:00
Pete Gillin
abbcddaaf4 Switch to an OpenJDK 11 toolchain by default.
Prior to this change, the default was to use and OpenJDK 9 toolchain,
with the EXPERIMENTAL_USE_OPENJDK11_TOOLCHAIN=true environment
variable available to opt into OpenJDK 11. After this change, the
default is to use OpenJDK 11, with
EXPERIMENTAL_USE_OPENJDK11_TOOLCHAIN=false available to opt out.

This change affects:
 - The version of javac used.
 - The version of javadoc used.
 - The version of other tools used during the build process (e.g. jar,
   jmod, and jlink).
 - For Java bytecode executed on the host, the version of the java
   executable used, and so the versions of the JVM and the OpenJDK
   libraries in the system module (or bootclasspath).

This change does not affect:
 - The Java language level, i.e. the version of Java expected in
   source code (the -source option to javac) or the version of Java
   bytecode produced (the -target option to javac).
 - Anything to do with code execution on the device.

Bug: 131683177
Test: make java droid docs cts tests
Test: zcat out/verbose.log.gz | grep 'prebuilts/jdk/jdk[0-9]*'
Test: make RunBluetoothRoboTests RunCarSettingsLibRoboTests
Test: cts-tradefed help
Test: atest CtsHostTzDataTests
Test: atest CtsLibcoreTestCases
Change-Id: I09dc22f1af4d1f2d7d3b85c08cb0ed9a1105aaca
Merged-In: Iaae89ef25c92ec099575c026fc50e41da4e143e8
2019-11-05 11:33:58 +00:00
Sasha Smundak
09950a4f4f Make the changes to emitXrefRule matching those in aosp/1145829
Test: build kzip
Bug: 121267023
Change-Id: Id3a70d113dd7c24071cbb7cbfbf138527991cb77
2019-11-04 16:35:32 -08:00
Adrian Roos
3b8f1cda45 API Lint: Archive lint errors
Adds reported lint errors to dist. This lets us track them and
build tooling on top.

Bug: 138440867
Test: make dist droid; ls -l out/dist/apilint
Change-Id: I75629e3d9e1a53d161d844dfac121a5998429e04
2019-11-04 19:04:52 +01:00
Ulyana Trafimovich
940ef19f77 Merge "Disable dexpreopt on targets that do not include default ART config." 2019-11-04 12:04:04 +00:00
Jiyong Park
5622d5351d Merge "stem property of java modules are propagated to Make" 2019-11-04 09:46:42 +00:00
Ulya Trafimovich
acb33e0b65 Disable dexpreopt on targets that do not include default ART config.
Dexpreopt build commands should only be generated on targets that
include build/make/target/product/runtime_libart.mk, which sets the
necessary variables such as PRODUCT_SYSTEM_DEFAULT_PROPERTIES that
contain default values passed to dex2oat. This file also sets a
variable PRODUCT_USES_DEFAULT_ART_CONFIG that is used in
build/make/core/dex_preopt.mk to decide if boot images should be
installed.

On some targets build/make/target/product/runtime_libart.mk is not
included. Prior to this patch, on such targets invalid dexpreopt
commands were generated, but not used, so they did not cause any
visible build failures. The invalid commands can be grepped as:

  lunch qemu_trusty_arm64-userdebug && m nothing \
    && fgrep -e '-Xms ' $ANDROID_BUILD_TOP/out/soong/build.ninja

In this case '-Xms ' is an ill-formed option passed to dex2oat (the
option expects one argument, but none is passed).

This patch makes the DisablePreopt variable passed from make to
soong more strict: it not only requires WITH_DEXPREOPT, but also
PRODUCT_USES_DEFAULT_ART_CONFIG. This means that dexpreopt commands
will not be generated on targets that do not include
build/make/target/product/runtime_libart.mk.

Test: lunch aosp_walleye-userdebug && m \
    && find $ANDROID_BUILD_TOP/out -name 'boot.art'
    # expect to find files in /out/target/product/walleye/system/framework/$ARCH/

Test: lunch qemu_trusty_arm64-userdebug && m \
    && fgrep -e '-Xms ' $ANDROID_BUILD_TOP/out/soong/build.ninja
    # expect empty output

Change-Id: If2d4fe2cdcb6a81c7c6d730d18c2b681a74fb0b7
2019-11-01 17:59:42 +00:00
Jeongik Cha
75b83b0a81 Link type will be check in android_library also
For now, Soong checks link-type in java_library, so it cannot block hidden api usage from android_library that app links with.
So we should add check in 'android_library'

Test: m nothing
Change-Id: Ic040270ec668bdd693b690ac8a88be1048922c3b
2019-11-01 15:29:15 +09:00
Jiyong Park
0b2387551b stem property of java modules are propagated to Make
62c7829595c0df53e96addcd347c11ac01012eee introduced the new stem
property to java modules, but it wasn't propagated to Make. Fixing the
problem.

This change also fixes a problem that (module name) == (file name) is
assumed in dexpreopt_config.go, which no longer is the case. A mutator
runs to build a map from module name to its stem. The map is then used
when filling up the file paths in the bootImageConfig struct.

Bug: 139391334
Bug: 143494499
Test: m
Test: BootImageProfileTest
Change-Id: Idbc894f877692401471130de6cbfe5e0dd129da9
2019-10-31 22:13:05 +09:00
Jiyong Park
9495b76fbd Remove api_srcs property from java_sdk_library
The property is no longer used.

Bug: 141149570
Test: m
Change-Id: I3136c7b03138296dc59127f596f7e96502edf608
2019-10-31 20:38:14 +09:00
Nicolas Geoffray
8a947aeefc Merge "Revert "Package dexpreopt artifacts for libcore jars in the ART apex."" 2019-10-30 11:28:12 +00:00
Nicolas Geoffray
24babe3a66 Revert "Package dexpreopt artifacts for libcore jars in the ART apex."
This reverts commit d5df949385.

Bug: 143594594
Bug: 143593500
Reason for revert: Some builds are failing.

Change-Id: I69986b472bce39266095e526fcd7ef5f48ece85e
Exempt-From-Owner-Approval: Going back to green.
2019-10-30 11:27:58 +00:00
Ulyana Trafimovich
b30d91cbc5 Merge "Package dexpreopt artifacts for libcore jars in the ART apex." 2019-10-30 10:13:32 +00:00
Treehugger Robot
520367cbd3 Merge "Add support for including app prebuilts in APEX." 2019-10-29 23:02:38 +00: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
Colin Cross
6cef481ee7 Use java language 1.9 for sdk_version: "current"
Java language was set for 1.8 for anything building against the
current SDK because the stubs were not built in Soong, so the
system modules could not be built.  The stubs have been built
in Soong since Iabd32b30954b3f4a6d9a779fde52a032b684807e, but
I5e870c34dd0ebc8ae3f888ec627da590c846a76f missed updating
this TODO.

Use 1.9 when building against the stubs, but continue using
1.8 for unbundled builds until we have prebuilt system modules.

Always use the core-current-stubs-system-modules to avoid
splitting android.* packages between the system modules and
the classpath, which would cause new classes in android.*
packages in classpath jars to be ignored.  Add a new
java9Classpath field to sdkDep that will contain the stubs jar
when targeting Java language level 1.9, and plumb it through
to javac and turbine.  Rename the modules field to bootclasspath.

Bug: 142896162
Test: m checkbuild
Change-Id: Icfd32d0a863b2303a997c7cf03cb3708aade4724
2019-10-29 13:35:39 -07:00
Colin Cross
6d8d8c6a91 Remove special case for sdk_version: "none"
The dependency handling for sdk_version: "none" (which propagated to
!sdkDep.hasStandardLibs()) was very similar to the normal useModule
case.  Combine the cases by making decodeSdkDep set useModule: true
and put the system modules in modules for the sdk_version: "none"
case.

Test: TestClasspath
Change-Id: Icc9ff4d43a38da25cc0e3628be95951d61773ad5
2019-10-29 13:35:39 -07:00
Colin Cross
bf3119ee35 Use system modules for turbine
turbine supports taking system modules on the command line,
now that we target Java language level 1.9 and use system modules
by default switch turbine to match javac.

Test: m javac-check
Change-Id: Ieee07502151da0d5693bb8929213d495c039106b
2019-10-29 13:35:39 -07: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
Colin Cross
74362a4d5e Move TestConfig sdk versions forward
The SDK version in TestConfig is very old, move it forward to trigger
the newer javaVersion code paths.

Bug: 142896162
Test: all Soong tests
Change-Id: Iaf2a6f6dfef43b006b0a09f193fbc2d2e103d90d
2019-10-28 14:55:03 -07:00
Colin Cross
617b1451b4 Split java 8 and 9 classpaths in TestClasspath
In preparation for adding the system modules jars to the classpath
for java 9, split the expected java 8 and java 9 classpaths into
separate fields.  Also replace the system: "bootclasspath" special
case with a bool that specifies that the module will always be
built using a java 8 style command line.

Test: TestClasspath
Change-Id: I661ec50d77a039c435c03bc8e6443cc5a57c206e
2019-10-28 14:55:03 -07:00
Dario Freni
cde2a037f6 Add support for including app prebuilts in APEX.
Bug: 138429615
Test: Created an APEX containing CtsShimPrebuilt and
CtsShimPrivPrebuilt.
Change-Id: I9d138ccfc03e4b96c9989d2681ad4e4ad5f20108
2019-10-28 16:05:32 +00:00
Treehugger Robot
05491b4861 Merge "Default to compiling lite protos" 2019-10-28 15:21:02 +00:00
Ulya Trafimovich
d5df949385 Package dexpreopt artifacts for libcore jars in the ART apex.
This patch adds dexpreopt files for the libore part of the
bootclasspath to the ART apex.

Since this is specific to the ART apex and makes not sense for other
apexes, the patch does not add a new module property, but only a
boolean flag denoting that this is an ART apex.

Dexpreopt artifacts packaged into the ART apex differ from those that
are packaged in the system image: it inludes only the libcore part of
bootclasspath jars, but not the framework part. When the boot image
extension is implementd, dexpreopt artifacts for the libcore jars will
be removed from the system image (but for now they are both in the
apex and in the system image).

Build rules for the new set of dexpreopt artifacts are created using
a new variant of the global boot image config. Previously we had two
variants: "default" (for the system image) and "apex" (for the
JIT-zygote experiment). This patch adds the third "libcore" variant.

Test: m
Test: m com.android.art deapexer \
    && find $ANDROID_BUILD_TOP -type f -name 'com.android.art.*.apex \
        | xargs deapexer | grep boot \
    Expect to find dexpreopt/$ARCH/boot-art*.{art,oat,vdex} files.
Test: m art/build/apex/runtests.sh

Change-Id: I353ef90304bc5e18c3055ea379b3b223e5c38948
2019-10-28 14:03:08 +00:00
Pete Gillin
ef99a4b06e Merge "Remove support for EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9." 2019-10-28 10:28:19 +00:00
Treehugger Robot
d3f11c13b1 Merge "add stem property to java modules" 2019-10-28 06:23:32 +00:00
Colin Cross
0f97adae5f Default to compiling lite protos
Soong was incorrectly defaulting to compiling for full protos but
using the lite runtime.  Switch to compiling lite protos by default.

Fixes: 119714316
Test: m checkbuild
Change-Id: I0832b854f01f2acb10682e68ce7cc68753ca9dda
2019-10-26 20:35:13 +00:00
Pete Gillin
a1c9e9da55 Remove support for EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9.
Prior to this change, setting that to "false" turned the default Java
language level back to 8. This change removes that option.

Bug: 115604102
Test: m java droid docs tests cts
Change-Id: I97bfd0dc8d941008b4071c6efe1c0c24950c4f1f
2019-10-25 16:55:06 +01:00
Jiyong Park
4c4c02400f add stem property to java modules
java_library, java_import and dex_import now support stem property to
set the output file name.

Bug: 139391334
Test: m
Merged-In: I11146badf558e524a973806114b9cb1344db4a6e
(cherry picked from commit 62c7829595c0df53e96addcd347c11ac01012eee)
Change-Id: I11146badf558e524a973806114b9cb1344db4a6e
2019-10-25 10:40:56 +09:00
Ulya Trafimovich
18263381ed Deduplicate config generation for boot images.
Both default and apex configs are used for dexpreopting bootclasspath
jars. The difference between the two configs is in the naming (default
paths contain "boot", and apex paths contain "apex"). Another
difference is that apex config does not have a zip archive.

Test: m
Test: `find $ANDROID_BUILD_TOP/out -name '*.art' | sort`
    returns the same list of files before and after the patch

Change-Id: I5b2e8d83ab94fd0b1b3d4dc3f0db243ef70bfb08
2019-10-23 17:19:17 +01:00
Pete Gillin
e195591829 Merge "Refactor and strengthen sdk_test.go." 2019-10-22 10:46:27 +00:00
Nicolas Geoffray
43118dc1fc Merge "Remove support for stripping dex." 2019-10-22 09:48:06 +00:00
Pete Gillin
bdf5d7170a Refactor and strengthen sdk_test.go.
This change:

- Removes usage of the EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9=false option
  from tests, since it is going to be removed. The java_version
  property is used instead.

- Commons up some of the assertions between the tests for language
  levels 8 and 9 in sdk_test.go.

- In commoning the code up, some additional assertions are made in the
  language level 9 cases, strengthening the tests.

Test: m nothing
Bug: 115604102

Change-Id: I693c5d299b5592b851c44dde4434d92a931f15cd
2019-10-21 14:36:41 +01:00
Jerome Gaillard
8436ccea9c Merge "Update droidstubs build target" 2019-10-21 09:32:12 +00:00
Treehugger Robot
8141c8781a Merge "Add tradefed_java_library_host" 2019-10-19 02:45:42 +00:00
Colin Cross
f0f2e2cf79 Add tradefed_java_library_host
Add a module type for tradefed libraries that causes an additional
copy to be installed at out/host/linux-x86/tradefed.

Bug: 122332235
Bug: 141877526
Test: m tradefed
Change-Id: Ib7160dd060ad83d2dfb81d6a7106cb0dac98553e
2019-10-18 15:14:15 -07:00
Nicolas Geoffray
c1bf724207 Remove support for stripping dex.
Stripping is incompatible with ART module updatability.

Bug: 65154345
Bug: 138851227

Test: build and observe no change in output (stripping is not used by
default).

Change-Id: I4bbc01d9979605b7dd2f73ee99a74c1e817c3e8c
2019-10-18 14:52:16 +01:00
Jerome Gaillard
0f59903d09 Update droidstubs build target
This allows to use Metalava to generate metadata files useful for
Android Studio as part of a droidstubs target.
Once those files have been created in a new metadata folder, they are
zipped to make it easier to transfer them into the
out/target/common/obj/PACKAGING folder where they can then be picked up
by the SDK build to be included there.

Bug: 142480924
Test: m sdk
Change-Id: I4be1c9e78369c65ee9cd94706c6d20ab0df6b797
2019-10-18 14:21:55 +01:00
Treehugger Robot
d091c6a67a Merge "Support privleged app in APEX" 2019-10-18 01:30:39 +00:00
Treehugger Robot
c5bba642f1 Merge "Prohibit dependencies outside of uses_sdks" 2019-10-18 00:30:18 +00:00
Colin Cross
ad4a597c79 Merge "Add method to determine variations from a Target" 2019-10-17 18:52:20 +00:00
Pete Gillin
4fe25b05b9 Merge "Enable Java language level 9 by default." 2019-10-17 10:38:35 +00:00
Jiyong Park
f7487318ac Support privleged app in APEX
privileged apps are installed to priv-app dir in APEX

Test: m
Change-Id: I8141e1c20e9486655606fa43b949783f11da09f4
2019-10-17 12:54:30 +09:00
Jiyong Park
a7bc8ad0b9 Prohibit dependencies outside of uses_sdks
When an APEX is built with uses_sdks, any depedndency from the APEX to
the outside of the APEX should be from the SDKs that the APEX is built
against.

Bug: 138182343
Test: m

Change-Id: I1c2ffe8d28ccf648d928ea59652c2d0070bf10eb
2019-10-17 11:19:53 +09:00
Treehugger Robot
d7d5e5a1ac Merge "Create scripts to update and freeze a module SDK" 2019-10-17 01:02:16 +00:00
Colin Cross
0f7d2ef3ac Add method to determine variations from a Target
The arch variants are hardcoded in every module type.  Refactor
them out into a Target.Variations() method in preparation for
splitting the arch mutator into two, which will require using
different variations.

Test: m checkbuild
Change-Id: I28ef7cd5168095ac888fe77f04e27f9ad81978c0
2019-10-16 14:52:30 -07:00
Adrian Roos
49a1384b11 Merge "API Lint: Apply Javadoc.args when invoking api lint" 2019-10-16 12:07:52 +00:00
Pete Gillin
1b3370f5d7 Enable Java language level 9 by default.
This changes the default Java language level from 8 to 9, i.e. javac
invocations now use -source 1.9 -target 1.9.

The environment variable EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9=false is
added to switch back to the language level 8 behaviour. (Previously,
setting that variable to true was required to opt in to language level
9.)

Test: make droid java tests cts docs
Test: javap -v <some class file in output> | grep 'major version' (reports 53, for classes from 'benchmarks' which is in Android.bp and 'ahat' which is in Android.mk)
Test: make RunBluetoothRoboTests RunCarSettingsLibRoboTests (two main flavours of robolectric)
Test: make cts && cts-tradefed help
Test: atest CtsLibcoreTestCases (reasonably low-level device tests)
Test: atest CtsHostTzDataTests (arbitrary host test)
Bug: 115604102
Change-Id: I9de888e1df021244d5e61c40934178676f09ecc7
Merged-In: I52be1817fa7121fca3bce3d8857cb9ed0825570c
2019-10-16 11:20:13 +01:00
Jiyong Park
9b409bcd10 Create scripts to update and freeze a module SDK
`m <sdk_name>` generates two scripts each of which is use to update the
current snapshot of the SDK and to freeze ToT as a new version,
respectively. Executing the scripts will copy necessary files (stub
libraries, AIDL files, etc.) along with Android.bp into the ./<apiver>
directory under the directory where the sdk is defined.

This change also introduces a new module type 'sdk_snapshot' that
represents a snapshot of an SDK. It will be auto-generated by the above
scripts, so developers are not expected to write this manually.

The module type 'sdk' is now used to simply specify the list of modules
that an SDK has.

Finally, this change changes the version separator from '#' to '@'
because '#' confuses Make.

Bug: 138182343
Test: m

Change-Id: Ifcbc3a39a2f6ad5b4f4b200ba55a1ce3281498cf
2019-10-15 18:49:58 +09:00
Treehugger Robot
d90d208628 Merge "AIDEGen: Remove the duplicate *.srcjar from srcs" 2019-10-15 01:51:37 +00:00
Adrian Roos
cab4a2c84a API Lint: Apply Javadoc.args when invoking api lint
Bug: 142459906
Test: make checkapi
Change-Id: I64c83a8064491303088cca713537c391f1a3d876
Merged-In: I64c83a8064491303088cca713537c391f1a3d876
2019-10-14 16:33:08 +02:00
patricktu
242faad111 AIDEGen: Remove the duplicate *.srcjar from srcs
AIDEGen collects the complied sources which are generated from build
system, the sources includes not only java/kt files but also srcjar
files. Since the srcjar files are record in srcjars parameter in json
file, we should keep only java or kt files in the srcs parameter.

The size diff of module_bp_java_deps.json:
Without this patch: 15,298,369 Bytes
With this patch: 15,044,804 Bytes

The build time diff:
Without this patch: 2m31.345
With this patch: 2m32.662

Bug: 141528361
Test: 1. m clean -j
      2. aidegen tradefed
      3. Open out/soong/module_bp_java_deps.json
      4. Find the module CtsSyncManagerCommon and check the
         sync_manager_cts.srcjar files doesn't exist in srcs but exists
         in srcjars section.

Change-Id: I43fc5c05b657473054e632cae4795220907dc711
2019-10-14 10:16:17 +08: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
Adrian Roos
075eedc38d droidstubs: Add API lint via metalava
Bug: 142459906
Test: make checkapi
Change-Id: I12fe864ef568ff6f5565106f7f24349f129decd7
2019-10-10 12:09:40 +00:00
Pete Gillin
1f52e93db2 Add experimental option to use OpenJDK 11 toolchain.
With this change, setting the environment variable
EXPERIMENTAL_USE_OPENJDK11_TOOLCHAIN=true switches from the OpenJDK 9
toolchain to the OpenJDK 11 one (prebuilts/jdk/jdk11).

Since the version of the java.base module has to match the version of
the jlink tool which consumes it, the --module-version argument to the
jmod create call is also switched.

Test: make
Test: EXPERIMENTAL_USE_OPENJDK11_TOOLCHAIN make
Bug: 131683177
Change-Id: I606d22538165f309fe5537bd67a26390b1dd5771
2019-10-09 18:38:14 +01:00
Pete Gillin
df7dc82a04 Remove the moduleName parameter to jarsToSystemModules.
This rule takes a moduleName parameter which only ever has the value
java.base. What's more, the assuption that the value will always be
java.base is baked into the rule in other ways (most significantly,
the module created with this name is passed to jlink, and jlink
requires a java.base module).

This change removes the parameter and hard-codes java.base everywhere,
on the basis that it's better to have it completely hard-coded than
partially configurable and partially hard-coded.

Test: make
Change-Id: Ib42cda92f623c5a1f929b5a99248ca8919e4700c
2019-10-09 17:09:38 +01:00
Treehugger Robot
c6136c9d65 Merge "Remove old-style support for translated second architectures" 2019-10-07 20:48:07 +00:00
Colin Cross
c080617c8b Shard aidl compiles into srcjars
Group aidl files into groups of 50 and compile them together into a
srcjar.

Bug: 124333557
Test: m checkbuild
Change-Id: I18e0858eab434071d3ff0039bb21e07c7311b601
2019-10-04 14:00:36 -07:00
Colin Cross
9516a6c3f2 Shard java proto files into groups of 100
Group protoc calls to generate java files into groups of 100
to avoid having a srcjar for every proto file.

Test: m checkbuild
Change-Id: I72a5efaabad24c975282df321d00ec2d7900645e
2019-10-04 14:00:36 -07:00
Colin Cross
ff6c33d885 Replace RelPathString() with ToMakePath()
Add a ToMakePath() method that returns a new path that points out
out/ instead of out/soong/, and replace the
"$(OUT_DIR)/" + path.RelPathString()
pattern with
path.ToMakePath().String()

Bug: 141877526
Test: m checkbuild
Change-Id: I391b9f2ed78c83a58d905d48355ce9b01d610d16
2019-10-03 10:07:53 -07:00
Colin Cross
70dda7e3da Separate InstallPath from OutputPath
Create a new type InstallPath that is similar to OutputPath to
differentiate intermediates output paths from installed output
paths.

RelPathString is a poorly defined, undocumented function that is
primarily used to get an install path relative to out/soong to
generate an equivalent install path for Make relative to $(OUT_DIR).
Move it to InstallPath for now, and fix the one remaining user on
OutputPath.

Add a method to create an NDK install path so that ndk_sysroot.go
doesn't have to do it manually with PathForOutput.

Bug: 141877526
Test: m checkbuild
Change-Id: I83c5a0bd1fd6c3dba8d3b6d20d039f64f353ddd5
2019-10-03 10:07:53 -07:00
Treehugger Robot
f856c005cb Merge changes from topic "soong_c_flags"
* changes:
  Creation of C Flags Build Variables
  Move sharding functions for reuse
2019-10-01 19:25:50 +00:00
Jaewoong Jung
9dc1756484 Merge changes I3d6506f5,I3667eac9
* changes:
  Fix split apk paths.
  Fix android_test install path.
2019-10-01 16:54:40 +00:00
Colin Cross
0a2f719bca Move sharding functions for reuse
Move shardPaths and shardTests to android.ShardPaths and
android.ShardStrings for reuse in other packages.

Test: m checkbuild
Change-Id: I868802872c73616b80f56cbf11f959c01a8b793a
2019-09-29 23:26:37 -07:00
Jaewoong Jung
7dd4ae2fb9 Fix split apk paths.
Soong has been outputting incorrect Android.mk entries for split apks.
soong_app_prebuilt.mk expects LOCAL_SOONG_BUILT_INSTALLED to contain a
list of <split apk path>:<on device install path> pairs whereas Soong
outputs <split apk path>:$(LOCAL_MODULE_PATH)/<split apk filename> pairs.

This also adds a missing underscore in split apk filenames.

Test: m Split
Bug: 140795853
Change-Id: I3d6506f5e12106174fbbaef34749a272b5e1b90c
2019-09-27 17:13:15 -07:00
Jaewoong Jung
0949f31657 Fix android_test install path.
Test: m nothing + diff soong mk and ninja files.
Bug: 140795853
Change-Id: I3667eac951dea7e447cf73219ff89199fca9ed63
2019-09-27 16:42:20 -07:00
Treehugger Robot
318c9c5d17 Merge "Pass filename mappings to C++ and Java extractors." 2019-09-27 20:00:44 +00:00
Sasha Smundak
651436460a Pass filename mappings to C++ and Java extractors.
Android builds by default put artifacts into out/ subdirectory of
the source tree, causing the extractor to record their names as
relative. The indexer considers such files as sources, which is wrong.
Fortunately, the extractor can be fed a set of filename rewriting
rules (see build/tools/vnames.json).
Also, undo previous unsuccessful attempt use to absolute path for the
output directory to distinguish between source code and artifacts.

Bug: 141385476
Test: run the build, inspect compilation units of the kzip file
Change-Id: I89ec3aed8fd14f43ea6e0b226d54f643346f6125
2019-09-27 10:28:11 -07:00
Jaewoong Jung
9a1e8bdd0b Migrate java/androidmk.go to new system #2
This change migrates remaining AndroidMk()s in java/androidmk.go to
AndroidMkEntries().

Test: Soong tests
Test: Built a system image
Test: Manual inspection of diffs
Change-Id: Ib1107fafb175fdfd8539bf6158548224e4c87a6d
2019-09-27 08:10:39 -07:00
Jaewoong Jung
2784fda152 Merge "Migrate java/androidmk.go to new system #1" 2019-09-27 14:40:24 +00:00
Paul Duffin
2e3e5e3e76 Remove unused core-system-modules
Soong tests no longer need to define a dummy version of this.

Test: m checkbuild
Bug: 141613583
Change-Id: Iad12560aedc74a499808bd52d9ea09ab0d68d743
2019-09-27 10:38:06 +01:00
Dan Shi
933b619383 Merge "Allow test to specify whether or not to auto-generate test config" 2019-09-27 00:01:12 +00:00
Dan Shi
6ffaaa830d Allow test to specify whether or not to auto-generate test config
Attribute `auto_gen_config` is added to test modules.
Test config will be generated if:
the attribute is not set and AndroidTest.xml doesn't exists
or
the attribute is set to true, whether or not AndroidTest.xml exists.

Test config will NOT be auto-generated if:
the attribute is not set and AndroidTest.xml exists
or
the attribute is set to false, whether or not AndroidTest.xml exists.

Bug: 141684102
Test: build test module with auto_gen_config set to true
Change-Id: I64fb003a83d8c32a967835e5f8d12fe4476043be
2019-09-26 13:29:28 -07:00
Colin Cross
84dfc3d331 Make CreateModule take an android.ModuleFactory
Reduce the boilerplate required to call CreateModule by taking an
android.ModuleFactory instead of a blueprint.ModuleFactory.

Test: m checkbuild
Change-Id: I1259d2dd3f7893b5319c333bc180727ac40f9e91
2019-09-26 17:19:26 +00:00
Treehugger Robot
ec3e81b4be Merge "Move sysprop gen code to sysprop module" 2019-09-23 22:25:40 +00:00
Paul Duffin
2b6f04ca42 Merge "Add custom SystemModules to bootclasspath to reduce duplication" 2019-09-23 10:31:40 +00:00
Inseob Kim
988f53cf5a Move sysprop gen code to sysprop module
sysprop_library now generates srcjar itself, effectively cutting the
implicit dependency from java module to sysprop module.

Bug: 131637873
Test: m {sysprop_library}-dump-api
Test: m (with no arguments) performs API check
Change-Id: Ia11a744e74b6f733ff0e30d194fbba22505ed644
2019-09-23 15:34:06 +09:00
Treehugger Robot
b1102ba828 Merge "Introduce module type 'sdk'" 2019-09-23 04:38:24 +00:00
Jiyong Park
d1063c1586 Introduce module type 'sdk'
This change introduces a new module type named 'sdk'. It is a logical
group of prebuilt modules that together provide a context (e.g. APIs)
in which Mainline modules (such as APEXes) are built.

A prebuilt module (e.g. java_import) can join an sdk by adding it to the
sdk module as shown below:

sdk {
    name: "mysdk#20",
    java_libs: ["myjavalib_mysdk_20"],
}

java_import {
    name: "myjavalib_mysdk_20",
    srcs: ["myjavalib-v20.jar"],
    sdk_member_name: "myjavalib",
}

sdk {
    name: "mysdk#21",
    java_libs: ["myjavalib_mysdk_21"],
}

java_import {
    name: "myjavalib_mysdk_21",
    srcs: ["myjavalib-v21.jar"],
    sdk_member_name: "myjavalib",
}

java_library {
    name: "myjavalib",
    srcs: ["**/*/*.java"],
}

An APEX can specify the SDK(s) that it wants to build with via the new
'uses_sdks' property.

apex {
    name: "myapex",
    java_libs: ["libX", "libY"],
    uses_sdks: ["mysdk#20"],
}

With this, libX, libY, and their transitive dependencies are all built
with the version 20 of myjavalib (the first java_import module) instead
of the other one (which is for version 21) and java_library having the
same name (which is for ToT).

Bug: 138182343
Test: m (sdk_test.go added)
Change-Id: I7e14c524a7d6a0d9f575fb20822080f39818c01e
2019-09-22 08:21:27 +09:00
Paul Duffin
68289b0efd Add custom SystemModules to bootclasspath to reduce duplication
Adds a library dependency to each of the dummy system modules created
by testing.go so that any changes in the behavior were detected by
the existing tests which were then fixed.

Bug: 141359858
Test: m checkbuild
Change-Id: Id4442f4aa3931ac93049f3367b96a5b49cc075e1
2019-09-20 14:52:56 +01:00
Colin Cross
3b19f5d71d Remove old-style support for translated second architectures
Translated second architectures now go in NativeBridgeArch instead
of DeviceSecondaryArch.

This reapplies I568046330abc002d4eed582cb999b62a5eaba790 with
ctx.Config().HasMulitlibConflict() added to fix the NDK build,
which has arm64, arm, x86_64, and x86 architectures enabled.

Test: m checkbuild
Test: OUT_DIR=out_ndk build/soong/scripts/build-ndk-prebuilts.sh
Test: no change to build.ninja or Android-aosp_cf_x86_phone.mk
Change-Id: Iadcafbd64bfb9579ae7c86914927c43a062b0c8e
2019-09-19 12:54:32 -07:00
Treehugger Robot
624dbac225 Merge "Add filter_packages property to droiddoc" 2019-09-19 13:24:46 +00:00
Colin Cross
4c5032bb66 Merge "Revert "Remove old-style support for translated second architectures"" 2019-09-18 21:12:45 +00:00
Colin Cross
402be41aa8 Revert "Remove old-style support for translated second architectures"
This reverts commit fe6330c7d2.

Reason for revert: this was accidentally propping up NDK builds
Bug: 141242600
Change-Id: Ie9f8e31479a74e8e9e14d720a5936da6b1d5d113
2019-09-18 21:12:31 +00:00
Treehugger Robot
da62bf96ce Merge "Remove old-style support for translated second architectures" 2019-09-18 20:47:43 +00:00
Colin Cross
e323f3cca3 Fix robolectric tests with sdk_version and prebuilt dependencies
Add deviceProperties to robolectric tests so they can set
sdk_version.  Use Dependency.BaseModuleName() instead of
ctx.OtherModuleName() to get the dependency name to pass to Make
to support prebuilts in libs, which may have a "prebuilt_" prefix
in ctx.OtherModuleName().

Test: m RunLauncherRoboTests
Change-Id: I59a889bd6107b989f336b147d0eaccabef611894
2019-09-18 16:33:27 +00:00
Colin Cross
fe6330c7d2 Remove old-style support for translated second architectures
Translated second architectures now go in NativeBridgeArch instead
of DeviceSecondaryArch.

Bug: 141242600
Test: m checkbuild
Change-Id: I568046330abc002d4eed582cb999b62a5eaba790
2019-09-18 16:23:18 +00:00
Jiyong Park
c6ddccfa88 Add filter_packages property to droiddoc
The property is used to filter input source files by their package
names.

Bug: 140764681
Test: m
Change-Id: If31adb81055ea7953ccd589344bdd298eaacedda
2019-09-17 12:25:44 +09:00
Elliott Hughes
26bce340e3 Track switch to toybox date for macOS.
Bug: http://b/139450866
Test: builds
Change-Id: I5ab0d20d761bcd03f3bee18b8343a2f8aa5e2275
2019-09-12 15:05:13 -07:00
Colin Cross
4e08ead52f Merge changes from topic "protobuf-3.9.1"
* changes:
  Add suffix and target.vendor.suffix to shared libraries
  Make javanano a plugin
2019-09-11 18:00:16 +00: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
Jaewoong Jung
b0c127cfd7 Migrate java/androidmk.go to new system #1
This change migrates some of AndroidMk()s in java/androidmk.go to
AndroidMkEntries(), mainly focusing on deduping test-related helper
funcs.

Test: Soong tests
Test: Built a system image
Test: Manual inspection of diffs
Change-Id: I7810085521600d9ea2df078837688ade41c04825
2019-09-10 07:38:31 -07:00
Colin Cross
6617b6d624 Merge "Use prebuilts for more tools in unbundled builds" 2019-09-09 17:21:44 +00:00
Elliott Hughes
2b9e20ef82 Merge "Use toybox md5sum instead of md5 on macOS." 2019-09-07 04:00:00 +00:00
Elliott Hughes
34b49d1402 Use toybox md5sum instead of md5 on macOS.
Test: builds locally
Change-Id: I04aa52de96e0525a44331cb0c057a8e18a95891d
2019-09-06 14:42:24 -07:00
Colin Cross
6ac046000f Make javanano a plugin
Treat proto.type: "javanano" as a plugin by explicitly passing the
path to protoc-gen-javanano.  This allows removing the javanano
customizations from the core plugin code, which no longer supports
javanano natively.

Bug: 117607748
Test: m checkbuild
Change-Id: Id7ed92d45583a7930f35c6734605d9304704bdbc
Merged-In: Id7ed92d45583a7930f35c6734605d9304704bdbc
2019-09-06 14:18:01 -07:00
Treehugger Robot
2895bf7182 Merge "Shard kythe invocations when javac is sharded" 2019-09-06 04:50:23 +00:00
Colin Cross
3b706fde7f Shard kythe invocations when javac is sharded
The kythe pipeline has trouble injesting all 6000 files of
framework.jar at once.  Shared invocations of the kythe extractor
when javac is sharded to produce multiple smaller kzip files.

Bug: 140426870
Test: no change to build.ninja
Test: m out/soong/.intermediates/frameworks/base/framework/android_common/framework0.kzip
Test: TestSharding in java_test.go
Change-Id: I867db4ef5cb1e7f3ce8359a46aac2c00ed8a8912
2019-09-05 16:49:11 -07:00
Treehugger Robot
5afe2d6869 Merge "Support including apk inside an apex" 2019-09-05 23:43:33 +00:00
Colin Cross
2ff22ae575 Merge "Bring back env flag to skip checkapi" 2019-09-05 22:55:33 +00:00
Luca Stefani
d63ea0a98f Bring back env flag to skip checkapi
* This was removed while moving to soong

Change-Id: Ibb41838b891a8a7ede48e687e8da16f87ad0a57b
2019-09-04 12:20:15 +02:00
Sundong Ahn
e1f05aaf44 Support including apk inside an apex
New property "apps" is added to APEX soong module. This property
configure a list of APKs to package inside APEX payload. For each
android_app module package it's APK into /app/$(android_app module Name)
directory.

Bug: 139906763
Test: m -j
Change-Id: Ic6655f211951af08097c76e157a07ebc52425718
2019-09-04 12:10:00 +09:00
Martin Stjernholm
242d9ed1ca Update dexpreopt for the ART APEX name change.
am: cc4b0ad706

Change-Id: I925557842275381d5a8754771a39cf72821628f0
2019-09-02 03:43:53 -07:00
Martin Stjernholm
cc4b0ad706 Update dexpreopt for the ART APEX name change.
Test: Build & boot
Bug: 135753770
Exempt-From-Owner-Approval: Approved internally
Change-Id: I3aac9112b022cce3ef8cfdf4bdbbed8bb0c8f4c7
Merged-In: I3aac9112b022cce3ef8cfdf4bdbbed8bb0c8f4c7
2019-08-30 17:47:30 +01:00
Treehugger Robot
7153b767a5 Merge changes from topic "drop_circular_dep"
* changes:
  Remove srcs_lib and srcs_lib_whitelist_pkgs
  Remove the automatic dependency to framework-res.apk for R/Manifest
  Prepare to be able to put framework-res in srcs
2019-08-30 13:47:31 +00:00
Jiyong Park
2867f766d4 Merge changes from topic "drop_circular_dep" into stage-aosp-master
* changes:
  Remove srcs_lib and srcs_lib_whitelist_pkgs
  Remove the automatic dependency to framework-res.apk for R/Manifest
  Prepare to be able to put framework-res in srcs
2019-08-30 05:14:21 +00:00
Pete Gillin
82639482fa Merge "Normalize and validate the java_version property."
am: 17f4728d4b

Change-Id: Ib1caaf9cbe29cfee6bbffa54acdd3aaabaf59e20
2019-08-29 11:32:00 -07:00