Commit graph

284 commits

Author SHA1 Message Date
Yi Kong
acee27cd72 Strip libgcc to only keep fallback symbols
We use libgcc as fallback for symbols not present in libclang_rt
builtins, however we didn't know what exact symbols were being used,
some may not be intended to fallback.

Create libgcc_stripped, which only contains unwind symbols from libgcc.

Bug: 29275768
Test: bionic-unit-tests
Change-Id: I5b349fa6138e51663bf3b67109b880b4356da8e8
2019-04-30 10:07:00 -07:00
Paul Duffin
2e61fa6e14 Add visibility support
Implementation uploaded for review. Includes unit tests but does not
yet handle prebuilts, that will come in a future change once some
more general issues with prebuilts and namespaces is resolved.

See README.md#Visibility for details of what this does and how to use
it.

Bug: 112158820
Test: add visibility rules for core library modules, make core-tests
Change-Id: I8ec980554398ad6f2d42043ce518f811a35da679
2019-04-26 12:37:37 +01:00
Dan Willemsen
633c502295 Support RuleBuilder.Sbox to wrap commands in sbox
This essentially allows you to declare that everything in a directory
will be created by the rule, and we'll ensure that your command actually
writes out all of the claimed outputs, and remove any other files that
previously existed in that directory.

Test: built-in tests
Change-Id: I990dce2b3a0d89ebd2736ac1a0cadfb5864c6e73
2019-04-15 14:52:05 -07:00
Colin Cross
19878da6a0 Move proto compilation to RuleBuilder
Using blueprint.Rule for protoc commands was causing code duplication
because there was no good way to run the same protoc for cc, java and
python but then run custom source packaging steps for java and python.
Move most of the code into a common function that returns a
RuleBuilder, and then let java and python add their own commands at
the end of the rule.

Bug: 70706119
Test: All Soong tests
Test: m checkbuild
Change-Id: Ic692136775d273bcc4f4de99620ab4878667c83a
2019-04-02 16:38:47 +00:00
Jaewoong Jung
525443aa22 Add override_android_app module type.
This is a new implementation of overriding module types that makes use
of local variants. With this, product owners can use PRODUCT_PACKAGES to
decide which override module to include in their products.

Bug: 122957760
Bug: 123640028
Test: app_test.go
Change-Id: Ie65e97f615d006b6e9475193b6017ea9d97e8e97
2019-03-21 13:26:20 -07:00
Vic Yang
efd249e62a Add support for no-vendor-variant VNDK
When no-vendor-variant VNDK is enabled, the vendor variant of VNDK
libraries are not installed.  Since not all VNDK libraries will be
ready for this, we keep a list of library names in cc/vndk.go to
indicate which libraries must have their vendor variants always
installed regardless of whether no-vendor-variant VNDK is enabled.

Also add --remove-build-id option to the strip script to facilitate
the check of functional identity of the two variants.

Bug: 119423884
Test: Add a dummy VNDK library and build with
      TARGET_VNDK_USE_CORE_VARIANT := true, with the corresponding
      build/make change.

Change-Id: Ieb1589488690e1cef1e310669a8b47a8b8759dac
2019-03-21 04:29:24 +00:00
Colin Cross
1b48842a4b Add path properties mutator
Add a mutator pass after DepsMutator that visits every property
struct in every module looking for properties that have a tag
`android:"path"`, and automatically add a SourceDepTag dependency
on any module references (":module-name") found.  Uses a cache to
store the mapping of property struct type to locations of
properties with the tag.

Test: android/path_properties_test.go
Change-Id: I38c0497843dde4890e9342c3a6f0b402c0720742
2019-03-07 18:36:24 +00:00
Colin Cross
3d7c9827d5 Add modules for converting java modules between host and device
java_device_for_host and java_host_for_device allow treating a
device module as a host module and vice versa.  They will be useful
for converting layoutlib and robolectric to Soong, as these modules
run device java code on the host.

Bug: 117920228
Test: device_host_converter_test.go
Change-Id: Ia9a371fb41a97bc16338097f3ce8b40099744167
2019-03-05 23:09:45 +00:00
Colin Cross
762286723a Add dexpreopt_bootjars_test.go
Add a test that exercises the dexpreopt_bootjars.go singleton.

Test: dexpreopt_bootjars_test.go
Change-Id: I01d4f6e22f6ff7b809af043391d7b6209dcb8675
2019-03-05 03:17:51 +00:00
Alex Light
778127a041 Add support for including py_binary and *_go_binary in apexs
These additional binary types are useful for some apexs. Add the
ability to include them. Due to the nature of the resulting artifacts
only py binaries with embedded launchers and host go binaries are
supported.

Test: m com.android.support.apexer
Bug: 119332365
Bug: 119332362
Change-Id: I27c253d3647cf7bbe15896610d7a74a5f93e8bec
2019-03-01 01:56:14 +00:00
Jaewoong Jung
acb6db331b Revert "Add override_module."
This reverts commit aa65e17016.

Reason for revert: Not compatible with PRODUCT_PACKAGES, and so has very limited use.

Change-Id: Ib141d3984a6f12bb50989e66037494c466b066f1
2019-02-28 16:22:30 +00:00
Jaewoong Jung
aa65e17016 Add override_module.
This new module type replaces the inherit-package function in make by
allowing developers to override the name, the certificate, and the
manifest package name of an android_app module.

Bug: 122957760
Fixes: 123640028
Test: app_test.go + BrowserGoogle
Change-Id: Iefe447e7078b25039233221361ef95c83a29973a
2019-02-27 14:35:39 -08:00
Colin Cross
44df581457 Refactor dexpreopt_bootjars.go to prepare for multiple boot images
Refactor dexpreopt_bootjars.go so that buildBootImage can be called
with a bootImageConfig to create rules to build the boot image in
preparation for building multiple boot images.

Test: m checkbuild
Change-Id: I7ba40a0988c8acbd6c1ee4e36f4bbb34fb4e2d24
2019-02-20 22:06:29 -08:00
Sasha Smundak
ff36da04e8 Implement vts_config module
Test: internal (see android/vts_config_test.go) + run 'm vts' and check
that host/linux-x86/vts/android-vts.zip remians the same
Change-Id: I0249a974a240e7669c3b9378c17739df8e120873
Fixes: 122617100
2019-02-19 16:58:43 -08:00
Colin Cross
e4759b9ab9 Add java/testing.go for sysprop_test.go
Share more of the setup code for java tests to sysprop_tests.go.

Test: java_test.go, sysprop_test.go
Change-Id: I0e3b287bf188c432d995a9a91a18ebef12aa47d1
Merged-In: I0e3b287bf188c432d995a9a91a18ebef12aa47d1
(cherry picked from commit b19745363f)
2019-02-16 17:08:01 -08:00
Colin Cross
800fe13146 Move dexpreopting of boot jars into Soong
Implement the dexpreopting of boot jars in singleton rules in
Soong.

Test: m checkbuild
Change-Id: Ic02ce941fa5e238b839b3eb4c06a3e10c62d98ff
2019-02-15 16:16:25 -08:00
Inseob Kim
c0907f191a Create sysprop_library soong module
A newly introduced sysprop_library soong module will generate a
java_sdk_library and a cc_library from .sysprop description files.
Both Java modules and C++ modules can link against sysprop_library
module, thus giving consistency for using generated sysprop API.

As Java controls accessibility of Internal / System properties with
@hide and @SystemApi, 2 different header files will be created. And
build system will selectively expose depending on the property owner
and the place where the client libraries go into.

Bug: 80125326
Bug: 122170616
Test: 1) Create sysprop_library module.
Test: 2) Create empty txt files under prebuilts/sdk.
Test: 3) Create api directory, make update-api, and see changes.
Test: 4) Try to link against sysprop_library with various clients.
Test: 5) Soc_specific, Device_specific, Product_specific, recovery flags
work as intended.
Change-Id: I78dc5780ccfbb4b69e5c61dec26b94e92d43c333
2019-02-13 23:32:51 +00:00
Colin Cross
f24a22a98a Move hiddenapi singleton rules to Soong
Move the rules that build hiddenapi-stubs-flags.txt,
hiddenapi-flags.csv and hiddenapi-greylist.csv into Soong.

Bug: 123645297
Test: m checkbuild
Test: m UNSAFE_DISABLE_HIDDEN_API_FLAGS=true
Change-Id: I90bf58710f6153ee8565994f799d3ec5699bc7fa
2019-02-06 11:23:40 -08:00
Colin Cross
571cccfcbc Prepare for a type-safe OnceKey
Add an opaque OnceKey type and use it for all calls to Once in
build/soong.  A future patch will convert the arguments to
Once* to OnceKey once users outside build/soong have been updated.

Test: onceper_test.go
Change-Id: Ifcb338e6e603e804e507203c9508d30ffb2df966
2019-02-06 01:52:41 +00:00
Colin Cross
feec25b084 Move dexpreopt.Script to android.RuleBuilder
Move dexpreopt.Script to android.RuleBuilder so that the builder
style can be used in more places.  Also add tests for it.

