Commit Graph

43 Commits

Author SHA1 Message Date
Victor Chang 2d457e1cc8 "module_current" and "system_server_current" should contain ART's @SystemApi(MODULE_LIBRARIES)
Before this fix, compiling a java_library against sdk_version:
"module_current" can't use the @SystemApi(MODULE_LIBRARIES) provided
by the ART module because the system module "core-current-stubs-system-modules"
contains only the public APIs.

Use the new system module with module lib APIs.

(cherry picked from commit b54f5aa3599196cfed8c32d3e52e1c35b51b8473)

Bug: 183097033
Test: m droid
Merged-In: I274e2710d1ff34e896aa620bfafb4481180c53b5
Change-Id: I374bc4899ef8f60344e37a94ad3cb8492f47fb4d
2021-07-01 10:57:26 +01:00
Paul Duffin 79abe57f53 Remove FixturePreparer.Extend()
Use GroupFixturePreparers instead.

Bug: 182885307
Test: m nothing
Change-Id: Idc01d3cc5a57576a4cf417e9105d1ab851126e10
2021-04-01 10:33:20 +01:00
Paul Duffin a71a67a4f5 Remove extraneous calls to TestingBuildParams.RelativeToTop()
Deprecated the method to try and prevent any other uses being added.

Bug: 183650682
Test: m nothing
Change-Id: Ia6f43851e5a00c9d96af780e3bd21e03175e1a2f
2021-03-30 20:03:22 +01:00
Paul Duffin 71ae59412b Remove javaFixtureFactory
Replaces uses of javaFixtureFactory with prepareForJavaTest and removes
the unused javaFixtureFactory.

Bug: 182885307
Test: m nothing
Change-Id: I809772d14af2af211b9e15ad676fbdc06b07cd46
2021-03-24 01:07:12 +00:00
Paul Duffin 414ea5eb73 Remove uses of buildDir from java/java_test.go and java/sdk_test.go
Remove any uses, either direct (or indirect via testJavaConfig or
similar methods), of the package level buildDir variable from this
file.

Bug: 182885307
Test: m nothing
Change-Id: I4d9dc39d3b1e5c37ba1f9e72da94048949c0fd17
2021-03-24 01:07:12 +00:00
Paul Duffin 171de3ef7c Fix TestClasspath to work without javaMockFS()
Bug: 182638834
Test: m nothing
Change-Id: Icd6fe93cbda418cb4eaf5e99800894d4c4cc5e6f
2021-03-18 08:02:38 +00:00
Paul Duffin 76101fa5ec Convert TestClasspath to test fixtures
The main complication with this change was that many of the tests check
paths that are provided by the default java modules. The location of
them is different in the test fixtures that it is when using
testConfig() and so the test needed to be changed.

Bug: 182638834
Test: m nothing
Change-Id: I6d325dbd3ba39e5de7e53c576d7cfe07bd95a965
2021-03-18 08:02:38 +00:00
Colin Cross ae8600b507 Pass Config to NewTestContext instead of ctx.Register
Prepare for using Config when adding singletons by passing
Config to NewTestContext and NewContext instead of to ctx.Register.
This will enable a followup change to store SingletonMakeVarsProviders
registered on the Context in the Config, which is necessary to run
multiple tests in parallel without data races.

Test: all soong tests
Change-Id: Id229629a4e42ff4487d317241673837726c075fc
2020-11-12 10:07:49 -08:00
Colin Cross 405af07859 Revert "Make lots of tests run in parallel"
This reverts commit 323dc60712.

Reason for revert: Possible cause of test instability
Bug: 170513220
Test: soong tests

Change-Id: Iee168e9fbb4210569e6cffcc23e60d111403abb8
2020-10-09 18:34:24 -07:00
Colin Cross 323dc60712 Make lots of tests run in parallel
Putting t.Parallel() in each test makes them run in parallel.
Additional t.Parallel() could be added to each subtest, although
that requires making a local copy of the loop variable for
table driven tests.

Test: m checkbuild
Change-Id: I5d9869ead441093f4d7c5757f2447385333a95a4
2020-10-06 15:12:22 -07:00
Dan Willemsen 9f43597ff7 Remove obsolete PDK build functionality
This hasn't worked for a couple years, and continues to bitrot. Just
remove it.

