Commit Graph

738 Commits

Author SHA1 Message Date
Ulyana Trafimovich 79a94a27b6 Merge "Replace `is_uses_lib` property with `provides_uses_lib`." 2020-09-10 14:34:20 +00:00
Ulya Trafimovich 54027b572e Replace `is_uses_lib` property with `provides_uses_lib`.
The previous property was boolean-valued and provided only the
information whether the library should be treated as <uses-library>
by Soong. The new property is an optional string, which is the name of
the <uses-library>. The name can be different from the module name, as
in the case of "qcrilhook" module which provides <uses-library>
"com.qualcomm.qcrilhook".

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: I65b68e6f7c420ab9c443a76de4c917d31fcd8c8f
2020-09-10 10:47:41 +01:00
Kousik Kumar 3e0b9c031c Merge "Check UseRBE is set before replacing any template with the RE version." 2020-09-10 09:24:17 +00:00
Ulyana Trafimovich 0f13eff149 Merge "Be more strict about unknown install <uses-library> paths." am: 117a5ef307
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1418529

Change-Id: Ib28e902e7f8ec57a15ef50692024cd37a96696bc
2020-09-08 15:34:50 +00:00
Ulya Trafimovich 045e11ad0d Be more strict about unknown install <uses-library> paths.
Allow default install paths only for compatibility libraries. For other
libraries that are explicitly specified in `uses_libs` and
`optional_uses_libs` unknown install path should be an error.

Bug: 132357300
Test: lunch cf_x86_phone-userdebug && m
Change-Id: I2209c90a939a8aa46c42e13bb42d09c07e4d0895
2020-09-07 13:58:51 +01:00
Ulyana Trafimovich 99bd329274 Merge "Allow non-SDK Java libraries to masquerade as <uses-library>." am: bb3467d297
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1417188

Change-Id: If25aaa0174091e966cc5c6b16063b6486a7b4ab6
2020-09-07 10:23:53 +00:00
Ulyana Trafimovich bb3467d297 Merge "Allow non-SDK Java libraries to masquerade as <uses-library>." 2020-09-07 09:49:07 +00:00
Ramy Medhat 16f23a4038 Check UseRBE is set before replacing any template with the RE version.
Test: presubmit
Change-Id: I6df58b4e700f0d231367af2710672d731d20a736
2020-09-03 01:29:49 -04:00
Treehugger Robot 6346ec0f46 Merge "Add compile_dex for java_import" am: e263af74db
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1392497

Change-Id: I9fbbd7e1f02a64f5e0ed9b583a61e64fd4306362
2020-09-02 02:02:32 +00:00
Liz Kammer d6c31d274e Add compile_dex for java_import
Test: go java tests
Test: m
Bug: 160455085
Change-Id: I2db95dfe565e78b630007adc3360a58614d0127e
2020-09-01 12:34:08 -07:00
Ulya Trafimovich 21a7375205 Allow non-SDK Java libraries to masquerade as <uses-library>.
Extend usesLibraryProperties with a boolean is_uses_lib property and
move these properties from java.AndroidApp to java.Module to allow
java.Library modules set the new propery and be recognized as
<uses-library> by Soong.

