Commit graph

95 commits

Author SHA1 Message Date
Paul Duffin
2ff6d1b6d2 Provide support for preparing tests with prebuilt_apis
Adds general support for generating a set of prebuilt apis for a set of
releases and modules. Plus some wrappers for common use cases.

This temporarily will delete any existing conflicting files and replace
them so that it can be used in tests without first removing
javaMockFS(). The future update that removes javaMockFS() will also
remove that workaround.

Bug: 182638834
Test: m nothing
Change-Id: If4e2118f2384b9866cf3f85a5afec1e2e4f9ac95
2021-03-15 17:17:40 +00:00
Paul Duffin
bf028b533d Extract PrepareForTestWithJavaSdkLibraryFiles from javaMockFS()
Needed for tests in both java and sdk packages.

Bug: 182638834
Test: m nothing
Change-Id: Ia8c5e7db47d8b63bf8dcf2965b3af60a4d35a9e5
2021-03-14 01:08:26 +00:00
Paul Duffin
95bdab4000 Support test fixtures in java package
Restructures the java package test setup code to create FixturePreparer
instances for setting up a test fixture and converts some tests to
use it.

The goal with this change is not to switch all the java tests over to
directly using the new model but instead to ensure that the majority of
the java tests run with the new model, to allow existing tests to
easily switch to the new model when needed and to allow dependent
packages to be switched to the new model.

Bug: 181070625
Test: m nothing
Change-Id: I1c9d96ddbc973aaf9733dcd7fa0479f79b0f471f
2021-03-10 10:13:09 +00:00
Paul Duffin
3785673f9b Allow java_sdk_library_import to contribute to hiddenapi processing
Invokes hiddenAPIExtractInformation() on the java_sdk_library_import's
dex implementation jar provided by the deapexer (on behalf of
prebuilt_apex) so that hiddenAPI can extract the information it needs,
if anything, from the dex file.

The dex file provided by deapexer has already had the hiddenapi
information encoded into it so it does not need to do that again.

Usually, it would require a classes implementation jar as well in
order to extract information from UnsupportedAppUsage annotations but
that is not available for a java_sdk_library_import. Fortunately, the
modules that are currently affected by this do not contain any such
annotations. This just uses a public api stubs jar instead.

Bug: 181267622
Test: m nothing
Change-Id: I96275e46f8b7fecba88075319e9f2da5ae315c03
2021-03-01 12:58:28 +00:00
Paul Duffin
4fd997bc13 Refactor the hiddenAPI() method for reusability
A follow up change needs to be able to contribute to the information
the hiddenapi process collates without having a dex file encoded. This
change pushes all the functionality related to information gathering
into the hiddenAPIGenerateCSV() method and then renames it and the
hiddenAPI() method to make it clearer what they do.

Bug: 178361284
Test: m droid
      Verified that hiddenapi files (both aggregated ones and for the
      individual modules) are not affected by this change.
Change-Id: I04417720216a0fbadcd88e6185e7de6570af6216
2021-02-08 19:10:50 +00:00
Paul Duffin
5bbfef8718 Fix some minor issues with boot_image
Mistakenly used HostAndDeviceDefault (which builds host and device
variants by default) instead of HostAndDeviceSupported which only
builds a device variant by default.

Moved the test definitions of art and framework boot images from being
defined in all Java related tests into the test where they belong. This
is needed in order to improve the ART and framework boot image specific
testing.

Bug: 177892522
Test: m droid
Change-Id: I16771f09bd789033e18c58ae6dd4b6b9e865d831
2021-01-30 12:57:26 +00:00
Paul Duffin
3451e1600f Add boot_image module type
Adds a boot_image module type. Follow on changes will add instances of
boot_image to represent the ART and framework boot images in the art
and frameworks/base repositories respectively.

For the moment they retrieve their associated boot image configuration
from the map returned by genBootImageConfigs() and leave the actual
work of creating the ninja rules to create the boot images to the
dex_bootjars singleton.

