summaryrefslogtreecommitdiff
path: root/java/java.go
AgeCommit message (Collapse)Author
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
2019-01-09Remove duplicated shouldUncompressDex logicColin Cross
shouldUncompressDex has already been computed and stored in deviceProperties.UncompressDex, pass it to dexpreopter instead of recomputing it. Also add a stub for java libraries to set UncompressDex. Test: no change to build.ninja Change-Id: I663d9fbbe768a8dc9a97c7d456dd7a010f43162d
2019-01-06Don't dexpreopt when compile_dex but not installableColin Cross
Modules shouldn't be dexpreopted and possibly stripped when compile_dex is set but installable is not set. This matches the previous behavior when the dexpreopt rules were in Make. Bug: 121317615 Test: dexpreopt_test.go Change-Id: I6f80b7b37a990c475b91aa5d98a19a3baa85eb1b
2019-01-06Don't dexpreopt or strip java_test modulesColin Cross
I6bb2c971cee65d2338839753aa0d84939f335b1b accidentally caused java_test modules to be dexpreopted and possibly stripped. Test: dexpreopt_test.go Change-Id: Ida8f046c509c97e38bd3bce66944d32f01530db4
2019-01-04Add buildDir to java patch-module paths.Jaewoong Jung
This solves a problem where javac fails to find patch-module targets when a build diretory is not under the project root. Bug: 117770838 Test: java_test.go + manual build Change-Id: If70d0d388a3f6c87b3f78a927df2063616d50c8a
2018-12-25In java.go, add implement check for both Dependency and IDE relevant interfacesalbaltai
1. Add var _ to declare the struct Import implement IDEInfo and IDECustomizedModuleName interfaces 2. Modify var _, a typo case for struct Module implement Dependency interface 3. Add nil checking for Dependency interface implementation 4. Add more comment for developer Bug: 121985695 Test: 1. m aidegen 2. $ANDROID_HOST_OUT/bin/aidegen framework 3. check import static android.Manifest.permission.BIND_VOICE_INTERACTION; denpendency should be resolved in frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java Change-Id: Ia2d2d65b83a52d35ccb3927a36bcf686d5223e20
2018-12-25In java/java.go, enhance the checking logic for Dependency interface ↵shinwang
implementation Add nil checking for Dependency interface implementation Bug: 121985695 Test: 1. m aidegen 2. $ANDROID_HOST_OUT/bin/aidegen framework 3. check import static android.Manifest.permission.BIND_VOICE_INTERACTION; denpendency should be resolved in frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java Change-Id: Ibac280ce3de2537f453c4ca7e8f79f55667f1fa0
2018-12-18Add a flag to allow unbundled builds to build SDKs from sourceColin Cross
Mainline modules are tightly coupled to the platform, and should build against the current SDK from source and not prebuilts. Add a flag UNBUNDLED_BUILD_SDKS_FROM_SOURCE to specify that a TARGET_BUILD_APPS build should build the current SDK instead of using the prebuilts. Bug: 121194841 Bug: 121231426 Test: no change to out/build-aosp_sailfish.ninja Test: forrest unbundled build Test: forrest master apps build Test: forrest mainline modules build Change-Id: I45a40a335483dae2fe192721df9b31bdbab97ee5
2018-12-15Dexpreopt soong modules inside soongColin Cross
Port the dexpreopt logic from Make to the dexpreopt package in Soong, and use it to dexpreopt Soong modules. The same package is also compiled into the dexpreopt_gen binary to generate dexpreopt scripts for Make modules. This relands Ib67e2febf9ed921f06e8a86b9ec945c80dff35eb and I462182638bd57b1367b5bfb0718e975c11ae66f7, along with multiple fixes to depsfile generation in dexpreopt_gen that caused .odex files for modules in defined make to be missing dependencies on boot.art, and a fix to not dexpreopt and strip tests. Bug: 119412419 Bug: 120273280 Test: no differences to dexpreopt outputs on aosp_sailfish system/, only expected changes to dexpreopt outputs on system_other (.vdex files for privileged Soong modules no longer incorrectly contain .dex contents). Test: OUT_DIR=$PWD/out m Test: NINJA_ARGS="-t deps out/target/product/sailfish/obj/APPS/Contacts_intermediates/dexpreopt.zip" m Change-Id: I6bb2c971cee65d2338839753aa0d84939f335b1b
2018-12-14Revert "Dexpreopt soong modules inside soong"Colin Cross
This reverts commit 29ff88741e710b05743dcf347484c31311e81cda. Test: none Bug: 119412419
2018-12-13Dexpreopt soong modules inside soongColin Cross
Port the dexpreopt logic from Make to the dexpreopt package in Soong, and use it to dexpreopt Soong modules. The same package is also compiled into the dexpreopt_gen binary to generate dexpreopt scripts for Make modules. Bug: 119412419 Bug: 120273280 Test: no differences to dexpreopt outputs on aosp_sailfish system/, only expected changes to dexpreopt outputs on system_other (.vdex files for privileged Soong modules no longer incorrectly contain .dex contents). Change-Id: Ib67e2febf9ed921f06e8a86b9ec945c80dff35eb
2018-11-14Enable kotlinc flags in blueprint filesZoran Jovanovic
Add support for adding kotlinc files in the module. Some flags are unnecessary as they are added by default (-no-jdk and -no-stdlib), or are not needed on an Android build (-include-runtime), or may conflict with the build (-kotlin-home and -Xintellij-plugin-root), so the error stops the build if they are added. Test: part of java/java_test.go Change-Id: If3b2777062daaa490a20c014e9b1bb4b1cb0a8df Signed-off-by: Zoran Jovanovic <zoran.jovanovic@sony.com>
2018-11-14APEX can be flattenedJiyong Park
When TARGET_FLATTEN_APEX is set to true, APEXes are flattened, which means files in an APEX is not packaged into the mini file system image, but instead directly copied to the system partition. This option is for devices where kernel does not support loopback devices or the maximum number of loopback devices is too small (though the threshold is TBD as of now). This CL also fixes a bug that jars having bytecode are installed instead of those having dex. Bug: 118485880 Test: TARGET_FLATTEN_APEX=true m apex.test; tree out/target/product/.../system/apex/apex.test shows list of files in it. Test; m apex.test, then a file out/target/product/.../system/apex/apex .test.apex exists. Change-Id: I5a3d62d392d05f2779c4925388afe4f6e460059b
2018-10-31Support setting target_sdk_version separately from sdk_versionDan Willemsen
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
2018-10-26Remove sdk_version: "core_platform_current"Neil Fuller
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
2018-10-25Store dex files uncompressed and unstripped in privileged APKsColin Cross
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
2018-10-22Don't check the link type from stubs libs.Jiyong Park
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
2018-10-18Fix instrumentation_for to match LOCAL_INSTRUMENTATION_FORColin Cross
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
2018-10-18Support main_class property in java_binary modulesColin Cross
Add a main_class property that will be used to generate a manifest containing a Main-Class entry. Test: m checkbuild Change-Id: I0a59bb2b93cad915afd82fba708fa0f7eda2fe7a
2018-10-11aidegen: Fix bug of generating module dependency informationpatricktu
Bug: 117588037 Test: cd $android_root;make aidegen;aidegen -m tradefed Change-Id: I05712ef3243771605034e4e9a746b8e1081c3516
2018-10-08Add support for android_app_certificate modulesColin Cross
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
2018-10-08Add support for JNI libraries to android_app modulesColin Cross
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
2018-10-03Make more java modules defaultableColin Cross
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
2018-10-03sdk_version <= 28 implies Java 1.8Jiyong Park
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
2018-09-28soong_zip: Add testsColin Cross
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
2018-09-26TradeFed: Add "test_config_template" flag in Android.bpJack He
* 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
2018-09-19Allow patch_module attribute in target: { android: { ... } } block.Tobias Thierer
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
2018-09-18Collect modules' info to create IDE project file.Brandon Lee
- 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
2018-09-13Allow exclude_java_resources to affect java_resource_dirsColin Cross
Allow excluding files from directory globbed by java_resource_dirs. Test: java_test.go Change-Id: I9922842248be1a386ab111a5187608438638ffb1
2018-09-12Add a new sdk_version "core_platform_current"Neil Fuller
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
2018-09-11Enable Java 9 language support through java_version: "1.9" alone.Tobias Thierer
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
2018-09-04Adapt special case framework support.Mathew Inwood
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
2018-08-30Enforce dependencies have right architectureColin Cross
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
2018-08-29Add jetifier support in Soong.Nan Zhang
This is a blocker for droiddoc targets migration under vendor/. Test: N/A Bug: b/72552006 Change-Id: If85a0917c1ac0d88b9d5b488216a638b4dabd39f
2018-08-29Revert "Add support for renamed kotlin stdlib."Colin Cross
This reverts commit 66c0c4067f8a70847eaa37273671aa8fe4203f1d. Bug: 112674805 Test: m checkbuild Change-Id: I687888136b570f080b57af352af0130355acd216
2018-08-27Put kotlin classes in header jarColin Cross
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
2018-08-17Removed Metalava related checksNan Zhang
Test: m -j checkbuild Bug: b/70351683 b/78245848 Change-Id: Ie26e95081d8d90b626cfb43d017cb2ae500b7b25 Merged-In: Ie26e95081d8d90b626cfb43d017cb2ae500b7b25
2018-08-16Don't pass resources to r8Colin Cross
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
2018-08-16Support patch_module in java modulesColin Cross
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
2018-08-16Make :module provide the output file for java modulesColin Cross
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
2018-08-15Don't link java tests against junit by defaultColin Cross
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
2018-08-14Support data properties in java_test and android_testColin Cross
Files in the data property will be passed to LOCAL_COMPATIBILITY_SUPPORT_FILES in Make. Test: m checkbuild Change-Id: Ifc074317f957aba8f55daa30abc5b9737d1eceac
2018-08-14Move autogenerated test config into SoongColin Cross
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
2018-08-10Enable prebuilt jar installation in frameworkNan Zhang
Test: m -j dokka Bug: 72394196 Change-Id: Ide09dc2fe64ea5db0d771e16d4b9293638b5d65c
2018-08-07Support 'test_config' into soong modulesJulien Desprez
Test: make general-tests Bug: 110982517 Change-Id: Ib2eab2653fdfce6f699b85c9fbc64558b6d40363
2018-07-26Build Java aidl w/ '-b'.Steven Moreland
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
2018-07-24Add private-stub-annotations.jar as core-java libNan Zhang
Since currently android.jar compile against to it. Test: m -j metalava_android_stubs_current Bug: b/78245848 Change-Id: Id5812f69125085821182295e577849b5f2c4bead
2018-07-22Fix `go vet` issuesDan Willemsen
Test: go vet ./... Change-Id: Ifb936ccc5e2b5a2c3fcbbbcb54f680e2973ea1b3
2018-07-17Change classpath for droiddocSundong Ahn
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