Commit Graph

2373 Commits

Author SHA1 Message Date
Colin Cross 0b67a8bd0f Allow kotlin modules to skip packaging the kotlin stdlib
Host tools like lint may package their own version of the kotlin
stdlib, and any jars loaded by them shouldn't contain the platform
version.  Add a static_kotlin_stdlib property that defaults to true
to allow building the module without staticalling including the kotlin
stdlib.

Bug: 153485543
Test: m ApiFinder
Change-Id: I7da78ef493806ce4ab0050e4ee9e8d330b0509c8
2020-06-18 15:58:32 -07:00
Colin Cross 9ca38d22a4 Fix annotation processors in kotlin modules that generate resources
The kapt rule was only keeping the generated sources, and not the
generated classes directory.  The generated classes directory will
contain resources generated by the annotation processor and needs
to be added to the final jar.

Test: m ApiFinder
Bug: 153485543
Change-Id: I89197d0afcb1eee011c01aa400f9977e66f43768
2020-06-18 15:58:28 -07:00
Makoto Onuki 56ecbaef4c Merge "Disable "show member in hidden parent" metalava error" 2020-06-18 22:57:48 +00:00
Makoto Onuki 1d5b713275 Disable "show member in hidden parent" metalava error
There are a quite few violations unfortunately, so let's disable it for now.
The plan is to fix all the issues in the internal master and enable it.

Bug: 159121253
Test: build / Tree hugger
Change-Id: I0b0ce937ecd17853b3bb32f7605310b21be77b31
2020-06-18 13:34:19 -07:00
Paul Duffin 296cf33171 Instrument the java_sdk_library implementation library
Bug: 159241638
Test: build jacoco-report-classes-all.jar with and without
      prebuilt for framework-tethering. Ensure it contains the
      jacoco-report-classes.jar for framework-tethering.
Change-Id: I8183bd9613dfaf0ded5f9ac36567d5d29a8941e8
2020-06-18 21:19:08 +01:00
Ramy Medhat 2f99eec459 Add sandbox property to the javadoc rule.
The sandbox property indicates whether metalava should only read
inputs explicitly specified on the command line. This CL adds the
property and sets the appropriate configuration for RBE depending
on whether the sandbox is set or not.

Test: built aosp_crosshatch-userdebug with/without RBE_METALAVA.
Change-Id: I7256d29f18e0af18dbe65d1c7dbbf62fd3d65f4c
2020-06-17 22:57:42 -04:00
Colin Cross a553358b34 Merge "Add support for running Android lint on java and android modules." 2020-06-18 01:16:40 +00:00
Treehugger Robot d7ffbb578d Merge "Consolidate adding common java properties" 2020-06-17 21:52:55 +00:00
Paul Duffin 44b481b81b Fix check-boot-jars when a boot jar is provided by prebuilt
Previously, when a boot jar was provided by a java_sdk_library_import
module the check-boot-jars check failed because the file it depended on
was not available. In an incremental build the build failed due to the
file in the out directory not having a rule to generate it.

That was because the module was named prebuilt_<module>.<apex> instead
of <module>.<apex>. This was fixed by simply removing prebuilt_ prefix
from the name if it was present.

After fixing that the check-boot-jars still did not work properly
because it was expecting a jar file containing .class files but instead
was given a jar file containing .dex files which meant the check did
not work properly.

This was fixed by defining a new ApexDependency interface for use by
the apex/apex.go code to use instead of java.Dependency for generating
the androidmk entries. The *SdkLibraryImport type then implemented
those, by delegating to the implementation library.

Bug: 158304459
Bug: 159112414
Test: m check-boot-jars
      m checkbuild
	  manual inspection of the .jar file used by check-boot-jars to
	  ensure it contained .class files and not .dex files.
Change-Id: I545c5c9072dd472337d2f9b4dfdf08f53c981662
2020-06-17 16:59:43 +01:00
Jiyong Park 49062c89f9 Rename module -> module-lib
When sdk_version: "module_current" in an unbundled build, previously
prebuilt/sdk/current/module/android.jar was used. But that path is
wrong; we have prebuilt/sdk/current/module-lib/android.jar for the
module APIs. Fix the mismatch by changing the string name of the module
API from "module" to "module-lib".

Also, "system_server" for system server API is changed to
"system-server" to match with the path
/prebuilts/sdk/current/system-server/.

Bug: N/A
Test: https://android-build.googleplex.com/builds/forrest/run/L86100000601675127
Change-Id: I23e9befbd9592d3b22989c2c8fbf34d434273288
2020-06-17 21:31:00 +09:00
Colin Cross 014489c1e6 Add support for running Android lint on java and android modules.
Add a rule that runs Android lint on each java and android module
and produces reports in xml, html and text formats.

Bug: 153485543
Test: m out/soong/.intermediates/packages/apps/Settings/Settings-core/android_common/lint-report.html
Change-Id: I5a530975b73ba767fef45b257d4f9ec901a19fcb
2020-06-16 15:44:16 -07:00
Treehugger Robot 001ad5a6fc Merge "Installed APKs should not have `prebuilt_` prefix" 2020-06-16 22:34:29 +00:00
Alex Humesky c7f8b74365 Merge "Do not override "-g:source,lines" for host java binaries when PRODUCT_MINIMIZE_JAVA_DEBUG_INFO is set." 2020-06-16 20:08:58 +00:00
Sasha Smundak 57f0ee1fa9 Installed APKs should not have `prebuilt_` prefix
Bug: 159031374
Test: treehugger & manual
Change-Id: I48f2595781efc1303c777619e082ce7765b73038
2020-06-16 09:41:02 -07:00
Yo Chiang 07d75070a6 java_sdk_library: Require xml permission file only if it is generated
Eliminates invalid LOCAL_REQUIRED_MODULES lines in the generated
Android.mk entries.

Bug: 7456955
Test: TH artifact noop
Test: Add unittest to java/androidmk_test.go
Test: m nothing and verify build rule doesn't contain invalid REQUIRED
Change-Id: Ic8d7e6d08181f6a24fd2aa86479bb9303cfd9be8
2020-06-16 19:20:23 +08:00
Paul Duffin e40383355b Merge "Let APEX build against preferred java_sdk_library_import" 2020-06-16 09:37:53 +00:00
Alex Humesky 2070e32eb9 Do not override "-g:source,lines" for host java binaries when PRODUCT_MINIMIZE_JAVA_DEBUG_INFO is set.
Test: Ran unittests
Change-Id: Ic061b4bf107bcd931813d69f6d72b521d79fbc35
2020-06-15 21:33:49 -04:00
Colin Cross ce6734e666 Consolidate adding common java properties
Use a method to add the properties that are present on all java modules.

Bug: 153485543
Test: m checkbuild
Change-Id: I7803b15eb0de810c8ab8d4b9acf2511935a26fb6
2020-06-15 18:16:10 -07:00
Roland Levillain d38ab21c6e Merge "Introduce product variables to select Java code coverage paths in Soong." 2020-06-15 18:41:03 +00:00
Chris Gross a7a36e22fb Merge "Use EMMA_INSTRUMENT_FRAMEWORK for apex framework libs." 2020-06-15 16:50:59 +00:00
Paul Duffin eedc5d55ce Let APEX build against preferred java_sdk_library_import
If a java_sdk_library_import has a corresponding java_sdk_library then
make the java_sdk_library_import export both the xml and impl modules
created by the java_sdk_library.

Makes java_sdk_library_import consistent with java_sdk_library by
providing libraries within the same APEX access to the implementation
library instead of the stubs.

Bug: 158304459
Test: m nothing
      Test what happens when building com.android.tethering with and without
      a preferred "framework-tethering" java_sdk_library_import. Make sure that
      it does not change the generated APEX.