Test: rule_builder_test.go
Change-Id: I92a963bd112bf033b08899e930094b908acfcdfd
2019-02-05 13:28:43 -08:00
Dan Willemsen
b05526711e Add sh_binary[_host] for shell script that should be installed as executable
We've been putting these in cc_prebuilt_binary, but that's not really
correct. It also tries adding '.exe' to the end of windows executables,
which isn't desirable for bat files.

Test: Use sh_binary_host
Change-Id: Idd5418dceb81ac55b766c987fbb69a810aeb8a3b
2019-01-28 10:59:10 -08:00
Colin Cross
cb9880786d Optimize filterArchStruct when nothing is filtered
Runtime-created struct types have limit on the name of the type,
which is the full text of the fields in the struct.  Avoid creating
runtime struct types when filtering produces an identical struct.
Also add tests and godoc for filterArchStruct.

Test: arch_test.go
Change-Id: If7eb27ea9e72073d5252e93f2110b08889ed76b1
2019-01-25 21:26:53 +00:00
Doug Horn
c32c6b0d79 Support building for Fuchsia.
This CL adds configs for the arm64 and x64 fuchsia
device targets, sets up the necessary linker flags,
and disables some functionality that is not currently
supported on Fuchsia.

Bug: 119831161
Test: Compile walleye, internal validation against
fuchsia_arm64-eng and fuchsia_x86_64-eng.
Change-Id: I2881b99d2e3a1995e2d8c00a2d86ee101a972c94
2019-01-24 18:59:29 +00:00
Colin Cross
be9cdb8d64 Replace annotation_processors with plugins
Follow bazel's modules for annotation processors by introducing
a java_plugin module type that can contain extra metadata about
the annotation processor, the processor class and a flag to
specify if the annotation processor is compatible with the
turbine optimization.  Deprecate the annotation_processors
property, which took a list of java_library_host modules, in
favor of the plugins property, which takes a list of java_plugin
modules.  The annotation_processors property will be removed
once all uses have been replaced with plugins.

Bug: 77284273
Test: plugin_test.go
Test: m caliper
Change-Id: I37c1e80eba71ae2d6a06199fb102194a51994989
2019-01-23 20:17:51 +00:00
Colin Cross
21fc9bbe19 Move kotlin to it's own file
kapt is going to make kotlin a little more complicated, move the
rules and tests to their own files.

Bug: 122251693
Test: m checkbuild
Change-Id: Ieed78b97995ced210b710bd50c357514cc8e3bc6
2019-01-22 16:32:11 +00:00
Colin Cross
8faf8fc060 Move hiddenapi to Soong
Perform hiddenapi CSV generation and dex encoding for Soong modules
in Soong.  This fixes an issue where dexpreopting was happening on
a different jar than was being installed.

Bug: 122856783
Test: m checkbuild
Test: no change out/target/common/obj/PACKAGING/hiddenapi-flags.csv
Test: only ordering change to out/target/common/obj/PACKAGING/hiddenapi-greylist.csv
Test: cts/tests/signature/runSignatureTests.sh
Change-Id: I4fc481efc29e73cb2bdaacf672e86d5f6f0075ae
2019-01-17 22:19:28 +00:00
yelinhsieh
80880a3460 Autogen python test config.
Feature request from developer, autogen python test config.

Bug:118442443

Test: $source build/envsetup.sh ; lunch
      $sed -i '/test_config/d' tools/acloud/Android.bp
      $make acloud_test
      $[ -f $ANDROID_HOST_OUT_TESTCASES/acloud_test/acloud_test.config ] && echo "Found" || echo "Not found"

Change-Id: I196230581b456afe03e67f9cd84c028d18ba08d9
2019-01-14 03:30:06 +00:00
Colin Cross
fb6d781202 Split out sdk.go from java.go
Split out SDK handling functions from java.go to sdk.go and tests
from java_test.go to sdk.go.

Test: sdk_test.go
Change-Id: I83ef48cbe5230572c1d4ecc0e89021d2f7c71b76
2019-01-10 07:09:29 +00:00
Colin Cross
638149e650 Add dexpreopt enabled tests
Add tests that verify when dexpreopt is enabled or disabled.

Test: dexpreopt_test.go
Change-Id: Ideba9c0dac30eb31e7ae29e46d1d1590202b8369
2019-01-05 22:36:13 -08:00
Colin Cross
43f08db29e Dexpreopt soong modules inside soong
Port the dexpreopt logic from Make to the dexpreopt package in Soong,
and use it to dexpreopt Soong modules.  The same package is also
compiled into the dexpreopt_gen binary to generate dexpreopt scripts
for Make modules.

This relands Ib67e2febf9ed921f06e8a86b9ec945c80dff35eb and
I462182638bd57b1367b5bfb0718e975c11ae66f7, along with multiple fixes
to depsfile generation in dexpreopt_gen that caused .odex files for
modules in defined make to be missing dependencies on boot.art, and
a fix to not dexpreopt and strip tests.

Bug: 119412419
Bug: 120273280
Test: no differences to dexpreopt outputs on aosp_sailfish system/,
      only expected changes to dexpreopt outputs on system_other
      (.vdex files for privileged Soong modules no longer incorrectly
      contain .dex contents).
Test: OUT_DIR=$PWD/out m
Test: NINJA_ARGS="-t deps out/target/product/sailfish/obj/APPS/Contacts_intermediates/dexpreopt.zip" m
Change-Id: I6bb2c971cee65d2338839753aa0d84939f335b1b
2018-12-15 19:07:54 -08:00
Colin Cross
4ff85ebeb7 Revert "Dexpreopt soong modules inside soong"
This reverts commit 29ff88741e.

Test: none
Bug: 119412419
2018-12-14 11:49:58 -08:00
Colin Cross
29ff88741e Dexpreopt soong modules inside soong
Port the dexpreopt logic from Make to the dexpreopt package in Soong,
and use it to dexpreopt Soong modules.  The same package is also
compiled into the dexpreopt_gen binary to generate dexpreopt scripts
for Make modules.

Bug: 119412419
Bug: 120273280
Test: no differences to dexpreopt outputs on aosp_sailfish system/,
      only expected changes to dexpreopt outputs on system_other
      (.vdex files for privileged Soong modules no longer incorrectly
      contain .dex contents).
Change-Id: Ib67e2febf9ed921f06e8a86b9ec945c80dff35eb
2018-12-13 15:53:54 +00:00
Jiyong Park
25fc6a9cc9 Stubs variant is used when building for APEX
When a native module is built for an APEX and is depending on a native
library having stubs (i.e. stubs.versions property is set), the stubs
variant is used unless the dependent lib is directly included in the
same APEX with the depending module.

Example:

apex {
    name: "myapex",
    native_shared_libs: ["libX", "libY"],
}

cc_library {
    name: "libX",
    shared_libs: ["libY", "libZ"],
}

cc_library {
    name: "libY",
    stubs: { versions: ["1", "2"], },
}

cc_library {
    name: "libZ",
    stubs: { versions: ["1", "2"], },
}

In this case, libX is linking to the impl variant of libY (that provides
private APIs) while libY is linking to the version 2 stubs of libZ. This is
because libY is directly included in the same apex via
native_shared_libs property, but libZ isn't.

Bug: 112672359
Test: apex_test added
Change-Id: If9871b70dc74a06bd828dd4cd1aeebd2e68b837c
2018-12-04 17:46:22 +09:00
Jaewoong Jung
62707f79ab Add filegroup support to notice property.
Also, replace all notice file references with the parent directory
pattern(../) with filegroups. This new version has
ALLOW_MISSING_DEPENDENCIES support, so shouldn't break branches that
don't contain the libwinpthread project.

Bug: 118899640
Test: Manual build + forrest runs on previously failed branches.
Change-Id: I13e70e8dab547f82c1c8f15eccc7ae116e480ad5
2018-11-27 09:45:18 -08:00
Ivan Lozano
074ec480ef Add support for AArch64 XOM binaries.
Adds build system support for generating AArch64 binaries with
execute-only memory layouts via a new xom module property. Also adds
support for an ENABLE_XOM build flag for global builds.

Bug: 77958880
Test: make -j ENABLE_XOM=true
Change-Id: Ia2ea981498dd12941aaf5ca807648ae37527e3ee
2018-11-21 08:59:37 -08:00
Jaewoong Jung
491fe5ffd8 Revert "Add filegroup support to notice property."
This reverts commit ff7a1a47d9.

Reason for revert: Broke ART buildbot

Change-Id: I005ccfcc2c36bbcb274cb2a069fc701168faacd2
2018-11-19 16:18:54 +00:00
Jaewoong Jung
ff7a1a47d9 Add filegroup support to notice property.
Also, replace all notice file references with the parent directory
pattern(../) with filegroups.

Bug: 118899640
Test: Manual build
Change-Id: I841345d747f41a3bb5beea66ad87a979734c39a4
2018-11-16 13:26:43 -08:00
Jaewoong Jung
16c7d3d263 Revert "Revert "Revert "Revert "Export static libraries.""""
This reverts commit 555c114283.

Reason for revert: The namespace issue in the pi-dev-plus-aosp-without-vendor branch is now fixed.

Change-Id: I26ed591447797a8ee505f43bdd209162418b6c5e
2018-11-16 01:20:05 +00:00
Jaewoong Jung
555c114283 Revert "Revert "Revert "Export static libraries."""
This reverts commit eb05c2a633.