Bug: 177892522
Test: m droid
Change-Id: Ib69701de0d24d996bb8e8be7a20b941be907390e
2021-01-26 13:00:07 +00:00
Paul Duffin
4c183c7581 Merge "Make dexpreopt tools available for all java tests" 2021-01-26 12:08:30 +00:00
Paul Duffin
635aa0834f Make dexpreopt tools available for all java tests
Bug: 177892522
Test: m nothing
Change-Id: I594bddae692ef76dc8c3da504934d0151b13d4c9
2021-01-25 19:15:19 +00:00
Anton Hansson
370fd0b050 Minor cleanup in prebuilt_apis
Use ints instead of strings for version comparison.

Bug: 178171189
Test: m
Change-Id: I53d71b138a64b902b3f00adafec5d354630a5e35
2021-01-25 10:58:41 +00:00
Paul Duffin
1ab6186e91 Switch dex_bootjars to a singleton module
The main difference between a singleton and a singleton module that
affects this change is that the latter requires a module to be defined
in order for the singleton to be instantiated. This change defines the
module in both the tests and the standard build.

Bug: 177892522
Test: m droid
Change-Id: Id6669835cf3a2ab7359fa53047eb9042992a9362
2021-01-21 16:49:34 +00:00
Paul Duffin
c059c8c9a0 Add java.RegisterRequiredBuildComponentsForTest function
Insulate tests that exercise code in the java package from having to
register the build components provided by the java package by providing
a single function that registers them all. This follows the pattern
currently used in the cc and rust packages.

This change is in preparation for switching the dex_bootjars singleton
from a singleton, which does not require a module definition in order
to be instantiated, to a singleton module which does. That will require
adding a module definition into java.GatherRequiredDepsForTest() and
this change ensures that the required components will have been
registered in every test.

Bug: 177892522
Test: m nothing
Change-Id: I6475db8240894947dd07c89a940a3e4f201aa598
2021-01-21 11:47:32 +00:00
Anton Hansson
dff2c78a20 Add attribute to disable last-api compat tracking
Setting this to true by default is dangerous as it can mask bugs. Create
a dedicated attribute for java_sdk_library to enable this behavior
instead. The default will be flipped in a future CL when all the current
offenders have been fixed.

Fix all the tests to have the right API files.

Bug: 176092454
Test: m nothing
Change-Id: Ieab94bcb74abf8d018365a56fb447fe3dbd46957
2020-12-21 17:25:30 +00:00
Ulya Trafimovich
24813e1d80 Unify handling of compat and normal libs in class loader contexts.
Also, add tests for compatibility libraries in class loader context.

This CL separates special-case handling of compatibility libraries into
a "fixup" step that is done after class loader context is constructed by
Soong. This allows to handle compatibility libraries and normal
libraries uniformly, which should enable further simplification of class
loader context representation (in subsequent CLs).

Currently the only "fixup" step is removal of libraries from conditional
class loader context if they already are in unconditional context. This
check cannot be done at the time when the libraries are added to
conditional context, because the full uncoditional context is not yet
known at that time. Previously construction of unconditional context was
delayed, now it is no longer delayed and handled in the same way as
unconditional context, and the "fixup" does the filtering.

Test: lunch aosp_cf_x86_phone-userdebug && m
Bug: 132357300
Change-Id: Ie71e9fb2d3d529b5317cd84e09ab3c853017c349
2020-10-27 17:05:30 +00:00
Paul Duffin
fb6ae5bc73 Add support for using sdk_version: "module_<ver>"
Fixes a panic when trying to build something with
sdk_version: "module_30".

Test: m nothing
Change-Id: I9b2ce50957f59e2bead335ffa58888e15cda1f78
2020-09-30 16:20:17 +01:00
Anton Hansson
a2adc37fc9 Make hiddenapi use prebuilt stubs when it should
Bug: 160455085
Test: build_unbundled_mainline_module.sh (with disabled source-stubs)
Test: hiddenapi_singleton_test.go
Change-Id: Id93c974351b3f8efdf8e4efe4192d3809f4fcaa5
2020-09-18 08:06:58 -07:00
Liz Kammer
88d593d942 Merge "Add hidden_api for java_import" 2020-09-14 13:57:09 +00:00
Liz Kammer
5ca3a6293e Add hidden_api for java_import
Test: go java tests
Test: m
Bug: 160455085
Change-Id: Ib6e826e32ca73ceea0799b26145ad06b1e62a1bf
2020-09-10 07:56:03 -07: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
Jeongik Cha
219141c6bb Introduce BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES
If BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES has a numeric value,
it replaces "current" or "system_current" with the version which
the flag indicates.

