summaryrefslogtreecommitdiff
path: root/java/java.go
AgeCommit message (Collapse)Author
2020-08-04Refactor java compileDex Liz Kammer
We want to support a compile_dex property for java_import. This splits dex-related properties into a dexer struct which can be embedded in relevant modules. Test: m Test: soong tests Bug: 160455085 Change-Id: If56a51dac43f630d49483a36db29cd50e9ccd529
2020-07-27Add `data_native_bins` property to java_test_host Liz Kammer
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-22Build transitive lint reports for apex modules Colin Cross
Build and export transitive lint report zips for apex modules. Bug: 153485543 Test: m TARGET_BUILD_APPS=com.google.android.wifi lint-check dist Change-Id: I5a1805440452301a7e2c4ca91482b989638b54fb
2020-07-10Pass unstripped JNI libraries to Make Colin Cross
Pass a list of unstripped JNI libraries to Make so that they can be installed into the symbols directory. Bug: 159726429 Test: forrest Change-Id: Ieb4bffbb3d0a09f476da011399c5b8b1611929d7
2020-07-06Support kotlin multiplatform sources Colin Cross
Add a common_srcs property and propagate it to the module.xml file passed to kotlinc. Test: m checkbuild Change-Id: Ief768bafb943513c9ffbc01e829abc078f0a72bc
2020-07-01Merge changes Ib7ad715d,I3a83b5ed Treehugger Robot
* changes: Remove frameworkResModule from sdkCorePlatform. Remove the concept of useDefaultLibs from Soong.
2020-07-01Merge "Rename the Default* constants in java/config." Treehugger Robot
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-07-01Remove the concept of useDefaultLibs from Soong. Pete Gillin
This field in the java/sdk structure was used in two of the many possible configurations, so it wasn't really a "default". It also meant that, to understand those configurations, the reader had to know what was considered the default, which was only possibly by reading the code in java.go and droiddoc.go which implemented special code paths when useDefaultLibs was true. By eliminating that setting and explicitly setting the required values, the code is simpler and easier to understand. This change is a straight refactoring, in the sense that the output of the build should be unchanged. Regarding the changes to the proguardRaiseTag dependency in java.go: - This is a noop for anything which had sdkDep.useModule = true prior to this change, because they all had the same value for hasFrameworkLibs() and hasStandardLibs(). - This is a noop for anything which had sdkDep.useDefaultLibs = true prior to this change, because they do not use proguard settings. - Therefore, it is a noop overall. - Nevertheless, it is required to make sdkCorePlatform work. Without this change, such modules would pick up a dependency on framework libs via the (unused) proguardRaiseTag, which creates a circular dependency, because this is the sdk_version used when building framework libs themselves. Bug: 157640067 Test: m java docs droid Change-Id: I3a83b5edc1bd48c16b55f6f77e3e710fc8fbd8fa
2020-06-29Apply hiddenapi encoding to java_sdk_library .impl Paul Duffin
Adds a ConfigurationName property, and ConfigurationName() method that allows a library to separate its name (e.g. framework-tethering.impl) from the name used in the build configuration, e.g. ctx.Config().BootJars(). Updates hiddenapi processing to use ConfigurationName() instead of ctx.ModuleName(). Changes java_sdk_library to set the ConfigurationName property of the implementation library to the name of the module instead of <module>.impl so that it will match the name in the boot jars list. Bug: 159683330 Test: m framework-tethering dexdump ${PRODUCT_OUT}/apex/com.android.tethering/javalib/framework-tethering.jar | grep hiddenapi | wc -l Verify that there are >0 hiddenapi entries. Add java_sdk_library_import prefer=true for framework-tethering and repeat the above to verify that there are 0 hiddenapi entries. Apply this change, repeat above and verify that there are the same # of entries as before. Remove the prebuilt for framework-tethering Repeat the above and verify that there is no change to the # of entries Merged-In: I6c3016c35d0fcb1b95d4f9b37a307a69878f8e0a Change-Id: I6c3016c35d0fcb1b95d4f9b37a307a69878f8e0a (cherry picked from commit c4422106a7cf4731e27d664646bc0d57ad3f37fa)
2020-06-26Add `soong.java.testProperties` to `java_defaults` module type. Roland Levillain
This is so that we can use some test properties in a `java_defaults` module for ART run-tests. Test: atest art-run-test-001-HelloWorld Bug: 147814778 Change-Id: Ifb9817ca2f08e64f911c123a4022fbf688405547
2020-06-25Support multiple dists per Android.bp module, and dist output selection. Jingwen Chen
This CL adds "dists" to the base property struct to support multiple dist file configurations, and generic tag support to dist tagged outputs of modules. Fixes: b/152834186 Test: soong tests and `m sdk dist` Change-Id: I80c86bc9b7b09e671f640a4480c45d438bdd9a2a Signed-off-by: Jingwen Chen <jingwen@google.com>
2020-06-25Merge "apex/apk: enforce min_sdk_version of all deps" Jooyung Han
2020-06-24Include resources in sdk snapshot of java library impl Paul Duffin
Bug: 159607838 Test: m nothing Change-Id: Ie7ddbffc3957f832abfadb27292c436e8e5dcbf3
2020-06-24apex/apk: enforce min_sdk_version of all deps Jooyung Han
Enforce min_sdk_version for every payload dependency of updatable APEX/APKs. android.CheckMinSdkVersion() calls ApexModule.ShouldSupportSdkVersion for every transitive dependency from APEX/APK modules to see if it meets the min_sdk_version requirements. The common implementation for apex/android_app is provided in android/apex.go. Bug: 145796956 Bug: 152655956 Bug: 153333044 Test: m nothing Change-Id: I4a947dc94026df7cebd552b6e8ccdb4cc1f67170
2020-06-18Support adding extra lint checks Colin Cross
Add a lint.extra_check_modules property to list modules to use as plugins to Lint. Bug: 153485543 Test: m checkbuild Change-Id: I25c7799438cfec43163e757637c65b8657488d36
2020-06-18Allow kotlin modules to skip packaging the kotlin stdlib Colin Cross
Host tools like lint may package their own version of the kotlin stdlib, and any jars loaded by them shouldn't contain the platform version. Add a static_kotlin_stdlib property that defaults to true to allow building the module without staticalling including the kotlin stdlib. Bug: 153485543 Test: m ApiFinder Change-Id: I7da78ef493806ce4ab0050e4ee9e8d330b0509c8
2020-06-18Fix annotation processors in kotlin modules that generate resources Colin Cross
The kapt rule was only keeping the generated sources, and not the generated classes directory. The generated classes directory will contain resources generated by the annotation processor and needs to be added to the final jar. Test: m ApiFinder Bug: 153485543 Change-Id: I89197d0afcb1eee011c01aa400f9977e66f43768
2020-06-18Merge "Add support for running Android lint on java and android modules." Colin Cross
2020-06-17Merge "Consolidate adding common java properties" Treehugger Robot
2020-06-17Fix check-boot-jars when a boot jar is provided by prebuilt Paul Duffin
Previously, when a boot jar was provided by a java_sdk_library_import module the check-boot-jars check failed because the file it depended on was not available. In an incremental build the build failed due to the file in the out directory not having a rule to generate it. That was because the module was named prebuilt_<module>.<apex> instead of <module>.<apex>. This was fixed by simply removing prebuilt_ prefix from the name if it was present. After fixing that the check-boot-jars still did not work properly because it was expecting a jar file containing .class files but instead was given a jar file containing .dex files which meant the check did not work properly. This was fixed by defining a new ApexDependency interface for use by the apex/apex.go code to use instead of java.Dependency for generating the androidmk entries. The *SdkLibraryImport type then implemented those, by delegating to the implementation library. Bug: 158304459 Bug: 159112414 Test: m check-boot-jars m checkbuild manual inspection of the .jar file used by check-boot-jars to ensure it contained .class files and not .dex files. Change-Id: I545c5c9072dd472337d2f9b4dfdf08f53c981662
2020-06-16Add support for running Android lint on java and android modules. Colin Cross
Add a rule that runs Android lint on each java and android module and produces reports in xml, html and text formats. Bug: 153485543 Test: m out/soong/.intermediates/packages/apps/Settings/Settings-core/android_common/lint-report.html Change-Id: I5a530975b73ba767fef45b257d4f9ec901a19fcb
2020-06-15Do not override "-g:source,lines" for host java binaries when ↵ Alex Humesky
PRODUCT_MINIMIZE_JAVA_DEBUG_INFO is set. Test: Ran unittests Change-Id: Ic061b4bf107bcd931813d69f6d72b521d79fbc35
2020-06-15Consolidate adding common java properties Colin Cross
Use a method to add the properties that are present on all java modules. Bug: 153485543 Test: m checkbuild Change-Id: I7803b15eb0de810c8ab8d4b9acf2511935a26fb6
2020-06-15Merge "Introduce product variables to select Java code coverage paths in Soong." Roland Levillain
2020-06-15Merge "Use EMMA_INSTRUMENT_FRAMEWORK for apex framework libs." Chris Gross
2020-06-15Introduce product variables to select Java code coverage paths in Soong. Roland Levillain
Introduce product variables `JavaCoveragePaths` and `JavaCoverageExcludePaths` (resp. populated from environment variables `JAVA_COVERAGE_PATHS` and `JAVA_COVERAGE_EXCLUDE_PATHS`). Use them to control which Java modules are candidate for instrumentation based on their source path. By default (when `JavaCoveragePaths` is empty), have all Java module be candidate for instrumentation, to preserve the existing behavior. Test: export EMMA_INSTRUMENT=true \ && export EMMA_INSTRUMENT_FRAMEWORK=true \ && export JAVA_COVERAGE_PATHS=art \ && m Bug: 158212027 Bug: 156284897 Change-Id: Ibe9c1f41ed6110867411952689c5a7ad6536f277
2020-06-11Use EMMA_INSTRUMENT_FRAMEWORK for apex framework libs. Chris Gross
Static coverage builds that trigger a dexpreopt target for a bootclasspath jar can fail since coverage for jars in apexes are turned on by default which requires jacocoagent to be present on the bootclasspath. Fix this by using EMMA_INSTRUMENT_FRAMEWORK to conditionally instrument framework libs in apexes. Bug: 157737183 Test: EMMA_INSTRUMENT=true EMMA_INSTRUMENT_STATIC=true m -j droid Change-Id: I2c323553e08741bc46b196bc3bb860614bc3f85b
2020-06-11Merge changes from topics "dist-for-goals", "soong-dist", "tests-PathForSource" Colin Cross
* changes: Add DistForGoal to MakeVarsContext Define Soong phony rules in Make Remove paths from cc.TestConfig Remove most paths from java.TestConfig Allow tests to bypass PathForSource existence checks
2020-06-11Merge "Fix on-device paths to used libraries in dexpreopt." Ulyana Trafimovich
2020-06-10Fix on-device paths to used libraries in dexpreopt. Ulya Trafimovich
Test: lunch aosp_cf_x86_phone-userdebug && m Test: Cherry-pick in internal master and check that on-device path to com.google.android.dialer.support.jar now is on /product partition (as it should be) and not on /system: $ oatdump \ --instruction-set=x86 \ --oat-file=out/target/product/vsoc_x86/product/priv-app/GoogleDialer/oat/x86/GoogleDialer.odex \ | grep '^classpath' \ | grep -o '[^[]*com.google.android.dialer.support.jar' /product/framework/com.google.android.dialer.support.jar Bug: 132357300 Change-Id: Idf279ac713b9b29ff3a29f1b072bc1d57f48db26
2020-06-09Merge "dex_import that isn't available for platform isn't installed" Jiyong Park
2020-06-09Define Soong phony rules in Make Colin Cross
To support dist-for-goals in Soong, we need to define all phony rules in Make so that dist-for-goals can insert additional dependencies on them. Collect all the phony rules in phonySingleton and write them out as Make rules when Soong is embedded in Make, or as blueprint.Phony rules when Soong is run standalone. Test: m checkbuild Change-Id: I68201eff30744b0f487fc4f11f033767b53a627d
2020-06-08dex_import that isn't available for platform isn't installed Jiyong Park
This change fixes a bug that dex_import module is always installed to the platform even when the module is not available to the platform. Exempt-From-Owner-Approval: cherry-pick from AOSP Bug: 158284983 Test: OUT_DIR=/tmp/ndk build/soong/scripts/build-ndk-prebuilts.sh Merged-In: I85570506e700be59ee63e4f1d7902a40e36df39c (cherry picked from commit afd3d11a795b9f331637d3587a94142f20e8c55d) Change-Id: I85570506e700be59ee63e4f1d7902a40e36df39c
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-05Correct link type for module stubs Anton Hansson
Module stubs compile against module_current, so any module depending on them had to compile against module_current (or broader) too. Treat them as the API surface the stubs are for. Bug: 157010342 Test: m Change-Id: I49b9082dc1b5afe6c22e94126e574dd8061f0f39 Merged-In: I49b9082dc1b5afe6c22e94126e574dd8061f0f39 (cherry picked from commit 0bd88d0b4e782df6aa99475307a4cfab6d617d14)
2020-06-05Improve the structure of the link check method Anton Hansson
Match by name first, then by kind. Bug: 157010342 Test: m Change-Id: Ic337a073c3bd14ac03b1d899aeb612247a708495 Merged-In: Ic337a073c3bd14ac03b1d899aeb612247a708495 (cherry picked from commit ac103461a47e86665ec78df6e5d9792d7464a57b)
2020-06-04Revert^2 "Rename DexJar interface method to DexJarBuildPath." Ulyana Trafimovich
This reverts commit b0dc851ff4eca650042b52ce4ff06cb7e0312b77. Reason for revert: relanding original change. Build failures were caused by a race with another CL: https://r.android.com/1320920 Test: lunch aosp_cf_x86_phone-userdebug && m Change-Id: Ic9016582dae7773b4d4f84a63425f1ef7a5d061f
2020-06-04Merge "Revert "Rename DexJar interface method to DexJarBuildPath."" Ulyana Trafimovich
2020-06-04Revert "Rename DexJar interface method to DexJarBuildPath." Ulyana Trafimovich
This reverts commit 562c240185dd4adcbdb75d2924c69657f6ac7cff. Reason for revert: breaks `lunch full-eng && m checkbuild`. Change-Id: Id7c7d6240d98afaf8edd49b6c96cd05534b784cc
2020-06-04Merge "Rename DexJar interface method to DexJarBuildPath." Ulyana Trafimovich
2020-06-03Rename DexJar interface method to DexJarBuildPath. Ulya Trafimovich
This is a prerequisite change before adding DexJarInstallPath. Test: lunch aosp_cf_phone-userdebug && m Change-Id: I033e08b8bb06c0a844a6bbbfcdc48ce33e9c95cf
2020-06-02Always run package check Paul Duffin
Previously, the package check was only run when building checkbuild or the phony target created for a specific module. It would not run when building a module that depended upon a library with the permitted_packages property. That was because the package check was only run when the package-check.stamp file was built and that was only added to the phony and checkbuild targets. Instead of touching a separate package-check.stamp file to indicate that the check has been performed this change copies the input jar file to the package check to a separate ../package-check/<jar> file which is then treated as the output of the library and is the input for any dex processing. So, any modules that depend on this library will transitively depend on the output file produced by the package check command and so will ensure that the package check is always run. Test: Removed "android.net" from the permitted_packages for "framework-tethering", build "framework-tethering" which triggered and failed the package check and "com.android.tethering" which did not. Made this change. Built "com.android.tethering" which triggered and then failed the package check. Removed change to "framework-tethering" Bug: 157649935 Change-Id: Ib01aa09e13f80282218049270eb7a58ec5f9f605
2020-06-02dex_import can be added to apex Jiyong Park
Bug:157886942 Test: m Change-Id: Ida6f7bb784efe74cc1fa0e8d370eaee803f08b0f
2020-05-29Collect permitted packages from java_sdk_library instances Paul Duffin
Switching an updatable boot jar from java_library to java_sdk_library changed the contents of the updatable-bcp-packages.txt due to the code requiring the module to be *Library. This change updates that to allow it to be any module that implements the PermittedPackagesForUpdatableBootJars interface which is *Library and anything that embeds that like *SdkLibrary. Bug: 155164730 Test: m droid and check the contents of system/etc/updatable-bcp-packages.txt Change-Id: I464af74628da311734f102f77ec8158daec5b32d
2020-05-29Merge "Add support for remote-execution / caching of jar/zip actions" Kousik Kumar
2020-05-28Add support for remote-execution / caching of jar/zip actions Kousik Kumar
Test: Ran a build with `RBE_JAR="true" RBE_JAR_EXEC_STRATEGY="remote" RBE_ZIP="true" RBE_ZIP_EXEC_STRATEGY="remote" ... use_rbe m` and that succeeded. Bug: b/156765207 Change-Id: Ia17b532fbb282be414adf879914870082dd0841b
2020-05-28apex respects stem of java_library modules Jiyong Park
apex now respects stem of java_library modules. As a follow-up we need to suppor the same for other types of modules. Bug: 157638999 Test: m Change-Id: Iaf5023020b5440f1ffd4f5414b5a7864655fc22a
2020-05-27Merge "Allow the user to explicitly set the java Uncompress_dex property." David Srbecky
2020-05-27Merge "AIDEGen: Add path attribute to okhttp module." Treehugger Robot