Change-Id: I2f4edea937ac377431a5696c92cbd467bded62ef
2020-06-15 16:57:09 +01:00
Paul Duffin 0c5bae5e83 java_sdk_library: Add system-server scope
Bug: 155164730
Test: m nothing
Merged-In: I49a2dab5c064b05f16691a3fae65f2b4ffc53bfd
Change-Id: I49a2dab5c064b05f16691a3fae65f2b4ffc53bfd
(cherry picked from commit 5a757b1ebb)
2020-06-15 15:02:19 +01:00
Roland Levillain ada1270ef8 Introduce product variables to select Java code coverage paths in Soong.
Introduce product variables `JavaCoveragePaths` and
`JavaCoverageExcludePaths` (resp. populated from environment variables
`JAVA_COVERAGE_PATHS` and `JAVA_COVERAGE_EXCLUDE_PATHS`). Use them to
control which Java modules are candidate for instrumentation based on
their source path. By default (when `JavaCoveragePaths` is empty),
have all Java module be candidate for instrumentation, to preserve the
existing behavior.

Test: export EMMA_INSTRUMENT=true \
        && export EMMA_INSTRUMENT_FRAMEWORK=true \
        && export JAVA_COVERAGE_PATHS=art \
        && m
Bug: 158212027
Bug: 156284897
Change-Id: Ibe9c1f41ed6110867411952689c5a7ad6536f277
2020-06-15 11:57:31 +01:00
Ulya Trafimovich 6e82748bd6 Rename dexpreopt.config field to bring it in sync with Make.
Different names of the same field in Make and in Soong resulted in
the field being dropped when unmarshalling the JSON from Make to Soong.
As a result, the list of optional used libraries for Make modules was
always empty.

Test: lunch aosp_cf_x86_phone-userdebug && m
Test: Cherry-pick in internal master and observe that the logcat error
    "ClassLoaderContext shared library size mismatch" for GoogleDialer
    has disappeared:
    terminal-1 $ lunch cf_x86_phone-userdebug && m && launch_cvd
    terminal-2 $ adb wait-for-device && adb root \
        && adb logcat | grep 'size mismatch'
    (nothing after the change, one error message before the change)

Bug: 132357300
Change-Id: I57820646fa7c1d8af01b2cbc8a3521da450719c0
2020-06-12 14:47:50 +01:00
Chris Gross 190fdc0b1a Use EMMA_INSTRUMENT_FRAMEWORK for apex framework libs.
Static coverage builds that trigger a dexpreopt target for a bootclasspath
jar can fail since coverage for jars in apexes are turned on by default
which requires jacocoagent to be present on the bootclasspath.

Fix this by using EMMA_INSTRUMENT_FRAMEWORK to conditionally instrument
framework libs in apexes.

Bug: 157737183
Test: EMMA_INSTRUMENT=true EMMA_INSTRUMENT_STATIC=true m -j droid
Change-Id: I2c323553e08741bc46b196bc3bb860614bc3f85b
2020-06-11 23:21:47 +00:00
Colin Cross 440e0d0542 Use inclusive language in build/soong
Test: m checkbuild
Change-Id: Id07890b7cbc2397291a658ca00e86b43c743aafc
2020-06-11 15:33:16 -07:00
Colin Cross 1adc63ec3d Merge changes from topics "dist-for-goals", "soong-dist", "tests-PathForSource"
* changes:
  Add DistForGoal to MakeVarsContext
  Define Soong phony rules in Make
  Remove paths from cc.TestConfig
  Remove most paths from java.TestConfig
  Allow tests to bypass PathForSource existence checks
2020-06-11 18:36:18 +00:00
Ulyana Trafimovich 69bd288409 Merge "Fix on-device paths to used libraries in dexpreopt." 2020-06-11 13:47:19 +00:00
Ulyana Trafimovich 5cdb051ce3 Merge "Remove host boot image from boot.zip." 2020-06-11 10:04:58 +00:00
Martin Stjernholm fa096325fe Merge changes from topics "target-build-unbundled", "unbundled-preopt"
* changes:
  Don't disable dexpreopting implicitly in unbundled builds.
  Add TARGET_BUILD_UNBUNDLED as a variable to control builds.
2020-06-11 10:01:59 +00:00
Elliott Hughes a82ad479a4 Merge "Remove TARGET_PREFER_32_BIT support." 2020-06-10 18:07:06 +00:00
Ulya Trafimovich 9ab4933a1c Remove host boot image from boot.zip.
Host boot image is not needed in boot.zip, which is used for the ART
APK scanner and runs on target. This commit also changes the paths in
the boot.zip by removing OS subdirectory.

Test: lunch aosp_cf_x86_phone-userdebug && m
Test: m out/soong/vsoc_x86/dex_bootjars/boot.zip \
    && zipinfo -1 out/soong/vsoc_x86/dex_bootjars/boot.zip
    system/framework/x86/boot-framework.art
    system/framework/x86/boot-framework.oat
    system/framework/x86/boot-ext.art
    system/framework/x86/boot-ext.oat
    system/framework/x86/boot-core-icu4j.art
    system/framework/x86/boot-core-icu4j.oat
    system/framework/x86/boot-telephony-common.art
    system/framework/x86/boot-telephony-common.oat
    system/framework/x86/boot-voip-common.art
    system/framework/x86/boot-voip-common.oat
    system/framework/x86/boot-ims-common.art
    system/framework/x86/boot-ims-common.oat
    system/framework/x86/boot-framework-atb-backward-compatibility.art
    system/framework/x86/boot-framework-atb-backward-compatibility.oat
    system/framework/x86/boot-framework.vdex
    system/framework/x86/boot-ext.vdex
    system/framework/x86/boot-core-icu4j.vdex
    system/framework/x86/boot-telephony-common.vdex
    system/framework/x86/boot-voip-common.vdex
    system/framework/x86/boot-ims-common.vdex
    system/framework/x86/boot-framework-atb-backward-compatibility.vdex

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

Bug: 132357300
Change-Id: Idf279ac713b9b29ff3a29f1b072bc1d57f48db26
2020-06-10 14:53:36 +01:00
Jiyong Park d4873a6b68 Merge "dex_import that isn't available for platform isn't installed" 2020-06-09 23:02:10 +00:00
Colin Cross c3d87d3112 Define Soong phony rules in Make
To support dist-for-goals in Soong, we need to define all phony rules
in Make so that dist-for-goals can insert additional dependencies on
them.  Collect all the phony rules in phonySingleton and write them
out as Make rules when Soong is embedded in Make, or as blueprint.Phony
rules when Soong is run standalone.

Test: m checkbuild
Change-Id: I68201eff30744b0f487fc4f11f033767b53a627d
2020-06-09 14:38:50 -07:00
Colin Cross 238c1f3903 Remove most paths from java.TestConfig
Now that tests don't need to specify every path passed to
PathForSource or PathForModuleSrc, remove most of them from
java.TestConfig.  Leave a few that are globbed by lots of tests,
and move a few that are globbed by a single test into the tests.

Test: all soong tests
Change-Id: Ica91d7203a6a7dbca0fd4fed84c78f149b8699e1
2020-06-09 14:38:39 -07:00
Pete Gillin d7db79cc8b Merge "Split the core/platform API into stable and legacy versions." 2020-06-09 13:20:31 +00:00
Ramy Medhat 4e372f7841 Merge "Turn on metalava sandbox warning in all droiddoc metalava invocations." 2020-06-09 12:17:38 +00:00
Elliott Hughes 79ae341d4b Remove TARGET_PREFER_32_BIT support.
Bug: https://issuetracker.google.com/138812821
Test: builds
Change-Id: If96cccbd82ba1311165d61c947c928c6e7cd5593
2020-06-08 16:37:13 -07:00
Jiyong Park 01bca755ae dex_import that isn't available for platform isn't installed
This change fixes a bug that dex_import module is always installed to
the platform even when the module is not available to the platform.

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

Bug: 158284983
Test: OUT_DIR=/tmp/ndk build/soong/scripts/build-ndk-prebuilts.sh
Merged-In: I85570506e700be59ee63e4f1d7902a40e36df39c
(cherry picked from commit afd3d11a79)
Change-Id: I85570506e700be59ee63e4f1d7902a40e36df39c
2020-06-08 21:53:52 +09:00
Pete Gillin 1f41dbff64 Split the core/platform API into stable and legacy versions.
For now, everything outside libcore still uses the legacy version.

