summaryrefslogtreecommitdiff
path: root/java/java_test.go
AgeCommit message (Collapse)Author
2018-02-28Change name of droiddoc target output to *-stubs.srcjarNan Zhang
Test: m -j core-docs Bug: b/70351683 Change-Id: If8c00a9992d262b7cd4c95794073591dcc245bd2
2018-02-22Droiddoc Support in SoongNan Zhang
Support Droiddoc to Soong based on core/droiddoc.mk. The non-std doclet based droiddoc compilation output is a "real" stubs.jar instead of a directory of java files and a timestamp file. The std doclet based javadoc compilation output is a "empty" stubs.jar instead of a timestamp file. The stubs.jar will be exported to out/target/common/obj/JAVA_LIBRARIES/$(LOCAL_MODULE)_intermediates/classes.jar and out/target/common/docs/$(LOCAL_MODULE)-stubs.jar A $(LOCAL_MODULE).zip file will be generated also, and is exported to out/target/common/docs/$(LOCAL_MODULE)-docs.zip if property: installable is not set to false. Bug: b/70351683 Test: unittest + convert libcore docs Android.mk to Soong manually. Change-Id: I1cffddd138a5d9d445f86a3d4a3fd4de88a2bc0f (cherry picked from commit 78188ec622cb1ee24171455867fc58ffab91562e)
2018-02-15Revert "Revert "Support filegroup in exclude_srcs""Nan Zhang
This reverts commit 606e9de344fae07473dd79e5ac556886a72035de. Reason for revert: <try to fix the broken build yesterday> Change-Id: I2963b9af63c7c7398159e5e9a1e448266e1c81d5 Test: unittest
2018-02-09Revert "Support filegroup in exclude_srcs"Tobias Thierer
This reverts commit f36a3d9b6da654bf8bd7a49315b1625cf0e774ce. Reason for revert: Broke several builds. I'm acting build cop, reverting. Bug: 70351683 Change-Id: I775ada4e9cb6473519d51420b41b818af163da44
2018-02-07Support filegroup in exclude_srcsNan Zhang
Test: add unit-test, m -j32 Bug: b/70351683 Change-Id: Iff83c56d45dd668d9df6131c7df2e23e5c73a21b
2018-02-07Support sdk_version: "core_current"Jiyong Park
core_current is a pseudo SDK version which is a core Java API subset of the Android API. It is expected to be mainly used for external Java projects which are agnostic to Android; such as junit, guava, etc. A module built with this SDK version can only link to java modules of the same kind. It can't depend on modules built with other sdk (e.g. current) or without sdk. Bug: 72206056 Test: m -j Change-Id: I778e7b4fcb9456a12b418ffd633ea78e29951e84
2018-01-19Add PLATFORM_SYSTEMSDK_VERSIONS and BOARD_SYSTEMSDK_VERSIONSJiyong Park
PLATFORM_SYSTEMSDK_VERSIONS is the list of System SDK versions that the platform is supporting. Contrary to the public SDK where platform essentially supports all previous SDK versions, platform support only a few recent System SDK versions, since some of old System APIs are gradually deprecated, removed from the following SDKs and then finally deleted from the platform. This will be part of the framework manifest. The list can be specified by setting PLATFORM_SYSTEMSDK_MIN_VERSION. If it is set to an old version number, then System SDKs from the version to the current version (PLATFORM_SDK_VERSION) are considered to be supported by the platform. If PLATFORM_SYSTEMSDK_MIN_VERSION is not set, only the latest System SDK version is supported. Next, BOARD_SYSTEMSDK_VERSIONS is the list of System SDK versions that the device is using. This is put to the device compatibility matrix device is using. The device and the platform is considered as compatible only BOARD_SYSTEMSDK_VERSIONS in the device compatibility matrix are in the PLATFORM_SYSTEMSDK_VERSIONS in the framework manifest. When BOARD_SYSTEMSDK_VERSIONS is set, a Java app or library in vendor or odm partitions which didn't specify LOCAL_SDK_VERSION is forced to use System SDK. Also, the build system does the additional integrity check to ensure that LOCAL_SDK_VERSION is within BOARD_SYSTEMSDK_VERSIONS or PLATFORM_SYSTEMSDK_VERSIONS (if BOARD_SYSTEMSDK_VERSIONS isn't set). Bug: 69088799 Test: m -j Test: BOARD_SYSTEMSDK_VERSIONS=P m -j Change-Id: Id38f02b4be86710411be22bc28109e6894f8a483
2018-01-03Add R8 supportColin Cross
Add support for R8 to optimize apps and java libraries. Test: m checkbuild Change-Id: I2afd5d7a84912d3ab613c32c599bd1ebe60562e0
2018-01-02Pass OpenJDK 8's bootclasspath for host tools targeting <= 1.8.Colin Cross
Follow the Make change in I9b6081edfdd2c3e9a450ae8a39c4e32c3d2cda92 to explicitly pass the OpenJDK 8 bootclasspath when targeting <= 1.8. Bug: 70862583 Test: java_test.go Test: javap -c -p out/soong/.intermediates/external/guava/guava/linux_glibc_common/javac/classes/com/google/common/hash/AbstractStreamingHashFunction\$AbstractStreamingHasher.class | grep ByteBuffer.flip shows java/nio/Buffer return type in signature. Change-Id: Ief66bbf6e3a4220b3afb2e02009bd0157d4c7fae
2017-12-16Add missing dependencies on classpath jars for kotlincColin Cross
The kotlinc build rules were missing dependencies on the jars in the classpath. Test: TestKotlin in java_test.go Change-Id: I56681785289f942b1070751b7dc5944e7a995b7f
2017-12-06Split java_binary modules into common and binary variantsColin Cross
Add a common_first multilib type and use it for java.Binary so that the java part is compiled as a "common" arch type but the wrapper script is installed as a "linux_glibc" arch type. This allows java_binary to be used as a tool dependency for a genrule. Bug: 68397812 Test: TestJavaBinary Change-Id: I809060839ce8878300da3fb76426ceb1ea6b0e8e
2017-12-06Add java_genrules to use jars as inputs and outputsColin Cross
Add a java_genrule that has the right multilib flags to be a dependency of a java rule. Make java libraries implement SourceFileProducer so that their classes jar can be used as an input to a java_genrule. Allow libs and static_libs dependencies to be a java_genrule. Test: TestJarGenrules Change-Id: Ib1b31ef9c0b7e72eeed2c9ecc4ce8a1088e0b1c9
2017-12-01Split up testJavaWithEnvFsColin Cross
Instead of passing all the options to testJavaWithEnvFs, split it up into testConfig, testContext, and run. Tests that don't need any special options can continue to use testJava, more complicated tests can call the three functions manually. This gives more flexibility in complicated tests for the next patch. Test: soong java tests Change-Id: Ifd5dcb40cf08e4cbf69bf8e02c5698adbfbcdcb3
2017-12-01Add system_$(VER)Sundong Ahn
The system_$(VER) is added for vendor, similar to sdk. Bug: 67724799 Test: build Merged-In: I2545c92707591ca278066870c74e9f49e9825855 Change-Id: I2545c92707591ca278066870c74e9f49e9825855 (cherry picked from commit b8baff1fa353a311c3dd918dfa29ec45dd0168be)
2017-11-29Allow building framework.jar and framework-res.apkColin Cross
Update app support enough to build framework-res.apk, link framework.jar against its generated files, and export it to make. Bug: 69917341 Test: m checkbuild tests docs Change-Id: I7db29cd1f5fabb22e844483ecc7c38abfedbbe0a
2017-11-29Replace aapt support with aapt2Colin Cross
Use aapt2 instead of aapt to compile Android app resources. Also generate all files into srcjars instead of individual sources. Test: m checkbuild Change-Id: I5a67991a0daf0017e8159b46fcff7d5564a91468
2017-11-24Move java test resources in mock filesystem to a different directoryColin Cross
Move the java test resources from res to java-res to avoid confusion with Android app resources that are implicitly expected in res. Also allow tests to provide extra files. Test: java_test.go Change-Id: I13349a21da5c6d449cd23947c2628efbed3eb230
2017-11-08Pass results of Finder into BlueprintJeff Gaston
Bug: 64363847 Test: m -j Change-Id: I79db8c524af6e77c35a0199ec1876e5eb94e8971
2017-11-06Support Javac sharding in Soong.Nan Zhang
Test: m clean && m -j java and java_test.go Change-Id: I110a0ff029448d3319aed2788d25d90a6c1a7fa0
2017-10-26Fix kotlin -classpath argumentColin Cross
kotlinc expects -classpath, not --classpath. Also add a test that uses only .kt files to exercise the code when there are no java sources. Test: java_test.go Change-Id: Ifa5a007b460b40ea2188d0907570fbdca6c48da7
2017-10-20Support multiple outputs in genrules with depfile: trueColin Cross
Ninja doesn't support depfiles on a rule with multiple outputs. Use a single output and put all the rest as implicit outputs. Bug: 68057449 Test: java_test.go Change-Id: Ia544493b1b3b51b185c865149d8f3e0eb3c57ee2
2017-10-20Use prebuilts/sdk/*current until Soong can generate stubsColin Cross
The android_*stubs_current modules don't yet exist, so fall back to the prebuilt jars for now. Test: m checkbuild Change-Id: Iabd32b30954b3f4a6d9a779fde52a032b684807e
2017-10-20Support Turbine in Soong.Nan Zhang
If sdk jars(android_stubs_current, etc) are compiled using soong java modules, we have to filter them when running Java build with Turbine. TODO: provide more unit-tests. Test: m clean && m -j32; go test java_test Change-Id: Iad7c241b0e8b0ca760950733f513124b56c84564
2017-10-19Move all jar intermediates to subdirsColin Cross
Make all the jar intermediates called modulename.jar, and put each in a subdir for the tool that generated it. This will simplify using the jars as inputs to genrules and resources. Test: java_test.go Change-Id: If00e16bd7df5a4ba24ebc4b68c9ccf2cfda49544
2017-10-17Initial kotlin supportColin Cross
Allow java libraries to specify .kt sources, precompile them with kotlin, and then pass them in the classpath to javac. Bug: 65219535 Test: java_test.go Change-Id: Ife22b6ef82ced9ec26a9e5392b2dadacbb16546f
2017-10-16Initial support for converting jars to java9 system modulesColin Cross
Adds a java_system_modules module type that (when EXPERIMENTAL_USE_OPENJDK9 is set to true) converts a list of java library modules and prebuilt jars into system modules, and plumbs the system modules through to the javac command line. Also exports the location of the system modules to make variables, as well as the name of the default system module. Test: TestClasspath in java_test.go, runs automatically as part of the build Bug: 63986449 Change-Id: I27bd5d2010092422a27b69c91568e49010e02f40
2017-10-10Let tests override environmentColin Cross
Pass an environment to TestConfig that will be used for all Config.Getenv calls. Test: none Change-Id: I683cd9c9e0db61c9bfd2adb27fca78f558f225c4
2017-10-09Add test for java generated sourcesColin Cross
Bug: 67364649 Test: TestGeneratedSources Change-Id: I5400e4b013dc47c04b9d32787e50c5281033484d
2017-10-04Correctly add dependencies to java_resource_dirs filesColin Cross
java_resource_dirs was using a file list file that was generated at ninja time to get the list of files to include, which meant there were no dependencies on the files to cause res.jar to get rebuilt. Switch to using a glob at soong time instead. This is substantially similar to a glob in java_resources, except that java_resource_dirs strips the listed directories off the paths that end up in the jar. Test: TestResources in java_test.go Change-Id: I4b9b38f7b6b38a013cbb4e211187e7282a6795c0
2017-10-04Fix bootclasspath for host variants of java_library modulesColin Cross
The partial hostdex support was causing the host variant of java_library modules to depend on core-oj and core-libart, which caused the tagsoup jar to use the wrong java.lang.System.arraycopy signature. Remove the hostdex code that was causing the problem, and add a test. Test: java_test.go Change-Id: I4f7b1f29c99aae328ba19b042538d9d35544aa43
2017-10-02Fix arch specific properties for java modulesColin Cross
Arch specific properties were not being applied to modules with OS set to Common. Test: java_test.go Change-Id: I8f1b49ca51b0cf96f78006dfcd121672e581d9c5
2017-10-02Make java_library_static uninstallable by defaultColin Cross
Static libraries are not dexed and are not installable on a device. Test: m -j checkbuild Change-Id: Iea01df381e6c8cf2439fdb87200895db6aac99e2
2017-10-03Fix excluding resource directoriesColin Cross
Using a glob as a path failed the existence check. Append the glob after converting the path to a string. Test: TestExcludeResources in java_test.go Change-Id: Ic1fd40aa283f3b0d59c1c589dbeec411583eddf1
2017-09-29Add java file resources and flag to include sourcesColin Cross
Add a properties to allow including files as resources, including support for filegroups. Also add a flag that causes module sources to be included in the final jar. Test: java_test.go TestResources Change-Id: Ida8ee59b28df9fe66952170f46470d3a09fd5d65
2017-09-29Use pre-desugar classes in classpathColin Cross
Follow the make change in I87aee34940937dbde33a977f55d1faf2c8054561 to use classes before desugar in the classpath. Test: java_test.go Change-Id: I1054f4aea1eb349b6f687e1af0adb92a944fd8c5
2017-09-20Remove android_prebuilt_sdk modulesColin Cross
Forcing sdk modules to be declared explicitly is unnecessary, just add the required dependencies on the jar and aidl files. Test: java_test.go Change-Id: Ib28bdc1051c5825e7c0efb6adff1f9282675560e
2017-09-20Fix java sdk testsColin Cross
Fix the java module sdk tests, and expand them to cover testing all classpaths including for the host. Test: java_test.go Change-Id: I71be13cc5545f5c4d5b377c4c8de3dccbb09abf9
2017-09-20Convert java tests to NewTestArchContextColin Cross
Java tests will need to test code inside if ctx.Device() blocks, switch to using TestArchConfig and NewTestArchContext. Disable TestSdk for now, just registering modules that depend on the SDK triggers panics because of previously untested code that is now executed. Test: java_test.go Change-Id: Iff2c814af56cc830327db8d951c4350034c00361
2017-09-20Initial device java supportColin Cross
First pass at java support for the device. Adds desugar before dx, and passes javalib.jar to make. Test: m -j checkbuild Change-Id: I3138d943bc4867a52c3fce8fbdb597773793988d
2017-09-20Rearrange manifest file handling in merge_zips and soong_zipColin Cross
Jar always puts default MANIFEST.MF files in if none was specified. Copying that behavior in soong_zip causes problems with merge_zips, because it ends up taking the default manifest from the classes.jar instead of the user's manifest from res.jar. We don't want the user's manifest in the classes.jar, otherwise a change to the manifest will cause all the class files to rebuild. Instead, move the manifest insertion to the final merge_zips stage. Test: m -j checkbuild Change-Id: Id6376961dbaf743c2fb92843f9bdf2e44b963be0
2017-09-05Make javac rules output a jar with soong_zipColin Cross
Make javac rules output a jar file instead of a classes.list. Combine the output jar, static jar dependencies, and resources into the final jar using a separate rule. For now, use a shell command with unzip and soong_zip to create the final jar, eventually it will be done with a zip2zip-style jar combiner. Bug: 64691570 Test: java_test.go Change-Id: Id8e6313e0097b78947d88e86e47b56ad08caca1a
2017-08-31Rename no_standard_libraries to no_standard_libsColin Cross
For consistency with libs and static_libs. And make it a *bool so that it can be overriden when used in java_defaults modules. Test: java_test.go Change-Id: If0eaf5d5571dc6e565056d273b0addd960d6b33f
2017-08-31Add core-oj to bootclasspathColin Cross
Also clear the bootclasspath for device builds so javac doesn't fall back to the default rt.jar bootclasspath. Test: java_test.go Change-Id: Ia21f55c7d45db560e2f44be81b2f46587d9026f2
2017-08-11Rename java_prebuilt_library to java_importColin Cross
And make it work like bazel's java_import, using a "jars" property instead of "srcs", and allowing multiple jars to be listed. Test: soong tests Change-Id: Ida2ace6412bd77b4feb423646000a1401004e0ea
2017-07-31Fix java prebuiltsColin Cross
The java prebuilt tests weren't registering the prebuilts mutators, which hid an issue where prebuilts modules weren't getting renamed to avoid collisions with source modules of the same name, which ended up causing the prebuilt module to try to add a dependency on itself. Test: java_test.go Change-Id: I3327d27533591cb08a4b8b8b5e1668a6f72be8df
2017-07-20Rename names in java package to not have java prefixColin Cross
Prefixing names in the java package with "java" is redundant, inside the java package it is clear that they refer to something java related, and outside the package they will be referred to with a java. prefix. Test: java_test.go Change-Id: I9eb8eecb7ac5f6fbf8e87f5c219b3f50dbd18c87
2017-07-20Add support for java_defaults modulesColin Cross
Test: java_test.go Change-Id: I6dba1671c7eb019183af94bb7b10810296740101
2017-07-19Rename java module and property names for consistencyColin Cross
prebuilt_java_library -> java_prebuilt_library prebuilt_sdk -> android_prebuilt_sdk java_resource_dirs -> resource_dirs exclude_java_resource_dirs -> exclude_resource_dirs java_libs -> libs java_static_libs -> static_libs Test: java_test.go Change-Id: Icb0eefa6663844e20ad0a8729fb2c90ec916c3eb
2017-07-19Add basic tests for java modulesColin Cross
Java modules have been unused for a few years, add a few very basic tests to exercise the modules as they are brought up to date. Test: java_test.go Change-Id: Ib23fc065674a61308333130ff1a992525b92e705