summaryrefslogtreecommitdiff
path: root/java/sdk_test.go
AgeCommit message (Collapse)Author
2021-07-01"module_current" and "system_server_current" should contain ART's ↵Victor Chang
@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-04-01Remove FixturePreparer.Extend()Paul Duffin
Use GroupFixturePreparers instead. Bug: 182885307 Test: m nothing Change-Id: Idc01d3cc5a57576a4cf417e9105d1ab851126e10
2021-03-30Remove extraneous calls to TestingBuildParams.RelativeToTop()Paul Duffin
Deprecated the method to try and prevent any other uses being added. Bug: 183650682 Test: m nothing Change-Id: Ia6f43851e5a00c9d96af780e3bd21e03175e1a2f
2021-03-24Remove javaFixtureFactoryPaul Duffin
Replaces uses of javaFixtureFactory with prepareForJavaTest and removes the unused javaFixtureFactory. Bug: 182885307 Test: m nothing Change-Id: I809772d14af2af211b9e15ad676fbdc06b07cd46
2021-03-24Remove uses of buildDir from java/java_test.go and java/sdk_test.goPaul Duffin
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-18Fix TestClasspath to work without javaMockFS()Paul Duffin
Bug: 182638834 Test: m nothing Change-Id: Icd6fe93cbda418cb4eaf5e99800894d4c4cc5e6f
2021-03-18Convert TestClasspath to test fixturesPaul Duffin
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
2020-11-12Pass Config to NewTestContext instead of ctx.RegisterColin Cross
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-10-09Revert "Make lots of tests run in parallel"Colin Cross
This reverts commit 323dc60712491c71ccdc5363c42df61f0a192487. Reason for revert: Possible cause of test instability Bug: 170513220 Test: soong tests Change-Id: Iee168e9fbb4210569e6cffcc23e60d111403abb8
2020-10-06Make lots of tests run in parallelColin Cross
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-08-11Remove obsolete PDK build functionalityDan Willemsen
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-07Introduce AlwaysUsePrebuiltSdksJeongik Cha
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-07-23Enforce the legacy core/platform API restriction.Pete Gillin
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 c0f4373106d6c205d11e3bbd61085736de7ec2df)
2020-07-01Tidy up the definition of sdkCore.Pete Gillin
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-01Rename the Default* constants in java/config.Pete Gillin
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-06-08Split the core/platform API into stable and legacy versions.Pete Gillin
For now, everything outside libcore still uses the legacy version. Test: treehugger Bug: 157640067 Change-Id: If5234e9ee533ff537926801a0af045d36b1caf01
2020-06-05Create a framework.aidl for non-updatable platformAnton Hansson
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 85c151c3f3aa64c140524de23493c39ea5822292)
2020-05-15Use system modules for prebuilt SDKs >=30Colin Cross
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-03-25Make system_server stubs consistent with other stubsAnton Hansson
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 bbd78556daf4a7e015f2e3ddfe9539909e9ebf40)
2020-02-12sdk_version: "system_server_current"Jiyong Park
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-01-31sdk_version: "module_current" is supportedJiyong Park
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
2019-12-18Move filesystem into ConfigColin Cross
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-10-29Use java language 1.9 for sdk_version: "current"Colin Cross
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-28Move TestConfig sdk versions forwardColin Cross
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-28Split java 8 and 9 classpaths in TestClasspathColin Cross
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-21Refactor and strengthen sdk_test.go.Pete Gillin
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-16Enable Java language level 9 by default.Pete Gillin
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-04Shard aidl compiles into srcjarsColin Cross
Group aidl files into groups of 50 and compile them together into a srcjar. Bug: 124333557 Test: m checkbuild Change-Id: I18e0858eab434071d3ff0039bb21e07c7311b601
2019-09-20Add custom SystemModules to bootclasspath to reduce duplicationPaul Duffin
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-07-17Java test code clean-upJaewoong Jung
Remove unused parameters and make testJava return the config. Test: Ran all java tests. Change-Id: Iaa123f3fd93188e2f55452b887e1d340429cc710
2019-06-24Remove the no_framework_libs propertyPaul Duffin
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-18Depend on all the files from system modulesDan Willemsen
Instead of just one of the files that we pass into javac. Test: treehugger Change-Id: I8478e88656487c9f667893d7c17839f0ea63c78f
2019-06-17Add sdk_version:"core_platform" to replace no_framework_libs:truePaul Duffin
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-17Remove the no_standard_libs propertyPaul Duffin
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-13Add sdk_version:"none" to replace no_standard_libs:truePaul Duffin
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-12Never allow java_library_host with no_standard_libs: truePaul Duffin
This combination makes no sense. Bug: 134566750 Test: m droid Change-Id: Ib37bbac165395c003d23225e0469ba60fa6a56ea
2019-06-12Add test for no_framework_libs:truePaul Duffin
Bug: 134566750 Test: m droid Change-Id: Ie3c5c0730d4505c7932952eb20b5ccafd806a73a
2019-05-09Rename EXPERIMENTAL_USE_OPENJDK9 to EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9.Pete Gillin
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-04-18Build framework.aidl in SoongColin Cross
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-18Get default sdk_test.go values from configColin Cross
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-02Fix sdk_version: "system_current" when Platform_sdk_final=trueColin Cross
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-01-10Use latest SDK version for current in PDK buildsColin Cross
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-10Split out sdk.go from java.goColin Cross
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