Test: treehugger
Bug: 157640067
Change-Id: If5234e9ee533ff537926801a0af045d36b1caf01
2020-06-08 10:53:51 +01:00
Treehugger Robot 8a624337b3 Merge "Use sdkSpec to compare sdk_versions of APK/JNI" 2020-06-08 07:27:26 +00:00
Jooyung Han 652d5b31ef Use sdkSpec to compare sdk_versions of APK/JNI
"current" is converted to int differently if we use
sdkSpec.effectiveVersion for APK and android.ApiStrToNum for JNI.
For example, in REL branch, "current" is equiv to PlatformSdkVersion
for APK, but 10000(FutureApiVersion) for JNI.

Use sdkSpec.effectiveVersion to compare APK.min_sdk_version and
JNI.sdk_version.

Exempt-From-Owner-Approval: cherrypick from internal

Bug: 145796956
Test: m
Merged-In: I2c4dbb79ae8712004dc3a9e647aa53cd5de7b508
Change-Id: I2c4dbb79ae8712004dc3a9e647aa53cd5de7b508
(cherry picked from commit 9d2c0f7af2)
2020-06-08 07:19:56 +00:00
Alexander Smundak 99e4fba932 Merge "Fix android_app_set documentation" 2020-06-05 22:31:32 +00:00
Sasha Smundak 613cbb1733 Fix android_app_set documentation
Also, fix linter warnings.

Bug: 152319766
Test: treehugger & manual
Change-Id: Id9b296d9301902deb463b299413491bc66d58944
2020-06-05 10:27:23 -07:00
Anton Hansson 2d0c1946fa Correct link type for module stubs
Module stubs compile against module_current, so any module depending on
them had to compile against module_current (or broader) too. Treat them
as the API surface the stubs are for.

Bug: 157010342
Test: m
Change-Id: I49b9082dc1b5afe6c22e94126e574dd8061f0f39
Merged-In: I49b9082dc1b5afe6c22e94126e574dd8061f0f39
(cherry picked from commit 0bd88d0b4e)
2020-06-05 15:16:17 +01:00
Anton Hansson cc51a6886e Improve the structure of the link check method
Match by name first, then by kind.

Bug: 157010342
Test: m
Change-Id: Ic337a073c3bd14ac03b1d899aeb612247a708495
Merged-In: Ic337a073c3bd14ac03b1d899aeb612247a708495
(cherry picked from commit ac103461a4)
2020-06-05 15:16:17 +01:00
Anton Hansson 3f07ab2d63 Create a framework.aidl for non-updatable platform
framework.aidl includes the parcelables from the non-updatable
part of the framework as well as the modules. This causes a
dependency cycle when building module stubs:
module_stub -> module_sdk -> framework.aidl -> public_sdk -> module_stub

The module_sdk only includes the the stubs for the non-updatable
part of the framework, so it should also only contain the non-updatable
parcelables. This change creates a framework_non_updatable.aidl with
those parcelables, and updates module_current to use that.

Bug: 144149403
Test: m
Test: m && diff out/soong/framework{,_non_updatable}.aidl
      (the diff contains just TestApi + module parcelables)
Change-Id: I224117a0ff695c22d4a4317a51a9b775ed73066b
Merged-In: I224117a0ff695c22d4a4317a51a9b775ed73066b
(cherry picked from commit 85c151c3f3)
2020-06-05 15:16:16 +01:00
Anton Hansson 83509b549c Build java_sdk_library stubs with language level 8
This is in line with the main android stubs (android.jar). I discovered
the difference since we want to merge some java_sdk_libraries into the
android.jar files, but I believe the rationale for compiling it with
version 8 applies to all stubs (we don't want level 9-language features
because some tooling may be stuck with version 8).

Bug: 144149403
Test: presubmit (checkbuild)
Change-Id: I9439ed516dda68ef516ff08d1c6045de3d3c1c0e
Merged-In: I9439ed516dda68ef516ff08d1c6045de3d3c1c0e
(cherry picked from commit cf4dd4c1df)
2020-06-05 15:16:16 +01:00
Anton Hansson 9d7c3fb4da Don't require merge_annotations_dir for annotations_enabled
As far as I can tell, annotations_enabled does not require use of
merge_annotations_dir (although it may have done in the past).

Bug: 157010342
Test: m
Change-Id: I6705522774203b4566f58679bbc2f0c17422c1dd
Merged-In: I6705522774203b4566f58679bbc2f0c17422c1dd
(cherry picked from commit c5e13279ad)
2020-06-05 15:16:16 +01:00
Ulyana Trafimovich 3ef493ff91 Merge "Refactor library path representation in dexpreopt." 2020-06-05 10:46:01 +00:00
Treehugger Robot a5c94e1409 Merge "Allow apex module to have android_app_set as its constituent." 2020-06-05 05:52:51 +00:00
Sasha Smundak 18d98bc3e0 Allow apex module to have android_app_set as its constituent.
Fixes: 157166068
Test: treehugger & manual
Change-Id: I9f91f1b761286f489d175eb0772f78f702e8a2d6
2020-06-04 20:25:53 -07:00
Martin Stjernholm 95d6ea3781 Don't disable dexpreopting implicitly in unbundled builds.
Test: art/test/testrunner/run_build_test_target.py art-linux-bionic-x64
  with TARGET_BUILD_UNBUNDLED enabled in the build scripts
Test: art/test/testrunner/testrunner.py --target --64 --optimizing
  with TARGET_BUILD_UNBUNDLED enabled in chroot on device
Bug: 157549171
Change-Id: I124c341d1801c4afa22f836dd567019de3e9498e
2020-06-04 20:28:21 +01:00
Ulya Trafimovich d4bcea4e24 Refactor library path representation in dexpreopt.
This is a preliminary CL before fixing on-device paths to DEX jars.
It groups together the inormation about on-host build paths and
on-device install paths to library DEX jars.

This CL changes the structure of module dexpreopt.config files
generated by the build system. Aside of that, no functional changes.

Test: lunch aosp_cf_x86_phone-userdebug && m
Change-Id: I059654be7670f2ba66248d9c49b9694a0591f9c1
2020-06-04 17:37:42 +01:00
Ulyana Trafimovich 5539e7b568 Revert^2 "Rename DexJar interface method to DexJarBuildPath."
This reverts commit b0dc851ff4.

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

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

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

Change-Id: Id7c7d6240d98afaf8edd49b6c96cd05534b784cc
2020-06-04 10:37:36 +00:00
Ulyana Trafimovich 2a08566634 Merge "Rename DexJar interface method to DexJarBuildPath." 2020-06-04 10:05:33 +00:00
Ramy Medhat c8d60bc7c6 Turn on metalava sandbox warning in all droiddoc metalava invocations.
Test: built aosp crosshatch userdebug with RBE_METALAVA=1 and dependency
file support.

Change-Id: I5ca637984429df12fe05bb07f5db154be9b24f97
2020-06-04 01:54:07 -04:00
Treehugger Robot a8bf98852a Merge "dex_import can be added to apex" 2020-06-04 05:06:22 +00:00
Colin Cross 3747336d23 Merge "Revert "Always run package check"" 2020-06-03 17:15:51 +00:00
Colin Cross b549b77120 Revert "Always run package check"
This reverts commit 91206d9ed1.

Reason for revert: package-check.sh doesn't work on mac
Bug: 158081251
Bug: 157649935
Change-Id: I50af71d54d5f1f8b516bfcf1efbcf6217e89c83a
2020-06-03 17:15:15 +00:00
Ulya Trafimovich 562c240185 Rename DexJar interface method to DexJarBuildPath.
This is a prerequisite change before adding DexJarInstallPath.

Test: lunch aosp_cf_phone-userdebug && m
Change-Id: I033e08b8bb06c0a844a6bbbfcdc48ce33e9c95cf
2020-06-03 11:40:45 +01:00
Jaewoong Jung 264700345d Merge "Soong package structure refactoring" 2020-06-02 16:30:50 +00:00
Paul Duffin 3dbf9fd892 Copy removed.txt file to the snapshot correctly
Previously, the code copied the current.txt file to both the
current_api and removed_api properties. This change copies the
removed.txt file to the removed_api property instead.

Bug: 157980685
Test: m nothing
Change-Id: Iad34e91051da43222d22c240c16f50887c43d73e
2020-06-02 14:40:28 +01:00
Paul Duffin 91206d9ed1 Always run package check
Previously, the package check was only run when building checkbuild or
the phony target created for a specific module. It would not run when
building a module that depended upon a library with the
permitted_packages property. That was because the package check was
only run when the package-check.stamp file was built and that was only
added to the phony and checkbuild targets.

