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
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
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
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
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
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
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
java_resource_dirs was using a file list file that was generated
at ninja time to get the list of files to include, which meant
there were no dependencies on the files to cause res.jar to get
rebuilt. Switch to using a glob at soong time instead. This
is substantially similar to a glob in java_resources, except that
java_resource_dirs strips the listed directories off the paths
that end up in the jar.
Test: TestResources in java_test.go
Change-Id: I4b9b38f7b6b38a013cbb4e211187e7282a6795c0
Honor the default resource exclusions in java_resources properties
including *.java.
Test: m -j checkbuild
Change-Id: Ia117a000680161b54c189758926ddb2068a2a2c3
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
Libraries with no source files but static lib dependencies should
still be installable.
Test: m -j checkbuild
Change-Id: Ibc91aa3153241092ce86888dbf90e99b66069ff2
The partial hostdex support was causing the host variant of
java_library modules to depend on core-oj and core-libart,
which caused the tagsoup jar to use the wrong
java.lang.System.arraycopy signature. Remove the hostdex
code that was causing the problem, and add a test.
Test: java_test.go
Change-Id: I4f7b1f29c99aae328ba19b042538d9d35544aa43
Unbundled builds might not have the prebuilt/sdk files, allow
the build to continue and then fail if the module is actually
built.
Test: m -j checkbuild
Change-Id: I21163778f1cc50945c7a12e57da0e39ba963aa7c
Arch specific properties were not being applied to modules
with OS set to Common.
Test: java_test.go
Change-Id: I8f1b49ca51b0cf96f78006dfcd121672e581d9c5
Using a glob as a path failed the existence check. Append the
glob after converting the path to a string.
Test: TestExcludeResources in java_test.go
Change-Id: Ic1fd40aa283f3b0d59c1c589dbeec411583eddf1
Add a no_framework_libs property similar to no_standard_libs.
The new property will allow modules to continue to link against
the standard bootclasspath libraries that contain java.*, but
not against the framework libraries. This avoids having to
specify the bootclasspath libraries explicitly.
Test: m -j checkbuild
Change-Id: I0be13a45cadca9b90a0fd1797885cd18c5b462e3
The apps build depends modules that have empty sdk_version. Let the
behavior match make for now.
Test: m -j TARGET_BUILD_APPS=Gallery2
Change-Id: Ie5545d2cd6b1268b0b3392dc0af2e4eb3d38a588
Add a properties to allow including files as resources, including
support for filegroups. Also add a flag that causes module sources
to be included in the final jar.
Test: java_test.go TestResources
Change-Id: Ida8ee59b28df9fe66952170f46470d3a09fd5d65
Follow the make change in I87aee34940937dbde33a977f55d1faf2c8054561
to use classes before desugar in the classpath.
Test: java_test.go
Change-Id: I1054f4aea1eb349b6f687e1af0adb92a944fd8c5
Don't waste time running dx on libraries that will never end up
on the device.
Test: m -j checkbuild
Change-Id: Iad1750823d3261cd6ad6eb6aa00c74d45b9737a3
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
The resources jar and the combined jar are not always used, so
add the errorprone dependency to the compiled jar.
Test: m -j checkbuild
Change-Id: Iaa10a04347758c676bb704969b86f9442e6c3175
For consistency with make, rename java resources to
java_resource_dirs and android resources to resource_dirs.
Test: m -j checkbuild
Change-Id: Ie9aac50fef40f6a9093b4b98759e79cd086bb797
Hostdex support isn't working yet, and we are accidentally producing
a dex jar for host modules, which confuses soong_java_prebuilt.mk.
Test: m -j checkbuild
Change-Id: Ie2c331fa697f49dab23c380a5c6e0490d67c9f74
Forcing sdk modules to be declared explicitly is unnecessary, just
add the required dependencies on the jar and aidl files.
Test: java_test.go
Change-Id: Ib28bdc1051c5825e7c0efb6adff1f9282675560e
Fix the java module sdk tests, and expand them to cover testing
all classpaths including for the host.
Test: java_test.go
Change-Id: I71be13cc5545f5c4d5b377c4c8de3dccbb09abf9
Java tests will need to test code inside if ctx.Device() blocks,
switch to using TestArchConfig and NewTestArchContext.
Disable TestSdk for now, just registering modules that depend
on the SDK triggers panics because of previously untested code
that is now executed.
Test: java_test.go
Change-Id: Iff2c814af56cc830327db8d951c4350034c00361
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
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
Turbine leaves out bridges which can cause javac to unnecessarily insert
them into subclasses. Setting this flag causes our custom javac to
assume that the missing bridges will exist at runtime and not recreate
them in subclasses. If a different javac is used the flag will be
ignored and extra bridges will be inserted, which should be harmless.
The flag is implemented by https://android-review.googlesource.com/c/486427
Test: m -j checkbuild
Test: check core-libart for extra methods
Bug: 65645120
Change-Id: I6e2babe4a5a24cda4903845ae895c369343ec55b
So that we don't get confused when using :<module> in srcs to depend on
a module that could also be a HostBinTool.
Test: m -j
Change-Id: Ia3b1c26826e70f84c6dc5ff78c95dd11d76901b6
A space was missing between flags in the errorprone build rule.
Test: m -j RUN_ERROR_PRONE=true checkbuild
Change-Id: If6f48a700e6f19e318b6cc9734e1d8fd2289491f
Strip module-related javac 9 command line arguments that don't apply
to javac 8.
Test: m -j checkbuild
Change-Id: If44a3d9d7227e923117dc75bbabbddb41026b25d
Trying to use dx.jar for the jar module name and dx for the
wrapper module name leads to the make side installing dx.jar.jar.
The separate names are only needed to make LOCAL_REQUIRED_MODULES
work. Make the names the same again, and use a manual dependency
from the installed location of the wrapper script to the installed
location of the jar to make sure that both get installed and that
the wrapper script timestamp is always as new as the jar.
Test: m -j checkbuild
Change-Id: Ibc8ce9d24ed770e9a270fb8eaa8fe1b427a382a7
Instead of trying to squeeze soong jars through prebuilt_internal.mk,
make a separate soong_java_prebuilt.mk.
Test: m -j checkbuild
Change-Id: Idadef3c21a6f618d573110f04c80d7db3db92031
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
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
Some java libraries will never be installed, support an
installable: false property and export it back to make as
LOCAL_UNINSTALLABLE_MODULE := true.
Test: m -j checkbuild, manually inspect out/soong/Android*.mk
Change-Id: I825ec897648c82fb7323da7df3539c9aaa6bcfce
Also clear the bootclasspath for device builds so javac doesn't
fall back to the default rt.jar bootclasspath.
Test: java_test.go
Change-Id: Ia21f55c7d45db560e2f44be81b2f46587d9026f2
Pass the sdk_version property, the platform sdk version, or 10000
to dx as --min-sdk-version.
Test: m -j checkbuild
Change-Id: I5fae03f44153dc2d6244c33f4c055e746980aefe
For consistency with libs and static_libs. And make it a *bool
so that it can be overriden when used in java_defaults modules.
Test: java_test.go
Change-Id: If0eaf5d5571dc6e565056d273b0addd960d6b33f
Split InstallFileName into InstallExecutable that does chmod +x
after copying the file. Also remove InstallFile and rename
InstallFileName to InstallFile.
Test: m -j checkbuild
Change-Id: Id41ad4eafe521f6cd5d8cc250b7747ecb3da8dfc
jlink and jmod are new commands added in OpenJDK 9.
The new commands are exported only when the environment
variable EXPERIMENTAL_USE_OPENJDK9 is set to true.
Control of toolchain commands moved to soong in commit
2aad9c2882
Bug: 38177569
Test: Treehugger
Change-Id: I52d81b95357162e31a2017080b27ef076a470b14
Export TARGET_JAVAC and HOST_JAVAC to make. This moves control
of the javac command line flags into soong.
Test: m -j checkbuild
Merged-In: Ifa3e35be0abd2778741680216427403ba58a0a3b
Change-Id: Ifa3e35be0abd2778741680216427403ba58a0a3b
(cherry picked from commit 2478d8b885)
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
Export jar-args.sh in JAR_ARGS so that make doesn't have to
duplicate the sed scripts.
Test: m -j checkbuild
Bug: 64634025
Change-Id: Ia5d0a303f23b32b8ff672fc882d51d5e99316ffa
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
Convert java_binary modules into two make modules, one for the
underlying java_library and one for the wrapper prebuilt.
Test: m -j checkbuild
Change-Id: I5ddf74f24f1e41fc1f39b3e8d254b7e191dbd47a
It's never anything except nil, and it unnecessarily complicates
the implementations.
Test: m -j checkbuild
Change-Id: I3e3b7251f32ffa84dbdfd0448faf248c306ca808
It's never anything except nil, and it unnecessarily complicates
the implementations.
Test: m -j checkbuild
Change-Id: I8a117a86aa39aeb07d9d8d0686ef869c52784f19
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
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
The java prebuilt tests weren't registering the prebuilts mutators,
which hid an issue where prebuilts modules weren't getting renamed
to avoid collisions with source modules of the same name, which
ended up causing the prebuilt module to try to add a dependency
on itself.
Test: java_test.go
Change-Id: I3327d27533591cb08a4b8b8b5e1668a6f72be8df
Prefixing names in the java package with "java" is redundant, inside
the java package it is clear that they refer to something java
related, and outside the package they will be referred to with a
java. prefix.
Test: java_test.go
Change-Id: I9eb8eecb7ac5f6fbf8e87f5c219b3f50dbd18c87
Java modules have been unused for a few years, add a few very basic
tests to exercise the modules as they are brought up to date.
Test: java_test.go
Change-Id: Ib23fc065674a61308333130ff1a992525b92e705
Converting java to use Path objects incorrectly used PathForModuleSrc
for a path that might not exist, use ExistentPathForSource instead.
Test: java_test.go
Change-Id: I50e4e315a10ab08c4e72065094ae29844874f5e4
Change module factories from returning a blueprint.Module and a list
of property structs to returning an android.Module, which holds the
list of property structs.
Test: build.ninja identical except for Factory: comment lines
Change-Id: Ica1d823f009db812c518f271a386fbff39c9766f
Add a java/config package to hold config information, and share
it with make through makevars.
Test: builds
Change-Id: I46c088bda0fe97a1823bfdd80fa692d0bf61da1b
Remove inheritance implemented with the bad "superclass calls
subclass through interface" pattern, and replace it with composition.
Test: builds
Change-Id: If323f89360455b3f98b40777edaaaa265bb3b5fc
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
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
Move Soong's globbing-with-dependencies support into Blueprint so it can
be used for subdirs= lines in Android.bp files.
Blueprint has a slight change in behavior around subname= lines, it now
always uses the subname and doesn't fall back to Blueprints. To support
the Blueprints files in build/blueprint, use them directly with build=.
Test: build, add source file that matches glob, rebuild
Change-Id: Ifd0b0d3bc061aae0a16d6c7ca9a1cd8672656b4d
We were emulating this for proto files, standardize it and make the
other generators use it as well.
Test: Compare out/soong/build.ninja before/after change
Test: mmma -j system/tools/hidl
Change-Id: I1888c7b981749060a398387bbb9b481270bf6d75
Register mutators inside lambdas that are called in a defined order to
correctly order mutators before and after the arch and deps mutators.
Test: build.ninja identical
Change-Id: Iefe2a3515aee8570e76a6e76925db4cda0e9e822
Mutator registration is tightly coupled with the android package, move
all registration from the soong package to the android package.
Test: build.ninja identical
Change-Id: Ie183d0b52cc7431c9e05b231934d189208ef1efe
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
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
Blueprint now requres DependencyTags to be passed to AddDependency
calls. Use the tags to avoid setting member variables on modules, which
will be lost after the mutators have been called.
Change-Id: I8c1d9ed1db85a300e14394b911a516d361ba9f75
Now, instead of combining multiple binaries into a single BUILD_PREBUILT
definition, use separate instances for every module variant. This fixes
HOST vs HOST_CROSS prebuilts, and should be saner overall. From make,
these should look the same, we're only just using one instance of
prebuilt_internal per BUILD_PREBUILT call instead of multiple.
With that simplification, we don't have to store as much state, and can
directly write into the buffer.
Also switch from io.WriteString to fmt.Fprintln, which will require
fewer explicit string concatentations, and we don't need to worry about
newlines.
Allow the module-provided functions to return errors.
Change-Id: If30453b21fa21387f635626618d8fabfc78e6859
Explicitly allow installation into the data partition instead of using
"../data" for tests. At the same time, pipe through the information
required for vendor modules.
Change-Id: I6baf9d828c285e1080e43074beef8aebdbb38875
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
This changes the build system to no longer run zipalign when signapk
is also run. Running zipalign is no longer needed because signapk
takes care of alignment.
Bug: 25794543
Change-Id: I7bb43421c993bf32f09b0acce2a652376378964f
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
EarlyMutators are identical to BottomUpMutators, except they run before
DynamicDependencies. DynamicDependencies can be replaced with a
BottomUpMutator. Replace both EarlyMutators and DynamicDependencies
with BottomUpMutators, which allows setting the order between all
mutators through registration order.
Change-Id: Id1305d798d3d2da592061c89d7c10a71780b71a3
The source path was being appended to the module out directory
to create the file list file, which was resulting in .. in the
source path moving the file list file up the directory tree.
Use SrcDirRelPath to convert the globbed resource directories
to be relatiave to $srcDir before appending them.
Also do the same fix to generated aidl, logtags, yacc, and lex
files.
Change-Id: I2e636bd30abf03bc1d80a897951a9812cc3e09ef
If resources and java files were compiled from the same directory,
ctx.Glob could try to create a glob file that had the same name
as the directory containing another glob file. Namespace each
call to ctx.Glob so they never conflict.
Change-Id: I4db73af568a2ff2e708e9db64798073b1ed2ff61
Instead of putting all the blueprint registrations in soong_build,
put them all in init() functions. This puts the registration next
to the implementation.
Change-Id: Ide1a749518f5e9d1367a18ab3bb1d91da3310c76
To align with the current make build system, add exclude_srcs and
exclude_java_resource_dirs. These replace the functionality of
arch_subtract and glob exclusions that use "-file" to exclude a file.
Change-Id: I91c23d5e3c9409f2d9f7921f950153a03a68ad61
Improve the comments associated with properties to work better with
Blueprint's auto-documenting feature.
Make all properties structs into named types so that thet types can be
found using reflection and cross-referenced to the source code to
auto-extract docs.
Remove the leading <property>: text from properties, the documentation
will include the lowercased name of the property.
Add filter tags to the nested arch properties.
Change-Id: I4ef5db86358886fe61456c24eb2dbe6f7b876115
Make common.Glob take an interface that is the intersection of
blueprint.ModuleContext and blueprint.SingletonContext used by
Glob and GlobRule, allowing it to be called on either. Also
move ExpandSources and Glob into AndroidModuleContext.
Change-Id: I8d1a3160c5dd201033afdb37210e82d8065b137d
Various build rule changes to match AOSP:
Add libunwind_llvm and libdl as dependencies for libc++ on device
Always add libcompiler_rt-extras as a dependency
Add libm, libc, and libdl as depnendencies for libc++ static binaries
Disable some clang warnings, and add some clang filtered cflags
Add -fstack-protector to host linux builds
Add jack_flags property to java modules (currently ignored)
Change-Id: Ic0da617bdeaf25f58cb8298dd9ea91b7d6509151
Handle java resource globbing in two passes, the first on the
list of resource dirs to produce a list of directories, and the
second to glob for files inside those directories using **/*.
Fixes incorrect jarSpec dir errors when the resource directories
list contains globs.
Change-Id: Icea5d8178336eb7de4ad91a9acba4822423d9f60
Delete package-export.apk before rebuilding to avoid aapt warnings
about using -f on existing packages.
Change-Id: I189486c4b3bd5fa46eff2e3b6a244d28329e7f02
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
Add support for running aapt to generate R.java and Manifest.java,
compiling java into jar, adding resources to the jar to convert it
into an apk, signing the apk, and zipaligning the apk.
Change-Id: I7a73fef590d07f35b3d0b56a8571780c09bb10ae
Store the jar output file for the app build to use.
Allow module types built on top of javaBase to provide filelist files
containing source files.
Allow module types built on top of javaBase to insert dependencies through
JavaDynamicDependencies.
Allow any java module to depend on framework-res.apk.
Move the install rule from javaBase to JavaLibrary.
Change-Id: I46e7e80139845ef7cc89daf180bddbdf77125555
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
Java vs. Android resource directories are already confusing enough,
rename resource_dirs to java_resource_dirs to make room for
android_resource_dirs.
Change-Id: Iffd087860b98df29e81d8d2f823be87c8227e614
aidlFlags gets specified for every aidl file. Use a module scoped
ninja variable to hold the aidl flags, and while we're at it do the
same for javacFlags.
Change-Id: I980f0006c41918154ab0479d56387630a7e1d677
SDK prebuilts need to be treated differently than other prebuilts.
They are used like a normal Java prebuilts when compiling java files,
but they are also used as aapt includes when compiling apps, and they
provide prebuilt aidl files when compiling aidl sources. Create a
new module type so dependers can determine what kind of dependency
they are.
Change-Id: If426da63cfadcb4b14abda58c7b346554912a07a
Add support for converting logtags files to source files. Each
.logtags file is converted to a .java file, but only after all
.logtags files have been combined into a merged text file by
the logtagsSingleton.
Change-Id: I375d82874029bd26a7c528e46add2a638ba123f9
jarjar modifies the .class files in a jar, when using static java
library dependencies we need to use the modified class files and
not the ones that javac produced. If jarjar is enabled, use
the prebuilt jar extractor to get the classes out of classes-jarjar.jar
and export them through j.classJarSpecs.
Change-Id: Ia2854f1c26d630da12cab7c421007aad4f793ecd
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
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
If a java library only links against the same jar as bootclasspath,
the jar was being added to classpath and not bootclasspath, leaving
bootclasspath blank and using the default bootclasspath. Reverse
the order so that bootclasspath takes effect.
Change-Id: Ib9fbf01897314a57228013d4aef52606390b0aca
Support -file or -path/glob in file lists that contain globs to
subtract files from the resulting glob. Also move source file
prefixing and handling into a common function.
Change-Id: Ib6d74ce22f53cae7348c4ba35b779976d90359a6
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
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
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