summaryrefslogtreecommitdiff
path: root/java/java.go
AgeCommit message (Collapse)Author
2019-09-18Fix robolectric tests with sdk_version and prebuilt dependenciesColin Cross
Add deviceProperties to robolectric tests so they can set sdk_version. Use Dependency.BaseModuleName() instead of ctx.OtherModuleName() to get the dependency name to pass to Make to support prebuilts in libs, which may have a "prebuilt_" prefix in ctx.OtherModuleName(). Test: m RunLauncherRoboTests Change-Id: I59a889bd6107b989f336b147d0eaccabef611894
2019-09-05Shard kythe invocations when javac is shardedColin Cross
The kythe pipeline has trouble injesting all 6000 files of framework.jar at once. Shared invocations of the kythe extractor when javac is sharded to produce multiple smaller kzip files. Bug: 140426870 Test: no change to build.ninja Test: m out/soong/.intermediates/frameworks/base/framework/android_common/framework0.kzip Test: TestSharding in java_test.go Change-Id: I867db4ef5cb1e7f3ce8359a46aac2c00ed8a8912
2019-08-30Merge changes from topic "drop_circular_dep"Treehugger Robot
* changes: Remove srcs_lib and srcs_lib_whitelist_pkgs Remove the automatic dependency to framework-res.apk for R/Manifest Prepare to be able to put framework-res in srcs
2019-08-29Normalize and validate the java_version property.Pete Gillin
There are two parts to this change. Normalization: If a module specifies 'java_version: "9"', this is now normalized into 'java_version: "1.9"'. Users might reasonably assume that "9" should be valid, since javac treats them as synonyms (and, in fact, the javac documentation lists "9" as a valid value but doesn't mention "1.9"). However, the soong code that triggers JPMS support (i.e. setting -system rather than --boot-class-path) looks for the string "1.9", so prior to this change modules specifying "9" would fail with a confusing error ('javac: option --boot-class-path not allowed with target 1.9'). Normalizing "9" to "1.9" fixes this. (The change normalizes the other supported values, too, for consistency.) Validation: This change also makes the build fail-fast with a clear error message for invalid values. In particular, modules specifying "10" or "11" fail with an explicit message that this is not supported, in anticipation of the switch to OpenJDK 11. Prior to this change, modules setting those values would get the confusing '--boot-class-path not allowed' error described about since JPMS support would not be triggered. (That could be fixed by changing the JPMS logic to trigger on "10" and "11", but that would be dangerous since support in the rest of the system for v54 and v55 class files is unproven: it is better to fail explicitly.) (This change also makes it fail-fast for any unrecognized values.) Test: make java Test: make targets with java_version set to "1.8", "8", "1.9", and "9", all succeed ("9" fails without this change) Test: make targets with java_version set to "10" and "11", fail with the explicit "not supported" message Test: make target with java_version set to "xxx", fails fast with the "unrecognized" message Bug: 131683177 Change-Id: I2f5eb496c29d7736c68c01401c3f0967aeae99fc
2019-08-29Remove srcs_lib and srcs_lib_whitelist_pkgsJiyong Park
They are no longer used. Sources are provided via filegroup. Also removing the SrcDependency interface as it is no longer used. Bug: 135922046 Test: m Merged-In: I81f9614d20fbdd2f7d18340d6dbdb592e7acde06 (cherry picked from commit fa21cba64a3a14164642a7067c071f861b7ac96e) Change-Id: I81f9614d20fbdd2f7d18340d6dbdb592e7acde06
2019-08-29Remove the automatic dependency to framework-res.apk for R/ManifestJiyong Park
framework-minus-apex and framework-annotation-proc had automatic dependency to framework-res.apk to get the generated R.java and Manifest.java as their inputs. That is no longer needed as the sources are fed from framework-srcs filegroup. Bug: 70046217 Test: m Merged-In: Ibb03db01c177d6e908cbbdf91f18be8744f02c03 (cherry picked from commit 8cc55bdffe1ebb4cfcfa412d3733fd918c58db60) Change-Id: Ibb03db01c177d6e908cbbdf91f18be8744f02c03
2019-08-23Implement sysprop_library API stability checkInseob Kim
sysprop_library now checks the API stability itself, cutting dependency on java_sdk_library. Under the directory {module_dir}/api, {module_name}-current.txt and {module_name}-latest.txt hold API signatures. When sysprop_library is built, or a user run "m {module_name}-check-api" command, API check is performed. First, current.txt must have exactly same signature with built sysprop_library module. Second, current.txt must be compatible with latest.txt. Build system emits a handy error message to generate/update those API files, in case of missing or mismatching. Also, a script file for freezing API files is introduced. Bug: 131637873 Test: 1) m && boot blueline Test: 2) m {sysprop_library} performs API check Test: 3) manual test for check-api, freezing api Change-Id: I9d25f5dc64299e666527ca8e23d7233966901c4e Merged-In: I9d25f5dc64299e666527ca8e23d7233966901c4e Merged-In: Ib7ad4f17e82c90da5ef3f80e2ab88c0b53112c60 (cherry picked from commit 093f0eb1331dffaab23e9252d2a4dbc6a27156f0)
2019-08-19Elaborate comment on paltform_apisJeongik Cha
Bug: 132780927 Test: None Change-Id: If0a4f97ea8f0af0c962fd963daad01adb3e5412f
2019-08-06Add an output file tag for proguard dictionariesColin Cross
Allow modules to depend on the proguard dictionary of another module using module{.proguard_map}. Bug: 122332855 Test: m checkbuild Change-Id: I918b487872c1a8ef8a51c0b994277efb0512d157
2019-07-31Merge "Add a rule about platform_apis"Jeongik Cha
2019-07-30Merge "Support source code cross-referencing for C++ and Java"Treehugger Robot
2019-07-29Add a rule about platform_apisJeongik Cha
As sdk_check.mk checks, soong starts to check every app. If sdk_version is empty, platform_apis must be true. If sdk_version is not empty, platform_apis must be false. Test: soong test Test: m Bug: 132780927 Change-Id: I7ba702d616404d155f8ac40cd008828663ad1488
2019-07-26Support source code cross-referencing for C++ and JavaSasha Smundak
Use Kythe (https://kythe.io) to build cross reference for the Android source code. ~generate the input for it during the build. This is done on demand: if XREF_CORPUS environment variable is set, build emits a Ninja rule to generate Kythe input for each compilation rule. It also emits two consolidation rules (`xref_cxx` and `xref_java`), that depend on all Kythe input generation rules for C++ and Java. The value of the XREF_CORPUS environment variable is recorded in the generated files and thus passed to Kythe. For the AOSP master branch it is `android.googlesource.com/platform/superproject`, so the command to build all input for Kythe on that branch is: ``` XREF_CORPUS=android.googlesource.com/platform/superproject m xref_cxx xref_java ``` Each Kythe input generation rule generates a single file with .kzip extension. Individual .kzip files have a lot of common information, so there will be a post-build consolidation step run to combine them. The consolidated .kzip file is then passed to Kythe backend. The tools to generate .kzip files are provided by Kythe (it calls them 'extractors'). We are going to build them in toolbuilding branches (clang-tools and build-tools) and check them in as binaries into master and other PDK branches: For C++, `prebuilts/clang-tools/linux-x86/bin/cxx_extractor` for Java, `prebuilts/build-tools/common/framework/javac_extractor.jar` Bug: 121267023 Test: 1) When XREF_CORPUS is set, build generates Ninja rules to create .kzip files; 2) When XREF_CORPUS is set, building `xref_cxx`/`xref_java` creates .kzip files; 3) Unless XREF_CORPUS is set, build generates the same Ninja rules as before Change-Id: If957b35d7abc82dbfbb3665980e7c34afe7c789e
2019-07-26Revert "Revert "Split Java libraries per apex""Jiyong Park
This reverts commit f0f7ca8335cca669dd524b39d52997c28eb59e48. Bug: 138182343 Test: apex_test added Change-Id: I5c8a0935ac0f456137c8656815e220b0e7848a5d
2019-07-25Revert "Split Java libraries per apex"Jiyong Park
This reverts commit aa53324ac8308d974435cf2c8566835b87e3e05d. Reason for revert: b/138337109 (broke ndk build) Change-Id: I9497cb4337add3f8c491a684bcaadea3bdbfaa85
2019-07-23Split Java libraries per apexJiyong Park
Just like native libs, a java library that is included in an APEX is mutated for the APEX. This allows us to infer the context (e.g. sdk_version, etc.) for building a java library in an APEX. Bug: 138182343 Test: apex_test added Change-Id: I9292ea097b98e74a8a794f164bd2bed3921d6337
2019-07-18Add a systemModules utility typeColin Cross
Storing system modules in a classpath is clumsy, as there should only ever be one system modules, and it needs to store both a directory to pass as the argument and a set of generated files to use as dependencies. Store them in a separate systemModules type instead. Test: m checkbuild Change-Id: I020556c736bd5091865bcca51dc0fb9e4db6b45b
2019-07-17Merge changes from topic "buildnumberfromfile"Colin Cross
* changes: Allow jar wrapper to take quoted arguments Add rspfile support to RuleBuilder Prepare droiddoc for using RuleBuilder Manually escape BuildNumberFromFile Fix android.Expand and ninja escaping Add RuleBuilder helper functions for built and prebuilt tools Add documentation to droiddoc.go module types
2019-07-16Merge changes Ia106d48e,Ib6c0e778Colin Cross
* changes: Remove use of deprecated ExtractSourcesDeps Dedup path properties across property structs
2019-07-16Remove use of deprecated ExtractSourcesDepsColin Cross
Tag DexImportProperties.Jars with `android:"path"` and remove the call to ExtractSourcesDeps. Test: m checkbuild Change-Id: Ia106d48ecf7e3fc98637a757a9812edcf65f5b82
2019-07-15Revert "Don't build hiddenapi flags or encode dex for unbundled builds"Jiyong Park
This reverts commit 7b8a567f44b3fdb30eac8211e8ed8e27fb162797. Bug: 137282010 Test: With the CL above this one, the unbundled mainline module build does not fail. Change-Id: I2f49fa7dbe1da92cb282a9bc14acd5830888ed17
2019-07-11Add RuleBuilder helper functions for built and prebuilt toolsColin Cross
Replace the common pattern of: cmd.Tool(ctx.Config().HostToolPath(ctx, "tool")) with: cmd.BuiltTool("tool") And similarly for PrebuiltBuildTool. Test: m checkbuild Change-Id: I7d63188505362c7df6a3b3e7330b4a2cca5a2409
2019-07-01Merge "Enforce hidden api usage in vendor (soong)"Treehugger Robot
2019-06-28Enforce hidden api usage in vendor (soong)Jeongik Cha
From aosp/588578, if vendor app doesn't fill sdk_version, build scirpt overwrites system_current to sdk_version. But there is no similar enforcement in soong. So, as make does, sdkVersion() returns "system_current" if it is device-specific or soc-specific module. and sdk_version is not filled. Test: pass soong test Bug: 132780927 Change-Id: I69bb3d7bfcf7c27c2db4d0efbe046f9c7879b4bc
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-13Make sdkDep/decodeSdkDep the source of truth about the sdkPaul Duffin
Previously, different parts of the build used different sources of information about the SDK (i.e. the default libraries) against which a Java module aimed at the device was built. Some used the sdk_version property, others used the no_standard_libs or no_framework_libs, some used a combination of all three. That lead to inconsistent handling in the code, e.g. some parts treated no_standard_libs: true as implying no_framework_libs: true and others did not, and also in the build files, e.g. some modules specified no_framework_libs: true and sdk_version: "system_current" which makes no sense, or no_standard_libs: true and sdk_version: "core_current" which are inconsistent. This is the first step in a refactoring to simplify the sdk selection process by replacing the no_standard_libs/no_framework_libs properties with some extra options for the sdk_version property. This change consists of: 1) Extra functions sdkContext to access the no_standard_libs and no_framework_libs properties. 2) Extra field/functions in sdkDep to store and access the value of no_standard_libs/no_framework_libs. 3) Changes to decodeSdkDep(...) to pass the values of the no_... properties through to the returned sdkDep. 4) Change all code that accesses the no_... properties directly to call decodeSdkDep(...) to get an sdkDep object and then accessing the values of the no_... properties from there. The accessor functions on sdkDep are called has...() rather than no...() as most callers of the methods invert the value anyway and !no...() is harder to reason about than has...(). The hasFrameworkLibs() function returns true if and only if no_standard_libs and no_framework_libs are false. That is consistent with all but one usage of the no_framework_libs property and that is not affected by it. Bug: 134566750 Test: m droid Change-Id: I196e3304e8bd802fb154e897397b0dd337f868e2 Exempt-From-Owner-Approval: Colin has already given +2 modulo some minor nits and this blocking other changes.
2019-06-10Add GenerateAndroidBuildActions to DefaultsModuleBaseColin Cross
Add an empty GenerateAndroidBuildActiosn to DefaultsModuleBase so that every defaults module doesn't need to provide one. This will also allow adding an implementation in the next patch. Test: m checkbuild Change-Id: I13554bdb3a287c2f18e1efab74d4f08a1ba8620c
2019-06-06Consolidate baseContext, BaseContext, and BaseModuleContextColin Cross
blueprint.BaseModuleContext is the set of methods available to all module-specific calls (GenerateBuildActions or mutators). The android package split the same functionality across baseContext (nee androidBaseContext), BaseModuleContext, and BaseContext. Consolidate all of them into android.BaseModuleContext. Test: m checkbuild Change-Id: I2d7f5c56fd4424032cb93edff6dc730ff33e4f1e
2019-06-06Merge "Touch up manifest if there's no source code."Jaewoong Jung
2019-06-04Add .jar tag to java modulesColin Cross
Allow java modules to be referenced as ":module{.jar}" to get the classes .jar. Bug: 122333007 Test: m checkbuild Change-Id: I2d07f774ae8ed5a39206059c4102727c6802d26e
2019-06-04Support tagged module referencesColin Cross
There are cases where a module needs to refer to an intermediate output of another module instead of its final output. For example, a module may want to use the .jar containing .class files from another module whose final output is a .jar containing classes.dex files. Support a new ":module{.tag}" format in any property that is annotated with `android:"path"`, which will query the target module for its ".tag" output(s). Test: path_properties_test.go, paths_test.go Test: no unexpected changes in build.ninja Change-Id: Icd3c9b0d83ff125771767c04046fcffb9fc3f65a
2019-06-03Touch up manifest if there's no source code.Jaewoong Jung
The new package manager behavior requires packages without source code to have an application element with hasCode attribute set to false in their manifest. With this change, Soong can now automatically insert one for codeless apps. Test: app_test.go, manifest_fixer_test.py Fixes: 124375490 Change-Id: Ied89a8d07c63805ab910859a4f7c45fc1c60bb73
2019-05-31Merge "AIDEGen: Collect the srcjar into out/soong/module_bp_java_deps.json"Treehugger Robot
2019-05-29Port uses-shared library verification and dexpreopting to SoongColin Cross
Ports 09f3b97f4b488cd3a7b7d72038b173575b02c162 (Add support for preopt with uses-libraries) from Make to Soong to support verifying and preopting shared libraries. This reapplies Id25f55f07a55120bebe2a9b32c094209efc85c8b with fixes for unbundled builds and builds with ALLOW_MISSING_DEPENDENCIES=true set. Bug: 132357300 Test: app_test.go Test: m checkbuild Change-Id: I964309a68ec4ed081f3f3154879c71048ecb5455
2019-05-29Merge "Revert "Port uses-shared library verification and dexpreopting to Soong""Colin Cross
2019-05-29Revert "Port uses-shared library verification and dexpreopting to Soong"Colin Cross
This reverts commit b66d7b1c20f7e54a5920780ba6643e971d216d31. Reason for revert: broke unbundled builds Change-Id: I96ae287885107079de4a26e6b100ad8ed66961c0
2019-05-29Merge changes from topic "verify_uses_libraries"Treehugger Robot
* changes: Port uses-shared library verification and dexpreopting to Soong Move verify_uses_libraries.sh out of dexpreopt
2019-05-28Don't build hiddenapi flags or encode dex for unbundled buildsColin Cross
Builds with TARGET_BUILD_APPS shouldn't build the hiddenapi flags or encode dex files even if frameworks/base exists. Bug: 133343287 Test: mainline modules build Change-Id: I0647451420fd09bb680808b35e1ad3b8f514ba46
2019-05-28Port uses-shared library verification and dexpreopting to SoongColin Cross
Ports 09f3b97f4b488cd3a7b7d72038b173575b02c162 (Add support for preopt with uses-libraries) from Make to Soong to support verifying and preopting shared libraries. Bug: 132357300 Test: app_test.go Test: m checkbuild Change-Id: Id25f55f07a55120bebe2a9b32c094209efc85c8b
2019-05-27AIDEGen: Collect the srcjar into out/soong/module_bp_java_deps.jsonpatricktu
Build module_bp_java_deps.json without this change: Build time: 3m53.761s File size: 12,955,363 Bytes Build module_bp_java_deps.json with this change: Build time: 3m49.106s File size: 13,361,647 Bytes Bug: 132407603 Test: 1. SOONG_COLLECT_JAVA_DEPS=false make nothing 2. SOONG_COLLECT_JAVA_DEPS=true make nothing 3. Check module_bp_java_deps.json in /out/soong. In SettingsProvider section there should contain "srcjars": [ "out/soong/.intermediates/frameworks/base/packages/SettingsProvider/SettingsProvider/android_common/gen/R.jar" ] Change-Id: I800a4d4f13b280d7ef87005e599cbd0aaf8c93f4
2019-05-21Merge "Add kotlin-stdlib-jdk8 when using Kotlin"Colin Cross
2019-05-21Merge "Avoid targeting Java 9 for targets with SDK version up to 29."Pete Gillin
2019-05-20Avoid targeting Java 9 for targets with SDK version up to 29.Pete Gillin
Targets with sdk_version values up to and including 29 should not use Java language level 9, even if EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9=true is set. This change fixes a downstream issue. Bug: 131678633 Test: EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9=true make droid tests docs cts java Test: (same test in downstream branch) Change-Id: Ic58e8df2e06d6e07bc42255314521831dc41b239
2019-05-15Turn off dex actions for sourceless modules.Jaewoong Jung
Test: dexpreopt_test.go Fixes: 129370564 Change-Id: Ic292f37c4f782b14fce625b85817b58c31d3f276
2019-05-15Add kotlin-stdlib-jdk8 when using KotlinColin Cross
kotlin-stdlib-jdk8 contains extensions to the Kotlin standard library for use when targeting Java language level 8. Test: m checkbuild Change-Id: Iac5f977f9080d8e0e2402b08a992a93c909744e9
2019-05-13Merge "Don't hide *.kotlin_module in turbine dependencies"Treehugger Robot