Instead of touching a separate package-check.stamp file to indicate
that the check has been performed this change copies the input jar file
to the package check to a separate ../package-check/<jar> file which is
then treated as the output of the library and is the input for any dex
processing. So, any modules that depend on this library will
transitively depend on the output file produced by the package check
command and so will ensure that the package check is always run.

Test: Removed "android.net" from the permitted_packages for
      "framework-tethering", build "framework-tethering" which
      triggered and failed the package check and
      "com.android.tethering" which did not.
      Made this change.
      Built "com.android.tethering" which triggered and then failed the
      package check.
      Removed change to "framework-tethering"
Bug: 157649935
Change-Id: Ib01aa09e13f80282218049270eb7a58ec5f9f605
2020-06-02 10:29:47 +01:00
Jiyong Park 77acec63fe dex_import can be added to apex
Bug:157886942
Test: m
Change-Id: Ida6f7bb784efe74cc1fa0e8d370eaee803f08b0f
2020-06-02 11:54:01 +09:00
Jaewoong Jung 4b79e98a6e Soong package structure refactoring
Give prebuilt_etc and sh_binary their own packages and split the
gigantic main Android.bp up to small, per-package ones.

Test: m nothing, TreeHugger
Bug: 156980228
Change-Id: I7b00cd344b9f16861f1ff39edf0029f016b853d0
2020-06-01 13:44:48 -07:00
Ulya Trafimovich c9af538c90 Add android.test.base to class loader context for API version < 30.
Test: lunch aosp_cf_x86_phone-userdebug && m
Change-Id: Id2ece4b2a6317998e1dd177e853848cc3956f39f
2020-06-01 12:51:38 +01:00
Paul Duffin e739f1ed9f Collect permitted packages from java_sdk_library instances
Switching an updatable boot jar from java_library to java_sdk_library
changed the contents of the updatable-bcp-packages.txt due to the code
requiring the module to be *Library. This change updates that to allow
it to be any module that implements the
PermittedPackagesForUpdatableBootJars interface which is *Library and
anything that embeds that like *SdkLibrary.

Bug: 155164730
Test: m droid and check the contents of system/etc/updatable-bcp-packages.txt
Change-Id: I464af74628da311734f102f77ec8158daec5b32d
2020-05-29 12:31:41 +01:00
Treehugger Robot b719d60d20 Merge "Ensure package check is run for java_library in APEX" 2020-05-29 06:53:46 +00:00
Kousik Kumar c4cdba07d3 Merge "Add support for remote-execution / caching of jar/zip actions" 2020-05-29 03:31:20 +00:00
Treehugger Robot ad43500655 Merge "java_sdk_library: Propagate shared_library to snapshot" 2020-05-29 02:06:54 +00:00
Treehugger Robot 00f5701ade Merge "apex respects stem of java_library modules" 2020-05-29 00:45:03 +00:00
Kousik Kumar 366afc5011 Add support for remote-execution / caching of jar/zip actions
Test: Ran a build with `RBE_JAR="true" RBE_JAR_EXEC_STRATEGY="remote"
RBE_ZIP="true" RBE_ZIP_EXEC_STRATEGY="remote" ... use_rbe m` and that
succeeded.

Bug: b/156765207
Change-Id: Ia17b532fbb282be414adf879914870082dd0841b
2020-05-28 11:56:48 -07:00
Paul Duffin d7eb1c2a76 java_sdk_library: Propagate shared_library to snapshot
Passes the shared_library property through to the snapshot. It does not
optimize away the default value in order to make it easier to invert
the default value in future. The current default value was only chosen
for convenience because most existing usages were already treated as
shared libraries. It would be safer if modules had to opt in to be used
as shared libraries.

Bug: 155164730
Test: m nothing
Change-Id: I33c7323f2389b44ed49cebe517ae2cce349117f1
2020-05-28 17:39:25 +01:00
Jiyong Park a62aa23990 apex respects stem of java_library modules
apex now respects stem of java_library modules.

As a follow-up we need to suppor the same for other types of modules.

Bug: 157638999
Test: m
Change-Id: Iaf5023020b5440f1ffd4f5414b5a7864655fc22a
2020-05-28 23:48:16 +09:00
Paul Duffin 63d8febd35 Ensure package check is run for java_library in APEX
Package checks were not being run for java libraries that were in an
APEX and not on the platform. This change fixes that and updates the
script to report all failing classes to make it easier to update the
list of packages.

Test: m java
Bug: 157633658
Change-Id: I28044e08d3a40e9f3464bb2158ef6a28d57264d1
2020-05-28 15:06:35 +01:00
Kousik Kumar 309b1c0da3 Add support for remote-execution / caching of signapk actions
Test: "RBE_SIGNAPK=true RBE_SIGNAPK_EXEC_STRATEGY=remote ... use_rbe m" on crosshatch-userdebug and
signapk targets worked
Bug: b/156765091

Change-Id: I4b8c21320c2f38914ef39d3d8f036d885fab4e72
2020-05-28 06:14:56 -07:00
Jiyong Park 932cdfeb06 Add default_to_stubs option to java_sdk_library
Previously, when a lib that doesn't have sdk_version property set
depends on a java_sdk_library, the impl library was used for linking.
This might be too permissive because the client lib might be using empty
sdk_version because it needed some private APIs from the platform, but
not from the java_sdk_library. This actually happend for some of the CTS
tests. They don't set sdk_version, but were directly depending on
android.test.[base|runner|mock].stubs libraries. If we switch the
references to the stub libraries into the corresponding java_sdk_library
modules (e.g. aandroid.test.[base|runner|mock]), then we would be
allowing private APIs to the CTS tests, which is not good.

To solve this problem, default_to_stub property is introduced. It when set
to true prevents the impl lib from being used for linking. When a module
that doesn't have sdk_version depends on it, the widest API surface that
the java_sdk_library provides is linked instead.

Bug: 157007292
Test: m
Change-Id: Id2acc3cafb71d1e90d4fdc9c0c70a73983355e0f
2020-05-28 18:07:06 +09:00
Ramy Medhat f1665501e8 Merge "Add support for Metalava implicit dependencies for remote execution." 2020-05-27 23:23:25 +00:00
Liz Kammer 966b2f02fb Add signing lineage for runtime_resource_overlay
Add ability to specify a signing lineage file for
runtime_resource_overlay.

Test: app_test.go
Bug: 153366049
Merged-In: I68286bc0caa9daad6ef74db39f7750924f1d93dd
Change-Id: I68286bc0caa9daad6ef74db39f7750924f1d93dd
2020-05-27 12:18:27 -07:00
Paul Duffin b1e61be41d Merge "java_sdk_library: Create separate impl library" 2020-05-27 17:14:15 +00:00
Jaewoong Jung 3f2845d251 Merge "Make android_app_import multi targets arch module." 2020-05-27 16:14:58 +00:00
David Srbecky 38b2a86091 Merge "Allow the user to explicitly set the java Uncompress_dex property." 2020-05-27 13:45:29 +00:00
Paul Duffin 5df793011d java_sdk_library: Create separate impl library
Most dependencies on java_sdk_library instances (JSL) simply reference
them by name and rely on the build to pick the correct part, impl,
stubs for a specific scope, headers or implementation jars or dex jars.
Generally, the build gets that decision right. If it does not the for
most of the components of the JSL there is a way to reference them
directly. However, that is not true for the implementation library as
that is created the JSL itself.

Access to the implementation library should be avoided as it opens up
the possibility that use will be made of an API that is not tracked and
maintained which could lead to compatibility issues. However, there is
a case where use of the implementation library is required and safe.
That is when it is being used from other libraries within the same APEX
as the JSL. In that case the JSL and its dependencies will be updated
together so compatibility is not an issue.

This change adds a new <module>.impl java_library that compiles the
implementation library in the same way as the JSL itself does. This will
allow the modules that are blocked from converting to JSL because of
this limitation to progress. Initially the library is only for use
for compiling but follow up changes will switch the rest of the build
from using the implementation library created by JSL to the separate
module.

It also adds the ability to give the separate .impl library a more
restrictive visibility than the JSL further limiting misuse.

