Refactor the soong.config loading code to support reading in
product variables from soong.variables.
Change-Id: I389e6bb5c501b53167267d5f5d0d25557811cf72
Allow modules to vary their properties based on product variables.
For now, DEVICE_USES_LOGD, DEVICE_USES_JEMALLOC, and DEVICE_USES_DLMALLOC,
and BOARD_MALLOC_ALIGNMENT are supported.
Product variables can provide a value (only bool and int supported for
now), and if any of the product variable properties contains a "%d"
then Sprintf will be called with the property value as the format
and the product variable value convert to an int as the only argument.
For example:
product_variables: {
dlmalloc_alignment: {
cflags: ["-DMALLOC_ALIGNMENT=%d"],
},
},
will cause -DMALLOC_ALIGNMENT=16 to be added to any top level
properties called "cflags".
Change-Id: I74882a6ab4914d3e222f8d06cfac371b7b829ae5
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
Add nested properties that can vary based on the specific cpu type,
for example cortex-a9 or cortex-a15.
Change-Id: I107d6e30527c11d0bdd9bf17fb29513ffb07f9cc
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
Translation is getting complicated because the expressions supported
by Blueprint are difficult to support in Make. Modify androidbp
to use context aware parsing so it can evaluate all expressions at
parse time, so it only needs to deal with constant values.
Change-Id: I57047645fb48475baecd0361f78a93ec0a26011e
The glob depFile is not a listed output file of a rule, so it will
never be deleted by the cleanup phase. Remove the unnecessary phony
rule to avoid a warning when running soong -d explain:
ninja explain: output .intermediates/androidmk/glob/build/soong/Androidmk.d of phony edge with no inputs doesn't exist
Change-Id: I40ed5a28fb29b8455981f6debf1de2ea21c911ea
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
So that we generate the Android.mk file if it is removed. Adding
Android.mk files is already handled by the implicit dependencies in
common.Glob
Change-Id: I568e24b7bc44ecadbbe01c1f7c6a97afd819c7db
This finds any Android.bp files with Android modules defined, and if
there isn't an Android.mk file in the same directory, it will run
androidbp to generate one in $OUT
Change-Id: Ie8aef492e8cd28f6c314ce1254730975a1b8991f
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
Build a map of blueprint directory to modules built from that
directory, and then add phony rules to build.ninja that emulate
the behavior of mma in the current build system.
Also fixes checkbuild to depend on checkbuild files and installable
files, but not installed files.
Change-Id: I8bad6e93387940df7439dbd4554f6d79f924c65f
CloneEmptyProperties is much faster than CloneProperties followed
by ZeroProperties. Cuts >100ms off soong_build runtime, which will
become more important when we start calling soong_build a second
time to automatically generate documentation.
Change-Id: I45d948b36d9937a21b13dab068c3ce9a60b5a59b
Require directories listed in the include_dirs, local_include_dirs, and
exported_include_dirs properties to exist.
Change-Id: I5b079bd2c607839bb28dae43801cd7345bde2299
Take HostOrDevice out of Arch, and put it into AndroidModuleBase
instead. Also separate out the host vs. device mutator from
ArchMutator. This will make it possible for genrules to depend
on a host tool, regardless of which host arches it is compiled
for.
Change-Id: I22bbfd28b65c3eebdfa101a712f90dd615148dc8
At least libcutils and boringssl need to set source files that
apply to x86 or x86_64, but only on the host or on the device.
Add new properties that can contain arch variant properties:
target.android_arm
target.android_arm64
target.android_mips
target.android_mips64
target.android_x86
target.android_x86_64
target.linux_x86
target.linux_x86_64
target.darwin_x86
target.darwin_x86_64
Change-Id: I5a7076653a7367a63daa7f7e34a6a28f5cbdfbe7
Fix two bugs in globbing: check for excludes before globs so that
excludes that contain globs are not treated as includes, and
remove the Generator attribute from globRule so that the rule
reruns if the command line changes, for example if the glob or
excludes list changes.
Change-Id: I216c0c925eeb00a3814300548c005bcdf64a1f30
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
The envDeps map may be accessed concurrently by multiple modules
in GenerateBuildActions, wrap the accesses in a mutex.
Change-Id: I18abf2687997c045a99b987908623f7d8c2ea344
Put quotes around the glob exclude options to avoid accidentally
expanding globs during execution.
Change-Id: Ia6fc7fa7dbe1d75e97d6039642e1c89be027689a
Replace the Config interface with a struct that wraps the real
*config object. This keeps the existing pointer behavior without
having to list all of the available config functions in the interface.
Change-Id: If55a622b5a112ca5dc7193ebd59f2931b3a8e6cd
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
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
Add support for yacc (.y or .yy) and lex (.l or .ll) files. Also
tweak locations of .o files for normal and generated sources to
makes sure they don't collide.
Change-Id: I03172cddbdc022525bf392a81d72050406b8cdb3
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
Use the config to get paths to install to, allow installing
a file to a different file name than the intermediate file,
and allow dependencies between installed files.
Change-Id: I37ac32d2fa1458150b6d54f6ec9cdac70a0259e8
Java resource support requires globbing directories while ignoring
specific filenames. Add support for multiple -e options to
soong_glob to specify filenames to exclude, and split out Glob
into GlobRule to insert a rule to generate a glob file list.
Change-Id: Ia911dd68bd1638452881d18378572d015fd4e31a
Instead of setting a string property to magic default value and then
checking for it later, call ctx.ContainsProperty to determine if it
was set. Use the same method on the clang bool property, which
couldn't be set to a magic value.
blueprint's ModuleContext.ContainsProperty only works on a single
property, not on all arch variant properties -
ModuleContext.ContainsProperty("clang") will return false if
clang was not set but arch.arm.clang was set - so track which
properties were extended inside extendProperties, and override
ModuleContext.ContainsProperty in AndroidModuleContext to also
check the extended properties.
Change-Id: I03cbe71dc69344972e23d6c794da9be05e720c45
The context checkbuild files were not copied to the module checkbuild
files before calling generateModuleTarget, which would cause them
to not be considered, and in the case of a module with a single
variant, cause a build failure when the checkbuild target was skipped.
Change-Id: I77faafdc1a8a866e3c2c1157f987015b553acf01
The linker and a few other executables and libraries need to know
if they are a 32-bit process running on a 64-bit host. Add
android64 and android32 target types to set custom cflags.
Change-Id: I142378e2d5be17a87ff761257dacc1734b093048
Ninja can't depend on environment variables, so modifying build
behavior based on environment variables requires coordinating
between the soong script that invokes ninja and the soong_build
manifest generator.
Allow any module to call Config.Getenv to get the contents of an
environment variable while registering a dependency on it.
After all modules have been processed write out the state of
all used environment variables to a JSON file called
.soong.environment. During the next build the soong script
will use the soong_env tool to compare the contents of
.soong.environment to the current environment, and force a
build manifest regeneration by deleting the .soong.environment
file if any variables have changed.
Change-Id: Id0d81933a857bc2fc1cd7a393a3c6cec73dc4824
Add Host(), Device(), and Debug() to AndroidModuleContext to allow
build rule generators to easily determine build options.
Change-Id: Ib93a462cb45189399063f641b3a8df175db0592e
Refactor common code out of NewCC* to initialize the ccBase,
ccDynamic, and ccLibrary structures. Also adds an enum for the
default multilib values.
Change-Id: Iaeffe86bf2568b6054be4ddcee725818af45e14f
Modules can choose to add "installed files", which are files that
a product can depend on to cause the module to build, and "checkbuild
files", which will only be built if another module that needs to build
depends on them. For every target, add a module-install and a
module-checkbuild target that create dependencies on those files,
and then add a global checkbuild target that depends on all the
module-checkbuild targets. Also add a module target for each module
that depends on module-install and module-checkbuild.
Change-Id: I801389ad6ab9806b71d92cd327a0f9cb7582e0df
Initial build logic for building android with soong. It can build
a variety of C and C++ files for arm/arm64 and host.
Change-Id: I10eb37c2c2a50be6af1bb5fd568c0962b9476bf0