summaryrefslogtreecommitdiff
path: root/java/builder.go
AgeCommit message (Collapse)Author
2017-10-18Use soong_javac_wrapper in soong javac compiles Colin Cross
Test: m checkbuild Change-Id: I0f9ff0a719ac550a011c2878fc51595dc3427aed
2017-10-17Initial kotlin support Colin 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 generators Colin 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* functions Colin 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 modules Colin 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-16Refactor errorprone support to reduce duplication Colin Cross
Use a helper function to set up errorprone and javac compiles. Test: m -j checkbuild Test: m -j RUN_ERROR_PRONE=true Change-Id: Icef3a5e1b359487eea3c3306d3d5763dab912b38
2017-10-04Get dex jar resources from classpath jar Colin 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-03Add support for .proto files in java modules Colin Cross
Test: m -j checkbuild Change-Id: Ia03429948baebff85164a91a34507866c97a08ef
2017-09-29Remove jarSpec structure Colin Cross
It's not doing anything anymore, and the next patch will need more complex jar arguments. Just remove it. Test: m -j checkbuild Change-Id: I96d15995e86263ec04fd5c13ab0fd54d8b85c788
2017-09-20Initial device java support Colin Cross
First pass at java support for the device. Adds desugar before dx, and passes javalib.jar to make. Test: m -j checkbuild Change-Id: I3138d943bc4867a52c3fce8fbdb597773793988d
2017-09-20Rearrange manifest file handling in merge_zips and soong_zip Colin Cross
Jar always puts default MANIFEST.MF files in if none was specified. Copying that behavior in soong_zip causes problems with merge_zips, because it ends up taking the default manifest from the classes.jar instead of the user's manifest from res.jar. We don't want the user's manifest in the classes.jar, otherwise a change to the manifest will cause all the class files to rebuild. Instead, move the manifest insertion to the final merge_zips stage. Test: m -j checkbuild Change-Id: Id6376961dbaf743c2fb92843f9bdf2e44b963be0
2017-09-11Add missing space between errorprone flags Colin Cross
A space was missing between flags in the errorprone build rule. Test: m -j RUN_ERROR_PRONE=true checkbuild Change-Id: If6f48a700e6f19e318b6cc9734e1d8fd2289491f
2017-09-05Make javac rules output a jar with soong_zip Colin Cross
Make javac rules output a jar file instead of a classes.list. Combine the output jar, static jar dependencies, and resources into the final jar using a separate rule. For now, use a shell command with unzip and soong_zip to create the final jar, eventually it will be done with a zip2zip-style jar combiner. Bug: 64691570 Test: java_test.go Change-Id: Id8e6313e0097b78947d88e86e47b56ad08caca1a
2017-09-05Move error_prone config to external/error_prone Colin Cross
The error_prone config will likely need to be updated at the same time as the error_prone prebuilts, so move the config into the same project. This requires jumping through some hoops because external/error_prone may not be present in all manifests. Bug: 64489631 Test: m -j RUN_ERROR_PRONE=true Change-Id: I2c59df1148134ffedac0e00d32ac7082a9fb5330
2017-08-28Pass javac flags to errorprone builds Colin Cross
Pass CommonJdkFlags to errorprone builds, which is required for frameworks/base/layoutlib/create to work correctly. Unfortunately, javac and errorprone cannot use the same syntax for the heap size, javac needs -J-Xmx and errorprone needs -Xmx, so split the heap size flag out into a separate variable. Test: m -j RUN_ERROR_PRONE=true javac-check Change-Id: Icd7f8cf627534fb089ec83e462c060572dd2d20c
2017-08-28Add error-prone support Colin Cross
Add support for compiling java sources with the error-prone tool. Test: m -j checkbuild Change-Id: Ieb4ee0e05f8f34a52ed7bcf1c7cbacf1c9c4d0b5
2017-08-14Convert soong java from soong_zip to jar Colin Cross
soong_zip produces jar files that are not compatible with java's ZipInputStream. Switch to jar using ugly sed scripts to munge file lists into the alternating -C and file arguments required by jar. Bug: 64536066 Test: m -j checkbuild Test: build/soong/scripts/jar_args.sh --test Change-Id: Ifcc4bdab25e7d02342720eb246c673ff9a58bddb
2017-08-11Bring java support closer to current version of make Colin Cross
Make the javac arguments match what is used by make, and export them back to make. A future change will switch make to use the the exported ones. This makes a dx.jar compiled with soong have identical class files as one compiled with make. Test: manual Change-Id: Ia5196f1f42bc564e99de22e32e72fd2930e9fbae
2017-08-11Rename java_prebuilt_library to java_import Colin Cross
And make it work like bazel's java_import, using a "jars" property instead of "srcs", and allowing multiple jars to be listed. Test: soong tests Change-Id: Ida2ace6412bd77b4feb423646000a1401004e0ea
2017-07-14Fix incorrect package for variable Colin Cross
java doesn't use a config package for its variables Test: java_test.go Change-Id: I84c396b794d6eef971b1ef174a6f6e529071c452
2017-06-14Add JAVAC_WRAPPER support Yoshisato Yanagisawa
To run javac with AndroidGomaStaticRule, let me make JAVAC_WRAPPER also show up to javac/builder.go. Test: USE_GOMA=true JAVAC_WRAPPER=gomacc m -j32 Bug: b/62334576 Change-Id: I19e1e4315f71d8706800da810b5212f5964171a4
2017-05-10Prettify soong ninja build descriptions Colin Cross
Descriptions currently look like: [ 0% 4/29328] cc out-soong/.intermediates/external/clang/lib/Sema/libclangSema/android_arm_armv7-a-neon_denver_static_core/obj/external/clang/lib/Sema/SemaCodeComplete.o This is not very helpful - most of the characters are used to show the output path, which contains useful information like target architecture, but also contains most of the path to the source files twice, and less useful information like the exact variant name used by soong. Make the descriptions look like: [ 0% 3/29329] //external/clang/lib/Sema:libclangSema clang++ SemaTemplateInstantiate.cpp This is //path/to/module:modulename tool relative/path/to/source/file Test: builds, looks pretty Change-Id: I3087aa7d4eb1860ef6239d77407b8b35445616d7
2016-08-31Enable goma in soong Colin Cross
When the UseGoma flag is set, put all rules except the C compilation rule in an externally defined local_pool, which will have been created by kati. The gomacc wrapper will already be in the CC_WRAPPER environment variable. Bug: 31142427 Change-Id: I699d4edff2e302eee398dad8692ceb14721a628c
2016-08-11Rename soong_jar to soong_zip Dan Willemsen
This is a general purpose tool that happens to contain some jar specific features. Change-Id: I05f4654d4517c245ad7a3c15492e0d2368bbf64f
2016-05-31Start using blueprint_go_binary Dan Willemsen
And install the tools into a more obvious location. soong_env is not moved, since we need it to exist early, so that we can use it in soong.bash in case there's a build failure. Change-Id: I9bd1fa320d84d180b2cf3deb90782d380666f7a6
2016-05-18Rename common to android Colin Cross
Rename the "common" package to "android", because common is too generic. Also removes all android.Android naming stutter. Ran: gomvpkg -from 'android/soong/common' -to 'android/soong/android' gorename -from '"android/soong/android".AndroidModuleContext' -to 'ModuleContext' gorename -from '"android/soong/android".AndroidBaseContext' -to 'BaseContext' gorename -from '"android/soong/android".AndroidModuleBase' -to 'ModuleBase' gorename -from '"android/soong/android".AndroidBottomUpMutatorContext' -to 'BottomUpMutatorContext' gorename -from '"android/soong/android".AndroidTopDownMutatorContext' -to 'TopDownMutatorContext' gorename -from '"android/soong/android".AndroidModule' -to 'Module' Change-Id: I3b23590b8ce7c8a1ea1139411d84a53163288da7
2015-12-09Use `Path` instead of string for file paths Dan Willemsen
This centralizes verification and common operations, like converting the path to a source file to the path for a built object. It also embeds the configuration knowledge into the path, so that we can remove "${SrcDir}/path" from the ninja file. When SrcDir is '.', that leads to paths like './path' instead of just 'path' like make is doing, causing differences in compiled binaries. Change-Id: Ib4e8910a6e867ce1b7b420d927c04f1142a7589e
2015-11-17Use Rule-local implicit dependencies Dan Willemsen
Depends on https://github.com/google/blueprint/pull/78 This uses the new CommandDeps field to move implicit dependencies embedded in the Command string next to the definition, instead of having to specify them in every BuildParam struct. This should make it easier to verify dependencies. Change-Id: I2711b160920e22fa962a436e1f7041272166f50f
2015-08-24Update to new blueprint api for bootstrap.BinDir Dan Willemsen
And regenerate build.ninja.in Change-Id: I35e8b0362799f94b33309d3944b411de5dbcf40a
2015-04-28java: add missing tool dependencies Colin Cross
Add missing dependencies on the jar, aapt, signapk, and zipalign tools. Change-Id: Ib70fdd41daf84c474f72e1219bf3d02931fcefd7
2015-04-27Extract jar files to different directory than compiling Colin Cross
Now that we use extractPrebuilts to extract compiled classes from jars after jarjar, it needs to extract to a different directory than used when compiling. Extract them to extracted/classes. Also move the classes.list and resources.list file out of the classes directory so they don't find themselves and end up in downstream jars. Change-Id: I070323466858edc7e33e14207c98f77d540882f3
2015-04-20java: add one-off build logic for frameworks/base Colin Cross
framework.jar needs to compile against R.java and Manifest.java from framework-res.apk. Rather than complicating the Blueprints properties with values that will only be used once, add one-off logic to collectDeps to extract the rJarSpec out of the framework-res module. Change-Id: I1195b1b5e07badc583703479382ceba35300b8fd
2015-04-13Fix multi-dex builds Colin Cross
Building with --multi-dex requires passing an output directory instead of an output file to dx. Change-Id: I9ffcfe8ff6b96dbdda3eec1076124cd38ae5077f
2015-04-10Miscellaneous fixes for java compiling Colin Cross
Remove java out directory before compiling to avoid incremental compile issues. Move the rspfile out of the out directory so it doesn't get deleted. cc->javac in the javac rule. Don't call javac if there are no source files. Change-Id: I0bb06c214da54a587bd9e7c9d17caaf0ed1e595e
2015-04-08Add aidl file support to java builds Colin Cross
Add support for aidl files listed in srcs for java builds, and an aidl_preprocess module type for framework and sdk aidls. Change-Id: I3aa537f4483822e5b534c74d0b35f13a938f8947
2015-04-08Move config into common and provide helper Colin Cross
Using ctx.Config().(Config) everywhere is a mouthful, and it is inefficient to do the type assertion. Put the Config interface into the context, and provide an AConfig() to return the Config already converted to the right type. Change-Id: I301a1fd7d2a005580aabca7866a37c5d42ad8c69
2015-04-08Add jarjar support Colin Cross
If jarjar_rules is set, pass the compiled jar through jarjar to produce a new intermediate jar. Change-Id: Ied596433fd5c49d05f07c04245f3abe8b9aadc5e
2015-04-03Add support for using prebuilt libraries as static dependencies Colin Cross
Extract files out of prebuilt libraries and create list files for classes and resources in order to allow including them in other jars. Change-Id: I9269d1fd6e0f570811a00bf319098ac1f7cdc816
2015-04-03Support java libraries, binaries, and prebuilts Colin Cross
Add support for compiling java libraries (.jar files with or without .dex), java binaries (.jar files with a wrapper script to run them), and java prebuilts (for the SDK .jars) Change-Id: Id624da64c92cf20c6d9577c6bb06e5b212af0d1b