Bug: 156618935
Test: m droid, flash, atest CtsProviderTestCases - sniff test
      tested that it fixes compilation issues with mainline module
Change-Id: Ifc4799feb4ada9dec8021efc13fe6a953bf2edd3
2020-05-27 12:53:26 +01:00
Ramy Medhat c7965cda05 Add support for Metalava implicit dependencies for remote execution.
Test: built aosp crosshatch userdebug with RBE_METALAVA=1
Change-Id: Ic64d98785e34717ef9bdad62b4885085f84f132a
2020-05-27 06:52:46 -04:00
Anton Hansson 54d925e88d Merge "Remove conditional running of checklast during checkapi" 2020-05-27 10:28:41 +00:00
Treehugger Robot c7c7e466ac Merge "AIDEGen: Add path attribute to okhttp module." 2020-05-27 07:18:19 +00:00
Kousik Kumar 97d095516e Merge "Add support for remote-execution / caching of turbine actions" 2020-05-27 03:41:50 +00:00
Jaewoong Jung 6abfbf7f9c Make android_app_import multi targets arch module.
I made a mistake and only fixed android_test_import in my previous
change, I5bbb2d2b733bbd6b868898285683ba5ff45be10b.

Bug: 154281342
Test: TreeHugger
Test: chromium-webview
Change-Id: I1575d9ef3f8596f1eb8db0867db09de08945d711
2020-05-26 20:10:08 -07:00
Paul Duffin 649dadfb87 Switch droiddoc to use SdkHeaderJars()
Previously, droiddoc was using SdkImplementationJars() to get a JAR to
add to the classpath in order to resolve unknown references in the
source.

Given that SdkHeaderJars() returns jars created by Turbine which are
(for compilation at least) functionally identical to the implementation
jars there is no point in using the implementation jars.

Bug: 148080325
Test: m nothing
Change-Id: I2b718cc1445c04e849dcb0b1f53bba2b0bd90c95
2020-05-26 18:32:44 +01:00
Paul Duffin 9b879594ed java_sdk_library: Expose implementation within APEX
Access to the implementation JARs is restricted to avoid code from
depending on implementation details that could change from one release
to the next which could cause compatibility issues. That is not a
problem when referenced from within the APEX that contains the
java_sdk_library.

As references from within the same APEX often need to access
implementation specific details of the java_sdk_library and doing that
from within the same APEX is safe this change all references to a
java_sdk_library made within the same APEX to use the implementation
jars instead of stub jars.

Bug: 155164730
Test: m droid
Change-Id: If239059690de61683c2ad2d8a0ce2e47286a3637
2020-05-26 18:32:44 +01:00
Paul Duffin daaa332827 java_sdk_library: Only expose impl jars when they are built
The implementation jars are not built if api_only: true. In that case
the jar paths must not be exposed implicitly as they will be nil and
they will just be ignored.

This change ensures that stubs are returned when the implementation
jars are not built.

Bug: 155164730
Test: m droid
Change-Id: Ic495982a5dcb2754916260e7d91d921a5da288ae
2020-05-26 18:32:44 +01:00
Anton Hansson 668b8a21cf Remove conditional running of checklast during checkapi
Since the metalava invocations have been merged into a single one,
and checkapi already requires the other timestamp, this has no effect.

Bug: 151160048
Test: m checkapi
Change-Id: I560058f0f4cdeaedaf247cd35119da2cf0b86ea0
2020-05-26 18:09:33 +01:00
Treehugger Robot 3f82e2426e Merge "java_sdk_library: Simplify SdkLibrary.sdkJars" 2020-05-26 15:46:52 +00:00
satayev ede18549e5 Merge "Generate combined deps-info for all updatable modules." 2020-05-26 13:28:28 +00:00
Paul Duffin c91f5d0cc7 java_sdk_library: Simplify SdkLibrary.sdkJars
The expression !sdkVersion.specified() is equivalent to the following:
    !sdkVersion.valid() || sdkVersion.kind == sdkPrivate

That means that the else if clause "sdkVersion.kind == sdkPrivate" will
never be reached so it was removed.

There is also no need to check sdkVersion.valid() as that will already
have been checked, and an error reported, before this code has been
called. Therefore that has been removed.

Bug: 148080325
Test: m nothing
Change-Id: Ib7c544b48dfb53bad3e15f9f73f71bd05cff9b49
2020-05-26 11:12:28 +01:00
Treehugger Robot 42ada5cff3 Merge "Add preprocessed property for android_test_import" 2020-05-21 22:22:28 +00:00
Liz Kammer 3b70b3fea5 Add preprocessed property for android_test_import
If set to true, preprocessed indicates that the prebuilt apk is
installable as is and does not need any further processing (e.g.
zipaligning, signing).

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

Bug: 157239179
Test: "atest ArtGtestsTarget" with http://go/aog/1302773
Change-Id: I4490aa0a61fa71f830feb6a46dffd8d20fccfc66
Merged-In: I4490aa0a61fa71f830feb6a46dffd8d20fccfc66
2020-05-21 19:59:25 +01:00
Treehugger Robot eee58d0eed Merge "java_sdk_library: Control shared library use" 2020-05-21 12:14:23 +00:00
Jooyung Han 5ab5856db3 Merge "apex: Make android_library support APEX variants" 2020-05-21 12:02:39 +00:00
Treehugger Robot 7d74b5f142 Merge "Improve tracking of exported sdk libraries" 2020-05-21 12:02:05 +00:00
Jooyung Han acc7bbebe4 apex: Make android_library support APEX variants
The android_library module type can be used within an android_app that
can itself be added to an apex but android_library does not call
android.InitApexModule(module) and so it does not support apex variants
and so is treated as if it cannot be part of an APEX even though it
actually is.

Now, android_library supports AEPX variants.

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

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

Bug: 156978407
Test: m
Merged-In: I3a21d653fe9c4159e3a89791fe1a8597865eeae6
Change-Id: I3a21d653fe9c4159e3a89791fe1a8597865eeae6
(cherry picked from commit bd133b1bdc)
2020-05-21 12:01:54 +00:00
Ulyana Trafimovich 8a4ec5024d Merge "Fix TestDexpreoptBootZip on non-Linux hosts." 2020-05-21 09:39:38 +00:00
Paul Duffin dfa131e673 java_sdk_library: Control shared library use
Previously, all java_sdk_library instances were assumed to be usable as
shared libraries, i.e. referenced from <uses-library> in Android
manifest. However, that was not true for any instances that specified
api_only: true and will not be true for many of the new Android
modules.

One consequence of this assumption is that use of one of the api_only
instances could (but fortunately does not appear to) have lead to an
invalid library being referenced in an app's manifest which would
prevent the app from loading. That would have been done automatically
by the implicit sdk library tracking and manifest fixing mechanism and
there would have been nothing a developer could have done about it.

Changes:
1) Prevents api_only instances from participating in the automatic
   tracking which will prevent them from being added to Android
   manifests and breaking apps.

2) Add a new shared_library property that can have the same effect as
   api_only while still creating a runtime implementation library.

3) Renamed commonProperties to commonSdkLibraryProperties to
   disambiguate it from the ModuleBase.commonProperties field.

4) Extracts requiresRuntimeImplementationLibrary() to remove duplicate
   code accessing the Api_only property.

5) Tests for the api_only and shared_library behaviours.

Test: m nothing - added tests, tests broke, fixed code, tests passed.
Bug: 156723295
Change-Id: Iccf509e808d5ff53522188541a4c54d8f9ada93c
2020-05-21 10:39:34 +01:00
Paul Duffin 859fe961b0 Improve tracking of exported sdk libraries
The build tracks the java_sdk_library/_import modules that are
referenced by libraries so that it can ensure that any Android app that
includes code that depends on one of those modules has the appropriate
<uses-library> entry in their manifest.

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

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

Test: atest CtsProviderTestCases - which relies on android.test.mock
      being implicitly tracked to verify that I had not broken
	  anything. Used aapt2 dump badging to read the manifest.
	  m nothing - to run the new tests which failed before fixing the
	  code.
Bug: 156723295
Change-Id: Ia99def91e9b74d2ed0a777de04b476c00ea0393d
2020-05-21 10:39:32 +01:00
Ulya Trafimovich 5006d8d4f7 Fix TestDexpreoptBootZip on non-Linux hosts.
The test was written with the assumption that the build OS is
Linux, which is not always the case (the test was broken on Darwin).