Reason for revert: Yet another broken build.

Change-Id: I4198f2dd5c7848365d71d03f6dbd598998fb9bd8
2018-11-09 22:25:37 +00:00
Jaewoong Jung
eb05c2a633 Revert "Revert "Export static libraries.""
This reverts commit 3affc07ca0.

Reason for revert: The notice dependency bug is now fixed.

Change-Id: I5424ade9d742fbe190651097c04914a29db6dfa0
2018-11-09 16:02:34 +00:00
Jaewoong Jung
3affc07ca0 Revert "Export static libraries."
This reverts commit 9d5ca159dc.

Reason for revert: This broke few builds.

Change-Id: Id9c4d7c145602a55ae07bb177f2c236e16f4fb63
2018-11-06 18:00:39 +00:00
Jaewoong Jung
9d5ca159dc Export static libraries.
Export static libraries through LOCAL_STATIC_LIBRARIES and
LOCAL_WHOLE_STATIC_LIBRARIES. This enables dependency-based NOTICE file
generation. Also, add a notice property in the libwinpthread module.

Bug: 36073965
Test: cc_test.go
Change-Id: If1ca1f9159e80cf8fbe71df7a13ca5d6a1f63b40
2018-11-05 23:48:10 +00:00
Jaewoong Jung
3e6b1fbcfb Revert "Export static libraries."
This reverts commit 5d19e1de88.

Reason for revert: Broke aosp-build-tools/darwin_mac

Change-Id: I1af36848fb5a00849aec69941ddef33769b1b536
2018-11-02 22:56:30 +00:00
Jaewoong Jung
5d19e1de88 Export static libraries.
Export static libraries through LOCAL_STATIC_LIBRARIES and
LOCAL_WHOLE_STATIC_LIBRARIES. This enables dependency-based NOTICE file
generation. Also, add a notice property in the libwinpthread module.

Bug: 36073965
Test: cc_test.go
Change-Id: Ic63ca523b40acac82bbe876f7aa40ecd495907c5
2018-11-01 22:45:59 +00:00
Jiyong Park
139a2e6935 Add filename property to prebuilt_etc
filename property is an optional property that specifies the name of the
installed file which is by default name of the module.

This will be used to APEXs to have ./etc/ld.config.txt files for their
own.

Test: m (prebuilt_etc_test.go added)
Change-Id: Ic8d0c0044c5bc2c6c33117fe2c19ef6ad75451a8
2018-10-26 22:14:59 +09:00
Colin Cross
ef35448ac5 Allow cc_genrule srcs to vary by architecture
Add arch_variant to the genrule srcs property so that cc_genrule
modules can vary the srcs and outs by architecture.

Test: cc/genrule_test.go
Change-Id: Idb17013e137d7ca21ca4cfc3e4c1fa7d89977043
2018-10-23 18:40:37 +00:00
Dan Willemsen
a0790e35c7 Rework how linux_bionic is built with LLD
In order to simplify the wrapper function, and stop using a linker
script, generate a set of flags to pass to LLD. Then run
host_bionic_inject on the linked binary in order to verify the
embedding, and give the wrapper function the address of the original
entry point (_start).

Bug: 31559095
Test: build host bionic with prebuilts/build-tools/build-prebuilts.sh
Change-Id: I53e326050e0f9caa562c6cf6f76c4d0337bb6faf
2018-10-22 15:46:03 -07:00
Jiyong Park
ff1458f670 APEX can be signed with different keys
A new module type 'apex_key' is defined to specify public and private
key pair for APEXs. An APEX can refer to the module via the property
'key'. When building the APEX, the private key from the key module is
used to sign it. In addition, the public key from the key module is
automatically installed to /system/etc/security/apex.

Bug: 115721587
Test: m apex.test; m
/apex/com.android.example.apex@1 exists

Change-Id: I82666db095bd7a09f6c1b9cbea2db57ebc076cbf
2018-10-16 09:53:11 +09:00
Jiyong Park
48ca7dc535 Add apex variants
Now, APEX-aware modules (the ones implementing android.ApexModule
interface) are created with multiple variants for each APEX that they
are included.

For example, if a module is included (either directly or indirectly -
via static linking) to two APEXs, the module is built separately for the
two APEXs (and of course separately for platform). This is a first step
to limit the symbol visibility to the modules built for APEXs; platform
private symbols and libs shouldn't be allowed for them.

In addition, the build system now tracks transitive dependencies of
the modules in APEXs. For example, if
native_shared_lib_modules:["libFoo"] then libFoo and its dependencies
are all automatically included to the APEX.

Bug: 112672359
Test: m apex.test; the built apex has additional libs (such as liblog,
libc++, ...) that are dependencies of the ones specified in Android.bp

Change-Id: Id9e3fc486dd4e7e36f8b6799dfb041868c5198d5
2018-10-11 14:24:18 +09:00
Jiyong Park
9d45299ba4 Add ApexModule interface for APEX-aware modules
ApexModule is the interface for APEX-aware modules. The module type apex
uses the interface to get APEX-specific information from other modules,
such as the list of APEXs that a module should be built for.

A module that is included in an APEX will be built specificaly for the
APEX. This is especially required for shared libraries; we shouldn't
just copy the artifacts built for platform, because they may be linking
against private (=unstable) symbols that are not available to APEXs
which are basically unbundled.

This CL, as a first step, makes cc.Module an APEX-aware module type.

Bug: 112672359
Test: m apex.test; the built apex has all the direct and transitive
shared lib dependencies of the libs and executables listed in Android.bp

Change-Id: I21f6a586654779984f0f5154b2a08b2adbf2168b
2018-10-11 11:19:07 +09:00
Colin Cross
a4f08813a3 Add support for JNI libraries to android_app modules
Make android_app modules a MultiTargets module, which means the
common variant will have a list of Targets that it needs to handle.
Collect JNI libraries for each Target, and package them into or
alongside the APK.

Bug: 80095087
Test: app_test.go
Change-Id: Iabd3921e1d4c4b4cfcc7e131a0b0d9ab83b0ebbb
2018-10-08 15:20:56 -07:00
Dan Willemsen
feea4dff66 Stop using GCC in toolchain_library
Instead, hardcode the ~dozen paths into build/soong/Android.bp, which
will unblock removing more GCC support.

Bug: 114286031
Test: m
Change-Id: I2508432e00b1469141f01e667f3c6a2fe30cd805
2018-10-07 23:50:34 -07:00
Colin Cross
2a07692643 Add tests for genrule command expansion
Add tests for expanding variables in a genrule cmd property.

Test: genrule_test.go
Change-Id: I8288b8616d518bb5f24a892c4e59f68d95055d0a
2018-10-05 21:29:14 +00:00
Brandon Lee
5d45c6f6f8 Collect modules' info to create IDE project file.
- Register a singleton and implement GenerateBuildActions func in java/jdeps.go.
- Declare a interface and a struct to collect info in android/module.go.
- Implement IDEInfo for Library & Import module in java/jdeps.go.
- Implement IDEInfo for Genrule module in genrule/genrule.go.
- Implement IDEInfo for fileGroup module in android/filegroup.go.
- Test codes for jdeps.go in java/jdeps_test.go.

Bug: 111044346

Test: export SOONG_COLLECT_JAVA_DEPS=1;mmm packages/apps/Settings
      out/soong/module_bp_java_deps.json will be generated

Change-Id: If61da77b4d7614c2c5da438b6af4c725ceccc5c3
2018-09-18 17:44:10 +00:00
Colin Cross
22f3795dca Remove relocation packer
The relocation packer prebuilt is gone, remove the references to it.

Bug: 110715614
Test: m checkbuild
Change-Id: Ia20f8198e4fc206f4995dd5168c811dac7c9df89
2018-09-05 16:30:11 -07:00
Colin Cross
303e21f695 Move autogenerated test config into Soong
Move autogenerating the test config for Soong modules into Soong
for java_test and android_test modules.

Bug: 70770641
Test: m checkbuild
Test: atest CtsUiRenderingTestCases
Change-Id: I02593add0407ef694b91c14cf27411a4f3cc4745
2018-08-14 15:44:08 -07:00
Logan Chien
031d2b32e3 Support prebuilt shared libs end with versions
This commit changes how `cc/androidmk.go` generates LOCAL_MODULE_STEM,
LOCAL_MODULE_SUFFIX, and LOCAL_BUILT_MODULE_STEM.  Now, `splitFileExt()`
takes a file name and a list of expected file extensions.
`splitFileExt()` searches the first occurrence of expected file
extensions in the file name.  If it can not find any, it will simply
return the last file extension.

Before this commit, `cc/androidmk.go` simply extracts the last file
extension (e.g. `.so`).  However, if the prebuilt shared libs end with
version numbers (e.g. `libc++.so.1`), it will use `$(LOCAL_MODULE).1` as
LOCAL_BUILT_MODULE_STEM and this will lead to missing target ninja
error.

