Commit graph

488 commits

Author SHA1 Message Date
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
Chris Gross
a7a36e22fb Merge "Use EMMA_INSTRUMENT_FRAMEWORK for apex framework libs." 2020-06-15 16:50:59 +00: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
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
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
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
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
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
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
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
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
Kousik Kumar
c4cdba07d3 Merge "Add support for remote-execution / caching of jar/zip actions" 2020-05-29 03:31:20 +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
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
David Srbecky
38b2a86091 Merge "Allow the user to explicitly set the java Uncompress_dex property." 2020-05-27 13:45:29 +00:00
Treehugger Robot
c7c7e466ac Merge "AIDEGen: Add path attribute to okhttp module." 2020-05-27 07:18:19 +00:00
David Srbecky
e033cbae40 Allow the user to explicitly set the java Uncompress_dex property.
ART tests need to explicitly control the compression.

Bug: 157239179
Test: "atest ArtGtestsTarget" with http://go/aog/1302773
Change-Id: I4490aa0a61fa71f830feb6a46dffd8d20fccfc66
Merged-In: I4490aa0a61fa71f830feb6a46dffd8d20fccfc66
2020-05-21 19:59:25 +01:00
Paul Duffin
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
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
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
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
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
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
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
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
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
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
Artur Satayev
480e25b74f Introduce min_sdk_version to deps info.
Bug: 149622332
Test: m
Change-Id: Ie6568cb8a82d5cca9a3dc91b5a068abf4b0632dc
2020-05-04 19:44:28 +01:00
satayev
9d6ea77c52 Merge "Ensure APEX's Java deps use stable SDKs." 2020-05-04 16:03:44 +00:00
Songchun Fan
4b25e319e6 Revert "[soong] new field in Android.bp to request APK signing V4"
This reverts commit 17d69e3484.

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

Test: builds
Change-Id: I87bd820cd6dbc5274ce3d28c4578381718aa805d
Merged-In: I70d6f7dc751510311b03e245b2189a76b395a49c
2020-05-01 11:29:36 -07:00
Jaewoong Jung
bf13546f54 Add defaults support to runtime_resource_overlay.
(This is a cherry-pick change.)

Bug: 154956723
Test: app_test.go
Change-Id: Ida29035ef45ec188c95a07a8bccaaa77eea486d7
Merged-In: Ida29035ef45ec188c95a07a8bccaaa77eea486d7
2020-04-28 20:49:17 +00:00
Artur Satayev
8cf899afcc Ensure APEX's Java deps use stable SDKs.
Test: m
Bug: 153333044
Change-Id: Ib1acf3073e96fe23c92d292ec0b1a91e2cd408db
2020-04-27 19:16:40 +01:00
Treehugger Robot
52c0b7b35b Merge "Repeat kapt processor argument for multiple processors" 2020-04-24 15:51:13 +00:00
Colin Cross
5a11686e64 Repeat kapt processor argument for multiple processors
kapt claims to support a comma separated list of annotation
processors, but it errors if multiple annotation processors
are given.  Surrounding the the list with {} does not error,
but it also doesn't even warn if the second element in the
list is garbage, so it may not be running the second
processor.  Repeat the processor argument for each
annotation processor class instead.

Bug: 154736649
Test: TestKapt
Test: m checkbuild
Change-Id: I4c7c161dbf867d7fba1aaf16fd5e502647e3f682
2020-04-22 20:43:37 -07:00
Artur Satayev
2db1c3f1c4 Check updatable APKs compile against managed SDKs.
As a follow up, this property will be set to APKs participating in mainline program.

Bug: 153333044
Test: m
Change-Id: I6ea2f3c1d26992259e4e9e6a6d8cecf091d39c43
2020-04-15 12:06:13 +01:00
Paul Duffin
6534770793 Stop requiring apex_available on java_library members of sdks
Previously, adding java_library to an sdk required that the names of
any APEXes that transitively compiled against it were added to its
apex_available property. This change removes that requirement.

Also corrects the dependency path in the TestApexAvailable_IndirectDep
error which previously passed through "shared from static" static
dependency tags even though those are explicitly NOT followed when
checking apex_available settings.

Bug: 152878661
Test: m droid
Change-Id: I995ed38956c1bc210b09494812de012fed9f9232
2020-04-08 08:40:44 +01:00
Treehugger Robot
ab768cf54b Merge "[soong] new field in Android.bp to request APK signing V4" 2020-04-05 02:14:41 +00:00
Songchun Fan
17d69e3484 [soong] new field in Android.bp to request APK signing V4
If "v4_signature: true" is set, the v4 signature file,
named [outputApkFile].idsig
will be generated along side the outputApkFile.

Test: m nothing
Test: atest PackageManagerShellCommandIncrementalTest
BUG: 149354175
Change-Id: Ie84725a15406f96f65042ea9909460e4eb34d57f
Merged-In: Ie84725a15406f96f65042ea9909460e4eb34d57f
2020-04-04 12:37:45 -07:00
Anton Hansson
78156ef5dd Add a Tag field to dist to dist a tagged output
Make java_library support this mode of output, to allow
callers to dist the classes.jar file rather than the dexed
jar file.

Bug: 152618077
Test: followup CL
Change-Id: I5ba6949833a0fbb95376142aec5096ff5f084c00
Merged-In: I5ba6949833a0fbb95376142aec5096ff5f084c00
(cherry picked from commit 1e65f94a4b)
2020-03-31 09:55:49 +01:00