Test: m nothing (on Linux host)
Bug: 157192627
Change-Id: I6ae3deed7a3342f4526528f29ce0a299d24b464b
2020-05-21 09:39:24 +00:00
Treehugger Robot c912b4617e Merge "java_sdk_library: Do not expose stubs implementation jar" 2020-05-21 09:16:04 +00:00
Treehugger Robot f716d58339 Merge "java_sdk_library: Access outputs using tags" 2020-05-21 09:15:58 +00:00
Treehugger Robot 4e1f005046 Merge "java_sdk_library: Improve consistency with ..._import" 2020-05-21 07:36:35 +00:00
Paul Duffin 83322ba6a2 Merge "java_sdk_library: Add redirection to module-lib stubs" 2020-05-21 07:25:17 +00:00
Paul Duffin 4b05b9ca39 Merge "java_sdk_library: Extract common stubs redirect code" 2020-05-21 07:24:56 +00:00
bralee 1fbf44089e AIDEGen: Add path attribute to okhttp module.
Bug: 157115477
Test: 1. aidegen Settings -n
         open merged_module_info.json
	 "okhttp": {
	     ...
	     "path": ["external/okhttp"]
         },
	 modules: "mimemap-testing-res.jar", "mimemap-res.jar"
                  "services.core.priorityboosted", "framework-tethering"
                  "bouncycastle_ike_digests",
                  "robolectric-sqlite4java-native"
                  have the 'path' attribute.
Change-Id: If3628887866c29dcc948dd427727f175a5199edc
2020-05-21 11:25:51 +08:00
Paul Duffin 63beac5076 Merge "Add --no-force-assign-all for java_sdk_library" 2020-05-20 17:02:30 +00:00
Paul Duffin 23970f4285 java_sdk_library: Do not expose stubs implementation jar
The stubs header jar is optimized for use as a dependency for others
to use. It only changes if there is a significant difference in the
externals of the classes, i.e. anything that a library being compiled
against depends upon. So changes to implementations of method or the
addition/removal of private methods, fields will have no impact.

As there is no benefit in returning the implementation of the stubs
jar this change removes it. The implementation is still used when
taking a snapshot as the header jar is an internal build artefact
that is not suitable for long term snapshot.

Bug: 155164730
Test: m droid
Change-Id: If91b4d106683f23788547c537228c58be2867174
2020-05-20 18:02:00 +01:00
Paul Duffin 46dc45aba9 java_sdk_library: Access outputs using tags
Previously, in order to access say the public stubs source jar it was
necessary to directly reference the module by name. This change adds
support for accessing them indirectly via tags.

Test: nothing
Bug: 155164730
Change-Id: Id6d76e56c7b46944b2d2a44a2163fb05a5b03de9
2020-05-20 18:01:54 +01:00
Paul Duffin 0f8faffdc0 java_sdk_library: Improve consistency with ..._import
The scopePaths struct is used by both java_sdk_library and its prebuilt
but was not populated in the same way. This change addresses those
discrepancies in preparation for a follow up change which will allow
access to some of those fields through OutputFileProvider.

Changes:
* Document the scopePaths field and struct.
* Switch those fields that may not be fully populated from Paths to
  OptionalPath to make that 100% clear and protect against unchecked
  use.
* Switch java_sdk_library_import to use the dependency extraction
  mechanism driven by the dependency tag. This should actually have
  been part of the change that added that mechanism.
* Only create prebuilt_stubs_sources if sources have been provided.
* Add dependencies from java_sdk_library_import on its stubs source
  child modules if sources have been provided. That will ensure the
  stubsSrcJar field is updated.
* Updates current/removedApiFilePath if provided for the scope in
  java_sdk_library_import.
* Extracts ApiStubsSrcProvider from ApiStubsProvider to allow it to
  be implemented by PrebuiltStubsSources so that it can provide access
  to the stubs src jar that it creates.

Test: m nothing
Bug: 148080325
Bug: 155164730
Change-Id: Ic5bf884b2b1e79841843e7c3b4642796ecd49f5d
2020-05-20 18:00:45 +01:00
Paul Duffin 803a9565cd java_sdk_library: Add redirection to module-lib stubs
Previously, when using sdk_version: "module_current" any direct
reference to an sdk library would use the public not module-lib stubs.
This change corrects that.

Prior to the addition of the module-lib api scope almost all
java_sdk_library instances supported all the scopes to which a request
for jars could be redirected, i.e. public, system and test. The
exceptions to that are a few special instances that were used with
sdk_version: "none" and so were either caught by the java_sdk_library
special cases or dropped through to public.

The addition of module-lib, plus the flexible control over which scopes
are generated means that is no longer true. It is possible for a
java_sdk_library to be requested for a scope it does not have which
would have resulted in an empty set of paths being returned leading to
confusing compilation errors.

To avoid that this change also adds support for using the inheritance
hierarchy defined by the apiScope.extends field to fall back to the
closest available surface.

Test: m nothing
Bug: 155164730
Change-Id: I6aab75a772433ee0a36b6f1758a4aec4be2f9a49
2020-05-20 18:00:45 +01:00
Paul Duffin b05d4295de java_sdk_library: Extract common stubs redirect code
The java_sdk_library and java_sdk_library_import redirect a request for
header and implementation jars to broadly the same place although the
java_sdk_library does have some special code that is mixed in with the
common code.

This change separates the java_sdk_library special code from the common
code and moves the common code into its own method for use by both
module types. That makes the special behavior clearer and ensures the
common behavior remains consistent in future.

Test: m nothing
Bug: 155164730
Change-Id: I53e41a18792488aefd6a886c587559e90b3c4fde
2020-05-20 18:00:45 +01:00
Liz Kammer ff000d65d4 Merge "Add signing linage support for android_app_import" 2020-05-20 15:21:16 +00:00
Kousik Kumar 1372c1b430 Add support for remote-execution / caching of turbine actions
Test: Ran a sample turbine action with:
RBE_TURBINE_EXEC_STRATEGY="remote" RBE_TURBINE="true" ... use_rbe m out/soong/.intermediates/external/protobuf/libprotobuf-java-micro/android_common/turbine/libprotobuf-java-micro.jar
and checked in reproxy_log.txt that remote-metadata had status SUCCESS.

Bug: b/156765475
Change-Id: I85c334e6998c6dd2a68460b3580d50fffd900e6f
2020-05-20 07:57:37 -07:00
Ulyana Trafimovich 7bdb5e5aaa Merge "Add a test for boot.zip (zip archive with boot image files)." 2020-05-20 08:29:21 +00:00
Ulyana Trafimovich 7645764e58 Merge "Raise an error instead of panic in SplitApexJarPairs." 2020-05-20 08:28:43 +00:00
Paul Duffin c495d2bfed Add --no-force-assign-all for java_sdk_library
Previously, the flag was only added for java_library modules that were
being instrumented. This will also add if for java_sdk_library modules
too.

Bug: 156705688
Test: TARGET_BUILD_VARIANT=userdebug PRODUCT=mainline_modules_x86 EMMA_INSTRUMENT=true NATIVE_COVERAGE=true ./vendor/google/build/build_unbundled_coverage_mainline_module.sh -j8
Merged-In: I5d06ec037007b1770748df24a2e2e8691f177f4f
Change-Id: I5d06ec037007b1770748df24a2e2e8691f177f4f
(cherry picked from commit 31b84c83bf)
2020-05-20 08:19:56 +01:00
Liz Kammer 1d5983b0f6 Revert "Use aapt2 flag --rename-resources-package in soong"
This reverts commit 1674f9b4e9.

Reason for revert: Breaks build

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

Test: app_test
Bug: 153366049
Merged-In: I260f198637a1a0f8b3373250413356785c56588a
Change-Id: I260f198637a1a0f8b3373250413356785c56588a
2020-05-19 09:00:25 -07:00
Ulya Trafimovich 86d9e3a7b7 Add a test for boot.zip (zip archive with boot image files).
Test: m nothing
Bug: 152593075
Change-Id: Ibd07bdbd7d66312d32c9f461a082ffbba7112030
2020-05-19 11:19:20 +01:00
Liz Kammer 1674f9b4e9 Use aapt2 flag --rename-resources-package in soong
This change uses aapt2 flag to change the package name encoded in the
resources table for override apps.