Bug: 111579848
Test: Build a program that links libc++_host (from prebuilts/clang)
Change-Id: Id96726c69705d518ea725bb6abd8ff4527ca0cbc
2018-08-09 10:45:18 +08:00
Colin Cross
31656958d6 Use manifest merger in Soong
Move the manifest merger config to Soong, and use it to merge
manifests of static dependencies of android_library and android_app
modules.

Bug: 110848854
Test: m checkbuild
Change-Id: Ib89e1f1a52a8b76157e4e0348baf42800412df0d
Merged-In: Ib89e1f1a52a8b76157e4e0348baf42800412df0d
Merged-In: I5d055ce63b8371db500f8868fb73ab3604b8c24a
2018-07-11 19:46:38 +00:00
Jiyong Park
f9332f1c86 Support recovery and recovery_available
`recovery: true` installs a module to the recovery partition.
`recovery_available: true` makes a module to be available to other
`recovery:true` or `recovery_available: true` modules.

These to are very similar to vendor, vendor_available properties, except
for the target partition.

Bug: 67916654
Bug: 64960723
Test: m -j, toybox_recovery is installed to the recovery/root/sbin
Change-Id: Iaebe0593de16c69fa70de251a61f4d018a251509
2018-05-15 16:27:12 +09:00
Jiyong Park
58c518b594 java_sdk_library does the apicheck by default
droiddoc now supports apicheck. java_sdk_library uses it to
automatically perform apichecks against the not-yet-release API and
the latest-released API.

A module type prebuilt_apis is added. It finds api txt files and creates
filegroup modules so that it can be referenced from java_sdk_library
across the module boundary.

Bug: 77575606
Test: m -j
Test: m -j checkapi
Test: m -j update-api
Change-Id: I0ba859972eac060296e1df2e71c4e047392d4877
2018-05-15 10:57:01 +09:00
Colin Cross
b2559a0224 Export lists of support libraries modules to Make
Make will use the list to sort support libraries into
LOCAL_STATIC_ANDROID_LIBRARIES and LOCAL_STATIC_JAVA_LIBRARIES
as appropriate.

Bug: 78300023
Test: m checkbuild
Change-Id: I58582b124f2b6a9b124683ddf8f5d77314f2e941
Merged-In: I58582b124f2b6a9b124683ddf8f5d77314f2e941
(cherry picked from commit ff8ab0745f)
2018-05-03 16:48:13 -07:00
Jiyong Park
5a8d1bee89 Add prebuilt_etc_xml
prebuilt_etc_xml installs an xml file to <partition>/etc[/<subdir>] and
validates the xml file against the given DTD file before installing it.

This change also includes some fixes for prebuilt_etc which is the super
module of prebuilt_etc_xml:

1) The module is changed to arch-specific module as the prebuilts are only
for devices (installed under the etc dir), but not for hosts.

2) Dependency to android.Prebuilt is removed because android.Prebuilt is
intended to be used for the case when a module can exist as prebuilts,
source or both. These prebuilt_etc_* modules are prebuilt only.

3) srcs property which accepts a list of source files is changed to src
that only accepts single source file, which makes more sense for
prebuilts.

Bug: 65686190
Test: m -j (xml_test.go)
Change-Id: I40484f3f6615b99f6b8d43176db0c40c5bfd838e
2018-04-28 00:13:00 +09:00
Alex Light
ec868fc42a Add support for generating Compdb file
Some tools (i.e. you-complete-me) make use of a 'compdb' file
(compile_commands.json) that records (among other things) the
arguments needed to compile a file. These tools can use this with
libclang to provide semantic completions and perform other IDE
actions. This CL adds support for soong to generate a (simple)
compile_commands.json file.

Test: make SOONG_GEN_COMPDB=1 SOONG_LINK_COMPDB_TO=$ANDROID_BUILD_TOP nothing
      examine $ANDROID_BUILD_TOP/compile_commands.json

Change-Id: I751bb344b90dfcdad1dfd71c2a85bacd345f0464
2018-04-24 08:15:02 -07:00
Jiyong Park
c678ad3f71 Adding java_sdk_library
java_sdk_library is to make a Java library that implements optional
SDK APIs to apps. It is actually a wrapper for several modules: 1) stubs
library that clients are linked against to, 2) droiddoc module that
internally generates API stubs source files, 3) the real runtime shared
library that implements the API, and 4) XML file for adding the runtime
lib to the classpath at runtime if requested via <uses-library>.

Note: this is only the initial CL for the feature. Followings are features
currently missing and under development.

1) check for API consistency
2) install stubs libs as the dist artifacts
3) ensuring that apps have appropriate <uses-library> tag
4) disallowing linking to the runtime shared lib
5) HTML generation

Bug: 77575606
Test: m -j

Change-Id: I4a4ccf6e730e041703c63bb275d8860d0de96887
2018-04-19 08:57:30 +09:00
Pirama Arumuga Nainar
955dc4999e Fix few issues with filegroups
Bug: http://b/64121881
Bug: http://b/78188880

- Allow filegroup's properties to be extended by a LoadHook
- Support a filegroup (':module') in a prebuilt's 'Srcs' property to
export files from a different path as the prebuilt's sources.

This change also includes a refactoring that moves genrule/filegroup.go
to android/filegroup.go so that FileGroupFactory is visible in
prebuilt_test.go.

Test: Test
https://android-review.googlesource.com/c/platform/development/+/469159
in clang-tools branch on Linux, Darwin.  Test regular build in
aosp/master.

Change-Id: I3ff6215ab2e62955f039fd1086c31f1bd50ebcf6
2018-04-18 18:56:33 +00:00
Colin Cross
a97c5d3f08 Add support for android_library modules
Add support for compiling android_library modules into AARs,
and refactor app support on top of it.

Bug: 73724997
Test: app_test.go
Change-Id: I1dfac5fffe577c6680bc4709147b2061eb7d819c
2018-04-16 15:24:47 -07:00
Jiyong Park
374510bcb6 Allow platform modules to link to vendor public libraries
Normally, when building with VNDK, platform modules are not allowed to
link against vendor libraries, because the ABI of the vendor libraries
are not guaranteed to be stable and may differ across multiple vendor
images.

However, the vendor public libraries are the exceptions. Vendor public
libraries are vendor libraries that are exposed to 3rd party apps and
listed in /vendor/etc/public.libraries.txt. Since they are intended to
be exposed to public, their ABI stability is guaranteed (by definition,
though it is up to the vendor to actually guarantee it).

This change provides a way to make a vendor lib as public by defining a
module of type 'vendor_public_library' with a map file that enumerates
public symbols that are publicized:

cc_library {
   name: "libvendor",
   proprietary: true,
   ...
}

vendor_public_library {
   name: "libvendor",
   symbol_file: "libvendor.map.txt",
}

This defines a stub library module named libvendor.vendorpublic from the
map file. `shared_libs: ["libvendor"]` is redirected to the stub library
when it is from the outside of the vendor partition.

Bug: 74275385
Test: m -j
Test: cc_test.go passes
Change-Id: I5bed94d7c4282b777632ab2f0fb63c203ee313ba
2018-03-30 10:22:52 +09:00
Nan Zhang
b8fa197878 Add Python protobuf support.
Python protobuf std libs will be wrapped in final binary/test par file.

Bug: b/70568913
Test: manually create real examples.
Change-Id: I7376ec9175f3e03d1adbd20858a7f74e826387ad
2018-03-22 15:56:51 -07:00
Logan Chien
ee97c3ed75 Add unit tests for android/neverallow.go
Bug: 74506774
Test: lunch aosp_walleye-userdebug && make  # runs unit tests
Change-Id: Ibde685d7213713be219681cb039ad58a43d9c377
2018-03-15 11:02:38 +08:00
Colin Cross
fabb608b27 Soong AAR prebuilt support
Add support for android_library_import modules that take an
aar file.

Bug: 73724997
Test: m checkbuild
Change-Id: I670b56f0a3b7501d9478a6064a04d0cb9c1bb611
2018-02-22 14:54:47 -08:00
Nan Zhang
581fd21e91 Droiddoc Support in Soong
Support Droiddoc to Soong based on core/droiddoc.mk. The non-std doclet
based droiddoc compilation output is a "real" stubs.jar instead of a
directory of java files and a timestamp file.

The std doclet based javadoc compilation output is a "empty" stubs.jar
instead of a timestamp file.

The stubs.jar will be exported to
out/target/common/obj/JAVA_LIBRARIES/$(LOCAL_MODULE)_intermediates/classes.jar
and out/target/common/docs/$(LOCAL_MODULE)-stubs.jar

A $(LOCAL_MODULE).zip file will be generated also, and is exported to
out/target/common/docs/$(LOCAL_MODULE)-docs.zip if property: installable is not set
to false.

Bug: b/70351683
Test: unittest + convert libcore docs Android.mk to Soong manually.

Change-Id: I1cffddd138a5d9d445f86a3d4a3fd4de88a2bc0f
(cherry picked from commit 78188ec622cb1ee24171455867fc58ffab91562e)
2018-02-22 11:14:13 -08:00
Colin Cross
f0056cb2ed Refactor dexing
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-02 18:23:43 -08:00
Steven Moreland
65b3fd900a neverallows in Soong
Straightforward way of expressing policy inspired by a similar
syntax in SELinux.

