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
In Soong, a Config() method will always return a Config. Make
ModuleContext, SingletonContext, TopDownMutatorContext and
BottomUpMutatorContext's Config() methods explictly return
a Config to avoid having to type-assert everywhere. Overriding
the Config method requires duplicating the list of methods in
blueprint.BaseModuleContext and blueprint.BottomUpMutatorContext,
following the same pattern used by the other *Contexts.
Config() obsoletes the AConfig() method used in some places, which
will be cleaned up in the next patch.
Test: m checkbuild
Change-Id: Ibe21efde933959811d52443496967ab8ce71215e
Fix some ninja variable issues in the aapt2 rules. These were
caught by app_test.go, but that wasn't being run automatically,
so add it to testSrcs.
Test: app_test.go
Change-Id: Ia01dda45ba5ced9c304056939c0e69f170c15de3
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
Wrap blueprint.PackageContext so that the *Func methods can provide
an android.Config instead of an interface{}. The modified signatures
means that every method in ModuleContext and SingletonContext
that takes a blueprint.PackageContext now needs to be wrapped to
take an android.PackageContext.
SingletonContext wasn't previously wrapped at all, but as long
as it is, wrap everything like ModuleContext does. This requires
updating every Singleton to use the android-specific methods.
Test: builds, all Soong tests pass
Change-Id: I4f22085ebca7def6c5cde49e8210b59d994ba625
Move the java test resources from res to java-res to avoid confusion
with Android app resources that are implicitly expected in res.
Also allow tests to provide extra files.
Test: java_test.go
Change-Id: I13349a21da5c6d449cd23947c2628efbed3eb230
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
dex_preopt defaults to true, only pass LOCAL_DEX_PREOPT := false
if dex_preopt is explcitly set to false.
Test: m, examine framework.jar
Change-Id: Ica6ce06d14bbc720da9c5b26559b9768a8a7f5a8
AOSP's current version of kotlinc only supports -jvm-target
1.8 or 1.6. Previously, we were passing the javaVersion
(the value passed to javac -target) but that would fail if
javaVersion was eg. 1.9.
This CL changes the kotlinc invocation to always pass
-jvm-target 1.8, regardless of javaVersion.
Bug: 69160377
Test: Treehugger
Change-Id: Ib12a8c2afbe908319513861a5380e70bf09d0be0
Assume logtags files will have hardcoded tag numbers and don't
build against the merged file. Simplifies the build when
logtags files are split across Make and Soong.
Test: m checkbuild
Change-Id: I1e995ec458690fcadb1b86d64864f277aa9fe3af
Export extract-srcjars.sh to Make so that it can be used to add
srcjar support to droiddoc rules.
Test: m checkbuild
Change-Id: I203ba6dad731ec9167eb8706bbfb345a484f024b
javastream proto is rarely used and tricky to support directly
in java because it depends on an extra host tool. It can be
supported with a genrule, so just remove the partial built-in
support.
Test: m checkbuild
Change-Id: Iffe75e7040cb889ca17fdd85ef3e8e64fc3aa9e9
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
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
Compute the common proto flags and pass them to the protoc invocation
when generating java files.
Test: m checkbuild
Change-Id: I0d4c23ad001d01eab03b404545383f009214106d
This way config.mk no longer needs to check which java is in PATH and
fix it. It'll be consistent for all build steps under soong_ui.
Also unify handling of ANDROID_JAVA_HOME / JAVA_HOME with
OVERRIDE_ANDROID_JAVA_HOME / EXPERIMENTAL_USE_OPENJDK9.
Test: m nothing
Test: build/soong/soong_ui.bash --make-mode nothing (w/o envsetup.sh)
Test: aosp_arm ninja files are the same before/after
Test: before/after ninja files match with OVERRIDE_ANDROID_JAVA_HOME
Test: before/after ninja files match with EXPERIMENTAL_USE_OPENJDK9
Change-Id: Icdb65093d9c346524074de239a4f895e4230a24d
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
Also adapt to the renaming of d8 to d8-compat-dx.
Test: USE_D8=true m -j16 PRODUCT-aosp_arm64-eng showcommands core-oj
Change-Id: Ic7aaa6a5da34a6a5706c20f53922a83cb1de1100
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
The min-sdk-version issue is solved.
Same goes for the ART layout gtests failure found on the art host bots.
Bug: 67569208
Test: m checkbuild / tests
Change-Id: I88c7f5e9ea5c5c5d1b13404ba5db1479f9f7f2f7
kotlinc expects -classpath, not --classpath.
Also add a test that uses only .kt files to exercise the code when
there are no java sources.
Test: java_test.go
Change-Id: Ifa5a007b460b40ea2188d0907570fbdca6c48da7
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
OpenJDK9 system modules are not build modules, which means they
can't be built with m core-system-modules. Add a phony target.
Test: m core-system-modules
Change-Id: If6d512ff7a009b49743fb25cbb566935ec1c0153
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
Also adds checks that the dependencies are android.Modules and
are not disabled.
Test: m checkbuild
Change-Id: I05e945f38915d49cd3c0ab72a86576949bc7eff2
Now that android.ModuleContext does not include blueprint.ModuleContext
we can rename android.ModuleContext.ModuleBuild to
android.ModuleContext.Build without colliding with
blueprint.ModuleContext.Build. Leave ModuleBuild as a wrapper around
Build for now to avoid having to update all the users outside
build/soong simultaneously.
Test: m checkbuild
Change-Id: I18eb8cc04faf002049a11d9aac97e9732ff5d638
The source for dx may not be available in PDK builds, use the
prebuilt one from prebuilts/build-tools instead.
Bug: 67663308
Test: m TARGET_BUILD_PDK=true
Change-Id: I9090b5190539f901fc05264a472133c12d4ea2a1
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
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
Ninja doesn't support depfiles on a rule with multiple outputs.
Use a single output and put all the rest as implicit outputs.
Bug: 68057449
Test: java_test.go
Change-Id: Ia544493b1b3b51b185c865149d8f3e0eb3c57ee2
The android_*stubs_current modules don't yet exist, so fall back to
the prebuilt jars for now.
Test: m checkbuild
Change-Id: Iabd32b30954b3f4a6d9a779fde52a032b684807e
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
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
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
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