summaryrefslogtreecommitdiff
path: root/java/java.go
AgeCommit message (Collapse)Author
2018-01-04Add EMMA_INSTRUMENT_STATIC supportColin Cross
Add jacocoagent when instrumenting with EMMA_INSTRUMENT_STATIC. Test: m EMMA_INSTRUMENT=true EMMA_INSTRUMENT_STATIC=true Change-Id: I451bb9d16b7f0a66fd06c2da576062b28830e470
2018-01-03Fix jacoco_cli invocationColin Cross
jacoco_cli --dest takes a directory, not a jar name, and assumes an output file with the same name as the input jar in that directory. Rename jacoco-report-classes.jar to jacoco-report-classes/modulename.jar, and generate to jacoco/tmp/modulename.jar before combining to the final output file at jacoco/modulename.jar. Bug: 69669951 Test: m EMMA_INSTRUMENT=true Change-Id: Ia7dd881d2819ae09dfb60a00b4c1b8396629cd9a
2018-01-03Add R8 supportColin Cross
Add support for R8 to optimize apps and java libraries. Test: m checkbuild Change-Id: I2afd5d7a84912d3ab613c32c599bd1ebe60562e0
2018-01-02Refactor dexingColin Cross
Move dexing support into java/dex.go, including the rules and logic from builder.go and the function from java.go. Test: no change to build.ninja Change-Id: I098d2a9774e28079ba44791679a0db6f876fe3e6
2018-01-02Move jacoco before desugarColin Cross
R8 will replace desugar+proguard+dx, which will mean jacoco has to run before desugar. In preparation, move jacoco before desugar now. Test: m EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true SKIP_BOOT_JARS_CHECK=true WITH_DEXPREOPT=false tests Change-Id: I5d98d2300ce83496f9b82c9b973f679701448474
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-21Strip module-info.class files when combining jarsColin Cross
Combining static jars from dependencies may bring in module-info.class files, which don't make sense once multiple modules have been combined, and sometimes confuse downstream tools like desugar. Strip them out like make does when combining jars. Test: m checkbuild Change-Id: I560c5acfcc6e1be9adf604c22cf200581f92f702
2017-12-21Remove --no-locals -> --release translationColin Cross
--no-locals is never used any more, remove the translation. Bug: 70886092 Test: m checkbuild Change-Id: Ie89aaad618c12c288d7e7bca863834cf7ee824fb
2017-12-21Add jacoco filter testsColin Cross
Add tests for converting jacoco filters to command line arguments to soong_zip. Bug: 64836607 Test: jacoco_test.go Change-Id: I969fa877e4be19bb92dcab5a796a4e4ec3fc166a
2017-12-18Prep D8 default instead of CompatDX in build/soongAlan Leung
Bug: 69329508 Test: m checkbuild tests Change-Id: Ibaa2d787c644cf25104af78305a6eed16028dcf0
2017-12-15Support output params in java protoColin Cross
Allow java modules using proto to specify output params to be passed to the proto generator. Test: m checkbuild Change-Id: I8a06f07218073236f4f85996ea5f09fb3702ed1a
2017-12-11Allow java manifest property to reference filegroupsColin Cross
Also factor out ExtractSourceDep and ExpandSource. Test: m checkbuild Change-Id: Ibc253514bc3109d84ec388a05c66b8108af5d6ab
2017-12-11Add USE_D8_DESUGAR option in build/soongAlan Leung
Add an option to use D8's desugar instead of the standalone version. USE_D8_DESUGAR=true m would trigger DCHECK in dex2oat unless https://android-review.googlesource.com/c/platform/art/+/562595 is patched in as well. Bug: 69329508 Test: m && USE_D8_DESUGAR=false m Change-Id: I864d88e257a2ba0b7f19aa5cced537301950e963
2017-12-11Allow java binary wrapper files to reference filegroupsColin Cross
Also allow commands with no tools for the case when standard shell utilities are used to munge an input file. Test: m checkbuild Change-Id: Ie061e90cafe1a0a0db004a89e9a17fb48709cb03
2017-12-06Add more dex_preopt propertiesColin Cross
Move dex_preopt to dex_preopt.enabled, and add dex_preopt.app_image, dex_preopt.profile_guided, and dex_preopt.profile. These values will be passed back to Make if provided to control dex preopting. Test: m checkbuild Change-Id: I54a4b1de697a08be20ab65d2a5dc43ce0046692d
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-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-30Replace ModuleContext.AConfig() with Config()Colin Cross
AConfig() now duplicates Config(). Replace the uses of AConfig() with Config(). Leave AConfig() for now until code in other projects is cleaned up. Test: m checkbuild Change-Id: Ic88be643049d21dba45dbd1a65588ed94bf43bdc
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-22Add Jacoco supportColin Cross
Add support for instrumenting jars with jacoco. Unlike in Make, Jacoco in Soong is done entirely using jars. Instrumentation is enabled by EMMA_INSTRUMENT=true, and affects all apps. If EMMA_INSTRUMENT_FRAMEWORK=true then it also affects any java libraries listed in InstrumentFrameworkModules. Bug: 69629238 Test: m EMMA_INSTRUMENT=true EMMA_INSTRUMENT_FRAMEWORK=true SKIP_BOOT_JARS_CHECK=true WITH_DEXPREOPT=false Change-Id: If699715b277529cd7322ffca67c23b0746e1cccd
2017-11-17Add support for .srcjar files from genrules and srcsColin Cross
Allow srcs to contain .srcjar files, which will be extracted just before javac. Also allow genrules and generated sources to directly return .srcjar files. Test: m checkbuild Change-Id: Ie4cf60ecb9d2ec63a4c2275221544203b1383597
2017-11-17Fix java AIDL properties to match C/C++Colin Cross
The C/C++ aidl properties use: aidl: { local_include_dirs: [], include_dirs: [], } But the Android.bp file was expecting: aidl_include_dirs: [], export_aidl_include_dirs: [], Update java AIDL support to match the C support, which is also what the androidmk conversion tool is creating. Test: m checkbuild Change-Id: I3df763d0b203b1b6556798a21b0553e7d35ad7d5
2017-11-08Change bool, and string properties to *bool, and *string for java,Nan Zhang
python, and genrule. Test: m -j checkbuild Bug: b/68853585 Change-Id: Ic9a8083818e920dc399a4b00841e2aa496f70faa
2017-11-06Support Javac sharding in Soong.Nan Zhang
Test: m clean && m -j java and java_test.go Change-Id: I110a0ff029448d3319aed2788d25d90a6c1a7fa0
2017-11-03Add default jar wrapper when wrapper property is not specifiedNan Zhang
Bug: b/68779881 Test: manually copied the jar-wrapper.sh to out/soong/host/linux-x86/framework Change-Id: Idee1e7e64c6e3c89c89a8cd9c107a38533356b6c
2017-11-01Propagate PRODUCT_MINIMIZE_JAVA_DEBUG_INFO to soong and use itColin Cross
Strip debug info in javac when PRODUCT_MINIMIZE_JAVA_DEBUG_INFO is set. Test: m with PRODUCT_MINIMIZE_JAVA_DEBUG_INFO=true Change-Id: I167e742662801291c516bf1ff826486560d22147
2017-10-27Allow java_host_binary to be used with genrule.Alex Light
This is done by implementing the HostToolPath interface for java Binary objects. Currently, in order for a java_binary_host to be used in this way the java_host_binary must include: compile_multilib: "first" Otherwise the genrule is unable to find the correct variant. Test: ./build_test.bash Test: Manual Bug: 68397812 Change-Id: I6849488dc13fa8c383df69d00f62ad815ec17876
2017-10-26Fix source jarsColin Cross
Source jars were not working as designed because javac will only compile files from the -sourcepath if there are references to them starting from files on the command line. Switch to extracting the source jars into a directory and passing a list of the files to javac. Test: m checkbuild Change-Id: I9f7d824f8538d081b2f5ad64ae3cbfd0e96213af
2017-10-24Don't panic in turbine with no classesColin Cross
ALLOW_MISSING_DEPENDENCIES=true can cause missing dependencies to be hidden from GenerateAndroidBuildActions, which is triggering the len(jars) == 0 check in compileJavaHeader. For the ALLOW_MISSING_DEPENDENCIES=true case the check is unnecessary, as the build rules will be replaced with runtime errors. On the off chance the check would have been hit in a real build, allow merge_zips to create an empty zip file if it is asked to. Test: m ALLOW_MISSING_DEPENDENCIES=true Change-Id: I3171f921d51229ddf38a1a647d32566658c673fa
2017-10-24Convert Visit*Deps from blueprint.Module to android.ModuleColin Cross
Also adds checks that the dependencies are android.Modules and are not disabled. Test: m checkbuild Change-Id: I05e945f38915d49cd3c0ab72a86576949bc7eff2
2017-10-23Fail when a module depends on a disabled moduleColin Cross
Copy the logic from cc.go to fail when a module depends on a disabled module. A future change will refactor this to remove the duplication and cover all other module types. Test: m TARGET_BUILD_PDK=true doesn't panic Bug: 67663308 Change-Id: Iab2b142cebdbd74df934e4733f0de83bd3334d86
2017-10-21Fix finding src directory for aidlColin Cross
aidlFlags was always looking for a src directory at the top level instead of in the module's source directory. Test: m checkbuild Change-Id: Ie31baa21c8632c2bd9a6ebc42e6291417b1f31cd
2017-10-20Support installable prebuilt jarsColin Cross
Some host modules need to be installed. Add an installable property. Test: m checkbuild Change-Id: Ifd023213ff66e81aa77ba1741c75837a1dd88d1d
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-20Add sdk_version property to imported jarsColin Cross
Test: m checkbuild Change-Id: I83dd6ad157c7a5918747ce8c9be05c1e1e22d710
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-19Add property to prevent dex preoptingColin Cross
Add dex_preopt property and pass it through to make as LOCAL_DEX_PREOPT. Test: m checkbuild Change-Id: I6f19d097d1769068b7e4093f011574c540c137f3
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-17Allow jarjar_rules to be arch-specificColin Cross
Modules may need to use jarjar on the device to move classes into the android namespace, but not on the host. Test: m checkbuild Change-Id: I910ebbe20e45e98edecca0d7c4fb18e806bc3c6c
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-16Use jars containg sources for java generatorsColin Cross
srcFileLists was an ill-fated attempt to deal with generators that produce a set of java sources that is not known ahead of time. For example, the list of files produced by protoc depends on the package statement in the .proto file. srcFileLists put the list of generated files into a file, which was then passed to javac using the @file syntax. This worked, but it was too easy to cause missing dependencies, and will not work well in a future distributed build environment. Switch to putting generated sources into a jar, and then pass them jar to javac using -sourcepath. Test: m checkbuild Change-Id: Iaab7a588a6c1239f7bf46e4f1b102b3ef517619b
2017-10-16Pass output file names into java.Transform* functionsColin Cross
Pass the output file name into the java.Transform* functions. This consistently puts control of the filename into java.go, which is often necessary to avoid collisions when the same rule is used multiple times in a single module. It also has the side-effect of removing the poorly named "stem" parameters. Test: java_test.go Change-Id: I7bc1d1f3bfae6f9d2c92870e6df381817817aab4
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-10Add hostdex supportColin Cross
If hostdex: true is specified for a java library, create an extra Make module that copies the dex jar to a module with a -hostdex suffix in the host output directory. Bug: 67600882 Test: m -j checkbuild Change-Id: I859dfaabeefdca714b566de94e00f74e03c85939
2017-10-09Fix doubled generated source filesColin Cross
Generated source files were being included twice, once manually and once by ctx.ExpandSources. Remove the manual one. Bug: 67364649 Test: TestGeneratedSources in later patch Change-Id: Ia6760b01a34a96767a914bdcb911a39fa6683300
2017-10-04Honor resource exclusions in java_resources propertiesColin Cross
Honor the default resource exclusions in java_resources properties including *.java. Test: m -j checkbuild Change-Id: Ia117a000680161b54c189758926ddb2068a2a2c3
2017-10-04Get dex jar resources from classpath jarColin Cross
Dex jars were getting their resources from the res.jar files of their transitive static dependencies. This accidentally bypassed jarjar on resources, since the jarjar pass only happened once the resources jar was combined into the classpath jar. Switch to getting the resources out of the classpath jar by merging it with the dex jar while skipping *.class. Test: m -j checkbuild Test: compare ext.jar to one generated by make Change-Id: I5f6f3da738dcb0af56ab9a1bd7174ed5359de2b2
2017-10-04Allow libraries with no sources to be installedColin Cross
Libraries with no source files but static lib dependencies should still be installable. Test: m -j checkbuild Change-Id: Ibc91aa3153241092ce86888dbf90e99b66069ff2