Bug: 132357300
Test: lunch cf_x86_phone-userdebug && m
Change-Id: I01cd5e0da3dd543c1c0597249d37d0914b213ca7
2020-09-01 17:45:39 +01:00
Xin Li 65cb5c69ea Merge Android R (rvc-dev-plus-aosp-without-vendor@6692709)
Bug: 166295507
Merged-In: Ifca7b65f4e27bf14cdc30f72f790b0de90130bae
Change-Id: I3a39be5f0b8736de4822c6a14072c78d4e4ad89d
2020-08-29 01:17:45 -07:00
Ulya Trafimovich fc24ad3d4e Propagate transitive SDK Java library dependencies to dexpreopt.
For some dependencies, like stubs, the SDK library may not be found at
build time (either because the implementation library is not among the
dependencies of the dexpreopted module, or because it's part of a
prebuilt, or because it's missing from the build altogether). In such
cases dexpreopt is useless, because dex2oat does not have access to the
full classpath (unless the &-classpath is used). Therefore do not
dexpreopt in such cases.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: If289088cfd103011ccb16165e95a97b30fd31b81
2020-08-27 11:47:15 +01:00
Liz Kammer 9c07d24477 Merge "Add imports_sdk_version to prebuilt_apis" 2020-08-24 16:50:51 +00:00
Treehugger Robot ec7a91f9fa Merge "Add extra_test_configs option" 2020-08-21 16:22:43 +00:00
Liz Kammer 2d2fd859bb Add imports_sdk_version to prebuilt_apis
This allows setting the prebuilt sdk's generated java_imports
sdk_version to "none".

Test: go tests
Test: m
Bug: 160455085
Change-Id: Id24aca811f0f09692971e63418da6685d8351737
2020-08-20 09:48:50 -07:00
Ulyana Trafimovich 9ce2221791 Merge "Collect paths to transitive SDK Java library dependencies." 2020-08-20 10:37:58 +00:00
Dan Shi 95d19422a6 Add extra_test_configs option
Bug: 163344047
Test: m -j HelloWorldHostTest hello_world_test HelloWorldTests
Change-Id: I237e3aa3f40df1f6387ba8ff6a16e56535cdeae9
2020-08-19 15:27:03 -07:00
Ulya Trafimovich 31e444e101 Collect paths to transitive SDK Java library dependencies.
Previously only the names were collected, and later used in the
manifest_fixer to add missing <uses-library> entries to the manifest.
Now we also need to collect build-time and on-device paths, to be used
in class loader context for dexpreopt. This commit only collects paths,
but does not pass them to dexpreopt yet.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: I34b229ee68f16ba215ba03770feadb4d890ec2bf
2020-08-19 13:51:21 +01:00
Anton Hansson 85f59b7b54 Merge "Remove special-cased stub deps on framework-res" 2020-08-18 11:58:57 +00:00
Anton Hansson 8f903f30ff Remove special-cased stub deps on framework-res
This dep is now possible to express in native Android.bp syntax,
which makes the build easier to understand.

Bug: 161214753
Test: build sdk, diff out/dist before and after
Change-Id: I878eda49b5bf54aaf581fc52e0fe9719e4bcdfce
Merged-In: I878eda49b5bf54aaf581fc52e0fe9719e4bcdfce
2020-08-17 11:00:03 +01:00
Colin Cross e07f2316b7 Rename ApexName to ApexVariationName
In preparation for reusing the same variation for multiple apexes,
rename ApexName to ApexVariationName.

Bug: 164216768
Test: all soong tests
Change-Id: I88f2c5b192ffa27acd38e01952d0cefd413222a0
2020-08-13 17:50:29 -07:00
Liz Kammer a7a64f3c5b Refactor java compileDex
We want to support a compile_dex property for java_import. This splits
dex-related properties into a dexer struct which can be embedded in
relevant modules.

Test: m
Test: soong tests
Bug: 160455085
Change-Id: If56a51dac43f630d49483a36db29cd50e9ccd529
2020-08-04 10:15:04 -07:00
Liz Kammer dd849a81f3 Add `data_native_bins` property to java_test_host
When multiple os/arch variants are supported, java_test_host could not
find a matching arch due to java having arch:common, whereas native
binaries support a specific architecture. This change adds the property
`data_native_bins` in order to support binaries with the appropriate
os/arch variants.

Test: m FirmwareDtboVerification with data_native_bins
Test: forrest
Bug: 153848038
Change-Id: I45adebff0fde2811d5ef5620c697b97b768c951f
2020-07-27 09:14:06 -07:00
Colin Cross 08dca38eb0 Build transitive lint reports for apex modules
Build and export transitive lint report zips for apex modules.

Bug: 153485543
Test: m TARGET_BUILD_APPS=com.google.android.wifi lint-check dist
Change-Id: I5a1805440452301a7e2c4ca91482b989638b54fb
2020-07-22 20:16:14 -07:00
Treehugger Robot 0add164d0e Merge "Pass unstripped JNI libraries to Make" am: bf81ed4fd1 am: 9a6d827dc3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1356262

Change-Id: I99a111aafcab5a8a8a5b704b9dd67904c93b0aea
2020-07-16 23:19:16 +00:00
Colin Cross 403cc15f1b Pass unstripped JNI libraries to Make
Pass a list of unstripped JNI libraries to Make so that they can be
installed into the symbols directory.

Bug: 159726429
Test: forrest
Change-Id: Ieb4bffbb3d0a09f476da011399c5b8b1611929d7
2020-07-10 13:44:32 -07:00
Treehugger Robot 3f1520570e Merge "Support kotlin multiplatform sources" am: 0ae555df1a am: 202dbc4ec0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1351108

Change-Id: Icbd63ed880b0df404170466c55b295aa4deb821c
2020-07-08 00:42:53 +00:00
Colin Cross a4c8cc6471 Support kotlin multiplatform sources
Add a common_srcs property and propagate it to the module.xml file
passed to kotlinc.

Test: m checkbuild
Change-Id: Ief768bafb943513c9ffbc01e829abc078f0a72bc
2020-07-06 17:58:09 -07:00
Treehugger Robot 12d1bde698 Merge changes Ib7ad715d,I3a83b5ed am: 7d9deed9fd am: 5befecfe64
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1353932

Change-Id: Ic5de5a55a939f2a1ae8ce922c31e52b6f7c443e3
2020-07-01 17:51:31 +00:00
Treehugger Robot 7d9deed9fd Merge changes Ib7ad715d,I3a83b5ed
* changes:
  Remove frameworkResModule from sdkCorePlatform.
  Remove the concept of useDefaultLibs from Soong.
2020-07-01 17:23:46 +00:00
Treehugger Robot 8034eafbed Merge "Rename the Default* constants in java/config." am: 8f70db2b48 am: 98d8ee9bd8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1353886

Change-Id: Ibf0533b6bd01244d30c5df89aa849a7f8da6f777
2020-07-01 15:25:53 +00:00
Treehugger Robot 8f70db2b48 Merge "Rename the Default* constants in java/config." 2020-07-01 14:43:46 +00:00
Pete Gillin 0638dfcf94 Rename the Default* constants in java/config.
These values are used in two out of the many possible sdk_version
configurations, and therefore weren't really defaults in any
meaningful sense. Giving them more descriptive names makes the code
easier to follow.

Bug: 157640067
Test: m nothing
Change-Id: Icf38a9c0be2606ad0478929e1b40dfcee36cddef
2020-07-01 12:40:58 +01:00
Pete Gillin e3d44b245b Remove the concept of useDefaultLibs from Soong.
This field in the java/sdk structure was used in two of the many
possible configurations, so it wasn't really a "default". It also
meant that, to understand those configurations, the reader had to know
what was considered the default, which was only possibly by reading
the code in java.go and droiddoc.go which implemented special code
paths when useDefaultLibs was true. By eliminating that setting and
explicitly setting the required values, the code is simpler and easier
to understand.

This change is a straight refactoring, in the sense that the output of
the build should be unchanged.

Regarding the changes to the proguardRaiseTag dependency in java.go:
- This is a noop for anything which had sdkDep.useModule = true prior
  to this change, because they all had the same value for
  hasFrameworkLibs() and hasStandardLibs().
- This is a noop for anything which had sdkDep.useDefaultLibs = true
  prior to this change, because they do not use proguard settings.
- Therefore, it is a noop overall.
- Nevertheless, it is required to make sdkCorePlatform work. Without
  this change, such modules would pick up a dependency on framework
  libs via the (unused) proguardRaiseTag, which creates a circular
  dependency, because this is the sdk_version used when building
  framework libs themselves.

Bug: 157640067
Test: m java docs droid
Change-Id: I3a83b5edc1bd48c16b55f6f77e3e710fc8fbd8fa
2020-07-01 12:40:58 +01:00
Paul Duffin a2058f8b7d Apply hiddenapi encoding to java_sdk_library .impl
Adds a ConfigurationName property, and ConfigurationName() method that
allows a library to separate its name (e.g. framework-tethering.impl)
from the name used in the build configuration,
    e.g. ctx.Config().BootJars().

Updates hiddenapi processing to use ConfigurationName() instead of
ctx.ModuleName().

Changes java_sdk_library to set the ConfigurationName property
of the implementation library to the name of the module instead of
<module>.impl so that it will match the name in the boot jars list.

Bug: 159683330
Test: m framework-tethering
      dexdump ${PRODUCT_OUT}/apex/com.android.tethering/javalib/framework-tethering.jar | grep hiddenapi | wc -l
      Verify that there are >0 hiddenapi entries.
      Add java_sdk_library_import prefer=true for framework-tethering
      and repeat the above to verify that there are 0 hiddenapi entries.
      Apply this change, repeat above and verify that there are the same # of entries as before.
      Remove the prebuilt for framework-tethering
      Repeat the above and verify that there is no change to the # of entries
Merged-In: I6c3016c35d0fcb1b95d4f9b37a307a69878f8e0a
Change-Id: I6c3016c35d0fcb1b95d4f9b37a307a69878f8e0a
(cherry picked from commit c4422106a7)
2020-06-29 19:05:19 +01:00
Roland Levillain a22054eed5 Merge "Add `soong.java.testProperties` to `java_defaults` module type." am: e95eb455cc am: 64b188b28f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1235127

Change-Id: Ibada0f3a014aeb37c28e704e89721d9c67453b83
2020-06-27 14:53:03 +00:00
Paul Duffin 420c026efd Apply hiddenapi encoding to java_sdk_library .impl am: c4422106a7
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/11988739

Change-Id: I9e257b70bc401b8b69273c787b74d0f4c04870f1
2020-06-26 20:11:30 +00:00
Paul Duffin c4422106a7 Apply hiddenapi encoding to java_sdk_library .impl
Adds a ConfigurationName property, and ConfigurationName() method that
allows a library to separate its name (e.g. framework-tethering.impl)
from the name used in the build configuration,
    e.g. ctx.Config().BootJars().

Updates hiddenapi processing to use ConfigurationName() instead of
ctx.ModuleName().

Changes java_sdk_library to set the ConfigurationName property
of the implementation library to the name of the module instead of
<module>.impl so that it will match the name in the boot jars list.

Bug: 159683330
Test: m framework-tethering
      dexdump ${PRODUCT_OUT}/apex/com.android.tethering/javalib/framework-tethering.jar | grep hiddenapi | wc -l
      Verify that there are >0 hiddenapi entries.
      Add java_sdk_library_import prefer=true for framework-tethering
      and repeat the above to verify that there are 0 hiddenapi entries.
      Apply this change, repeat above and verify that there are the same # of entries as before.
      Remove the prebuilt for framework-tethering
      Repeat the above and verify that there is no change to the # of entries
Change-Id: I6c3016c35d0fcb1b95d4f9b37a307a69878f8e0a
2020-06-26 18:14:18 +01:00
Roland Levillain b5b0ff3555 Add `soong.java.testProperties` to `java_defaults` module type.
This is so that we can use some test properties in a `java_defaults`
module for ART run-tests.

Test: atest art-run-test-001-HelloWorld
Bug: 147814778
Change-Id: Ifb9817ca2f08e64f911c123a4022fbf688405547
2020-06-26 12:51:37 +01:00
Jingwen Chen ce00ee318f Merge "Support multiple dists per Android.bp module, and dist output selection." am: d06f11ee71 am: 3779799731
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1335521

Change-Id: I2ca43562972b4d50f1e9fd4a801026aa9abb6816
2020-06-26 08:25:04 +00:00
Jingwen Chen 40fd90ae52 Support multiple dists per Android.bp module, and dist output selection.
This CL adds "dists" to the base property struct to support multiple
dist file configurations, and generic tag support to dist tagged outputs
of modules.

Fixes: b/152834186
Test: soong tests and `m sdk dist`

Change-Id: I80c86bc9b7b09e671f640a4480c45d438bdd9a2a
Signed-off-by: Jingwen Chen <jingwen@google.com>
2020-06-25 12:42:07 +00:00
Jooyung Han 14135e4c26 Merge "apex/apk: enforce min_sdk_version of all deps" am: 14a08f5b28 am: afdc5239b8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1287253

Change-Id: I63074e39f5f319789920e55802d4f7934b556e0a
2020-06-25 01:47:24 +00:00
Jooyung Han 14a08f5b28 Merge "apex/apk: enforce min_sdk_version of all deps" 2020-06-25 01:18:52 +00:00
Treehugger Robot cdc27099b4 Merge "Include resources in sdk snapshot of java library impl" am: 29abfb7fd1 am: 742dfaa142
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1348682

Change-Id: I02456391e111a91721aa04be044f41f59e7d3183
2020-06-24 14:46:26 +00:00
Paul Duffin 4e77284ab4 Include resources in sdk snapshot of java library impl
Bug: 159607838
Test: m nothing
Change-Id: Ie7ddbffc3957f832abfadb27292c436e8e5dcbf3
2020-06-24 13:04:15 +01:00
Jooyung Han 749dc69af1 apex/apk: enforce min_sdk_version of all deps
Enforce min_sdk_version for every payload dependency of updatable
APEX/APKs.

android.CheckMinSdkVersion() calls ApexModule.ShouldSupportSdkVersion
for every transitive dependency from APEX/APK modules to see if it
meets the min_sdk_version requirements.

The common implementation for apex/android_app is provided in
android/apex.go.

Bug: 145796956
Bug: 152655956
Bug: 153333044
Test: m nothing
Change-Id: I4a947dc94026df7cebd552b6e8ccdb4cc1f67170
2020-06-24 02:00:33 +09:00
Paul Duffin 9ee66da850 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
Merged-In: I545c5c9072dd472337d2f9b4dfdf08f53c981662
2020-06-20 11:38:08 +01:00
Colin Cross 8a3050e50d Merge changes I25c77994,I7da78ef4,I89197d0a am: 181c2a40d8 am: 7be9f60488
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1344320

Change-Id: I8b955daa70d3348ab011dee437ce028dd8c74a2f
2020-06-19 20:23:57 +00:00
Colin Cross 205a504053 Support adding extra lint checks
Add a lint.extra_check_modules property to list modules to use as
plugins to Lint.

Bug: 153485543
Test: m checkbuild
Change-Id: I25c7799438cfec43163e757637c65b8657488d36
Merged-In: I25c7799438cfec43163e757637c65b8657488d36
(cherry picked from commit 92e4b46af5)
2020-06-19 12:53:09 -07:00
Colin Cross aaf58061a0 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
Merged-In: I7da78ef493806ce4ab0050e4ee9e8d330b0509c8
(cherry picked from commit 0b67a8bd0f)
2020-06-19 12:53:09 -07:00
Colin Cross 3791b45f67 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
Merged-In: I89197d0afcb1eee011c01aa400f9977e66f43768
(cherry picked from commit 9ca38d22a4)
2020-06-19 12:53:09 -07:00
Colin Cross 92e4b46af5 Support adding extra lint checks
Add a lint.extra_check_modules property to list modules to use as
plugins to Lint.

Bug: 153485543
Test: m checkbuild
Change-Id: I25c7799438cfec43163e757637c65b8657488d36
2020-06-18 15:58:32 -07:00
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
Colin Cross 1e28e3c615 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
Merged-In: I5a530975b73ba767fef45b257d4f9ec901a19fcb
(cherry picked from commit 014489c1e6)
2020-06-18 11:01:47 -07:00
Colin Cross 1c14b4ecf6 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
Merged-In: I7803b15eb0de810c8ab8d4b9acf2511935a26fb6
(cherry picked from commit ce6734e666)
2020-06-18 11:01:47 -07:00
Colin Cross c65658301b Merge "Add support for running Android lint on java and android modules." am: a553358b34 am: 05394377ba
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1324098

Change-Id: Iae0b83aef382b116bedefa896e72d0c244046c61
2020-06-18 01:44:53 +00: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 6b8f282d98 Merge "Consolidate adding common java properties" am: d7ffbb578d am: 6eb9a491ea
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1337094

Change-Id: I680fe974df8e68207c8bbb2bc0fce24635d4bdc8
2020-06-17 22:21:58 +00:00
Treehugger Robot d7ffbb578d Merge "Consolidate adding common java properties" 2020-06-17 21:52:55 +00:00
Anton Hansson 71f093e485 Merge "Fix check-boot-jars when a boot jar is provided by prebuilt" am: 0e63a8e761 am: ac2a42054f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1341756

Change-Id: Ife514f78e7aea0b8ed05f74c21d3ce95054796cc
2020-06-17 20:02:20 +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
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
Alex Humesky 7072985393 Merge "Do not override "-g:source,lines" for host java binaries when PRODUCT_MINIMIZE_JAVA_DEBUG_INFO is set." am: c7f8b74365 am: 849ca22fe0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1339636

Change-Id: I482dee048952846d251168df148817e5b6c0efbd
2020-06-16 20:36:44 +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 23db998b8a Merge "Introduce product variables to select Java code coverage paths in Soong." am: d38ab21c6e am: f76e10aa2b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1326321

Change-Id: I3f66962252aac710d66f3f26908a7b5f530fa712
2020-06-15 19:07:06 +00: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 ca7a598d67 Merge "Use EMMA_INSTRUMENT_FRAMEWORK for apex framework libs." am: a7a36e22fb am: efa623c7e4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1320475

Change-Id: I2b9bca7a7d7107353541a36d5feeea492fc5ed87
2020-06-15 17:18:39 +00:00
Chris Gross a7a36e22fb Merge "Use EMMA_INSTRUMENT_FRAMEWORK for apex framework libs." 2020-06-15 16:50:59 +00:00
Colin Cross 9855207d0e 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.

Bug: 153485543
Test: m checkbuild
Change-Id: I68201eff30744b0f487fc4f11f033767b53a627d
Merged-In: I68201eff30744b0f487fc4f11f033767b53a627d
(cherry picked from commit c3d87d3112)
2020-06-15 09:46:31 -07: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
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 4aa6fbc9d5 Define Soong phony rules in Make am: c3d87d3112 am: 970fd93b92
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1325397

Change-Id: I44eba43a7c316b9cb9696d02962a84d0c1d8ebed
2020-06-11 20:47:03 +00:00
Colin Cross 970fd93b92 Define Soong phony rules in Make am: c3d87d3112
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1325397

Change-Id: Ia6a1f96c75c660525127c25472327dd78ba58124
2020-06-11 18:42:02 +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 12a10b050f Merge "Fix on-device paths to used libraries in dexpreopt." am: 69bd288409 am: 73759b9a5d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1326319

Change-Id: Iec7143aa2f61c9d5b7b61e8d9510db3a573d794a
2020-06-11 14:23:22 +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
Pete Gillin 811814282d Merge "Split the core/platform API into stable and legacy versions." am: d7db79cc8b am: 5dbf9e09f2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1322704

Change-Id: I731da4ed59432a67bdc3df124a8939bcf316aa0c
2020-06-09 16:37:21 +00:00
Jiyong Park 3a3c871410 dex_import that isn't available for platform isn't installed am: afd3d11a79
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/11787985

Change-Id: I617bce4198e4e4b4dc6779246f0bfadcb6a442a4
2020-06-08 13:13:27 +00: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
Jiyong Park afd3d11a79 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.

Bug: 158284983
Test: OUT_DIR=/tmp/ndk build/soong/scripts/build-ndk-prebuilts.sh
Change-Id: I85570506e700be59ee63e4f1d7902a40e36df39c
2020-06-08 19:59:02 +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 abbe8875b3 Revert^2 "Rename DexJar interface method to DexJarBuildPath." am: 5539e7b568 am: 0852ac9a6d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1324492

Change-Id: I75dc93bb6aac621a0d90e5c5051cdeab98f5d1ef
2020-06-05 01:29:34 +00: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 7e59e8e2df Merge "Revert "Rename DexJar interface method to DexJarBuildPath."" am: c55b679e7b am: 651a63ca9d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1324371

Change-Id: Ic3be6718aff2b04048bac17635b2858581fe7f8a
2020-06-04 11:13:23 +00: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 0cc337d35a Merge "Rename DexJar interface method to DexJarBuildPath." am: 2a08566634 am: 22cd1b5383
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1322701

Change-Id: I87a6570cc6184bb38dda1f83dac787c30d8aaa54
2020-06-04 10:36:28 +00:00
Ulyana Trafimovich 2a08566634 Merge "Rename DexJar interface method to DexJarBuildPath." 2020-06-04 10:05:33 +00:00
Jiyong Park 2cd081cf06 dex_import can be added to apex
Bug:157886942
Test: m
Change-Id: Ida6f7bb784efe74cc1fa0e8d370eaee803f08b0f
Merged-In: Ida6f7bb784efe74cc1fa0e8d370eaee803f08b0f
2020-06-04 10:28:44 +01:00
Treehugger Robot a7f51bb3c0 Merge "dex_import can be added to apex" am: a8bf98852a am: 55110941ea
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1320920

Change-Id: I09342ecaf016ca85ab5ac5812c46af6932179258
2020-06-04 05:38:13 +00:00
Tej Singh 8383972ec0 Revert "Always run package check"
This reverts commit aa7359ab0c.

Reason for revert: package-check.sh doesn't work on mac

Change-Id: Ia3dcee612c1f6b4121e1351c8710638ae41bc88a
Merged-In: I50af71d54d5f1f8b516bfcf1efbcf6217e89c83a
2020-06-03 18:45:54 +00:00
Colin Cross d89338653f Merge "Revert "Always run package check"" am: 3747336d23 am: 2f0963ecd3
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1323293

Change-Id: I3592365b63fab1597b2a41aafaa68e49d6f1e0f2
2020-06-03 17:56:14 +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
Paul Duffin 56e303ae4e Always run package check am: 91206d9ed1 am: d08b1040cb
Original change: undetermined

Change-Id: I7eed39d6b49b0e837c8ad0689a8e728f7b329e41
2020-06-02 13:31:18 +00:00
Paul Duffin aa7359ab0c 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
Merged-In: Ib01aa09e13f80282218049270eb7a58ec5f9f605
Change-Id: Ib01aa09e13f80282218049270eb7a58ec5f9f605
(cherry picked from commit 91206d9ed1)
2020-06-02 14:05:34 +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
Kousik Kumar c05da0a90e 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
Merged-In: Ia17b532fbb282be414adf879914870082dd0841b
2020-05-30 19:59:10 +00:00
Kousik Kumar 2b6185810a Merge "Add support for remote-execution / caching of jar/zip actions" am: c4cdba07d3 am: d996ff6a68
Change-Id: I41f544531788cfdf7a16560e24f27c9d31b186ad
2020-05-29 13:56:58 +00:00
TreeHugger Robot e3a5ad660d Merge "Collect permitted packages from java_sdk_library instances" into rvc-dev am: 5cfbb4332f
Change-Id: I3d5a7d6de21cfc988f146caef84ae1b8b1fd2a33
2020-05-29 13:32:49 +00:00
Paul Duffin a105cf99d0 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:35:18 +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
Jiyong Park ed50ca8dd8 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.

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

Bug: 157638999
Test: m
Merged-In: Iaf5023020b5440f1ffd4f5414b5a7864655fc22a
(cherry picked from commit a62aa23990)
Change-Id: Iaf5023020b5440f1ffd4f5414b5a7864655fc22a
2020-05-29 14:15:36 +09: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 db1bd15ef0 Merge "apex respects stem of java_library modules" am: 00f5701ade am: 3013ea064f
Change-Id: I40a1a6803d8af53a7889b8986f59fbafd4d13ee1
2020-05-29 01:17:33 +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
Anton Hansson 7be6199af1 Merge "Correct link type for module stubs" into rvc-dev am: 1733d6acf8
Change-Id: Ia5df51ecc76e9490aa94937ff8ba8eb92470dc5e
2020-05-28 09:01:27 +00:00
Anton Hansson 1733d6acf8 Merge "Correct link type for module stubs" into rvc-dev 2020-05-28 08:49:30 +00:00
TreeHugger Robot b676ead4e1 Merge "Add test_mainline_modules to the auto-gen test config(AndroidJUnitTest only)." into rvc-dev 2020-05-28 06:12:35 +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
Anton Hansson ec68fb417e Merge "Improve the structure of the link check method" into rvc-dev am: 5e8c81a91d
Change-Id: I097494045b4ce961b5d0f019e856893e19988e32
2020-05-27 11:20:20 +00:00
Anton Hansson 5e8c81a91d Merge "Improve the structure of the link check method" into rvc-dev 2020-05-27 11:09:53 +00:00
Treehugger Robot eb8c84ed4e Merge "AIDEGen: Add path attribute to okhttp module." am: c7c7e466ac am: d3205312ed
Change-Id: I229231b44e448f72d896545ef525a6c2f39a5e1f
2020-05-27 07:42:54 +00:00
Treehugger Robot c7c7e466ac Merge "AIDEGen: Add path attribute to okhttp module." 2020-05-27 07:18:19 +00:00
TreeHugger Robot e5138b82ab Merge "Allow the user to explicitly set the java Uncompress_dex property." into rvc-dev am: 6270b775de
Change-Id: If73110d3028a1accf0cf61e6baa3b265f443f763
2020-05-27 04:58:51 +00:00
TreeHugger Robot 6270b775de Merge "Allow the user to explicitly set the java Uncompress_dex property." into rvc-dev 2020-05-27 04:30:37 +00:00
Paul Duffin 007f650bbb Retry: "Improve tracking of exported sdk libraries" am: 64e6199756
Change-Id: I1ce69a094492316ba50da15e44968490f15a8bd8
2020-05-26 09:21:47 +00:00
Anton Hansson 0bd88d0b4e 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
2020-05-25 12:48:41 +01:00
Anton Hansson ac103461a4 Improve the structure of the link check method
Match by name first, then by kind.

Bug: 157010342
Test: m
Change-Id: Ic337a073c3bd14ac03b1d899aeb612247a708495
2020-05-25 12:48:09 +01:00
Paul Duffin 64e6199756 Retry: "Improve tracking of exported sdk libraries"
The build tracks the java_sdk_library/_import modules that are
referenced by libraries so that it can ensure that any Android app that
includes code that depends on one of those modules has the appropriate
<uses-library> entry in their manifest.

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

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

Test: atest CtsProviderTestCases - which relies on android.test.mock
      being implicitly tracked to verify that I had not broken
	  anything. Used aapt2 dump badging to read the manifest.
	  m nothing - to run the new tests which failed before fixing the
	  code.
Bug: 156723295
(cherry picked from commit 859fe961b0)
Change-Id: I760a9ac72856e3a07a497ce40db70c7e70106837
2020-05-25 10:41:20 +01:00
Remi NGUYEN VAN df5333db12 Revert "Improve tracking of exported sdk libraries" am: ed0314270d
Change-Id: I2a85486223ae046ff455752769ae08dffe6e98cf
2020-05-25 04:13:16 +00:00
Remi NGUYEN VAN ed0314270d Revert "Improve tracking of exported sdk libraries"
Revert submission 11569833

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

Change-Id: I3a07d412e795df512c430e4d2ed221f4d17e904a
2020-05-25 02:05:07 +00:00
David Srbecky 98c71228f1 Allow the user to explicitly set the java Uncompress_dex property.
ART tests need to explicitly control the compression.

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

Bug: 157239179
Test: "atest ArtGtestsTarget" with http://go/aog/1302773
Change-Id: I4490aa0a61fa71f830feb6a46dffd8d20fccfc66
Merged-In: I4490aa0a61fa71f830feb6a46dffd8d20fccfc66
2020-05-21 19:59:25 +01:00
Paul Duffin 442a475521 Improve tracking of exported sdk libraries
The build tracks the java_sdk_library/_import modules that are
referenced by libraries so that it can ensure that any Android app that
includes code that depends on one of those modules has the appropriate
<uses-library> entry in their manifest.

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

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

Test: atest CtsProviderTestCases - which relies on android.test.mock
      being implicitly tracked to verify that I had not broken
	  anything. Used aapt2 dump badging to read the manifest.
	  m nothing - to run the new tests which failed before fixing the
	  code.
Bug: 156723295
Merged-In: Ia99def91e9b74d2ed0a777de04b476c00ea0393d
Change-Id: Ia99def91e9b74d2ed0a777de04b476c00ea0393d
(cherry picked from commit 859fe961b0)
2020-05-21 14:53:38 +01:00
Treehugger Robot a0de4314f4 Merge "Improve tracking of exported sdk libraries" am: 7d74b5f142 am: 9e6bbde8b1
Change-Id: Ic39a86ee438e21c8b1cc4f9024e1bb889e7ca34c
2020-05-21 12:34:47 +00: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
Paul Duffin c8f2f186d1 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
Merged-In: I1733405526764272beba63470a9bc8a958d41024
Change-Id: I1733405526764272beba63470a9bc8a958d41024
(cherry picked from commit 0d3c2e136b)
2020-05-18 11:31:53 +01:00
Treehugger Robot 1c729e80c6 Merge "Add test_mainline_modules to the auto-gen test config(AndroidJUnitTest only)." am: 1d9e2364ed am: 30a6edb924
Change-Id: I2134c97ff74f278033887a0e9ea5f758f4080772
2020-05-18 02:28:33 +00:00
easoncylee ba60625021 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
Merged-In: I41ba8749ce46da62db402a8b8a555d4874e1cfc0
2020-05-18 09:59:07 +08: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 5c7020556f Extract common behavior between Module and Import am: 0d3c2e136b am: 8bf22015c0
Change-Id: I1566ab0283c3efacb3c31d3c5f78903797d62a8c
2020-05-17 16:00:35 +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
TreeHugger Robot 8a285478aa Merge "Use system modules for prebuilt SDKs >=30" into rvc-dev am: a91a16b484
Change-Id: Ide5005514be7f916212cde486f75230fec87c807
2020-05-15 23:56:39 +00:00
TreeHugger Robot a91a16b484 Merge "Use system modules for prebuilt SDKs >=30" into rvc-dev 2020-05-15 23:47:29 +00:00
Colin Cross eb03296b57 Don't use SDK variant for vendor JNI libraries
Vendor JNI libraries already have stable APIs enforced by the VNDK,
they shouldn't use SDK variants.

Bug: 156225490
Test: TestJNISDK
Change-Id: I21ba67e8e9fb05016caf5888129adc1a939545c2
Merged-In: I21ba67e8e9fb05016caf5888129adc1a939545c2
(cherry picked from commit c2d24050c5)
2020-05-15 10:13:42 -07:00
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