Adds a bpfix rule so that we can eventually remove the
product_variables.pdk definition, which is now always a no-op.

Test: treehugger
Change-Id: I830b54d419b59f6db1d4617b45e61a78234f57a7
Merged-In: I830b54d419b59f6db1d4617b45e61a78234f57a7
2020-08-11 01:11:44 +00:00
Jeongik Cha 816a23a50d Introduce AlwaysUsePrebuiltSdks
Instead of UnbundledBuild, use AlwaysUsePrebuiltSdks
to determine if java modules needs to be built against prebuilt sdks.
And rename UnbundledBuildUsePrebuiltSdks to AlwaysUsePrebuiltSdks to
express its behavior more correctly.(It can be orthgonal to "Unbundled")

Bug: 160390776
Test: TARGET_BUILD_UNBUNDLED_IMAGE=true m vendorimage

Change-Id: I0be7265c1959d8774c295372cd7a9250169f6df9
2020-08-07 12:15:52 +09: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
Pete Gillin 880f964f16 Tidy up the definition of sdkCore.
Compared to the effect of the toModule function, this (a) sets
noFrameworkLibs to true, which seems logically correct, and (b) stops
setting java9Classpath, which was redundant since the same stubs are
available in 1.9+ builds via the systemModules setting. (This brings
sdkCore into line with sdkCorePlatform in both cases.)

Test: m art.module.api.annotations
Change-Id: I61a868bc363a3bf174725b78c0a1657021cfe08a
2020-07-01 13:17:16 +01: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 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 3f07ab2d63 Create a framework.aidl for non-updatable platform
framework.aidl includes the parcelables from the non-updatable
part of the framework as well as the modules. This causes a
dependency cycle when building module stubs:
module_stub -> module_sdk -> framework.aidl -> public_sdk -> module_stub

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

Bug: 144149403
Test: m
Test: m && diff out/soong/framework{,_non_updatable}.aidl
      (the diff contains just TestApi + module parcelables)
Change-Id: I224117a0ff695c22d4a4317a51a9b775ed73066b
Merged-In: I224117a0ff695c22d4a4317a51a9b775ed73066b
(cherry picked from commit 85c151c3f3)
2020-06-05 15:16:16 +01:00
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
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 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
Jiyong Park 50146e9c8e sdk_version: "module_current" is supported
module_* is a new API surface for OS modules (e.g. APEXes). It has
slightly bigger API surface than the system_* SDK. Specifically, APIs
with @SystemApi(client=MODULE_LIBRARIES) are added there.

Bug: 146757305
Test: m

Change-Id: I8980e50c0e3a4cd843048e0de1f638e854384f46
2020-01-31 23:01:34 +09:00
Colin Cross 98be1bb00f Move filesystem into Config
The filesystem object was available through ModuleContext.Fs(), but
gives too much access to the filesystem without enforicing correct
dependencies.  In order to support sandboxing the soong_build
process move the filesystem into the Config.  The next change will
make it private.

Bug: 146437378
Test: all Soong tests
Change-Id: I5d3ae9108f120fd335b21efd612aefa078378813
2019-12-18 08:19:10 -08:00
Colin Cross 6cef481ee7 Use java language 1.9 for sdk_version: "current"
Java language was set for 1.8 for anything building against the
current SDK because the stubs were not built in Soong, so the
system modules could not be built.  The stubs have been built
in Soong since Iabd32b30954b3f4a6d9a779fde52a032b684807e, but
I5e870c34dd0ebc8ae3f888ec627da590c846a76f missed updating
this TODO.

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

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

Bug: 142896162
Test: m checkbuild
Change-Id: Icfd32d0a863b2303a997c7cf03cb3708aade4724
2019-10-29 13:35:39 -07:00
Colin Cross 74362a4d5e Move TestConfig sdk versions forward
The SDK version in TestConfig is very old, move it forward to trigger
the newer javaVersion code paths.

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

Test: TestClasspath
Change-Id: I661ec50d77a039c435c03bc8e6443cc5a57c206e
2019-10-28 14:55:03 -07:00
Pete Gillin bdf5d7170a Refactor and strengthen sdk_test.go.
This change:

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

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

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

Test: m nothing
Bug: 115604102