Test: app_test.go
Bug: 147434671
Change-Id: I70a43c2163709afc90262d74f975ce14a556cf55
2020-05-18 15:10:21 -07:00
Colin Cross 49e94c0a92 Merge "Use system modules for prebuilt SDKs >=30" 2020-05-18 19:02:43 +00:00
Treehugger Robot 1d9e2364ed Merge "Add test_mainline_modules to the auto-gen test config(AndroidJUnitTest only)." 2020-05-18 01:50:49 +00:00
Paul Duffin 0d3c2e136b Extract common behavior between Module and Import
Although the duplication being eliminated here is minimal follow up
changes will add more functionality that is common to Module and
Import.

Test: m nothing
Bug: 156723295
Change-Id: I1733405526764272beba63470a9bc8a958d41024
2020-05-17 13:32:13 +01:00
Paul Duffin a18abc2a61 java_sdk_library: Remove unnecessary qualification of fields
Fields in embedded structures can be accessed without qualifying them
by the type of the embedded structure.

This reduces the size of follow up changes that switch java_sdk_library
from embedding Library.

Bug: 156618935
Test: m nothing
Change-Id: I84f294c6f02d5089055130c63f5fb0538a1f21b9
2020-05-16 19:29:59 +01:00
Treehugger Robot 781baf01eb Merge "Remove unnecessary copying of common properties" 2020-05-16 14:22:01 +00:00
Paul Duffin 1dbe3ca254 Remove unnecessary copying of common properties
The (Soc/Device/Product/System_ext)_specific are all properties in
ModuleBase.commonProperties. Initially, they were explicitly copied
from the parent to the child. Since then the CreateModule() method
was modified to automatically copy all the commonProperties from the
parent to the child so this code is no longer necessary.

Bug: 156618935
Test: m nothing
      checked that it does not change the generated xml permissions
	  file for a java_sdk_library that sets soc_specific: true and
	  is in the vendor partition.
Change-Id: I8c985b50cb6b6c019b33a4652de482ded689fee4
2020-05-16 13:06:55 +01:00
Colin Cross 17dec171b4 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
Merged-In: Iebadad5980b952ed91c3ffd56cff1ce1827d3247
2020-05-15 17:21:58 -07:00
Jaewoong Jung 805f2492e8 Merge "Add apex_set module." 2020-05-15 23:13:38 +00:00
Treehugger Robot e070b8ebb4 Merge "Add lineage file to deps for signapk." 2020-05-15 20:48:09 +00:00
Artur Satayev 849f844252 Generate combined deps-info for all updatable modules.
Introduce a singleton apex rule to merge contents of individual
deps-info results into a single output file.