Bug: 163009188
Test: BOARD_CURRENT_API_LEVEL_FOR_VENDOR_MODULES=29 m, and then check if every vendor
java module's sdk_version is 29 if its sdk_version was current.

Change-Id: I17b49b8e02caf2d1bc57b91648d4420f3ad9fcb9
2020-08-27 23:09:54 +09: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
Pete Gillin
84c3807b99 Enforce the legacy core/platform API restriction.
This change silently decides whether modules which depend on either
sdkPrivate or sdkCorePlatform get the legacy or the stable version of
the core/platform API, based on whether the module's name is on a
hard-coded list or not.

Test: m java
Test: make a target from the list when its entry is commented out, which correctly fails
Bug: 157640067
Change-Id: I15e5a6c2f07e73718803501d705de0d7ab9bec90
Merged-In: I15e5a6c2f07e73718803501d705de0d7ab9bec90
Merged-In: Iaa97ddaa015e8079fcb3426585c5101c7ec9e22a
(cherry picked from commit c0f4373106)
2020-07-23 09:06:52 +01:00
Paul Duffin
d295daa19a Ensure that sdk/module_exports depends on source members am: cee7e66b07 am: e371a18acc
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1359444

Change-Id: If241aea3d4997adfa1edea5e17c35b02f6bc0eb6
2020-07-09 21:58:57 +00:00
Paul Duffin
cee7e66b07 Ensure that sdk/module_exports depends on source members
Previously, preferring a prebuilt of an sdk/module_exports's member
would cause the sdk/module_exports to depend on the prebuilt instead
of the source and cause problems with the build.

This chance prevents the dependency from an sdk/module_exports to its
members from being replaced with prebuilts.

Bug: 160785918
Test: m nothing
Change-Id: Iee4bcd438c11929e30fb5766701b05a0e89956d9
2020-07-09 17:51:06 +01:00
Treehugger Robot
c4ef52f518 Merge "Prepare Soong for switch to stable core/platform API." am: 286d8f9972 am: d6bc08bdbd
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1353885

Change-Id: I8785b0cf32bb45c97878500f53754012a681da51
2020-07-01 12:21:39 +00:00
Pete Gillin
40a0642385 Prepare Soong for switch to stable core/platform API.
This ensures that `m nothing` succeeds even if java/config/config.go
is changed to use `stable.core.platform.api.stubs` and
`stable-core-platform-api-stubs-system-modules` instead of the legacy
versions. (The change to stable cannot be made yet because real
targets depend on APIs only in legacy, but it is useful for the build
system to be ready for this change.)

Bug: 157640067
Test: m nothing (with and without local change mentioned above)
Change-Id: Id7562d8c592551fd0ed2b9849bcf6eb707c2a1d0
2020-07-01 11:31:30 +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
Colin Cross
300b266264 resolve merge conflicts of a73ffc21e0 to rvc-dev-plus-aosp
Test: I solemnly swear I tested this conflict resolution.
Bug: None
Change-Id: Ie8ad8a9e91bf4a86c90060b15dc88f9860539637
2020-06-11 12:12:30 -07:00
Paul Duffin
01c577968a Merge "java_sdk_library: Add system-server scope" into rvc-dev am: 4754d4451c
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/11705588

Change-Id: I6c2a7000cf7b46dcef8ed476d6e96ffc7e441ed4
2020-06-10 13:12:51 +00: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
Paul Duffin
5a757b1ebb java_sdk_library: Add system-server scope
Bug: 155164730
Test: m nothing
Change-Id: I49a2dab5c064b05f16691a3fae65f2b4ffc53bfd
2020-06-08 15:27:58 +01: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
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
Anton Hansson
c9cc20cbe8 Revert "Default annotations_enabled to true for sdk_library"
This reverts commit a9a3173ee3.