Change-Id: I693c5d299b5592b851c44dde4434d92a931f15cd
2019-10-21 14:36:41 +01:00
Pete Gillin 1b3370f5d7 Enable Java language level 9 by default.
This changes the default Java language level from 8 to 9, i.e. javac
invocations now use -source 1.9 -target 1.9.

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

Test: make droid java tests cts docs
Test: javap -v <some class file in output> | grep 'major version' (reports 53, for classes from 'benchmarks' which is in Android.bp and 'ahat' which is in Android.mk)
Test: make RunBluetoothRoboTests RunCarSettingsLibRoboTests (two main flavours of robolectric)
Test: make cts && cts-tradefed help
Test: atest CtsLibcoreTestCases (reasonably low-level device tests)
Test: atest CtsHostTzDataTests (arbitrary host test)
Bug: 115604102
Change-Id: I9de888e1df021244d5e61c40934178676f09ecc7
Merged-In: I52be1817fa7121fca3bce3d8857cb9ed0825570c
2019-10-16 11:20:13 +01:00
Colin Cross c080617c8b Shard aidl compiles into srcjars
Group aidl files into groups of 50 and compile them together into a
srcjar.

Bug: 124333557
Test: m checkbuild
Change-Id: I18e0858eab434071d3ff0039bb21e07c7311b601
2019-10-04 14:00:36 -07:00
Paul Duffin 68289b0efd Add custom SystemModules to bootclasspath to reduce duplication
Adds a library dependency to each of the dummy system modules created
by testing.go so that any changes in the behavior were detected by
the existing tests which were then fixed.

Bug: 141359858
Test: m checkbuild
Change-Id: Id4442f4aa3931ac93049f3367b96a5b49cc075e1
2019-09-20 14:52:56 +01:00
Jaewoong Jung f9a0443a9c Java test code clean-up
Remove unused parameters and make testJava return the config.

Test: Ran all java tests.
Change-Id: Iaa123f3fd93188e2f55452b887e1d340429cc710
2019-07-17 11:15:09 -07:00
Paul Duffin 5c2f963a1d Remove the no_framework_libs property
Corrects an error message that refers to no_framework_libs.

Removes any tests that use no_framework_libs:true where possible as
there are duplicate tests for sdk_version:"core_platform". Otherwise,
switches them over to use sdk_version:"core_platform".

Bug: 134566750
Test: m droid
Change-Id: I41abe1a49f5c744e3393ca9cdf0c41888f810c9f
2019-06-24 16:03:56 +01:00
Dan Willemsen ff60a73d89 Depend on all the files from system modules
Instead of just one of the files that we pass into javac.

Test: treehugger
Change-Id: I8478e88656487c9f667893d7c17839f0ea63c78f
2019-06-18 01:29:02 +00:00
Paul Duffin 50c217c744 Add sdk_version:"core_platform" to replace no_framework_libs:true
Where possible this duplicates any tests that use no_framework_libs:true
with ones that use sdk_version:"core_platform". If not possible (e.g. in the
default targets included in java/testing.go) it switches some to use
sdk_version:"core_platform" to ensure that there is no regression in the
behavior of no_framework_libs:true.

Follow up changes will switch all usages of no_framework_libs:true over
to use sdk_version:"core_platform" at which point no_framework_libs will be
removed.

Bug: 134566750
Test: m droid

Change-Id: I42cb181f628b723c8f32a158ae4752b4c83365ae
2019-06-17 13:17:35 +01:00
Paul Duffin a3d0986cfc Remove the no_standard_libs property
Corrects an error message that refers to no_standard_libs.

Removes any tests that use no_standard_libs:true where possible as
there are duplicate tests for sdk_version:"none". Otherwise, switches
them over to use sdk_version:"none".

The androidmk mapping from LOCAL_NO_STANDARD_LIBRARIES to
no_standard_libs has also been removed. There was little point in
updating the tool to map it through to sdk_version:"none" as there are
only a couple of places where it is used, in art's test running mk
targets and in some unbundled packages to work around some limitation
in .mk based build.

Bug: 134566750
Test: m droid
Change-Id: I6413c9b1fe3e63b93753a6a017d2981e32b7e013
2019-06-17 11:21:39 +01:00
Paul Duffin 52d398a841 Add sdk_version:"none" to replace no_standard_libs:true
Where possible this duplicates any tests that use no_standard_libs:true
with ones that use sdk_version:"none". If not possible (e.g. in the
default targets included in java/testing.go) it switches some to use
sdk_version:"none" to ensure that there is no regression in the
behavior of no_standard_libs:true.