Bug: 149622332
Test: m
Change-Id: I4ab7e1a3527fead97a81a5a2cb0e1e93a429117c
2020-05-15 19:10:19 +01:00
Jaewoong Jung fa00c06187 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
2020-05-15 11:02:01 -07:00
easoncylee 5bcff5d1fd Add test_mainline_modules to the auto-gen test config(AndroidJUnitTest 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
(search for auto-generated pattern)

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

Change-Id: I41ba8749ce46da62db402a8b8a555d4874e1cfc0
2020-05-15 12:50:48 +08:00
Sasha Smundak a7856c0077 Implement android_app_set module
Bug: 152319766
Test: manual and builtin
Change-Id: Id0877476f9ae23311d92c0b59a9c568140ab4119
2020-05-14 19:01:11 -07:00
Liz Kammer a7126555c9 Add lineage file to deps for signapk.
(This is a cherry pick.)

Test: app_test.go
Bug: 153366049
Merged-In: I1481eb51d5d02674922459bdfac65c59d1130015
Change-Id: I1481eb51d5d02674922459bdfac65c59d1130015
2020-05-14 16:29:36 -07:00
Treehugger Robot dcd0fc4be7 Merge "Add signing certificate lineage support to soong" 2020-05-14 23:11:24 +00:00
Colin Cross cb1d161666 Merge "Don't use SDK variant for vendor JNI libraries" 2020-05-14 22:59:47 +00:00
Paul Duffin 6b836ba566 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
Change-Id: I7dbafd7164d5da600ca45c39a7f93a5a40027a1f
2020-05-14 00:53:50 +01:00
Paul Duffin f9088b03c2 Merge "java_sdk_library: Propagate naming_scheme to snapshot" 2020-05-13 23:49:20 +00:00
Treehugger Robot bb008e6213 Merge "Reland "enforce sdk_version for JNI libs for updatable APKs"" 2020-05-13 23:24:26 +00:00
Liz Kammer e2b27f473f Add signing certificate lineage support to soong
(This is a cherry pick.)

Test: app_test
Bug: 153366049
Merged-In: I65a92d6c40057dcc01950991fb7be485de1c9080
Change-Id: I65a92d6c40057dcc01950991fb7be485de1c9080
2020-05-13 14:30:53 -07:00
Paul Duffin f7a6433bab java_sdk_library: Propagate naming_scheme to snapshot
Bug: 155164730
Test: m nothing
Change-Id: Iec7c52d2102b6294540090f3c1e32bd9d8cc7da8
2020-05-13 20:40:53 +01:00
Paul Duffin 38b5785e3f java_sdk_library_import: Propagate prefer to child modules
Bug: 155164730
Test: m nothing
Change-Id: Idb06d79baf346ac570beada79880814c5ef6bb50
2020-05-13 20:40:53 +01:00
Colin Cross c2d24050c5 Don't use SDK variant for vendor JNI libraries
Vendor JNI libraries already have stable APIs enforced by the VNDK,
they shouldn't use SDK variants.

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

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

(original commit: 98c4750f39)

Bug: 145796956
Test: m
Change-Id: I08543ccee7dfda0559a1fca108ceb5c28f84943f
2020-05-14 00:19:45 +09:00
Paul Duffin 87a05a389d 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
Change-Id: I5881e5ee7c2169c30f544882344a60a602dae917
2020-05-13 13:09:23 +01:00
Paul Duffin 6c9c5fc4bc 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
Change-Id: Ic859a61de155b3e582c17f6ab5e9298f5f4e709a
2020-05-13 08:52:56 +01:00
Paul Duffin dd9d0740fa 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
Change-Id: I966e82b8ae67624da168e05f5a2b062b832cb8cd
2020-05-13 08:52:56 +01:00
Paul Duffin 1b1e8069ec 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
Change-Id: I708657661188ea4a14a4dd8c6bc4b46237bbe5e0
2020-05-13 08:52:56 +01:00
Paul Duffin c3091c8c19 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
Change-Id: I9be9aab07252b491ab292b8847138a93b487cf53
2020-05-13 08:52:56 +01:00
Paul Duffin 0ff08bdb07 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
Change-Id: Iea7d59852d7aeb503120acf3c44e08eb0d9d07b9
2020-05-13 08:52:53 +01:00
Treehugger Robot fced20c3b4 Merge "java_sdk_library: Preserve sdk_version: "none" in snapshot" 2020-05-13 07:36:43 +00:00
Treehugger Robot c0320878e6 Merge "Enable api_lint in java_sdk_library" 2020-05-13 07:35:15 +00:00
Colin Cross 2bdf0da9e7 Merge "Revert "enforce sdk_version for JNI libs for updatable APKs"" 2020-05-13 01:26:25 +00:00
Jooyung Han cc928d9059 Revert "enforce sdk_version for JNI libs for updatable APKs"
This reverts commit 98c4750f39.

Reason for revert: broken builds

Change-Id: Icd3a9e226ff8ff288b682757cded9f43069ebc5e
2020-05-13 01:22:56 +00:00
Treehugger Robot 1852b586bf Merge "enforce sdk_version for JNI libs for updatable APKs" 2020-05-13 00:57:34 +00:00
Paul Duffin 780c5f4715 java_sdk_library: Preserve sdk_version: "none" in snapshot
Test: m nothing
Bug: 156354511
Change-Id: Icf7c20dc109a773430768c1a2d91c674551dbc1b
2020-05-12 15:52:55 +01:00
Ulya Trafimovich 8640ab9c26 Raise an error instead of panic in SplitApexJarPairs.
Test: aosp_walleye-userdebug boots
Change-Id: I9a1c4ec5c8862b1936820b3cee6db9a85015cb0e
2020-05-12 12:27:50 +01:00
Treehugger Robot e72da7f63c Merge "Add sourcepath to inputs of remoteable metalava action." 2020-05-12 04:15:16 +00:00
Ramy Medhat 0a5c8dea01 Add sourcepath to inputs of remoteable metalava action.
Test: presubmit
Change-Id: Idd77abddac0a676302226eb62883c74d5d7489af
2020-05-11 16:49:37 -04:00
Anton Hansson 432f75c61a Merge "Fix API lint copy command" 2020-05-11 17:54:08 +00:00
Paul Duffin 160fe41c39 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
Change-Id: I87ca5a942228cf6af1a9939f0334d6fc46c39a63
2020-05-11 18:05:45 +01:00
satayev ecea813997 Merge "Introduce app -deps-info." 2020-05-11 16:51:30 +00:00
Artur Satayev 1111b84822 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
Exempt-From-Owner-Approval: previous patch approved.
2020-05-11 16:51:06 +00:00
Treehugger Robot a586fecea6 Merge "java_sdk_library: Path extraction from deps depend on tag" 2020-05-11 14:47:21 +00:00
Anton Hansson 3361a294c0 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
Change-Id: I42b8b60d01dcaed34dbde0390eb1691d656a32cf
2020-05-11 15:40:30 +01:00
Treehugger Robot d2e4822774 Merge "Expand SystemApi annotation for generating system api" 2020-05-11 14:24:36 +00:00
Paul Duffin c878250d3f 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
Change-Id: I4e1861ea67f441f2948a0d7d7053ab0b1169955f
2020-05-10 23:42:02 +01:00
Paul Duffin 6e7ecbf972 Switch java_sdk_library_import to use SetDefaultableHook()
Ensure consistency with java_sdk_library.

Bug: 155295806
Test: m checkapi
Change-Id: I074e7c865b6b52c7bcf568da3342d8772623ce4f
2020-05-10 19:33:36 +01:00
Paul Duffin 9f10bbf4cf Merge "java_sdk_library: Specify visibility of stubs modules" 2020-05-10 18:31:56 +00:00
Paul Duffin 385378bf99 Merge "Retry: Detect invalid arch specific properties in snapshot" 2020-05-09 07:33:35 +00:00
Treehugger Robot 9c3a1291e2 Merge "Add error checking and tests for jni_uses_sdk_apis and jni_uses_platform_apis" 2020-05-09 02:13:42 +00:00
Colin Cross 3c007704c7 Add error checking and tests for jni_uses_sdk_apis and jni_uses_platform_apis
Check that jni_uses_sdk_apis and jni_uses_platform_apis are consistent
with sdk_version, and add tests that they select the right variant.

Bug: 154665579
Test: app_test.go
Change-Id: I544a4f881ba16dacd7e74cd480c095091b3cf667
2020-05-08 16:55:14 -07:00
Paul Duffin 864e1b45db 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
Change-Id: I3df60f0b53ba02ec2c55a80c7da058eac5909d26
2020-05-08 22:31:56 +01:00
Greg Kaiser a71fe150fa Merge changes from topic "revert-1302576-NGVCIVIIJO"
* changes:
  Revert "Detect invalid arch specific properties in snapshot"
  Revert "Adds support for 'ignored-on-host'"
  Revert "Fix snapshot of a host/device cc_library with stubs"
2020-05-08 19:18:40 +00:00
Greg Kaiser e509447c93 Revert "Detect invalid arch specific properties in snapshot"
Revert submission 1302576

Bug: 156054601
Reason for revert: Presumed root cause of build break.
Reverted Changes:
Ifc8116e11:Detect invalid arch specific properties in snapsho...
I7ebd33307:Adds support for 'ignored-on-host'
I167b47a13:Fix snapshot of a host/device cc_library with stub...

Change-Id: Id7eba0bdde5c579e10e9b42d94a7cfab5f34995f
2020-05-08 19:12:34 +00:00
Paul Duffin 4911a89181 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
Change-Id: Iffdd9f191ff0d74646356ac577560cc38efdd790
2020-05-08 18:03:31 +01:00
Paul Duffin 0d543640d5 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
Change-Id: Ic99b7333730ed8b918d8af72ae7bd6a851c2093a
2020-05-08 12:33:27 +01:00
Paul Duffin 8f265b9ab9 java_sdk_library: Add support for module_lib API surface
Adds api scope for the module_lib and adds that to the list of all
all available scopes. The scope is generated if and only if the
api_surfaces property contains "module_lib".

No other changes are needed as the generation of the APIs is completely
driven by the allApiScopes array and the information in its contained
apiScope structures.

Test: m checkapi
Bug: 155164730
Change-Id: I7769af6823badca8715a270f86cf53b4e954b7df
2020-05-08 07:51:00 +01:00
Paul Duffin 3375e35d99 java_sdk_library: Control API surfaces generated
Adds a per scope set of properties that allows explicit control over
the API surfaces generated.

Previously, the term active was used to determine whether it was
generated but that was a little abstract and unclear so has been
replaced by generated.

Test: m nothing
Bug: 155164730
Change-Id: I7539d89618b61f6b9d1a4b60cc3f9614b157f0d9
2020-05-08 07:51:00 +01:00
Paul Duffin af6fbcbcca Merge changes I167b47a1,I7ebd3330,Ifc8116e1
* changes:
  Fix snapshot of a host/device cc_library with stubs
  Adds support for 'ignored-on-host'
  Detect invalid arch specific properties in snapshot
2020-05-07 21:58:14 +00:00
Treehugger Robot cf23ab4cd8 Merge "Skip dexpreopting android_test_import modules" 2020-05-07 21:37:37 +00:00
Treehugger Robot 3d60daadbc Merge "Switch java_sdk_library to use SetDefaultableHook()" 2020-05-07 20:39:05 +00:00
Colin Cross c80828d567 Skip dexpreopting android_test_import modules
android_test_import modules should be labelled as tests so they are
not dexpreopted.

Bug: 155778135
Test: m CtsCorruptApkTests_Compressed_Q
Change-Id: I7baa5405d03df03920b01616b030ba77f882a77e
2020-05-07 12:06:14 -07:00
Colin Cross 7500f46b95 Merge "Add jni_uses_sdk_apis" 2020-05-07 18:09:47 +00:00
Colin Cross 7204cf0e6a Add jni_uses_sdk_apis
NetworkStackTests is using platform APIs for its Java code, but needs
to use portable JNI libraries.  Add a jni_uses_sdk_apis so that it
can select the SDK variants of JNI libraries even though it doesn't
set sdk_version.

(clean cherry-pick from internal branch)
Bug: 154665579
Test: atest NetworkStackTests
Merged-In: I841fb761ec1c1ab8596aac44e01eb7eb91428006
Change-Id: I841fb761ec1c1ab8596aac44e01eb7eb91428006
2020-05-07 18:09:06 +00:00
Ivan Lozano 6c4e5c05c3 Merge "Add gcov coverage support to Rust modules." 2020-05-07 17:56:43 +00:00
Paul Duffin ee20962378 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
Change-Id: Ifc8116e11d987cfe7aec2eeaa964f3bbf36b5dc2
2020-05-07 18:35:11 +01:00
Treehugger Robot aa71638941 Merge "java_sdk_library: Define relationship between api scopes" 2020-05-07 09:37:54 +00:00
Paul Duffin f022920bde Switch java_sdk_library to use SetDefaultableHook()
Previously, java_sdk_library used AddLoadHook() to register a hook that
when called would create its child modules. That meant the
java_sdk_library properties that were used to create the child modules,
e.g. sdk_version could not be defaulted because the modules are created
before the defaults are applied.

This change switches java_sdk_library to use the new
SetDefaultableHook() mechanism to register the hook instead of the
AddLoadHook() mechanism.

It also prevents the child modules from being created if the module has
been disabled.

Bug: 155295806
Test: m checkapi
Change-Id: Ic6f90eb4449338e549878f64e8119e286b9aa549
2020-05-07 10:24:00 +01:00