Bug: 70165717
Test: no neverallows hit
Test: manually checking neverallow rules by changing them/adding violations
Change-Id: I7e15a0094d1861391bfe21a2ea30797d7593c142
2017-12-19 15:26:08 -08:00
Colin Cross
e87040b2eb Allow Soong to generate its own build documentation
Add a rule in soong that re-executes soong_build in order to
generate build documentation.  This allows Soong to customize
the documentation.

Bug: 70516282
Test: m soong_docs
Change-Id: If143cfacd6ac20274cd7bb8d8fab0c07025a5553
2017-12-12 11:12:32 -08:00
Colin Cross
5425090a4f Add java_genrules to use jars as inputs and outputs
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-06 03:55:20 +00:00
Jeff Gaston
088e29ed38 Revert "Revert "Soong support for namespaces""
This mostly reverts commit 178d5fefc0
and mostly reapplies change I6d3e52ef62c4cabe85b9a135a54de0e1a6aab29c .

Bug: 65683273
Test: build/soong/scripts/diff_build_graphs.sh \
      --products=aosp_arm \
      'build/blueprint:work^ build/soong:work^' \
      'build/blueprint:work build/soong:work'
      # and see that the only changes were:
      # 1. adding some new files
      # 2. changing some line numbers
Test: m -j nothing # which runs unit tests

Change-Id: I32baae00277a547fdcdd1c2219fe6625ee0e45d7
2017-12-04 17:44:29 -08:00
Justin Yun
7154928c93 Install VNDK snapshot libraries for system build
When BOARD_VNDK_VERSION := <VNDK version>, or
PRODUCT_EXTRA_VNDK_VERSIONS includes the needed <VNDK version> list,
the prebuilt VNDK libs in prebuilts/vndk/ directory will be
installed.

Each prebuilt VNDK module uses "vndk_prebuilt_shared" for shared
VNDK/VNDK-SP libs.

Following is the sample configuration of a vndk snapshot module:
vndk_prebuilt_shared {
    name: "libfoo",
    version: "27",
    vendor_available: true,
    vndk: {
        enabled: true,
    },
    arch: {
        arm64: {
            srcs: ["arm/lib64/libfoo.so"],
        },
        arm: {
            srcs: ["arm/lib/libfoo.so"],
        },
    },
}

The Android.bp for the snapshot modules will be auto-generated by a
script.

Bug: 38304393
Bug: 65377115
Bug: 68123344
Test: set BOARD_VNDK_VERSION := 27
      copy a snapshot for v27
      build with make command

Change-Id: Ib93107530dbabb4a24583f4d6e4f0c513c9adfec
2017-12-05 10:19:43 +09:00
Jeff Gaston
178d5fefc0 Revert "Soong support for namespaces"
This reverts commit 63a250a336.

Reason for revert: Some failures:
  namespace_test.go:648: dir1/Blueprints:2:4: a namespace must be the first module in the file 
  such as New Build Breakage: aosp-master/build_test @ 4475274

Change-Id: I1b5db8eb934e51ff22241bfca44199d886b1393b
2017-11-30 00:43:43 +00:00
Colin Cross
44f066895d Fix aapt2
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
2017-11-30 00:40:38 +00:00
Jeff Gaston
63a250a336 Soong support for namespaces
Bug: 65683273
Test: build/soong/scripts/diff_build_graphs.sh \
      --products=aosp_arm \
      'build/blueprint:work^ build/soong:work^' \
      'build/blueprint:work build/soong:work'
      # and see that the only changes were:
      # 1. adding some new files
      # 2. changing some line numbers
Test: m -j nothing # which runs unit tests

Change-Id: I6d3e52ef62c4cabe85b9a135a54de0e1a6aab29c
2017-11-29 13:03:40 -08:00
Colin Cross
3bc7ffa59b Replace aapt support with aapt2
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-29 05:05:07 +00:00
Colin Cross
0875c52de7 Wrap PackageContext and SingletonContext
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
2017-11-29 05:04:30 +00:00
Colin Cross
cb9335932f Add Jacoco support
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-22 16:08:53 -08:00
Jeff Gaston
f5f6e49478 Prohibit accidental renames of product config json fields
Can be caused by `json:"omitempty"` instead of `json:",omitempty"`

Bug: 69076024
Test: m -j # which runs unit tests
Change-Id: I92e3193d00a740c72d36a56748e0b0a8ad1d772e
2017-11-20 16:28:53 -08:00
Colin Cross
f18e11074d Fix using aidl files from filegroups
Compute sources including from filegroup and genrule dependencies
before determining if any sources will cause flags to be added.

Test: gen_test.go
Change-Id: I0434b003bbda07a58bb2ce1a0a72997918c8fae2
2017-11-17 11:22:08 -08:00
Colin Cross
ad59e75a56 Add cc_library tests
Add tests around reusing objects between static and shared
libraries.

Test: library_test.go
Change-Id: I1a1a01c5ea9f9edfbcaa5b29c39c281630e04f70
2017-11-17 11:22:04 -08:00
Colin Cross
b671544973 Move first/last unique elements utility functions to android package
Move firstUniqueElements to android.FirstUniqueStrings,
lastUniqueElements to android.LastUniqueStrings, and lastUniquePaths
to android.LastUniquePaths.

Test: m checkbuild
Change-Id: Ieac840405126c7f8f98afb4a4ef35c01a18fe7fb
2017-10-24 12:12:32 -07:00
Jeff Gaston
11b5c51d4e split soong_zip into a library and a binary
to make it faster/easier to invoke from other Go programs
(such as multiproduct_kati)

Bug: 67478260
Test: m -j
Change-Id: Idd2671a44290550197c88f53dd11a6dd39c85cc5
2017-10-19 18:18:04 +00:00
Colin Cross
93e8595044 Initial kotlin support
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-17 16:25:22 -07:00
Colin Cross
1369cdb280 Initial support for converting jars to java9 system modules
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-16 15:00:02 -07:00
Colin Cross
6af17aa022 Add support for .proto files in java modules
Test: m -j checkbuild
Change-Id: Ia03429948baebff85164a91a34507866c97a08ef
2017-10-03 10:25:15 -07:00
Dan Willemsen
9d6c6722a7 Rename target.linux[_x86[_64]] to target.linux_glibc[_x86[_64]]
In the future, target.linux will apply to all targets running a linux kernel
(android, linux_glibc, linux_bionic). So move all current users to the specific
linux_glibc.

There will be another cleanup pass later that will move some instances back to
target.linux if the properties should be shared with target.android and
target.linux_bionic, but target.linux needs to be removed first.

Test: out/soong/build.ninja identical before/after
Change-Id: I04e4f984781e60feb355de7adf80c54300e0d1f5
2017-10-02 10:44:42 -07:00
Pirama Arumuga Nainar
ada83ec0a6 Add PGO support to soong
Bug: http://b/63768402
Bug: http://b/65598278

Add support for the 'pgo' property to specify how a module is processed
under PGO.  A sample property is below:

pgo: {
    instrumentation: true, // could be "sampling: true" when supported
    profile_file: "pgo_simple.profdata",
    benchmarks: ["pgo_simple"],
}

1. Runtime profiles can be gathered using "sampling" or
"instrumentation".  Sampling is not supported initially.

2. If 'toolchain/pgo-profiles' project is found,
'toolchain/pgo-profiles/${profile_file}' is passed to the compiler and
linker when building this module.

3. If ANDROID_PGO_INSTRUMENT environment variable is set, and includes a
benchmark in the 'benchmarks' list, appropriate flags (for e.g.
-fprofile-generate for instrumentation) are passed to the compiler and
linker when building this module.

Test: Add example modules that specify the pgo property and verify
appropriate flags and dependencies in the Ninja file.  Some
tests/examples are in https://android-review.googlesource.com/474805

Change-Id: I6242e0c904497a115e367dea6927ba1c4b906355
2017-09-21 12:37:19 -07:00
Dan Willemsen
c77a0b3f9c Extract the linker and embed it into host bionic binaries
The linux kernel requires that the ELF interpreter (runtime linker)
that's referenced by PT_INTERP be either an absolute path, or a relative
path from the current working directory. We'd prefer a relative path
from the binary, similarly to how we handle looking up shared libraries,
but that's not supported.

Instead, extract the load sections from the runtime linker ELF binary
and embed them into each host bionic binary, omitting the PT_INTERP
declaration. The kernel will treat it as a static binary, and we'll use
a special entry point (linker_wrapper) to fix up the arguments passed by
the kernel before jumping to the embedded linker. From the linker's
point of view, it looks like the kernel loaded the linker like normal.

Bug: 31559095
Test: Enable host bionic,
      out/soong/host/linux_bionic-x86/nativetest64/libdemangle_test/libdemangle_test
Change-Id: I8d0aea9790b5e86fcc3ea6e2d00cfa33907e2853
2017-09-20 15:34:33 -07:00
Dan Willemsen
3e5bdf29ba Add cc_genrule
cc_genrule is the same as a normal genrule, but can depend on other cc
modules (like cc_object).

