aboutsummaryrefslogtreecommitdiff
path: root/java/java.go
Commit message (Collapse)AuthorAgeFilesLines
...
* Support setting target_sdk_version separately from sdk_versionDan Willemsen2018-10-311-0/+13
| | | | | | | | | | | | Before this change, if targetSdkVersion wasn't set in the AndroidManifest.xml, we'd set it to the sdk_version from the Android.bp. But there are cases where you want to compile against a later SDK, but target an earlier one (especially if you depend on libraries that need to be compiled against more recent SDKs, like androidx). Test: build APK with different target_sdk_version. Change-Id: Iaed36b522955a374a049ef331158cc8fc5798ad2
* Remove sdk_version: "core_platform_current"Neil Fuller2018-10-261-5/+3
| | | | | | | | | | | This (effectively) reverts commit 3c979c33487d7507d2a195291f3cd824ca824b90. core_platform_current is the new default when no_framework_libs: true so doesn't need to be specified anywhere. Bug: 113148576 Test: build Change-Id: I6bb6c1a0ea24437c8253dc5d8fabd37edabc9d3e
* Store dex files uncompressed and unstripped in privileged APKsColin Cross2018-10-251-0/+2
| | | | | | | | | | | Privileged APKs need to store their dex files uncompressed so they can be verified and mapped directly out of the APK. Also track whether the module will be dexpreopted or not in order to determine if the dex file should be stripped before signing. Test: SystemUI.apk contains an uncompressed dex file Change-Id: I4dca86c7f8778595882405b34adcf2a7bae03c67
* Don't check the link type from stubs libs.Jiyong Park2018-10-221-17/+28
| | | | | | | | | | | | | getLinkType also tells whether the module in question is a stubs lib or not. If it is a stubs lib, link type from it isn't checked beause dependency from the stubs lib doesn't matter; the stubs lib is build-time only artifact. In addition, core-lambda-stubs is added to the list of stubs libs. Bug: 117964170 Test: m with https://android-review.googlesource.com/c/platform/libcore/+/793518/4 Change-Id: Ibd63484a1cc48dfd0afed6e6de098b7a38db5e61
* Fix instrumentation_for to match LOCAL_INSTRUMENTATION_FORColin Cross2018-10-181-11/+12
| | | | | | | | | | | | | | | The value from instrumentation_for should not go to aapt2 link --rename-instrumentation-target-package, that should be the equivalent of LOCAL_MANIFEST_INSTRUMENTATION_FOR. That property is never used in Make, so it is left unimplemented in Soong. Add the module listed in instrumentation_for as a shared library for javac, but don't import its resources. Bug: 117804211 Test: m checkbuild Change-Id: I7f035dc0ecb964a3ca391ae1ca2b87cb0f6a7cec
* Support main_class property in java_binary modulesColin Cross2018-10-181-2/+17
| | | | | | | | Add a main_class property that will be used to generate a manifest containing a Main-Class entry. Test: m checkbuild Change-Id: I0a59bb2b93cad915afd82fba708fa0f7eda2fe7a
* aidegen: Fix bug of generating module dependency informationpatricktu2018-10-111-1/+1
| | | | | | Bug: 117588037 Test: cd $android_root;make aidegen;aidegen -m tradefed Change-Id: I05712ef3243771605034e4e9a746b8e1081c3516
* Add support for android_app_certificate modulesColin Cross2018-10-081-1/+6
| | | | | | | | | | Some android_app modules need certificates located outside their directory. Instead of requiring paths from the root of the tree, add an android_app_certificate module that exports the certificate files. Test: m checkbuild Change-Id: Icbf3898894f3eb857e2d907e3e58dd072c6fabe9
* Add support for JNI libraries to android_app modulesColin Cross2018-10-081-3/+17
| | | | | | | | | | | Make android_app modules a MultiTargets module, which means the common variant will have a list of Targets that it needs to handle. Collect JNI libraries for each Target, and package them into or alongside the APK. Bug: 80095087 Test: app_test.go Change-Id: Iabd3921e1d4c4b4cfcc7e131a0b0d9ab83b0ebbb
* Make more java modules defaultableColin Cross2018-10-031-4/+10
| | | | | | | | | Make java_import, android_library and android_library_import modules defaultable, and add some missing property structs to java_defaults. Also use InitJavaModule everywhere. Test: m checkbuild Change-Id: I981875bbec5d1f87bae73f36a385e0b77c56c368
* sdk_version <= 28 implies Java 1.8Jiyong Park2018-10-031-1/+1
| | | | | | | | | | When sdk_version is equal to or less than 28, java_version is implied to 1.8 unless it is explicitly specified. It was 26 originally, and is now updated to 28 which is the most recent API version. Bug: 117069453 Test: EXPERIMENTAL_USE_OPENJDK9=true make apex_aidl_interface Change-Id: I18ebe3ec51ada54103f6d203b9bfae8ec6ea5d90
* soong_zip: Add testsColin Cross2018-09-281-0/+3
| | | | | | | | | | Add test that cover basic command line usage of soong_zip. -D is not covered yet as the implementation will be replaced with one that is also more easily testable in the next patch. Bug: 116751500 Test: zip_test.go Change-Id: I5a1bcee74ebc9cb3cf332c36f89bc12c0e807ad2
* TradeFed: Add "test_config_template" flag in Android.bpJack He2018-09-261-1/+6
| | | | | | | | | | | | | | | * Allow module owner to specify a test_config_template in Android.bp * The rule goes: 1. When "test_config" is set, Soong uses specified test config 2. If 1 is not true, check if "AndroidTest.xml" exist in the directory, if so, use "AndroidTest.xml 3. If 1 and 2 are not true, check if "test_config_template" is set. If so, use module specific template to generate test config 4. Otherwise, use Soong default template for test config for autogen Bug: 113359343 Test: make Change-Id: I9fb4b2b266be9e0c7cf23da4a51e1c8ae67cd857
* Allow patch_module attribute in target: { android: { ... } } block.Tobias Thierer2018-09-191-1/+1
| | | | | | | | | | | | | | | | | patch_module is currently only used for non-host targets, although there's a slim chance that there might be use cases on host in future. Currently, the only use case is patch_module: "java.base" in device targets. To avoid erroneously carrying the patch_module attribute over into the host version of the target, this CL lets them place it into the target: { android: { ... } } block. Test: Treehugger Test: EXPERIMENTAL_USE_OPENJDK9=true make android-icu4j-tests Bug: 115604102 Change-Id: If025d503d9c5681748a502a1d7433e8dbec3cac1
* Collect modules' info to create IDE project file.Brandon Lee2018-09-181-0/+45
| | | | | | | | | | | | | | | | - Register a singleton and implement GenerateBuildActions func in java/jdeps.go. - Declare a interface and a struct to collect info in android/module.go. - Implement IDEInfo for Library & Import module in java/jdeps.go. - Implement IDEInfo for Genrule module in genrule/genrule.go. - Implement IDEInfo for fileGroup module in android/filegroup.go. - Test codes for jdeps.go in java/jdeps_test.go. Bug: 111044346 Test: export SOONG_COLLECT_JAVA_DEPS=1;mmm packages/apps/Settings out/soong/module_bp_java_deps.json will be generated Change-Id: If61da77b4d7614c2c5da438b6af4c725ceccc5c3
* Allow exclude_java_resources to affect java_resource_dirsColin Cross2018-09-131-2/+3
| | | | | | | Allow excluding files from directory globbed by java_resource_dirs. Test: java_test.go Change-Id: I9922842248be1a386ab111a5187608438638ffb1
* Add a new sdk_version "core_platform_current"Neil Fuller2018-09-121-4/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | Add a new sdk_version "core_platform_current" value to java_library. This adds the ability to compile system code against the core platform API stubs. These stubs will contain the public SDK API _and_ a selection of extra methods just intended for use by system code (e.g. framework .jar) and which must be preserved if "core" is modularized to retain source and binary compatibility. Methods outside of the core platform API must not be relied upon. Future changes will adding methods to the core platform API and switch targets over to use the stubs. As soon as feasible, (hopefully) the default for when unspecified will be changed to be the same as specifying core_platform_current and build rules will have to explicitly specify when they want to compile against the core library implementation directly. Bug: 113148576 Test: mmm libcore/mmodules/core_platform_api_client_demo Change-Id: I72a03f28a4c38b4232e513a088c2d4e962c98868
* Enable Java 9 language support through java_version: "1.9" alone.Tobias Thierer2018-09-111-14/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some logic in java.go was conditional on TargetOpenJDK9(), which in turn relies on a global build flag (EXPERIMENTAL_USE_OPENJDK9=true). This CL changes the logic in collectBuilderFlags() to check for javaVersion greater or equal "1.9" instead, which is true when either EXPERIMENTAL_USE_OPENJDK9=true (global) or javaVersion "1.9" (a per-build target attribute). Because the value of flags.javaVersion isn't available there, TargetOpenJDK9()-dependent logic in Module.deps() was changed to be unconditional; as far as I understand, this means that system modules deps will be built regardless of whether they're needed later in the build. This will probably slow down the build unnecessarily until the first user of these system modules appears (expected soon), but probably not by much. There is some TargetOpenJDK9() related logic remaining in droiddoc.go, but this doesn't seem to break the build of Java 9 language sources and is probably no longer needed now that metalava is used for generating the stubs (thanks to Nan!), and those do not contain any Java 9 language features. Bug: 112443425 Test: Checked that Java 9 language support works on AOSP after this CL without a need for EXPERIMENTAL_USE_OPENJDK9=true, ie. after also patching CL http://r.android.com/646840 , "make docs droid cts" completes, the device boots and Java9LanguageFeaturesTest passes. Change-Id: I393b97a7b3bb4c1c3d06580c639e94ff6cf916ff
* Adapt special case framework support.Mathew Inwood2018-09-041-2/+2
| | | | | | | | | | | | | I'm adding a annotation processor to the framework target that does not run as part of the main build, but only for a parallel build target framework-annotation-proc, which is identical to framework except that it also runs an annotation processor. Update build rules to be aware of this target so that it builds successfully. Test: m framework-annotation-proc Bug: 113853502 Change-Id: I8b20758dc8bd0e8cb2542414d7a45a2cd7d2e158
* Enforce dependencies have right architectureColin Cross2018-08-301-15/+15
| | | | | | | | | | | | ctx.AddDependency will succeed if the named dependency only has a single variant, even if that variant is the wrong architecture. Use ctx.AddVariationDependency(nil, ...) instead, which requires that all variations of the calling module match the dependency. Bug: 112707915 Test: no change to out/soong/build.ninja Test: using a device dependency in a host java module is an error Change-Id: I70b661a57d4412eb63b8c9841febfb756e9e025d
* Add jetifier support in Soong.Nan Zhang2018-08-291-1/+10
| | | | | | | | This is a blocker for droiddoc targets migration under vendor/. Test: N/A Bug: b/72552006 Change-Id: If85a0917c1ac0d88b9d5b488216a638b4dabd39f
* Revert "Add support for renamed kotlin stdlib."Colin Cross2018-08-291-31/+2
| | | | | | | | This reverts commit 66c0c4067f8a70847eaa37273671aa8fe4203f1d. Bug: 112674805 Test: m checkbuild Change-Id: I687888136b570f080b57af352af0130355acd216
* Put kotlin classes in header jarColin Cross2018-08-271-6/+10
| | | | | | | | | If a module has kotlin sources the compiled kotlin clsases must be put in the header jar for anything that depends on the module to use. Bug: 113153312 Test: m checkbuild Change-Id: Ibc44e9a97655937315b03b05e51e09c2954d7008
* Removed Metalava related checksNan Zhang2018-08-171-11/+5
| | | | | | | Test: m -j checkbuild Bug: b/70351683 b/78245848 Change-Id: Ie26e95081d8d90b626cfb43d017cb2ae500b7b25 Merged-In: Ie26e95081d8d90b626cfb43d017cb2ae500b7b25
* Don't pass resources to r8Colin Cross2018-08-161-10/+88
| | | | | | | | | | R8 complains when it gets dex files in the input jar, but some tests use dex files or dex jars as resources. Keep resources separate from classes until after r8 has been run. Test: java_test.go Test: m checkbuild Change-Id: I1d9164d60d6b054ebb138648da07d80ee769177f
* Support patch_module in java modulesColin Cross2018-08-161-5/+20
| | | | | | | | A few tests that have classes in the java.base module need to pass --patch-module=java.base=<classpath> to javac. Test: m checkbuild Change-Id: I246bad92dcde976969b064aace5e2856e2bac971
* Make :module provide the output file for java modulesColin Cross2018-08-161-13/+23
| | | | | | | | | | | Make :module on a java_library provide the output file, which is normally the implementation jar. For java_library modules with installable: true or compile_dex: true this will be the dexjar instead. For android_app modules this will be the apk. Bug: 80144045 Test: no change to out/soong/build.ninja Change-Id: I739674aee60a38bfccb859369e4414b46f293d82
* Don't link java tests against junit by defaultColin Cross2018-08-151-7/+1
| | | | | | | | | | | | | There is more variety of java tests than I expected, don't default to including junit, that's just going to lead to unexpected junit classes for module authors that don't know to set junit: false. All existing uses of java_test are already not using junit or setting static_libs: ["junit"], and all test in Make are already specifying junit. Bug: 70770641 Test: m checkbuild Change-Id: I4393b70d87dd2b6e3bb719fdb758915053bee0c7
* Support data properties in java_test and android_testColin Cross2018-08-141-0/+7
| | | | | | | | Files in the data property will be passed to LOCAL_COMPATIBILITY_SUPPORT_FILES in Make. Test: m checkbuild Change-Id: Ifc074317f957aba8f55daa30abc5b9737d1eceac
* Move autogenerated test config into SoongColin Cross2018-08-141-0/+10
| | | | | | | | | | Move autogenerating the test config for Soong modules into Soong for java_test and android_test modules. Bug: 70770641 Test: m checkbuild Test: atest CtsUiRenderingTestCases Change-Id: I02593add0407ef694b91c14cf27411a4f3cc4745
* Enable prebuilt jar installation in frameworkNan Zhang2018-08-101-0/+4
| | | | | | Test: m -j dokka Bug: 72394196 Change-Id: Ide09dc2fe64ea5db0d771e16d4b9293638b5d65c
* Support 'test_config' into soong modulesJulien Desprez2018-08-071-0/+4
| | | | | | Test: make general-tests Bug: 110982517 Change-Id: Ib2eab2653fdfce6f699b85c9fbc64558b6d40363
* Build Java aidl w/ '-b'.Steven Moreland2018-07-261-1/+2
| | | | | | | | | | | | | | | | | | As it turns out, AIDL originally passed and returned success when it was asked to compile an unstructured parcelable even though no output files were created. The build system currently can't handle this because it is expecting outputs here, so I am adding this argument here which will cause the compiler to exit and error earlier as expected. Notice also that the make implementation of the AIDL build system also passes in this argument. Test: m framework (which invokes this many times) Bug: N/A Change-Id: Ia9b5280dc3593756784035a523399545c9947d80
* Add private-stub-annotations.jar as core-java libNan Zhang2018-07-241-1/+2
| | | | | | | | Since currently android.jar compile against to it. Test: m -j metalava_android_stubs_current Bug: b/78245848 Change-Id: Id5812f69125085821182295e577849b5f2c4bead
* Fix `go vet` issuesDan Willemsen2018-07-221-1/+1
| | | | | Test: go vet ./... Change-Id: Ifb936ccc5e2b5a2c3fcbbbcb54f680e2973ea1b3
* Change classpath for droiddocSundong Ahn2018-07-171-0/+1
| | | | | | | | | | | | When the module type is SdkLibraryDependency, the classpath has been gotten from headerJar Becuase droiddoc uses src files when it builds, we should change to use ImplementationJars instead of headerJar. Bug: 77577799 Test: make -j Change-Id: I1a072be69d7edff5636ea80af700be7796c3b0fc
* Add a Generate_get_transaction_name flag.Olivier Gaillard2018-07-171-0/+7
| | | | | | | | | Add a flag to be able to generate the Binder#getTransactionName method Test: manual Bug: 111200705 Change-Id: I3e8106261df5c63cdc005d07c9d8efcc6732db70
* Fix .kotlin_builtins globColin Cross2018-07-161-1/+1
| | | | | | | | The files in kotlin jars seem to be called .kotlin_builtins, not .kotlin_builtin. Test: m checkbuild Change-Id: I541aea758bbef6bb23632836cceb8339b82ffdff
* Make merge_zips -stripFile use blueprint style globsColin Cross2018-07-161-1/+3
| | | | | | | | | | merge_zips -stripFile was only considering the name of the file and ignoring the path. Make it more useful by supporting blueprint style globs. The previous behavior can be recreated by prefixing with **/. Bug: 111389216 Test: m checkbuild Change-Id: I25760fe3f1f77704dd9da9d107d9a38a415d681f
* Add exclude_files and exclude_dirs properties to java_importColin Cross2018-07-121-10/+25
| | | | | | | | | | | | | | Prebuilt jars sometime contain files that we don't want. In Make we would delete everything in META-INF when importing jars, but that caused problems when there were necessary files in there, so we added LOCAL_DONT_DELETE_JAR_META_INF. Soong does the opposite, keeping everything by default. Add properties to allow explicitly stripping unwanted files instead. Bug: 111389216 Test: m checkbuild Change-Id: I6d07f519ebc7d0e1bf0af93416bb569e3c2b1500
* Don't install java libraries by defaultColin Cross2018-07-111-28/+25
| | | | | | | | | | | | | | | | | Very few java libraries need to be installed, most are statically included in other modules. Device modules that are not installed also don't need to be dexed, saving checkbuild time. Change the default for java_library to not be installed, and allow libraries that should be installed to specify installed: true. This makes java_libary and java_library_static identical. It also simplifies some corner cases when converting from Make to Soong if a module is built for the host (which doesn't differentiate between static and non-static/installable) and statically for the device, which couldn't be represented in a single java_library in soong. Bug: 110885583 Test: m checkbuild, compare presubmit target files Change-Id: Idc0841c39a17cebd7bac3559c9408596d167a393
* Add support for min_sdk_versionColin Cross2018-07-091-38/+80
| | | | | | | | | | | Add min_sdk_version properties and use it for aapt2 --min-sdk-version and --target-sdk-version flags. Add an sdkContext interface that any function that needs an sdk version can take in order to get the values for the current module. Bug: 110848854 Test: m checkbuild Change-Id: Ic69f1f935d8b865ec77689350407df08bfac5925
* Add option to compile dex for a Java libraryDavid Brazdil2018-07-091-2/+13
| | | | | | | | | | | | | Currently Soong will only compile a Java library into dex if the library has device support and is installable. For our use case of inspecting the dex at build time this is not sufficient. Add a new "compile_dex" device property which forces the creation of a dex rule. In this case, the class jar remains the output file of the module. Bug: 79409988 Test: on related CL Change-Id: Ia908a47148a03a0bdb0da4315cce6efc86c51865
* Use correct variant for annotation processors.Mathew Inwood2018-07-031-2/+3
| | | | | | | | | Annotation processors should always have a common host variant, rather than a device variant as the build was looking for before. Bug: 110868826 Test: m Change-Id: I2b7d0e7ed1af3f2f9ddb87d2bf36920737a507e9
* Run ErrorProne in OpenJDK9Colin Cross2018-06-201-3/+15
| | | | | | | | | Use the OpenJDK9 javac to run ErrorProne by adding it to -processorpath and using -Xplugin:ErrorProne. Bug: 69485063 Test: m RUN_ERROR_PRONE=true javac-check Change-Id: I0496006b71b70766ef16d57753cbcf037897799c
* Use -processorpath for annotation processorsColin Cross2018-06-201-1/+6
| | | | | | | | | | | | | ErrorProne needs to be added to -processorpath, but once anything is passed via -processorpath javac stops looking in the classpath for annotation processors. Move annotation processors to -processorpath in preparation. This reapplies Ife06b3c7432ab971f5605dcc18a558bcbd99a675 with fixes to processorpath in errorprone rules. Test: m java Change-Id: I188136771386a2183fb31f4b70b50c95ac419ff8
* Revert "Use -processorpath for annotation processors"Colin Cross2018-06-211-6/+1
| | | | | | | | This reverts commit 6dd0bb3b7726cbf3f385da90745ce25deead9790. Reason for revert: broke RUN_ERROR_PRONE=true build Change-Id: I23d066281e392c6e7df29c5cd4558c7cf731c1a5
* Use -processorpath for annotation processorsColin Cross2018-06-201-1/+6
| | | | | | | | | | ErrorProne needs to be added to -processorpath, but once anything is passed via -processorpath javac stops looking in the classpath for annotation processors. Move annotation processors to -processorpath in preparation. Test: m java Change-Id: Ife06b3c7432ab971f5605dcc18a558bcbd99a675
* Export SDK library namesJiyong Park2018-06-201-0/+47
| | | | | | | | | | | | | | java_library, java_import, and android_library export SDK library names that they are using directly or indirectly via its dependencies. When building an apk, the manifest fixer uses the SDK lib names to automatically add <uses-library> tags. The SDK lib names are exported to the make world via LOCAL_EXPORT_SDK_LIBRARIES flag. Bug: 77575606 Test: m -j Change-Id: I4fe606eb7ed23843c58eebe6a324405fe1da34e5
* Support Java Lang level 9 for droiddoc in Soong.Nan Zhang2018-06-191-13/+21
| | | | | | Test: m -j docs / m -j metalava-api-stubs-docs Bug: b/70351683 Change-Id: I7220d04f508f6bb5ffd281cf31bc8c0069c219e5