Follow up changes will switch all usages of no_standard_libs:true over
to use sdk_version:"none" at which point no_standard_libs will be
removed.

Bug: 134566750
Test: m droid
Change-Id: I5f0fd3daa980f6b223abe454cba7f25a97a39d7a
2019-06-13 19:15:10 +01:00
Paul Duffin b815ada8c0 Never allow java_library_host with no_standard_libs: true
This combination makes no sense.

Bug: 134566750
Test: m droid
Change-Id: Ib37bbac165395c003d23225e0469ba60fa6a56ea
2019-06-12 14:08:13 +01:00
Paul Duffin fad7980075 Add test for no_framework_libs:true
Bug: 134566750
Test: m droid
Change-Id: Ie3c5c0730d4505c7932952eb20b5ccafd806a73a
2019-06-12 14:08:13 +01:00
Pete Gillin 0c2143e1ee Rename EXPERIMENTAL_USE_OPENJDK9 to EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9.
The current EXPERIMENTAL_USE_OPENJDK9 environment variable is a legacy
from when the 8 -> 9 toolchain upgrade was happening. That migration
is done and the variable only affects the language level, so it should
have a name that reflects that. (The current situation would be
especially confusing if we started a 9 -> 11 toolchain upgrade,
presumably controlled by a variable like EXPERIMENTAL_USE_OPENJDK11,
since the two settings look incompatible but are actually orthogonal.)

The current variable historically allowed a value or "1.8" which meant
"use the OpenJDK 9 toolchain but target language level 8". That value
no longer has any meaning and the new variable doesn't allow it.

Bug: 131678633
Test: `make` with `EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9=true`
Test: `javap -v $OUT_DIR/soong/.intermediates/libcore/core-oj/android_common/javac/classes/java/util/List.class | grep 'major version'` shows 53
Test: Audit all mentions of the old string here and downstream
Change-Id: Idad808c7f07913baba1a777627322d5452dabcef
2019-05-09 15:36:29 +01:00
Colin Cross 3047fa23da Build framework.aidl in Soong
Move the rules to build framework.aidl into Soong, and use it
when compiling aidl files with sdk_version: "current".

Also fixes incorrectly using the aidl includes exported by the
"framework" module when the proguardRaiseDep dependency was
added.

Bug: 130798034
Test: sdk_test.go
Change-Id: I126adf1d9e7b6acb528875ff62b974ba7ad9a337
2019-04-18 13:51:58 -07:00
Colin Cross 60405e50f8 Get default sdk_test.go values from config
This will help avoid merge conflicts between branches that have
additional default libraries.

Test: sdk_test.go
Change-Id: I98d5b8b2ea939df7ef57686f3bd913d6a21edc5d
Merged-In: I98d5b8b2ea939df7ef57686f3bd913d6a21edc5d
2019-04-18 12:35:16 -07:00
Colin Cross ff0daf4ccf Fix sdk_version: "system_current" when Platform_sdk_final=true
When PLATFORM_VERSION_CODENAME is set to REL Platform_sdk_final
becomes true, which causes the return value of sdkVersionToNumber
for "system_current" to a real version number instead of
FutureApiLevel.  This enables the check against
PlatformSystemSdkVersions, which doesn't contain "current".  Use
the numeric value instead.

Fixes: 129786845
Test: sdk_test.go
Change-Id: If7cf211cc01c5fbf3e3ece3c3f604718a13d5a9b
2019-04-02 23:18:30 +00:00
Colin Cross 98fd57460f Use latest SDK version for current in PDK builds
PDK builds need to use the latest SDK version instead of "current"
to match the behavior of Make.

Bug: 118634643
Test: sdk_test.go
Change-Id: Ice10d0ccb4066f27ce5839fc96a4026510057121
2019-01-10 07:09:35 +00:00
Colin Cross fb6d781202 Split out sdk.go from java.go
Split out SDK handling functions from java.go to sdk.go and tests
from java_test.go to sdk.go.

Test: sdk_test.go
Change-Id: I83ef48cbe5230572c1d4ecc0e89021d2f7c71b76
2019-01-10 07:09:29 +00:00