Test: mmma external/minijail
Change-Id: I8df87665c7bdc76ce89c92755c054f967a818e57
2017-09-18 23:33:25 -07:00
Colin Cross
38f794ee49 Refactor proto in preparation for java proto support
Test: m -j checkbuild
Change-Id: Idf00ea0bacb2777458f9af2c7eb47e1e1854eeba
2017-09-11 12:41:58 -07:00
Colin Cross
fee57cb33e Move error_prone config to external/error_prone
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-09-05 22:08:13 -07:00
Nan Zhang
a3fc4ba733 Add support for python_defaults modules
Test: python_test.go
Change-Id: I2077414a5b06da5e660a1b48bfdb2eb926fb702f
2017-09-05 17:31:24 -07:00
Colin Cross
c6bbef326f Add error-prone support
Add support for compiling java sources with the error-prone tool.

Test: m -j checkbuild
Change-Id: Ieb4ee0e05f8f34a52ed7bcf1c7cbacf1c9c4d0b5
2017-08-28 11:12:38 -07:00
Jeff Gaston
01547b23d2 Extract jar-sorting to be accessible to soong_zip
Bug: 64536066
Test: m -j # which runs unit tests
Change-Id: I4830bd331c9dab0b1d300a18aefaf25a6af4cfdc
2017-08-24 14:43:35 -07:00
Stephen Crane
ba090d16c2 Add LTO support to soong
Enabling the lto property for a module builds that module and all static
dependencies with LTO.

LTO (link-time optimization) allows the compiler to optimize and
generate code for the entire module at link time, rather than
per-compilation unit. LTO is required for Clang CFI and other
whole-program optimization techniques. LTO also allows cross-compilation
unit optimizations that should result in faster and smaller code, at the
expense of additional compilation time.

Test: make -j12 libc with lto: true for libc

Change-Id: Ib8baefedf60e02701d44673a7c473e0845730101
2017-08-15 12:54:12 -07:00
Jeff Gaston
f1fd45e784 Revert "Revert "Cacheable, multithreaded finder.""
Bug: 62455338
Test: m -j

This reverts commit d1abeb9d98.

Change-Id: I9f73031636157511b5f1c6ce8a205e9bc91669ff
2017-08-10 12:20:30 -07:00
Jeff Gaston
d1abeb9d98 Revert "Cacheable, multithreaded finder."
This reverts commit b6d161bf16.

Reason for revert: New Build Breakage: aosp-master/sdk_mac @ 4260825

Change-Id: I8bda8c50c5e5c9f84621d11a4c15b168833bcd21
2017-08-10 01:16:34 +00:00
Jeff Gaston
b6d161bf16 Cacheable, multithreaded finder.
It can find every Android.bp in internal master in
about 2.5 sec the first time and 0.3 sec subsequent times

Bug: 62455338

Test: m -j blueprint_tools # which runs the unit tests

Test: m -j blueprint_tools && \
  out/soong/host/linux-x86/bin/finder \
    -v
    --db /tmp/mydb \
    --names Android.mk \
    --prune-files .android-out-dir \
    --exclude-dirs .git,.repo \
    . \
    >/tmp/finder-log 2>&1

Change-Id: I5ab2650459a1dae0d5d076faf411ec2d053c743d
2017-08-08 14:19:55 -07:00
Colin Cross
72bb363608 Add basic tests for java modules
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
2017-07-19 23:17:43 +00:00
Justin Yun
8effde47de Install VNDK libs in /system instead of /vendor
If BOARD_VNDK_VERSION is set, and a module is set to
`vendor_available: true` it is installed in /system and /vendor.

However, if the module is a VNDK library, it must be
installed at `/system/${LIB}/vndk` instead of /vendor/${LIB}.
For those modules, need following to set.

vendor_available: true,
vndk: {
    enabled: true,
    support_system_process: true,
},

`support_system_process` is optional to define.
If it is defined to true, the module is regarded as vndk-sp.

link-type check for VNDK modules is added to make sure that VNDK
modules only link to other VNDK shared libraries or LL-NDKs.

move the ABI checks to VNDK from all of vendor_available.

Bug: 38304436
Test: attempt to compile with BOARD_VNDK_VERSION:=current
Test: Use `vendor_available_vndk: true` for VNDK modules and compile
      with BOARD_VNDK_VERSION:=current
Change-Id: I409268e0b7f05a9d01697bf9f9f4726b5aac631f
2017-07-18 14:48:29 +09:00
Colin Cross
cec8171420 Add integration testing infrastructure
Fix mutator registration for tests to allow different tests
in the same package to register different mutators.