Bug: 157010342
Reason for revert: broke ike
Exempt-From-Owner-Approval: clean revert
Change-Id: I592f50d0263ce78ea6d0d335cc7e0f493fcff800
2020-05-25 09:49:48 +00:00
Anton Hansson
a9a3173ee3 Default annotations_enabled to true for sdk_library
This turns out retention of Nullable annotations, which is almost
certainly what every user wants. Also add the "stub-annotations" lib to
the stub libs property, to make sure the nullability annotations
resolve properly.

Bug: 157010342
Test: m
Change-Id: I905144add4ef6f85445eedd1ba5169445f6005e0
2020-05-21 13:36:49 +01:00
Colin Cross
49e94c0a92 Merge "Use system modules for prebuilt SDKs >=30" 2020-05-18 19:02:43 +00: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
a91a16b484 Merge "Use system modules for prebuilt SDKs >=30" into rvc-dev 2020-05-15 23:47:29 +00:00
Sasha Smundak
4de27a5757 Implement android_app_set module
Bug: 152319766
Test: manual and builtin
Change-Id: Id0877476f9ae23311d92c0b59a9c568140ab4119
Merged-In: Id0877476f9ae23311d92c0b59a9c568140ab4119
2020-05-15 10:49:59 -07:00
Colin Cross
db22475ecb Use system modules for prebuilt SDKs >=30
Prebuilt SDKs >=30 now contain core-for-system-modules.jar,
convert them to system modules and use them when compiling against
the SDK to allow using javac -source 1.9 -target 1.9.

Bug: 117069453
Test: TestClasspath
Change-Id: Iebadad5980b952ed91c3ffd56cff1ce1827d3247
2020-05-14 19:51:31 -07:00
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
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
Liz Kammer
70dd74dde7 Add signing certificate lineage support to soong
Test: app_test
Bug: 153366049

Change-Id: I65a92d6c40057dcc01950991fb7be485de1c9080
2020-05-08 09:50:42 -07:00
Anton Hansson
f6aead085c Merge "Make system_server stubs consistent with other stubs" 2020-03-25 14:18:32 +00:00
Anton Hansson
ba6ab2e791 Make system_server stubs consistent with other stubs
Include the module_api stubs in system_server one instead of
putting both of these jars on the classpath. Also rename it
to be in line with the other stubs.

Bug: 149293194
Test: m
Exempt-From-Owner-Approval: approved internally
Change-Id: Iead5af4152a49cd59a4fd7afc0312c2f0c872c1e
Merged-In: Iead5af4152a49cd59a4fd7afc0312c2f0c872c1e
(cherry picked from commit bbd78556da)
2020-03-25 14:18:02 +00:00
Jiyong Park
19604de13e add aidl.export_include_dirs to java_import module type
This allows a java prebuilt to export AIDL files to its clients.

Bug: 151933053
Test: m
Change-Id: I21b5d5ce647141a7c76f62490adbccb858b10323
2020-03-24 16:44:11 +09:00
Anton Hansson
bbd78556da Make system_server stubs consistent with other stubs
Include the module_api stubs in system_server one instead of
putting both of these jars on the classpath. Also rename it
to be in line with the other stubs.

Bug: 149293194
Test: m
Change-Id: Iead5af4152a49cd59a4fd7afc0312c2f0c872c1e
2020-03-19 17:42:59 +00:00
Colin Cross
f28329de73 Move NDK test modules into cc/testing.go
Move the NDK modules defined in app_test.go into cc/testing.go in
preparation for using sdk_version: "current" in more tests.

Test: all soong tests
Change-Id: I80bc31225fb4562fce42781219cefbbd6affae06
2020-02-19 18:59:15 -08:00
Jiyong Park
aae9bd11c2 sdk_version: "system_server_current"
The new sdk version "system_server_current" is for system server
components that needs to use all public APIs, system APIs, module APIs,
and the system server APIs.

Bug: 146757305
Test: m
Change-Id: I24fd5af010532a110393676607dc90889f2ec17e
2020-02-12 04:36:43 +09:00
Treehugger Robot
c4930248c4 Merge "sdk_version: "module_current" is supported" 2020-02-06 03:50:43 +00:00