Allow tests to track the resulting ModuleBuildParams objects
to use in assertions, and provide helpers for getting them.
For example:
    config := android.TestConfig(buildDir)
    ctx := android.NewTestContext()
    ctx.RegisterModuleType(...)
    ctx.MockFileSystem(...)
    ctx.ParseBlueprintsFile("Android.bp")
    ctx.PrepareBuildActions(config)
    ctx.Register()
    // Get the Inputs value passed to the javac rule for the foo module
    inputs := ctx.ModuleForTests("foo".Rule("javac").Inputs

Test: java_test.go
Change-Id: I10c82967f5f3586d2c176f169906b571ed82fc73
2017-07-14 14:19:51 -07:00
Jiyong Park
d773eb3e86 add device_kernel_headers module for vendor-specific kernel headers
device_kernel_headers is a built-in heder-only lib that provides device-specific
kernel headers. The header path is configured via a new product variable
SystemIncludeDirs, which is currently the mirror of
TARGET_PROJECT_SYSTEM_INCLUDES in the make world.

Note: generic kernel headers (bionic/libc/kernel) have been added to the
include path by default. "device_kernel_headers" module is for device-specific
kernel headers such as /device/*/*/kernel-headers.

Note 2: this is opt-in for Android.bp modules (i.e. header_libs :
["device_kernel_headers"] required.) while it is always provided to
Android.mk modules.

Bug: 62939405
Test: choosecombo to aosp_sailfish (or any other Pixel/Nexus targets)
BOARD_VNDK_VERSION=current m -j gralloc.msm8996 (or any other vendor
libs using vendor-specific kernel headers)

Change-Id: I81c60abc13942c89fff723d1544b27a81b300db0
2017-07-08 09:29:04 +09:00
Colin Cross
3e3e72da90 Add java config and share it with make
Add a java/config package to hold config information, and share
it with make through makevars.

Test: builds
Change-Id: I46c088bda0fe97a1823bfdd80fa692d0bf61da1b
2017-06-23 11:24:54 -07:00
Jeff Gaston
aff66e55a9 Revert "Revert "Initial implementation of bpfix""
Bug: 38351765
Test: bpfix Android.bp

This reverts commit a8cc9c53fa.

Change-Id: I60f02a8dd920346aa17b9044f834ffe94fa693c6
2017-06-19 15:52:15 -07:00
Jeff Gaston
efc1b412f1 Have Soong try to enforce that genrules declare all their outputs.
This causes Soong to put the outputs of each genrule into a temporary
location and copy the declared outputs back to the output directory.
This gets the process closer to having an actual sandbox.

Bug: 35562758
Test: make

Change-Id: I8048fbf1a3899a86fb99d71b60669b6633b07b3e
2017-06-09 17:57:18 +00:00
Jeff Gaston
a8cc9c53fa Revert "Initial implementation of bpfix"
This reverts commit de4b0463f2.

Reason for revert: postsubmit build broken

Change-Id: If68a4af22e517b7be0876343a81c1319fa4d7046
2017-05-26 00:29:26 +00:00
Jeff Gaston
de4b0463f2 Initial implementation of bpfix
Bug: 38351765
Test: bpfix Android.bp

Change-Id: Ia94602f93bc40db3d006174c39102ac5fd29a64c
2017-05-24 13:06:35 -07:00
Nan Zhang
5323f8e32f Add python_test_host module.
bug: 31676493
Test: created py_test modules in real folder. and ran 'mma'.
Change-Id: I22aa2fad74b11e4a31ea7a4c4a4f0ea64cd3fc94
2017-05-17 11:26:00 -07:00
Colin Cross
2a252bef50 Support .rs and .fs files in cc_* module srcs lists
Translate .rs and .fs files to .cpp files using llvm-rs-cc.

Test: builds
Change-Id: I242cea0d09c9985730a512cec7705c3f1479f4ed
2017-05-05 18:22:30 -07:00
Colin Cross
7e0eaf15b9 Support %s in product variable properties
Support using strings as product variable substitutions, and
add tests for printfIntoProperty.

Test: varaible_test.go
Change-Id: I06cfadfb1d3fc81da72fb71323706df20426c8b7
2017-05-05 18:22:30 -07:00
Nan Zhang
db0b9a3cf3 Supported python build in host side.
The base module handles all the common functionalites, such as version
compatibilty check, version variations split, source file format check,
source/data file duplicate check.

The library/binary module focuses on how to generate binary build actions,
such as setting up stub script, zipping, filling in __init__.py in
runfiles dir tree.

Bug: b/31676493
Test: go test under python package

Change-Id: I06608369f350f7195873d459e1c8d1bdb811e77e
2017-05-05 13:27:56 -07:00
Jayant Chowdhary
3e231fd8bd Add header-abi-checker for Vndk abi checks.
header-abi-dumper: dumps abi exported by source files for Vndk.
header-abi-linker: links abi dumps produced by header-abi-dumper.
header-abi-diff: compares linked dumps.

Test: mm -j64 showcommands > make_log in bionic/libc.
      This produced linked dumps in out/soong/.intermediates.
      Copied these dumps to
      prebuilts/abi-dumps/ndk/current/arm64/source-based/.
      Changed the abi and re-ran mm -j64 showcommands > make_log
      confirmed that the build reported compatibility breakge without
      actually failing (advisory mode).

Change-Id: Iccad6908fe68a80f47230751671d156893b96ead
2017-04-14 19:48:10 -07:00
Dan Willemsen
4416e5db69 Split /system and /vendor modules, allow multi-installation
Nothing changes if BOARD_VNDK_VERSION isn't set.

When the VNDK is enabled (BOARD_VNDK_VERSION in Make), this will split
/system and /vendor modules into two different variant spaces that can't
link to each other. There are a few interfaces between the two variant
spaces:

The `llndk_library` stubs will be available in the /vendor variant, but
won't be installed, so at runtime the /system variant will be used.

Setting `vendor_available: true` will split a module into both variants.
The /system (or "core") variant will compile just like today. The
/vendor ("vendor") variant will compile against everything else in the
vendor space (so LL-NDK instead of libc/liblog/etc). There will be two
copies of these libraries installed onto the final device.

Since the available runtime interfaces for vendor modules may be
reduced, and your dependencies may not expose their private interfaces,
we allow the vendor variants to reduce their compilation set, and export
a different set of headers:

  cc_library {
      name: "libfoo",
      srcs: ["common.cpp", "private_impl.cpp"],
      export_include_dirs: ["include"],
      target: {
          vendor: {
	      export_include_dirs: ["include_vndk"],
	      exclude_srcs: ["private_impl.cpp"],
	      srcs: ["vendor_only.cpp"],
	  },
      },
  }

So the "core" variant would compile with both "common.cpp" and
"private_impl.cpp", and export "include".

The "vendor" variant would compile "common.cpp" and "vendor_only.cpp",
and export "include_vndk".

Bug: 36426473
Bug: 36079834
Test: out/soong/build.ninja, out/soong/Android- only changes due to _core addition and
      .llndk -> .vendor
Test: attempt to compile with BOARD_VNDK_VERSION:=current
Change-Id: Idef28764043bf6c33dc0d2e7e2026c38867ff769
2017-04-11 12:27:41 -07:00
Dan Willemsen
b916b80bf3 Add LLNDK support for the VNDK
Instead of using the NDK headers and libraries, add LL-NDK specific
headers and library stubs for VNDK users. This allows us to provide an
expanded liblog interface.

Test: aosp_arm; m -j
Test: Enable BOARD_VNDK_VERSION on aosp_arm; m -j
Test: Inspect out/soong/build.ninja before/after (w/o vndk)
Change-Id: Ic85f07fa10c695b5baab10c41f5e0ad38700bf3d
2017-04-07 10:18:56 -07:00
Dan Albert
30c9d6e771 Generate file to map codenames to API levels.
The NDK stub library generator needs to know what unreleased API
levels exist and what the ordering is between them. This singleton
will later be expanded to generate api-level.h to cut down on
duplication.

Test: make out/soong/api_levels.json && cat out/soong/api_levels.json
Bug: None
Change-Id: I53126dd2cacb67c331c44f7d7c77c98b176b93cd
2017-03-31 12:27:42 -07:00
Dan Willemsen
615609854f Revert "install *.so in different paths for their types"
This reverts commit 4c48f724e1. It's
causing test failures, warnings and complaints, so backing it out and
we'll resolve those before putting it back in.

Bug: 33681361
Test: m -j
2017-03-16 19:48:32 -07:00
Dan Willemsen
01a405a481 Add LinuxBionic toolchain and switch
This adds a toolchain definition for LinuxBionic that only supports
Clang/64-bit. It pulls pieces from the x86_linux_host and x86_64_device
configs, and uses the android clang triple, with some manual overrides.

To enable building this, set your soong.config file to:

 {"Host_bionic": true}

Bug: 31559095
Test: out/soong/{Android,make-vars}-aosp_arm64.mk the same with or
      without host bionic turned on
Test: No change to out/soong/build.ninja before/after this change
Change-Id: Id97dda8bd9aa670c32aed31fbe6aaa8175e70b59
2017-03-15 14:18:42 -07:00
Jiyong Park
4c48f724e1 install *.so in different paths for their types
Shared libraries are now installed to different directories depending on
their types.

* NDK libraries: /system/lib/ndk
* VNDK libraries: /system/lib/vndk
* VNDK-ext libraries: /system/lib/vndk-ext
* Framework-only libraries: /system/lib
* Vendor-only libraries: /vendor/lib
* Same-process HALs: /vendor/lib/sameprocess

In addition, a new module type vndk_ext_library is added. It is almost
identical to cc_shared_library but it introduces another attribute
'extends'. This is use to reference the vndk library that this vndk-ext
library is extending.

For example, in order to extend a vndk library libFoo:

cc_library {
  name: "libFoo",
  srcs: [...]
}
---------------------
vndk_ext_library {
  name: "libFoo-extended",
  srcs: [...]
  extends: "libFoo"
}

Then, libFoo will be installed as /system/lib/vndk/libFoo.so and
libFoo-extended will be installed as /system/lib/vndk-ext/libFoo.so.
Note that file name of the latter is libFoo.so, not libFoo-extended.so:
file name of an extending module is automatically set to that of the
extended module.

Bug: 33681361
Test: build & run. Libraries must be in the correct directories.
Change-Id: Ia1eb3940605d582a252c78da0f3a5b36fdab062b
2017-03-14 09:13:44 +09:00
Josh Gao
7bd4c5c339 Add libwinpthread, link it into win32 binaries.
Bug: http://b/31665213
Test: wine adb.exe
Test: wine fastboot.exe
Change-Id: I6d6ff69f0c016e2654119a09161685841cbccc7e
2017-02-23 17:57:03 -08:00
Dan Willemsen
581341d4f2 Native Coverage support in Soong (gcov)
This is configured the same as make -- a global NATIVE_COVERAGE=true
flag to allow native coverage, then COVERAGE_PATHS=path1,path2,... to
turn it on for certain paths.

There are .gcnodir files exported to Make and saved in $OUT/coverage/...
files which are `ar` archives containing all of the compiler-produced
.gcno files for a particular executable / shared library.

Unlike the Make implementation, this only passes links the helper
library (automatically through --coverage) when one of the object files
or static libraries being used actually has coverage enabled.

Host support is currently disabled, since we set -nodefaultlibs, which
prevents libclang_rt.profile-*.a from being picked up automatically.

Bug: 32749731
Test: NATIVE_COVERAGE=true COVERAGE_PATHS=system/core/libcutils m -j libbacktrace libutils tombstoned
      $OUT/coverage/system/lib*/libcutils.gcnodir looks correct (self)
      $OUT/coverage/system/lib*/libbacktrace.gcnodir looks correct (static)
      $OUT/coverage/system/lib*/libutils.gcnodir doesn't exist (shared)
      $OUT/coverage/system/bin/tombstoned.gcnodir looks correct (executable)
Test: NATIVE_COVERAGE=true COVERAGE_PATHS=external/libcxxabi m -j libc++
      Confirm that $OUT/coverage/system/lib*/libc++.gcnodir looks correct (whole_static_libs)
Change-Id: I48aaa0ba8d76e50e9c2d1151421c0c6dc8ed79a9
2017-02-14 13:05:48 -08:00
Fabien Sanglard
d61f1f4559 Add support for CMakefile generation
Test: Manually generated CMakeLists.txt for gui/ui/aapt2.

Change-Id: I7dedc300c1e50b8e39bc58091b650c0bbe2c62da
2017-02-07 09:43:02 -08:00
Nan Zhang
6d34b308ff Added phony module type for soong.
The "required" field within "phony" module in .bp file has to be
non-empty. And "phony" module doesn't contain any "src" files.
Bug: b/32981153
Test: make -j out/soong/build.ninja

Change-Id: Iaa2009467c44702572b97ca9cbd02c1d368c8d83
2017-02-06 22:23:19 -08:00
Dan Willemsen
1e70446251 Add a Go replacement for our top-level Make wrapper
Right now this mostly just copies what Make is doing in
build/core/ninja.mk and build/core/soong.mk. The only major feature it
adds is a rotating log file with some verbose logging.

There is one major functional difference -- you cannot override random
Make variables during the Make phase anymore. The environment variable
is set, and if Make uses ?= or the equivalent, it can still use those
variables. We already made this change for Kati, which also loads all of
the same code and actually does the build, so it has been half-removed
for a while.

The only "UI" this implements is what I'll call "Make Emulation" mode --
it's expected that current command lines will continue working, and
we'll explore alternate user interfaces later.

We're still using Make as a wrapper, but all it does is call into this
single Go program, it won't even load the product configuration. Once
this is default, we can start moving individual users over to using this
directly (still in Make emulation mode), skipping the Make wrapper.

Ideas for the future:
* Generating trace files showing time spent in Make/Kati/Soong/Ninja
  (also importing ninja traces into the same stream). I had this working
  in a previous version of this patch, but removed it to keep the size
  down and focus on the current features.
* More intelligent SIGALRM handling, once we fully remove the Make
  wrapper (which hides the SIGALRM)
* Reading the experimental binary output stream from Ninja, so that we
  can always save the verbose log even if we're not printing it out to
  the console

Test: USE_SOONG_UI=true m -j blueprint_tools
Change-Id: I884327b9a8ae24499eb6c56f6e1ad26df1cfa4e4
2017-02-06 14:05:07 -08:00
Colin Cross
faeb7aa135 Support data properties for test binaries
Allow tests to specify a data property that lists files or filegroup
modules that will be packaged alongside the test.  Also add a path
property to filegroup modules to allow shifting the path of the
packaged files, and add ExpandSourcesSubDir to expand the filegroup
sources while including a shifted relative path in the Paths objects.

Test: soong tests, manually adding data to a module
Change-Id: I52a48942660e12755d313ef13279313361b4fc35
2017-02-02 16:23:30 -08:00
Colin Cross
068e0feace Support filegroups
filegroup is a module that contains a list of files, and can be used
to export files across package boundaries.  filegroups (and genrules)
can be referenced from srcs properties of other modules using the
syntax ":module".

Test: m -j
Change-Id: I3d6fc4819c0b4225b474e0ad42f0d947f55a5961
2016-12-17 16:34:03 +00:00
Dan Willemsen
2e47b34435 Add Toolchain.Bionic()
Move some cc ctx.Host() / ctx.Device() checks over to using
ctx.toolchain().Bionic(). There will be more changes, these are just the
obvious ones dealing with host_ldlibs / crt / system libraries.

Bug: 31559095
Test: out/soong/build.ninja is identical
Change-Id: Ibba60483b4ab0e01f6996eb7d883120e4acc1830
2016-11-17 01:50:43 -08:00
Dan Willemsen
00fcbde401 Add LinuxBionic OsType
Actual support will come in later changes.

Bug: 31559095
Test: out/soong/build.ninja is identical
Change-Id: I31392fb78a51f43567d16aef89e32cd5137cdbc1
2016-11-17 01:49:50 -08:00
Colin Cross
6bde0948d2 Add android.Expand
Add android.Expand to expand $() variables in properties.

Test: expand_test
Bug: 31948427
Change-Id: Id30856a1d21d02e8997fcf2358e4a5feeede05be
2016-11-04 15:59:23 -07:00
Colin Cross
7f19f37443 Move globbing to Blueprint
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
2016-11-04 04:54:16 +00:00
Dan Willemsen
a03cf6d322 Add clang-tidy support
For every file which we can run clang-tidy (C/C++ clang-built), we add a
new build node that depends on the object file (since clang-tidy does
not export a depfile), and is depended on by the link step. This is
better than how we're doing it in make, since calling tidy can be turned
on or off without needing to rebuild the object files.

This does not attempt to port WITH_TIDY_ONLY from Make, since the way
that it works is broken (due to the lack of a depfile).

Bug: 32244182
Test: WITH_TIDY=true mmma -j bionic/libc
Test: ./soong (Setting ClangTidy: true)
Change-Id: I40bbb5bb00d292d72bf1c293b93080b5f9f6d8ea
2016-10-31 16:21:01 -07:00
Colin Cross
0c461f1f6e Add support for .proto files
.proto files are translated to .pb.cc and .pb.h files, which are then
compiled normally.

Bug: 32286026
Test: mmma -j system/extras/perfprofd
Change-Id: I538071424d667aacf35b4b8bfebe217f5f092726
2016-10-27 15:28:09 -07:00
Colin Cross
0d614dd222 Re-enable prebuilt_test
Use a temporary directory as the build directory during tests so files
don't get written to the source tree.

Also add a few more tests for prebuilts with no file specified.

Bug: 31800129
Test: m -j, make sure .soong.environment is not written to the source tree
Change-Id: I623bc114b2ff534c8df9fb3ce273e804711f8f05
2016-10-14 17:07:49 -07:00
Colin Cross
b778a9cb4e Disable prebuilt_test
The prebuilt tests are accidentally writing a .soong.environment file to
the build/soong/android directory, disable them until TestConfig() is
fixed to prevent writing to the source tree.

Bug: 31800129
Test: m -j, make sure .soong.environment is not written to the source tree
Change-Id: I3b7d47e42111ecababe275b7a9ff0d08bcebfc7a
2016-10-13 18:09:51 -07:00
Colin Cross
ce75d2c6a2 Initial prebuilt support
Support prebuilt shared libraries as an initial proof-of-concept of
prebuilts.  Future changes will support binaries and static libraries,
and the ability to select which to use based on something besides
blueprint properties.

Test: TestPrebuilts run during m -j
Change-Id: I6e84da667e9005ae11844bad01d25cbe4ced1ce3
2016-10-13 14:52:47 -07:00
Colin Cross
798bfce9d0 Move registration into android package
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
2016-10-12 14:30:44 -07:00
Dan Willemsen
394e9dc876 Add Relocation Packer support
This only applies to shared libraries on the device, and like stripping,
we'll let make do the actual packing if we're embedded in Make.

Change-Id: I1585d74ecfc41e18dcbb5ffb70005adf007cc941
2016-09-15 03:39:05 +00:00
Colin Cross
178a509855 Replace PropertyCustomizer with hooks
Replace PropertyCustomizer with a more extensible hooks mechanism.
Instead of passing an object that satisifies an interface, pass a
function pointer that takes a context interface as an argument.  Callers
can use lambdas to capture any other necessary parameters like property
structs.

Also add two new hooks, arch hooks that occur after splitting modules
into arch variants, and install hooks that occur each time a file is
installed to the output directory.

Change-Id: I3a3e34aa97f1a92d3a31e5004b4b1ba68869d242
2016-09-13 17:37:32 -07:00
Dan Willemsen
377737a01c Move Android.bp definitions into subdirs
Test: m blueprint_tools still produces the same tools
Change-Id: Ia1e2e43c62cb6035616bef9fbef56417b46cf3a4
2016-08-25 15:50:21 -07:00
Colin Cross
a120ec1c5e Add PropertyCustomizer
Allow any module factory to insert a PropertyCustomizer on the module,
which will be called before any other mutators.  The PropertyCustomizer
can append or prepend to any properties, allowing module types to extend
other module types by modifying the public, stable interface provided by
the properties.

Change-Id: Idff02be80d939a70df1c6bbccffdd1f04ff975d2
2016-08-22 17:08:06 -07:00
Colin Cross
9272ade7a8 Add DeviceConfig and OncePer objects
Add DeviceConfig to store per-device configuration information.  Put a
OncePer object inside Config and DeviceConfig, which computes a value
once per key per object to allow build logic to store arbitrary
per-build or per-device computed values.

Change-Id: I1a38b426f29d223ef5e803e0d4d9604500de2fd2
2016-08-17 16:39:06 -07:00
Dan Willemsen
47ec28f3b1 Rename soong_jar to soong_zip
This is a general purpose tool that happens to contain some jar specific
features.

Change-Id: I05f4654d4517c245ad7a3c15492e0d2368bbf64f
2016-08-11 01:30:16 -07:00
Dan Willemsen
017d8937fa soong_jar: Parallel compression
This compresses multiple files in parallel, and will split up larger
files (5MB+) into smaller chunks (1MB) to compress in parallel.

There is a small size overhead to recombine the chunks, but it's only a
few bytes per chunk, so for a 1MB chunk, it's minimal.

Rough numbers, with everything in the page cache, this can compress
~4GB (1000 files) down to 1GB in 6.5 seconds, instead of 120 seconds with
the non-parallel soong_jar and 150 seconds with zip.

Go's DEFLATE algorithm is still a bit worse than zip's -- about 3.5%
larger file sizes, but for most of our "dist" targets that is fine.

Change-Id: Ie4886c7d0f954ace46e599156e35fea7e74d6dd7
2016-08-11 01:30:16 -07:00
Dan Willemsen
3bf1a08505 Add zip2zip tool to copy zip entries from one file to another
This doesn't do any decompression / recompression, but just copies over
the already compressed contents. So it's similar to zip -U, but allows
rewriting of the paths.

The first expected usecase is to replace img_from_target_files during
the build, since it does the equivalent of this:

zip2zip -i <target-files.zip> -o <img.zip> OTA/android-info.txt:android-info.txt IMAGES/*:.

Except it decompresses and recompresses the images, which takes over a
minute instead of a few seconds.

Change-Id: I88d0df188635088783223873f78e193272dbdf1c
2016-08-10 16:57:03 -07:00
Colin Cross
b916a38233 Refactor cc modules to use decorators instead of inheritance
For example , instead of trying to have libraryLinker inherit from
baseLinker and libraryCompiler inherit from baseCompiler, create a
single decorator object that wraps both baseLinker and baseCompiler.

Test: Builds, no unexpected changes to build.ninja
Change-Id: I2468adaea8466c203a240259ba5694b8b1df7a52
2016-08-05 10:25:09 -07:00