Commit graph

325 commits

Author SHA1 Message Date
Inseob Kim
1f086e2f0d Generate VNDK snapshot with Soong except configs
This is the first commit to generate VNDK snapshot with Soong: .so
files, some txt files, and notice files are captured with Soong. As
ld.config.txt is currently in Android.mk and will be deprecated soon,
configs files (and zipping all of artifacts) are still handled with
Makefile.

Bug: 131564934
Test: 1) DIST_DIR=out/dist development/vndk/snapshot/build.sh
Test: 2) try installing vndk snapshot with:
     development/vndk/snapshot/update.py

Change-Id: I8629e1e25bfc461fd495565bb4872c9af176cf92
2019-05-15 10:26:54 +09:00
Pete Gillin
42e862c56d Merge "Rename EXPERIMENTAL_USE_OPENJDK9 to EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9." 2019-05-10 11:50:08 +00:00
Pete Gillin
0c2143e1ee Rename EXPERIMENTAL_USE_OPENJDK9 to EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9.
The current EXPERIMENTAL_USE_OPENJDK9 environment variable is a legacy
from when the 8 -> 9 toolchain upgrade was happening. That migration
is done and the variable only affects the language level, so it should
have a name that reflects that. (The current situation would be
especially confusing if we started a 9 -> 11 toolchain upgrade,
presumably controlled by a variable like EXPERIMENTAL_USE_OPENJDK11,
since the two settings look incompatible but are actually orthogonal.)

The current variable historically allowed a value or "1.8" which meant
"use the OpenJDK 9 toolchain but target language level 8". That value
no longer has any meaning and the new variable doesn't allow it.

Bug: 131678633
Test: `make` with `EXPERIMENTAL_JAVA_LANGUAGE_LEVEL_9=true`
Test: `javap -v $OUT_DIR/soong/.intermediates/libcore/core-oj/android_common/javac/classes/java/util/List.class | grep 'major version'` shows 53
Test: Audit all mentions of the old string here and downstream
Change-Id: Idad808c7f07913baba1a777627322d5452dabcef
2019-05-09 15:36:29 +01:00
dimitry
1f33e40972 Add native_bridge target to Android.bp
This allows us to build guest libraries for the native bridge for
arm/arm64 architectures.

Bug: http://b/77159578
Test: make
Change-Id: I35520ca456105ddadd456c78a4eb1e6de39147c5
2019-05-03 15:33:28 +02:00
Treehugger Robot
18805e483f Merge "Build contexts files with Soong" 2019-04-25 07:46:19 +00:00
Treehugger Robot
588c1ee5f8 Merge "Fix tests with cc_binary_host on mac" 2019-04-23 04:12:26 +00:00
Inseob Kim
0866b003b2 Build contexts files with Soong
This is to migrate sepolicy Makefiles into Soong. For the first part,
file_contexts, hwservice_contexts, property_contexts, and
service_contexts are migrated. Build-time tests for contexts files are
still in Makefile; they will also be done with Soong after porting the
module sepolicy.

The motivation of migrating is based on generating property_contexts
dynamically: if we were to amend contexts files at build time in the
future, it would be nicer to manage them in Soong. To do that, building
contexts files with Soong can be very helpful.

Bug: 127949646
Bug: 129377144
Test: 1) Build blueline-userdebug, flash, and boot.
Test: 2) Build blueline-userdebug with TARGET_FLATTEN_APEX=true, flash,
and boot.
Test: 3) Build aosp_arm-userdebug.

Change-Id: I49206e656564206d6f7265206361666665696e65
2019-04-23 10:10:56 +09:00
Colin Cross
9c6241f768 Fix tests with cc_binary_host on mac
cc_binary_host on mac uses ctx.Config().HostSystemTool(), which needs
PATH in the test environment.  Copy it from the original environment.

Fixes: 129763458
Test: proto_test.go
Change-Id: I41c1acdceee7c35036148256adafb471871034df
2019-04-22 15:55:56 -07:00
Colin Cross
e928452f30 Merge "Allow codename.fingerprint format for targetSdkVersion" 2019-04-22 16:48:35 +00:00
Colin Cross
109328714f Allow codename.fingerprint format for targetSdkVersion
Use codename.fingerprint format for targetSdkVersion if it is unset
in the manifest and UNBUNDLED_BUILD_TARGET_SDK_WITH_API_FINGERPRINT=true.

Test: manual
Bug: 130541924
Change-Id: I4e3b1274cc32038b00b292dc6d67559eb320e9e4
2019-04-18 16:05:37 -07:00
Dan Willemsen
54879d193e TARGET_FS_CONFIG_GEN is a list, not a single path
Bug: 130787336
Test: m oemaids_header_gen oemaids_headers passwd group
Test: Set TARGET_FS_CONFIG_GEN to a list of paths
Change-Id: Ic1f7d38239f3f805ca0723c24005d3e18a811870
2019-04-18 17:16:41 +00:00
Dan Willemsen
4e0aa23dd3 Convert yacc to a single RuleBuilder rule
So that <module>/gen/yacc/... is (re)created by a single rule, previous
files are removed, and location.hh is in the build graph when it is
produced.

Test: treehugger
Change-Id: I2f6e47ea07f315e10ae1cb8ad50697e7123d0285
2019-04-15 14:52:05 -07:00
Dan Willemsen
71c7460713 Expose TargetFSConfigGen to DeviceConfig from Make
Bug: 118089258
Test: m oemaids_header_gen oemaids_headers
Change-Id: I2675822ae01af9bbec70f0c0413c047f36b5e024
2019-04-10 20:24:16 -07:00
Dan Willemsen
412160e1c9 Stop using build/target -> build/make/target symlink
Instead, fully specify build/make/target/... everywhere

Test: treehugger
Change-Id: I07ba0e9b0604919a271afd5133070616e1f404fc
2019-04-09 21:36:26 -07:00
Colin Cross
092c9da922 Export more config variables
Export some more config variables that will be used to generate
robolectric's build.prop file.

Bug: 122331577
Test: m checkbuild
Change-Id: I39f3436ed5d5c4e730dd3e1f86c840cf6358ec87
2019-04-04 03:59:41 +00:00
Colin Cross
ff0daf4ccf Fix sdk_version: "system_current" when Platform_sdk_final=true
When PLATFORM_VERSION_CODENAME is set to REL Platform_sdk_final
becomes true, which causes the return value of sdkVersionToNumber
for "system_current" to a real version number instead of
FutureApiLevel.  This enables the check against
PlatformSystemSdkVersions, which doesn't contain "current".  Use
the numeric value instead.

Fixes: 129786845
Test: sdk_test.go
Change-Id: If7cf211cc01c5fbf3e3ece3c3f604718a13d5a9b
2019-04-02 23:18:30 +00:00
Anton Hansson
53c88448fd Separate device and product overlays
This change adds book-keeping of whether an overlay came from
DEVICE_PACKAGE_OVERLAYS or PRODUCT_PACKAGE_OVERLAYS. This is
later used when writing the output to soong_app_prebuilt.mk, to
use either LOCAL_SOONG_[DEVICE|PRODUCT]_RRO_PACKAGES depending
on the original source.

This change is intended to be a noop on its own, but allows a
follow-up make change to customize the location of the auto-generated
RRO packages.

Bug: 127758779
Test: verify noop on presubmit targets
Change-Id: Ib24fe1d05be132c360dd6966f7c83968c9939f77
2019-03-21 11:25:46 +00: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
07e51619a2 Remove ModuleSrcPath
ModuleSrcPath was designed as a type that ensured that modules only
referenced sources inside the directory that contained the Android.bp
file.  In practice they don't work very well, because allowing
filegroups and genrules as inputs to any module that takes a source
path means that the path might end up being to a file in another
source directory or to a generated file in the output directory.

Remove ModuleSrcPath, replacing it with SourcePath in the places
that need to explicitly refer to a path in the source tree, or
Path where it may be a source path or a generated path.

Make PathForModuleSrc return a Path instead of a SourcePath in
preparation for consolidation with ctx.ExpandSources, which will
make it possibly return paths to generated files.

Test: All soong tests
Change-Id: I973a78470ed14307eea5f6d0cc93942775a65715
2019-03-20 19:36:03 +00:00
Pirama Arumuga Nainar
4e128282f2 Enable coverage universally if COVERAGE_PATHS includes "*"
http://b/116873221

This will be used in a target in the build server to build all native
code with coverage.

Test: 'm NATIVE_COVERAGE=true COVERAGE_PATHS=* nothing' works as
expected.

Change-Id: I55d644ed9212c4ab0f1e4a00aac3a467fcf2a463
2019-03-01 16:17:53 -08: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
9be4152c21 Pass DEXPREOPT_BOOT_JARS_MODULES to Make
Make is not setting PreoptBootJars, pass the value computed in
Soong back to Make.

Test: m checkbuild
Change-Id: Ie3db926df9c5d6bf18db1003b95823c7566800a9
2019-02-20 22:06:30 -08:00
Colin Cross
69f59a3327 Make RuleBuilder methods take Paths
There are no more Make paths being used in Soong now that
dexpreopting and hiddenapi are in Soong. Use the Path types
in the inputs to RuleBuilder, and fix all users of RuleBuilder.

This reapplies I886f803d9a3419a43b2cae412537645f94c5dfbf with
fixes to disable preopt for Soong-only builds when the global
dexpreopt.config doesn't exist.

Test: all soong tests
Test: m checkbuild
Change-Id: I4dae9ecd5de22f062f9478ec8f0747f099cf8190
2019-02-20 22:06:09 -08:00
Colin Cross
93a9e5e3a2 Don't check ABIs in SecondArchIsTranslated
SecondArchIsTranslated is only used to determine whether or not to
dexpreopt the second arch, so it should return false for the case
where the primary and secondary arches are X86_64 and X86, but the
primary arch also lists an Arm ABI.

Bug: 124711830
Test: m on failing build
Change-Id: I6afc2fdda466e0c406dbeada2e9c3df2bb6853bf
2019-02-19 18:18:30 +00: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
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
Kostya Kortchinsky
d5275c8657 Add option to disable Scudo globally [Soong]
This adds an option in Soong to turn off Scudo globally.

Bug: 123228023
Test: enable Scudo for tombstoned, lunch marlin_svelte-eng && m -j, and
make sure that Scudo is not linked in
out/target/product/marlin/system/bin/tombstoned
Test: enable Scudo for tombstoned, lunch marlin-userdebug && m -j, and
make sure that Scudo is linked in
out/target/product/marlin/system/bin/tombstoned

Change-Id: I0b0992446953fc4074bde94507b66f92764c8143
Merged-In: I0b0992446953fc4074bde94507b66f92764c8143
2019-02-04 12:29:17 -08:00
Colin Cross
a74ca046da Replace *[]string with []string in product variables
There is no need for *[]string, []string can already hold a nil
value to specify "not set".

Test: all soong tests
Change-Id: I85a51b042c12aee1565a9287d62924feeeafd486
2019-02-01 16:43:02 -08:00
Jaewoong Jung
9d22a914bf Add a prod var to override package names.
Currently only java/app.go is affected by package name overrides. When
the var is used, the corresponding module's install APK name is changed
to the overriding name.

Bug: 122957760
Test: app_test.go + TreeHugger
Change-Id: Ie522da3d7280970d740d779cf2694560feae6180
2019-01-25 19:11:57 +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
Jaewoong Jung
2ad817c65d Enable certificate overrides with product vars.
Currently it is only for android_app, though it can be easily ported to
apex.

The make-side change will be made later, along with a real application.

Bug: 122957760
Test: app_test.go
Change-Id: I41f0be84f8b9f93e9518a16160e10eaa649388cd
2019-01-24 14:55:58 +00:00
David Brazdil
91b4e3e78b Disable all-assigned check in hiddenapi on master-art
Master-art configurations do not have frameworks/base and therefore do
not have hidden API flags. Pass --no-force-assign-all to `hiddenapi`
when frameworks/base does not exist to disable the corresponding
assertion. This enables us to enforce the assertion on non-master-art
builds and also get rid of logspam about missing flags on ART buildbots.

Test: art/tools/buildbot-build.sh on master-art
Bug: 123143676
Change-Id: I074d9554fb11dab3eef904016375730520107ec2
2019-01-23 22:55:41 +00:00
Colin Cross
afbb1734f6 Pass annotation processors to kotlinc
Enable the kotlin-annotation-processing plugin and pass annotation
processors to it.

Bug: 122251693
Test: m checkbuild
Test: TestKapt in kotlin_test.go
Change-Id: I841df454beaaa7edd263eea714ca0d958a03c9de
2019-01-22 21:47:19 +00:00
David Brazdil
0f670a22df Replace hiddenapi-{public,private}-list.txt with a CSV file
`hiddenapi` is being refactored to work with a single CSV file as
opposued to a multitude of text files (one per flag). This patch
changes the singleton rule for listing public/private APIs from
stubs to expect a CSV as an output.

Bug: 119068555
Test: compiles, hiddenapi-flags.csv unchanged
Change-Id: I622521d59979a6b01ecc8065a278412fedf7b9bc
2019-01-21 14:30:49 +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
Doug Horn
21b9427380 Initial Fuchsia support.
This change adds Fuchsia as a valid OS. Future changes
will add proper toolchain support.

Bug: 119831161
Test: Compile walleye. Confirm that adding `fuchsia` to the
os-specific declaration of an arbitrary target does not throw
a build error.
Change-Id: I64eb928afb7512f3fbe32abb313b4c3efe16b169
2019-01-17 16:21:07 +00:00
Ivan Lozano
b84fc9dc32 Enable execute-only memory layouts by default.
This enables execute-only memory (XOM) layouts to be used by default in
the build system. As of now, there's only support for ARM64 devices, so
this only affects those. Since userland XOM requires kernel support,
devices without the necessary support will continue to allow pages
marked execute-only to be read and they should be unaffected by this.

Bug: 77958880
Test: Device with and without kernel support boot.
Test: Binary throws segfault when reading from XOM on supported device.
Test: Debugger works and stack traces are still generated correctly.
Test: Teamfooding, stable during regular usage.

Change-Id: Ifc7438cd242a824db441b8d557454d1c3cc81eeb
2019-01-15 10:31:35 -08:00
Dan Willemsen
01a3c25ed7 Configure the default arch variant features per-OS
The minimum set of supported features are different between Android and
Linux with X86_64. So while the list of variants and features are still
technically correct, and may be shared more in the future, the default
needs to be configured differently.

Bug: 120208462
Test: add `host_supported: true` to libopus; m libopus
Change-Id: Ib79707d17b852f77341026085230c026b6386b78
2019-01-15 00:53:28 +00:00
Vladimir Marko
e8b00d69c0 Preopt: Do not strip non-image boot class path jars.
Test: Pixel 2 XL boots.
Bug: 119868597
Change-Id: I7bd3b7655aecf1a8c26dd8d4d18d3eec685ece88
2019-01-11 10:26:17 +00:00
Jiyong Park
9335a26cbd APEXes can be signed with devkeys
When PRODUCT_DEFAULT_DEV_CERTIFICATE is set to /vendor/foo/devkeys/test,
then the public/private key pairs for an apex_key is searched at
/vendor/foo/devkeys directory.

To be specific,

/system/timezone/Android.bp:
apex_key {
    name: "timezone.key",
    public_key: "com.android.tzdata.avbpubkey",
    private_key: "com.android.tzdata.pem",
}

When PRODUCT_DEFAULT_DEV_CERTIFICATE isn't set, the keys are searched at
/system/timezone, which is the path where Android.bp is located.

With PRODUCT_DEFAULT_DEV_CERTIFICATE set to /vendor/foo/devkeys/test,
the keys are searched at /vendor/foo/devkeys.

Bug: 121224311
Test: m (apex_test updated)
Test: m with crosshatch (PRODUCT_DEFAULT_DEV_CERTIFICATE is set to
/vendor/google/...)
Test: m with cheets (PRODUCT_DEFAULT_DEV_CERTIFICATE is set, but there
is no apex key there. The product is with TARGET_FLATTEN_APEX := true)

Change-Id: I213bbb96c433d851f9cc982871459fd7fb4fe47d
2019-01-11 13:35:56 +09:00
Jeongik Cha
c9464144a8 Check system certificate violation for product apks
Only if enforcement option is enable, it makes build error when there is apk located at system partition but signed with system certificate.

Bug: 74699609

Test: m -j

Change-Id: I23c41f2665dd97abac3e77d1c82d81ff91b894eb
2019-01-10 11:40:45 +09:00
Jiyong Park
7f67f48cbb Add PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES
It is a list of <module_name>:<manifest_name> pairs. When the module
name of an APK or an APEX matches with <module_name>, then its app
manifest name is overridden to <manifest_name>.

<module_name> and <manifest_name> can be patterns as in
com.android.%:com.mycompany.android.%.release

Note that, in case of APEXes, the manifest name refers to the name of
the zip container. The apex manifest name (which is specified in
apex_manifest.json) is not overridden.

Test: m with PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES for
1) an APK in Android.mk
2) an APK in ANdroid.bp
3) an APEX
and check that manifest names are modified as specified

Change-Id: Ie58882d90884695e893944c43d9c8803b283e93d
2019-01-09 21:12:27 +09:00
Colin Cross
1f367bfe8b Add a flag to allow unbundled builds to build SDKs from source
Mainline modules are tightly coupled to the platform, and should
build against the current SDK from source and not prebuilts. Add
a flag UNBUNDLED_BUILD_SDKS_FROM_SOURCE to specify that a
TARGET_BUILD_APPS build should build the current SDK instead of
using the prebuilts.

Bug: 121194841
Bug: 121231426
Test: no change to out/build-aosp_sailfish.ninja
Test: forrest unbundled build
Test: forrest master apps build
Test: forrest mainline modules build
Change-Id: I45a40a335483dae2fe192721df9b31bdbab97ee5
2018-12-18 22:46:24 -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
Jaewoong Jung
1d6eb68731 Use debug mode when running R8 for eng builds.
Bug: 119601874
Test: Built for different variants.
Change-Id: I2250587eb3e457ca15265eb9f8359872e9b08363
2018-11-30 15:23:16 +00:00
Dan Albert
23d37e09e9 Allow NDK APIs to be marked as drafts.
Draft APIs are available to the platform and to CTS to allow
developers to iterate on an API, but hidden from the NDK artifacts to
avoid releasing the API until it is ready.

Test: Mark binder_ndk headers and library as drafts, make checkbuild,
      build-ndk-prebuilts.sh, verify missing from NDK artifact.
Bug: http://b/120091134
Change-Id: I8685e92bdaaea581e17fe98e7a2bfb9388f9f132
2018-11-28 09:52:12 -08:00
Dan Albert
a3b83662b8 Up the NDK's minimum supported API level.
r18 doesn't support ICS.

Test: m checkbuild
Bug: http://b/119587551
Change-Id: I39ffa21c428bcdd7e970476bedc7d6dffb7b3c43
2018-11-27 13:58: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
Dan Willemsen
60e62f0c44 Add nanopb-c support
Test: cd hardware/ril; mma
Change-Id: Id1481940d15a2a3f6eb29af54ee30080ff2286cb
2018-11-17 15:28:25 -08:00
Jiyong Park
8fd6192480 APEX can be flattened
When TARGET_FLATTEN_APEX is set to true, APEXes are flattened, which
means files in an APEX is not packaged into the mini file system image,
but instead directly copied to the system partition.

This option is for devices where kernel does not support loopback
devices or the maximum number of loopback devices is too small (though
the threshold is TBD as of now).

This CL also fixes a bug that jars having bytecode are installed instead
of those having dex.

Bug: 118485880
Test: TARGET_FLATTEN_APEX=true m apex.test; tree
out/target/product/.../system/apex/apex.test shows list of files in it.

Test; m apex.test, then a file out/target/product/.../system/apex/apex
.test.apex exists.

Change-Id: I5a3d62d392d05f2779c4925388afe4f6e460059b
2018-11-14 13:41:54 +09:00
Colin Cross
37a07b1784 Revert "Use protoc-gen-javalite for java lite protos"
This reverts commit 5a5aca0568.

Change-Id: Iadbc2ec7fbc45d888383e0e6f569cbfc5ef6a996
2018-11-04 17:23:48 -08:00
Colin Cross
5a5aca0568 Use protoc-gen-javalite for java lite protos
Protobuf 3.5.2 does not natively support lite protos, instead they
are generated by the protoc-gen-javalite plugin compiled from
external/protobuf-javalite.

Bug: 117607748
Test: m checkbuild
Change-Id: I95c2d873f19d4c00e9dc312d7fdbe98cae250a8b
2018-11-03 00:05:58 +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
Colin Cross
5a0dcd5acf Store dex files uncompressed and unstripped in privileged APKs
Privileged APKs need to store their dex files uncompressed so they
can be verified and mapped directly out of the APK.

Also track whether the module will be dexpreopted or not in order
to determine if the dex file should be stripped before signing.

Test: SystemUI.apk contains an uncompressed dex file
Change-Id: I4dca86c7f8778595882405b34adcf2a7bae03c67
2018-10-25 17:47:12 +00:00
Colin Cross
395f2cfa89 Move Ndk_abis from soong.config to soong.variables
soong.config is not cleared between builds, which can cause
problems when switching between an ndk build and a platform build.

Bug: 118398924
Test: OUT_DIR=out_ndk DIST_DIR=dist build/soong/scripts/build-ndk-prebuilts.sh
Change-Id: Ifc03a0c25f46625375cdda5723e4a09d7d8050d5
2018-10-24 23:20:10 +00:00
Dan Willemsen
0ef639bb59 Allow generating modules once per OS instead of once per Class
When building with two OSes of the same class (Host, etc) enabled,
independently produce variants of each module for each OS, instead of
making `compile_multilib: "first"` select just one of the OSes.

My use case this is for Linux + LinuxBionic, which are both considered
Host class, but this would also applied if we wanted to generate rules
for Linux+Darwin, or some combination of firmware bits (either in
addition to Android in the Device Class, or multiple firmwares in a new
Class)

Bug: 31559095
Test: enable host bionic, see a linux(_glibc) and linux_bionic
      definition for binaries
Change-Id: I55e7f046758b3dc2a31da2c4b20274ec68ece0a0
2018-10-22 15:46:03 -07:00
Dan Willemsen
fa2aee1ca4 Remove USE_CLANG_LLD[=false]
This should always be true now. It will be a change for side branches
(build_tools, etc) that weren't setting UseClangLld in the
soong.variables file.

Test: treehugger
Change-Id: I9fd6157fda630bf8bb939677dbcb026f02685f19
2018-10-21 19:54:12 -07: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
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
Colin Cross
88da24e578 Add DevicePrefer32BitApps to Soong
Bug: 80095087
Test: m checkbuild
Change-Id: Ia2b2435492198ad646cbf7c59c6af59d381b20a5
2018-10-02 20:12:50 +00:00
Mathieu Chartier
d42f19cd7a Revert "Change LibartImgDeviceBaseAddress to 0x60000000"
This reverts commit 0c7bb7f31b.

Reason for revert: Some tests failing

Change-Id: I354ab0055aa8a7dea688422871d13aa78fa0018d

Exempt-From-Owner-Approval: bypass
Test: make
Bug: 112670831
Bug: 115828232
2018-09-18 07:10:36 +00:00
Mathieu Chartier
0c7bb7f31b Change LibartImgDeviceBaseAddress to 0x60000000
Lower it to have more space to allocate the region space after.

Test: make
Bug: 112670831
Change-Id: I336fe25466711d93481f30e69141449d3cfbf7e2
2018-09-07 14:06:39 -07:00
Colin Cross
ed064c0b1f Fix logic for adding gnu debuglink to match Make
Only add gnu debuglink on userdebug builds to match Make, and don't
add it when using minidebuginfo, which doesn't support it.

Bug: 113936524
Test: m checkbuild
Change-Id: Ifd529f88d63afa5627172fb6ea612aea77159f40
2018-09-05 16:30:16 -07:00
Dario Freni
95cf767918 s/product-services/product_services/g
Attempting to reduce the number of different spellings we have for
"product services" partition in the codebase.

Bug: 112431447
Test: m
Change-Id: I0a393a1d625e7ea3217d28735a4db709bce32395
Merged-In: I0a393a1d625e7ea3217d28735a4db709bce32395
2018-08-20 17:46:57 +00:00
Dario Freni
fd05a74e06 Add support for /product-services partition
This is an adaptation of Icc4f8c16bc389fe20db680849f311d02df1299c3, to
support modules that are installed on the /product-services partition.

Bug: 80741439
Test: m -j both with and without enabling the new partition
Change-Id: I72b335ad38baff5848cd3da7489343f8cf98ff16
2018-07-19 14:04:30 +01:00
Jiyong Park
8d52f86baf Fix: recovery module is disabled on 32-bit targets
Fixed a bug that recovery variant of a module is not created on 32-bit
targets. The bug was happening because the creation of the recovery
variant relied on DevicePrefer32BitExecutables() which returns false
for 32-bit only targets.

Now, recovery variant is checked against the primary architecture of the
device that is returned by DevicePrimaryArchType().

Test: m -j adbd.recovery on aosp_arm and aosp_arm64
adbd is built under recovery/root/system/bin and it is ELF32 and ELF64,
respectively for the targets.
Test: m -j libc.recovery on aosp_arm, aosp_arm64, aosp_sailfish
and the x86+arm target in mater. Only one libc.so is installed
under recovery/root/system/lib (or lib64).

Change-Id: I83a248d81f2c71dcfb0e9d887a75b71338f27b4d
2018-07-08 09:43:10 +09:00
Mathew Inwood
878c662602 Use correct variant for annotation processors.
Annotation processors should always have a common host variant, rather
than a device variant as the build was looking for before.

Bug: 110868826
Test: m
Change-Id: I2b7d0e7ed1af3f2f9ddb87d2bf36920737a507e9
2018-07-03 17:06:48 +01:00
Colin Cross
997262f506 Always use OpenJDK9 for building
Remove support for compiling with javac from OpenJDK8.
We still target 1.8 by default, and OpenJDK8 prebuilts are still
required for the bootclasspath and running robolectric.

Bug: 38418220
Test: m java
Change-Id: I5686deb0ae4f9927192a039d08adc0117b2605dd
2018-06-21 12:25:50 -07:00
Colin Cross
6654810f37 Run ErrorProne in OpenJDK9
Use the OpenJDK9 javac to run ErrorProne by adding it to
-processorpath and using -Xplugin:ErrorProne.

Bug: 69485063
Test: m RUN_ERROR_PRONE=true javac-check
Change-Id: I0496006b71b70766ef16d57753cbcf037897799c
2018-06-20 21:03:16 -07:00
Colin Cross
bafb897de7 Revert "Revert "Remove desugar support""
This reverts commit 7576916efc.

Reason for revert: includes art veridex fix this time

Change-Id: Ia8da00b5ec8ed3dc3ce2a2521f0a7b2b2b131960
2018-06-06 21:46:32 +00:00
Colin Cross
7576916efc Revert "Remove desugar support"
This reverts commit 000280bb0e.

Reason for revert: broke art veridex build

Change-Id: I9f7d7cdbe8e34671614687ac0b34c0338ef240e7
2018-06-06 21:42:39 +00:00
Colin Cross
000280bb0e Remove desugar support
Desugaring is always handled by d8 now.

Test: m checkbuild
Change-Id: I29e8f68e51b194a4090866acc63f19f0605e318d
2018-06-06 10:05:06 -07:00
Tri Vo
f544fe3db9 Account for multiple BOARD_PLAT_PUBLIC[PRIVATE]_SEPOLICY_DIR dirs
After https://android-review.googlesource.com/688488
BOARD_PLAT_PUBLIC[PRIVATE]_SEPOLICY_DIR can now specify multiple
directories.

Bug: n/a
Test: build sepolicy
Change-Id: I838c76736a3f1bd8759e24739cf82fea33a531b4
2018-05-22 09:23:44 -07:00
Colin Cross
bfd347dc82 Pass platform version name as --version-name for framework-res.apk
framework-res.apk should get the platform version name ("9") as
--version-name, not the SDK version ("28").  It will get copied
to compileSdkVersionCodename in APKs compiled against it.

Bug: 78324052
Test: aapt dump badging $OUT/system/framework/framework-res.apk | grep -i version
Change-Id: I34a601cb2c14f66199066e7d598862108da0b950
Merged-In: I34a601cb2c14f66199066e7d598862108da0b950
(cherry picked from commit b691e24d89)
2018-05-09 15:56:46 -07:00
Tri Vo
35a5143aee Expose selinux variables to Soong.
Bug: 33691272
Test: manual
Change-Id: I4a568fb25a36331afb2ca51c3d8a676c3aba09e1
2018-04-30 11:26:55 -07:00
Colin Cross
d09b0b653b Fix aapt2 --min-sdk-version after finalized SDK
aapt2 --min-sdk-version was using AppsDefaultVersionName(), which
is OMR1 for a non-finalized SDK, but 8.1.0 after finalization.
Add PlatformSdkCodename() for non-finalized SDKs, use it for
DefaultAppTargetSdk(), and pass it for aapt2 --min-sdk-version.

Bug: 78224641
Test: TestAppSdkVersion in app_test.go
Change-Id: I622eaf92f8a940f79007c2a579536da325700b06
2018-04-18 12:39:25 -07:00
Chih-Hung Hsieh
02b4da53a7 Add USE_CLANG_LLD and use_clang_lld.
* USE_CLANG_LLD is unedefined in current builds.
* When USE_CLANG_LLD is defined to 'true' or '1',
  use clang's lld instead of ld or ld.gold.
* When lld is enabled:
  * ld-only flags are not passed to 'lld'.
  * location_packer is disabled.
  * Use new lld's --pack-dyn-relocs=android.
* When lld does not work:
  * In Android.mk files use LOCAL_USE_CLANG_LLD := false.
  * In Android.bp files use use_clang_lld: false.
* Only arm, arm64, x86, and x86_64_devices have LLD flags;
  all other hosts and targets do not call lld yet.

Bug: 73768157
Test: make checkbuild and boot
Change-Id: I06b8a1e868a600997a7e70fe05c299d751d23d5f
2018-04-12 14:37:35 -07:00
Dan Willemsen
0fe7866897 Add VendorConfig for board-level Soong plugin configuration
This allows Soong (Go) plugins to get custom configurations set in the
current product's BoardConfig.mk.

I'll have some more comprehensive documentation later, but the general
concept is that you'd have one namespace per plugin, defined in the
BoardConfig.mk (though they would work in the product.mk files too):

  SOONG_CONFIG_NAMESPACES += myPlugin

Within that namespace you can set key-value pairs:

  SOONG_CONFIG_myPlugin := key1 key2 ...
  ...
  SOONG_CONFIG_myPlugin_key1 := value
  ...
  SOONG_CONFIG_myPlugin_key2 := true

Then in your plugin, you can ask for your namespace:

  vars := ctx.Config().VendorConfig("myPlugin")

And then use them:

  str := vars.String("key1")
  if vars.Bool("key2") { ... }
  if vars.IsSet("key3") { ... }

Warning: It's not a good idea to fail on missing inputs, since an
android tree may contain plugins from multiple owners, and we may
configure your modules (but not build/install them) even if they're not
meant for the currently configured product.

Bug: 76168832
Test: define some variables, use them
Test: m blueprint_tools
Change-Id: I4c38f5a4344022c6f332de279d9bbef24502e741
2018-04-11 01:45:37 +00:00
Dan Willemsen
45133ac184 Make Config.ProductVariables private
All access to these should be going through the methods on Config /
DeviceConfig.

Bug: 76168832
Test: m blueprint_tools
Change-Id: I47512dd58fb1a1a3f25838a9b1adaed2c41af8d3
2018-04-11 01:45:29 +00:00
Dan Willemsen
674dc7f7f0 Expose ProductVariables from TestConfig
In preparation for unexporting ProductVariables, explicitly return a
pointer to the structure from TestConfig / TestArchConfig.

Bug: 76168832
Test: m blueprint_tools
Change-Id: Iccfb4c912f8e0ee3f620cc1ee00f0cdc5cba7735
2018-04-11 01:45:22 +00:00
Dan Willemsen
3fb1faeeb9 Use Config/DeviceConfig functions to access ProductVariables
An upcoming change will stop exporting ProductVariables from Config, so
switch to using existing accessor functions, and add more when they're
missing.

Bug: 76168832
Test: out/soong/build.ninja is identical
Change-Id: Ie0135bdbd2df3258ef3ddb53e5f8fc00aa9b97f7
2018-04-11 01:45:14 +00:00
Jayant Chowdhary
34ce67d454 Consider binder bitness while looking for abi references.
Binder bitness does not always correlate directly with primary arch, as
assumed earlier. For example: it is possible to have devices with
primary arch 'arm' and use 64 bit binder.

Bug: 74362434

Test: utils/create_reference_dumps.py;
      m -j vndk_package for aosp_arm64_ab, aosp_arm_ab invokes
      header-abi-diff on both arm and arm64 arches.

Test: mm -j64 in system/libhwbinder on troublesome internal target.

Change-Id: Iea0a24b57cdb3033e25b6fe126c5d5d717f45b4e
2018-03-08 16:49:59 -08:00
Colin Cross
15cd21a492 Report errors when opening config files
The error handling when opening config files was ignoring all errors
except ENOEXIST.  Report other errors, instead of passing nil to
json.NewDecoder and getting:
config file: out/soong/soong.config did not parse correctly: invalid argument

Bug: 73951413
Test: touch out/soong/soong.config && chmod a-r out/soong/soong.config && m
Test: rm out/soong/soong.config && m
Change-Id: I4a609b7f060b760b76ee829b83c0eb405340f58f
2018-02-27 19:30:40 +00: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
Pirama Arumuga Nainar
49540800f0 Search for PGO profiles in PGO_ADDITIONAL_PROFILE_DIRS
This variable can be set in BoardConfig.mk to specify a list of
additional paths that contain PGO profiles.  These directories are
searched after the predefined paths in soong/cc/pgo.go while finding
PGO profiles.

Test: Set this variable in a BoardConfig and verify that such profiles
are found and that these paths are searched after the predefined paths
in soong/cc/pgo.go.

Change-Id: I0bb9523de614d0f23aba8d51c887d8fc8f41c993
2018-02-13 09:41:13 -08:00
Jaekyun Seok
5cfbfbb67a Use product instead of oem for Product specific module
Bug: 64195575
Test: succeeded building product.img with BOARD_PRODUCTIMAGE_PARTITION_SIZE,
BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE and PRODUCT_PRODUCT_VERITY_PARTITION.
Change-Id: Icc4f8c16bc389fe20db680849f311d02df1299c3
2018-01-25 07:50:35 +09:00
Jiyong Park
1a5d7b1539 Add PLATFORM_SYSTEMSDK_VERSIONS and BOARD_SYSTEMSDK_VERSIONS
PLATFORM_SYSTEMSDK_VERSIONS is the list of System SDK versions that the
platform is supporting. Contrary to the public SDK where platform
essentially supports all previous SDK versions, platform support only a
few recent System SDK versions, since some of old System APIs are
gradually deprecated, removed from the following SDKs and then finally
deleted from the platform. This will be part of the framework manifest.

The list can be specified by setting PLATFORM_SYSTEMSDK_MIN_VERSION. If
it is set to an old version number, then System SDKs from the version
to the current version (PLATFORM_SDK_VERSION) are considered to be
supported by the platform. If PLATFORM_SYSTEMSDK_MIN_VERSION is not set,
only the latest System SDK version is supported.

Next, BOARD_SYSTEMSDK_VERSIONS is the list of System SDK versions that
the device is using. This is put to the device compatibility matrix
device is using. The device and the platform is considered as compatible
only BOARD_SYSTEMSDK_VERSIONS in the device compatibility matrix are
in the PLATFORM_SYSTEMSDK_VERSIONS in the framework manifest.

When BOARD_SYSTEMSDK_VERSIONS is set, a Java app or library in vendor or
odm partitions which didn't specify LOCAL_SDK_VERSION  is forced to use
System SDK. Also, the build system does the additional integrity check
to ensure that LOCAL_SDK_VERSION is within BOARD_SYSTEMSDK_VERSIONS or
PLATFORM_SYSTEMSDK_VERSIONS (if BOARD_SYSTEMSDK_VERSIONS isn't set).

Bug: 69088799
Test: m -j
Test: BOARD_SYSTEMSDK_VERSIONS=P m -j
Change-Id: Id38f02b4be86710411be22bc28109e6894f8a483
2018-01-19 15:42:18 +09:00
Stephen Hines
6ea0f81c3f Remove unnecessary DeviceUsesClang.
This build function is unnecessary now that GCC is completely
unsupported for Android platform builds. It is similar to
USE_CLANG_PLATFORM_BUILD from the build/make side of things.

Bug: http://b/64032869
Test: Builds
Change-Id: Iddf5f91cc997c337c77a644265cb8dc4e5a915b4
2018-01-11 14:29:41 -08:00
Alan Leung
e2fb6294e9 Make D8 Desugaring default.
Bug: 69329508
Test: m checkbuild

Change-Id: Ie74c2b27764aa5f2d60a0d33141735808bbc6d48
2018-01-04 11:36:27 -08:00
Tobias Thierer
18099fd856 Build with OpenJDK 9 -target 1.8 by default (attempt 4).
This is cherry-picked from attempt 3, which was reverted
due to http://b/70862583.

Before this CL topic, the build toolchain for .java source files
used OpenJDK 8, targeting 1.8 (v52 class files) by default.

This CL topic switches the default to OpenJDK 9, but still
targeting 1.8 (v52 class files) by default. If USE_ERROR_PRONE
is set to true, then the default remains OpenJDK 8.

Code in the Android platform should generally be unaffected,
but if host tools that are now compiled and run using
OpenJDK 9 are causing problems for your team, then let me
know.

To manually switch back to the old behavior for now (continue
using OpenJDK 8), run this command in your shell:
export EXPERIMENTAL_USE_OPENJDK9=false

Bug: 69449021
Test: Treehugger
Test: art/test/testrunner/run_build_test_target.py -j40 art-interpreter
Test: dalvik/dx/tests/run-all-tests

(cherry picked from commit 13f23a2753)

Change-Id: I57abae73f9bdb21ef004a5118ff0e4ef70418ed9
Merged-in: Iac78122f58df0ebbb55134d55021ce6c57351b5f
2018-01-04 11:07:38 +00:00
Colin Cross
b4330e222b Move string list utility functions to android package
Test: m checkbuild
Change-Id: I50a7ccf9fd7ed82b688e3eb90489c0bc0af33287
2017-12-28 17:41:02 +00:00
Jiyong Park
2db7692a74 Add [soc|device|product]_specific
Added three properties (soc_specific, device_specific, and
product_specific) that shows what a module is specific to.

`soc_specific: true` means that the module is specific to an SoC
(System-On-a-Chip) and thus need to be installed to vendor partition.
This has the same meaning as the old `vendor: true` setting.

`device_specific: true` means that the module is specific to the entire
hardware configuration of a device includeing the SoC and off-chip
peripherals. These modules are installed to odm partition (or /vendor/odm
when odm partition does not exist).

`product_specific: true` means that the module is specific to the
software configuration of a product such as country, network operator,
etc. These modules are installed to oem partition (or /system/oem when
oem partition does not exist). These modules are assumed to be agnostic
to hardware, so this property can't be true when either soc_specific or
device_specific is set to true.

Bug: 68187740
Test: Build. path_tests amended.
Change-Id: I44ff055d87d53b0d2676758c506060de54cbffa0
2017-12-21 12:16:29 +09:00
Alan Leung
c37c6343e2 Prep D8 default instead of CompatDX in build/soong
Bug: 69329508
Test: m checkbuild tests
Change-Id: Ibaa2d787c644cf25104af78305a6eed16028dcf0
2017-12-18 23:56:30 -08:00
Colin Cross
e1731a5803 Export app certificates to Make for apkcerts list
Bug: 70669383
Test: m apkcerts-list contains framework-res.apk
Change-Id: I38af458e4262371c9c8368b5eebcff063a9bc359
2017-12-14 12:28:41 -08:00
Justin Yun
8fe1212261 Install current VNDK libs to the versioned directories.
If PLATFORM_VNDK_VERSION has a version $VER other than "current",
install current VNDK libs to /system/lib[64]/vndk[-sp]-$VER.
Otherwise, they will be installed to /system/lib[64]/vndk[-sp].

Bug: 69883025
Test: device boot
Change-Id: Ifa8564f39687dab5b407bf2178b13022625a94f3
2017-12-13 10:47:44 +09: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
Tobias Thierer
e05f3a5f3f Revert "Build with OpenJDK 9 -target 1.8 by default except for errorprone."
After this revert CL topic, the default toolchain for Android
goes back to being OpenJDK 8.

This revert is being prepared ahead of time in case of
any problems with CL topic:
https://r.android.com/#/q/topic:bug69449021_attempt2

Bug: 69449021
Test: Treehugger
Change-Id: I9ead8d569226bd487baee3c6d5be9ec7033eb56a
2017-12-11 14:54:10 +00:00
Tobias Thierer
13f23a2753 Build with OpenJDK 9 -target 1.8 by default except for errorprone.
(This is cherry-picked from the first attempt to submit this CL
topic, which was reverted after 3 hours because of bug 70286093;
robolectric 3.{1.1,4.2} now stick with OpenJDK 8 to avoid that bug).

Before this CL topic, the build toolchain for .java source files
used OpenJDK 8, targeting 1.8 (v52 class files) by default.

This CL topic switches the default to OpenJDK 9, but still
targeting 1.8 (v52 class files) by default. If USE_ERROR_PRONE
is set to true, then the default remains OpenJDK 8.

Code in the Android platform should generally be unaffected,
but if host tools that are now compiled and run using
OpenJDK 9 are causing problems for your team, then let me
know.

To manually switch back to the old behavior for now (continue
using OpenJDK 8), run this command in your shell:
export EXPERIMENTAL_USE_OPENJDK9=false

Bug: 69449021
Test: Treehugger
Test: Running robolectric tests succeeds on internal-master
      after cherry-picking this CL topic, using the command
      line from http://b/70286093#comment1
(cherry picked from commit 0ae8b548af)

Change-Id: Ide6a7e55126d919a44f89ef8e0bd14fb12ff470e
2017-12-11 14:53:52 +00:00
Tobias Thierer
7c05949407 Revert "Default to building with OpenJDK 9 -target 1.8."
After this revert CL topic, the default toolchain for Android
goes back to being OpenJDK 8.

This revert is being prepared ahead of time in case of
any problems with original change topic,
https://r.android.com/#/q/topic:bug_69449021

Bug: 69449021
Test: Treehugger

This reverts commit 0ae8b548af.

Change-Id: Ief7646a94f1a264085cd299b4327d244b78a1537
2017-12-05 02:10:55 +00:00
Tobias Thierer
0ae8b548af Build with OpenJDK 9 -target 1.8 by default except for errorprone.
Before this CL topic, the build toolchain for .java source files
used OpenJDK 8, targeting 1.8 (v52 class files) by default.

This CL topic switches the default to OpenJDK 9, but still
targeting 1.8 (v52 class files) by default. If USE_ERROR_PRONE
is set to true, then the default remains OpenJDK 8.

Code in the Android platform should generally be unaffected,
but if host tools that are now compiled and run using
OpenJDK 9 are causing problems for your team, then let me
know.

To manually switch back to the old behavior for now (continue
using OpenJDK 8), run this command in your shell:
export EXPERIMENTAL_USE_OPENJDK9=false

Bug: 69449021
Test: Treehugger
Test: "make core-oj", checked that compilation now uses
      OpenJDK 9 javac -target 1.8
Test: Checked that this is still compiled using OpenJDK 8.
      export EXPERIMENTAL_USE_OPENJDK9=false
      make core-oj

Change-Id: Ic87e9bb2a2e5da0ff13a2e51845b5365901c1507
2017-12-05 02:07:30 +00: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
Colin Cross
e15ddaf4ae Fix builds outside of make
Builds outside of make use custom config files that may not set
some variables, which is causing nil pointer derefernces.  Use
wrapper functions that check for nil for the new config
variables.

Test: build/soong/scripts/build-ndk-prebuilts.sh
Change-Id: I0f837094532aeb2ecdbe401affa55a7535075bf6
2017-12-04 11:24:31 -08:00
Colin Cross
61ae0b7eed Use default app certificate from Make
Bug: 69917341
Test: m checkbuild
Test: framework-res.apk is identical after converting to Soong
Change-Id: I6980afd94ea130740da0defeea045eddc2fc6439
2017-12-02 01:26:50 +00: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
Tobias Thierer
a7cdd156a6 Support EXPERIMENTAL_USE_OPENJDK9=false.
This fourth possible value currently has the same semantics
as a default/unset EXPERIMENTAL_USE_OPENJDK9, but allows
people to explicitly switch back to the old semantics when
the default changes.

Test: make showcommands core-oj (in environments with
      EXPERIMENTAL_USE_OPENJDK9 set to "", "1.8", and "true").
Bug: 38177295

Change-Id: I25accf14344a05349a6e97572d7c2c1f6a7f2063
2017-11-17 13:14:11 +00:00
Vishwath Mohan
1fa3ac552d CFI include/exclude path support (Soong)
This CL adds the ability to centrally enable or disable CFI for
components using either an environment or product config
variable. This is a better, nore manageable option that enabling CFI
across each component individually.

Bug: 67507323
Test: CFI_INCLUDE_PATHS= system/nfc m -j40
Test: CFI_EXCLUDE_PATHS = frameworks/av m -j40

Change-Id: I38b77946759121aec99ab25f31aaee2e5d993f73
2017-11-08 18:56:10 -08:00
Colin Cross
126a25cb3d Propagate PRODUCT_MINIMIZE_JAVA_DEBUG_INFO to soong and use it
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
2017-11-01 12:51:16 -07:00
Colin Cross
face4e4563 Import AAPT-related product variables from make
Test: m checkbuild
Change-Id: I22113c17d240ff26652cea7df801a183343faebd
2017-10-30 17:36:41 -07:00
Colin Cross
0d3f8c0db6 Use prebuilt dx for PDK builds
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
2017-10-24 10:52:26 -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
Jiyong Park
6a43f04777 Squash vendor sources before linkageMutator runs
linkageMutator removes srcs property of the shared variant of a lib in
order to reuse *.o files compiled for the static variant also to the
shared variant.

However, this causes problem when vendor-specific srcs are specified in
target: {vendor: {srcs: ["..."]}}. For example, let's assume

cc_library {
    name: "libfoo",
    srcs: ["foo.c"],
    target: {
        vendor: {
            srcs: ["bar.c"],
        },
    },
}

Then,
static_vendor: inputs = foo.o, bar.o
shared_vendor: inputs = foo.o (from static_vendor), bar.o (from
static_vendor), bar.o

So, bar.o is included twice and this causes multiple symbol definition
error.

In order to handle the problem, vendor mutator is applied before the
linkage mutator and the vendor-specific srcs are squashed in the vendor
mutator.

Bug: 67731122
Test: build
Test: cc_test.go

Change-Id: I2a5390295dddfc41260e9b6f02746908cdf47228
2017-10-13 14:36:12 +09:00
Colin Cross
6ccbc913e4 Let tests override environment
Pass an environment to TestConfig that will be used for
all Config.Getenv calls.

Test: none
Change-Id: I683cd9c9e0db61c9bfd2adb27fca78f558f225c4
2017-10-10 23:28:43 -07:00
Colin Cross
fc3674a607 Remove android_prebuilt_sdk modules
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
2017-09-20 13:20:45 -07:00
Colin Cross
ae4c6180a7 Add test infrastructure for running the arch mutator
Add TestArchConfig and NewTestArchContext to create a test context
that will run the arch mutator, which is necessary to test any code
that is inside a ctx.Device() block or similar.

Test: next patch
Change-Id: Ieb1a0326bc27fc18ba88b8d37655a7e0c6870d6c
2017-09-20 13:20:45 -07:00
Colin Cross
32616ed3e0 Ignore environment variables in tests
The next change will cause java tests to fail if RUN_ERROR_PRONE=true
is set.  Make tests more hermetic by faking an empty environment.

Test: soong tests
Change-Id: I01057cb0c42ec08ebed8aea87505dd01e9981915
2017-09-05 22:08:13 -07:00
Colin Cross
595a406f88 Pass --min-sdk-version to dx
Pass the sdk_version property, the platform sdk version, or 10000
to dx as --min-sdk-version.

Test: m -j checkbuild
Change-Id: I5fae03f44153dc2d6244c33f4c055e746980aefe
2017-08-31 13:48:52 -07:00
Dan Albert
d4db4acffe Update the minimum NDK target API.
Gingerbread is no longer supported. ICS is now the minimum target.

Test: make checkbuild
Bug: None
Change-Id: I896b83d9984d90d907fe518cc722a4a3722626a1
2017-08-17 16:54:21 -07:00
Dan Albert
f5415d7cc6 Expose the minimum supported SDK version to make.
Right now this is hard coded in two places (here and in
core/binary.mk). Keep it in one place so it's easier to change.

Test: make checkbuild
Bug: None
Change-Id: I2a2c784d4c667b326f871e6144db92753c16c85f
2017-08-17 16:54:03 -07:00
Dan Albert
31384debd7 Adapt to PLATFORM_VERSION_FUTURE_CODENAMES.
Don't preserve the confusing names from make. Rename AllCodenames to
ActiveCodenames, add FutureCodenames, and add CombinedCodenames to
fetch the *real* AllCodenames.

To allow `introduced=P` in NDK library definitions, we need to know
that P exists. Use the combined list of current and future API
codenames generating stubs.

Test: make ndk
Test: check out/soong/api_levels.json
Bug: None
Change-Id: I435f9ce7446236edc268a84e33474044a55a6302
2017-08-02 17:14:10 -07:00
Ivan Lozano
5f59553bca Allow integer_overflow sanitizer path exclusion.
Add support for excluding paths from having integer_overflow applied to
them when using SANITIZE_TARGET=integer_overflow via an
INTEGER_OVERFLOW_EXCLUDE_PATHS make variable. This covers the soong side
of the change.

Bug: 30969751
Test: Build with SANITIZE_TARGET=integer_overflow
SANITIZE_TARGET_DIAG=integer_overflow
INTEGER_OVERFLOW_EXCLUDE_PATHS=<path> and confirmed this was no
longer being applied to binaries in that path.

Change-Id: I298b772f5425da28dff1cf007825be19558db3a8
2017-07-18 13:38:20 -07: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
Ivan Lozano
0c3a1efae4 Add integer_overflow sanitization build option.
Adds the SANITIZE_TARGET=integer_overflow build option to apply signed and
unsigned integer overflow sanitization globally. This implements the
Soong side of the build option.

An additional build option is provided to control whether or not to run
in diagnostics mode, controlled by SANITIZE_TARGET_DIAG. This works the
same way that SANITIZE_TARGET does and currently only supports
'integer_overflow' as an option.

A default sanitizer blacklist is added to avoid applying sanitization
to functions that are likely to exhibit benign overflows.

Bug: 30969751
Test: Building with and without the new flags, device boot-up, tested
various permutations of controlling the new flags from build files.

Change-Id: Ibc8a8615d3132f1a23faaf1cb4861f24c5ef734a
2017-07-07 09:52:23 -07:00
Dan Willemsen
00269f23ee Fix install location for vendor tests
These should be install in /data/nativetest* with the rest of the tests,
but had been moved to /vendor/nativetest* accidentally. Add some tests
so that this doesn't happen again.

Bug: 63393698
Test: m -j blueprint_tools
Test: compare out/soong/Android-aosp_arm64.mk
Test: compare out/soong/build.ninja
Change-Id: Id3b08a7e3908955df18a043a02ea576dc88086c3
2017-07-06 18:09:46 -07:00
Colin Cross
20e1365e61 Fix panic in builds with no device
Running prebuilts/build-tools/build-prebuilts.sh in a repo that
contains art/build/art.go panics because config.Targets[Device] is
empty.  Check the length before accessing the slice.

Test: prebuilts/build-tools/build-prebuilts.sh
Change-Id: Ifb9fe0fad07b22d6b574f505c08c5c761278aad0
2017-06-23 10:57:36 -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
Chris Larsen
ae7f3e26ec MIPS: Lower LibartImgDeviceBaseAddress() to fix ART tests.
Some of ART tests fail to mmap memory unless
LibartImgDeviceBaseAddress() is further lowered.

Test: booted MIPS32R2 in QEMU
Test: booted MIPS64 (with 2nd arch MIPS32R6) in QEMU
Test: test-art-target-gtest
Test: testrunner.py --target --optimizing
Test: repeat all of the above in configurations
      ART_READ_BARRIER_TYPE=TABLELOOKUP,
      ART_USE_READ_BARRIER=false
Test: repeat the above tests on CI20

Change-Id: I48cd9d8074e07073cc6abb2153660e00017b9e6b
2017-05-30 16:38:42 -07:00
Dan Willemsen
6606872bf6 Revert "Revert "Ensure environment dependencies are correct""
This reverts commit 4068a5db6c.

Now the Mac xcode-select and xcrun goes through Config.HostSystemTool,
which will grab $PATH through Config.Getenv

Test: m -j (on mac)
Change-Id: I2632c4fdb2ec961e59944cf02ff165e0fd3c869d
2017-05-15 15:22:45 -07:00
Dan Willemsen
4068a5db6c Revert "Ensure environment dependencies are correct"
This reverts commit e78473c33c.

Reason for revert: Broke mac builds, which rely on $PATH to find xcrun

Change-Id: I58711b94d472ab828823afaf53394a1aa869f3f5
2017-05-08 21:11:55 +00:00
Dan Willemsen
e78473c33c Ensure environment dependencies are correct
Store the os Environment on init, then clear it so that it's only
available via a call to Config.Getenv(). That way we're guaranteed to
know about all dependencies.

Test: Add some os.Getenv/Config.Getenv calls and ensure correct behavior
Test: cs/ shows no os.Getenv / os.LookupEnv / os.ExpandEnv calls that
would be affected
Change-Id: Ic519e0c871f340e752df03b8af0599d47c1d91d8
2017-05-05 23:08:16 -07:00
Colin Cross
893d816a6d Turn installation on in mega device build
Turn on installation in the mega device build, it is necessary for the ndk
sysroot installation.  Partially fixes mega device builds, they also need
to run without -w dupbuild=err on the ninja command line because multiple
variants of the same architecture try to install to the same ndk sysroot.

Test: mega device build
Change-Id: I982d77f9ff19f5bc29fc9fe54a0df8db3579c3e3
2017-04-27 12:21:24 -07:00
Vishwath Mohan
c32c3ebfb9 Change the global CFI flag to default to enabled.
This CL changes the ENABLE_CFI flag to default to enabled. Setting it
to false will override local settings to enable CFI.

Bug: 30227045
Bug: 22033465
Test: m -j40 works and device boots
Test: cfi is honored unless the global flag is set.
Change-Id: Ie3285c5eac60c8f6012c6b6c23be149a8787af0c
2017-04-13 17:17:28 -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
11b261472a Rework vndk detection
Instead of having a module define `use_vndk: true`, assume that we're
building with the VNDK if we're installed on the vendor partition, and
BOARD_VNDK_VERSION==current. This now matches our behavior in Make.

Once BOARD_VNDK_VERSION!=current, we'll need to disable modules that
need to otherwise compile against the VNDK, since we can only compile
against the current VNDK.

Test: build.ninja for aosp_arm is the same before/after
Test: Ensure there are no boards that set BOARD_VNDK_VERSION
Change-Id: If937fa7bdb119648137af52daebadf486163484b
2017-03-29 04:33:25 +00:00
Alexey Frunze
6e5dfaaeb1 MIPS: Adjust LibartImgDeviceBaseAddress() for CC GC.
The concurrent copying GC allocates large contiguous
space at low addresses. This moves the image(s) out
of the way to higher addresses.

Test: booted MIPS32R2 in QEMU
Test: booted MIPS64 (with 2nd arch MIPS32R2) in QEMU

Change-Id: I1c54e6142844ab1ad7820765ae313650e9ab8875
2017-03-20 16:58:43 -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
Ryan Campbell
469a18aae2 Support path exclusion for native coverage.
Specify list of paths to exclude from coverage instrumentation.

Test: make NATIVE_COVERAGE=true COVERAGE_PATHS=hardware/interfaces
COVERAGE_EXCLUDE_PATHS=hardware/interfaces/graphics
Bug: 35769817

Change-Id: I3bf10e5e5697d140d6cff73d000768b00aa28ca4
2017-02-27 11:08:34 -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
Jack He
ee8e7a7a2c Removed Bluetooth build variables from the soong build parser
* Removed BLUETOOTH_HCI_USE_MCT
* Removed BOARD_BLUETOOTH_BDROID_HCILP_INCLUDED

Bug: 34951912, 35203653
Test: Code compilation, no visible user effects
Change-Id: I89af075a334f2ec7b2a3046a4aaa5bcc19d454e0
2017-02-09 14:36:09 -08:00
Colin Cross
c0d58b4a0f Fix envDeps initialization and locking
If Config.GetEnv was called when envDeps was uninitialized (for
example in a test) it would panic, which if recovered (for example in
a test) would cause it to continue without unlocking the mutex, and
could later deadlock.  Fix the initialization by initializing in
GetEnv if necessary, and use defer to avoid holding the mutex after
a panic.

Test: soong tests
Change-Id: I453522faaf47ff6fbc4702345cfe177100bdc522
2017-02-06 15:45:16 -08:00
Vishwath Mohan
1b017a76e1 Hide CFI behind a global flag.
This CL ensures that locally enabling CFI in a .bp file is not honored
unless it is enabled globally using ENABLE_CFI=true first, effectively
hiding it behind a flag.

Bug: 30227045
Bug: 22033465
Test: m -j40 works and device boots
Test: cfi is correctly honored only when the global flag is set.
Change-Id: Iccc6e4bf5e7828ab8ce6056f3e40922712faa0d8
2017-01-19 14:40:34 -08:00
Jack He
8cc714313c Add Android.bp variables to the soong build parser
* BtConfigIncludeDir: BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR
* BtHcilpIncluded: BOARD_BLUETOOTH_BDROID_HCILP_INCLUDED
* BtHciUseMct: BLUETOOTH_HCI_USE_MCT

Bug: 32958753
Test: Code compilation, no user visible effects

Change-Id: I0dc53172ee823e4e0fa69749e1297713796538cf
2017-01-11 16:07:44 -08:00
Hiroshi Yamauchi
e2a106353f Add ArtUseReadBarrier to ProductVariables.
Bug: 33492005
Test: top-level angler build.
Change-Id: Ib04284bac923a143038655d495bcbacaabf61440
2016-12-19 15:31:32 -08:00
Dan Willemsen
4353bc4422 Support system/vendor for devices without a vendor partition
Test: lunch aosp_arm-eng; m -j vulkan.default
Change-Id: I91eabf98f53c455ec4ade95215f11a6f89631747
2016-12-05 17:21:13 -08:00
Colin Cross
99d7c23006 Provide config helpers for environment variables
Add GetenvWithDefault, IsEnvTrue, and IsEnvFalse helpers to Config.

Test: m -j checkbuild
Change-Id: Id855e5349115eb2a18b2e73cfd1bd84b5874ff93
2016-11-29 15:29:34 -08:00
Dan Willemsen
d2ede879b5 Add basic VNDK support in Soong
Export a list of libraries in the VNDK, which is currently empty.

Take in Make's global BOARD_VNDK_VERSION, and use that as the SDK
version for modules that specify use_vndk: true.

Modules that use the vndk have some configuration as if they were
building against the NDK (the absence of globally defined headers), but
in other cases look like platform modules (using the platform libc++,
for now).

This change does not attempt to enforce any linking constraints, that
will come in a later patch.

Test: out/soong/build.ninja doesn't change
Change-Id: I3be206b67015ac5177b7eef4a451c579e3dc903f
2016-11-28 13:45:24 -08:00
Dan Albert
073379e549 Revert "Revert "Use the platform SDK version from the config.""
This reverts commit 74b8b55bb2.

Test: OUT_DIR=ndk-out DIST_DIR=ndk-dist \
          build/soong/scripts/build-ndk-prebuilts.sh
Bug: None

Change-Id: Ia320609ec6fb382b13ff9007a6496b73198ff871
2016-11-10 11:11:07 -08:00
Dan Albert
74b8b55bb2 Revert "Use the platform SDK version from the config."
This reverts commit 9bef523809.

Reason for revert: Broke things

Change-Id: Ic3deac4fb6992572ac0cc95fa04d003e0c29f113
2016-11-09 19:39:42 +00:00
Dan Albert
9bef523809 Use the platform SDK version from the config.
N is in AOSP now.

Test: make ndk && ls out/soong/ndk/platforms/android-24
Bug: None
Change-Id: I846ee12d10e962931bf22c94c37cdf7207dd4ff7
2016-11-08 12:53:39 -08:00
Colin Cross
d8f2014d3b Fix race condition writing soong.config
soong_build is run twice simultaneously now, once for manifest
generation and once for docs generation.  If one starts writing the
default soong.config file, and the other starts reading it, the reader
can see an empty file and fail.  Write the soong.config file to a
temporary file and the atomically rename it into place.

Bug: 32628314
Test: rm out/soong/soong.config && m -j blah && cat out/soong/soong.config
Change-Id: I8119b11d45093284b24cbc926d81eb9ea4bf2e27
2016-11-03 16:48:37 +00:00
Colin Cross
23ae82a2b2 Support sanitizing a single device arch
Allow specifying one or more architectures to sanitize for.  Defaults to
sanitizing all architectures.  Allows reducing the cost of sanitization
by only sanitizing half of the platform.

Bug: 29498013
Test: No change to build.ninja files with m -j SANITIZE_TARGET=address
Test: m -j SANITIZE_TARGET=address SANITIZE_TARGET_ARCH=arm
Test: nm -D $OUT/system/bin/app_process64 | grep asan, no asan symbols found
Change-Id: I972cccc2f19443895d47b44bd8104105f93ffb7d
2016-11-02 15:18:19 -07: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
Dan Albert
4098deb0b8 Add an NDK ABIs mega build configuration.
The NDK needs generic prebuilts for all architectures.

Test: echo '{ "Ndk_abis": true }' > soong.config && \
          ./soong $OUT_DIR/ndk.timestamp
Bug: None

Change-Id: I2ee3ebbf4cbd1bc593f9e4e9fb44fb66711da9d5
2016-10-19 14:33:37 -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
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
20780c80a0 Remove HostPrefer32BitExecutables
HOST_PREFER_32_BIT was used during the switch to 64-bit host tools to
keep the SDK building as 32-bit, but is never set any more.

Change-Id: I7c2db269d3f7fa1f4e0c022cbced789755a62d81
2016-09-02 14:06:30 -07:00
Colin Cross
9d45bb78c5 Enable goma in soong
When the UseGoma flag is set, put all rules except the C compilation
rule in an externally defined local_pool, which will have been created
by kati.  The gomacc wrapper will already be in the CC_WRAPPER
environment variable.

Bug: 31142427
Change-Id: I699d4edff2e302eee398dad8692ceb14721a628c
2016-08-31 09:48:08 -07:00
Colin Cross
1e7d3706d6 Add support for preferred arch symlinks
Add a symlink_preferred_arch property to binaries to allow compiling the
binary for multiple architectures and then creating a symlink to the
preferred archicture, for example dalvikvm32 and dalvikvm64, with
dalvikvm symlinked to dalvikvm64.

Test: mmma -j art/dalvikvm
Change-Id: Ied15f2be9d52c01006fe8ac207c175b78558eab1
2016-08-25 22:42:02 +00:00
Colin Cross
0f4e0d6c5d Add art
Re-land I557c86d2282178d215ea17abb71e556bdc4ba722

Change-Id: Ic26e1a6b17569acbfe68b4a219982ce45cecefbd
2016-08-25 14:00:25 -07:00
Colin Cross
857a527f67 Revert "Add art"
This reverts commit f7288f3906.

Change-Id: Ibb63fe2a95d1517fea63a65a7dbe5cac84902107
2016-08-25 01:03:59 +00:00
Colin Cross
f7288f3906 Add art
Change-Id: I557c86d2282178d215ea17abb71e556bdc4ba722
2016-08-23 13:14:40 -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
5951c8a3a9 Use PlatformSdkVersion from Make
This doesn't need to be hardcoded, and should be updated anyways.

Change-Id: Ie28d0d7655e8db3c02d110ae578a763a69b73f92
2016-07-19 19:17:52 -07:00
Colin Cross
cc85e683a4 Return copies of global sanitizer slices
sanitize.begin() modifies the slice returned by Config.SanitizeHost()
and Config.SanitizeDevice(), return a copy so the global slice doesn't
get corrupted.

Bug: 29188876
Change-Id: I4c7a59b7e96529166519b23a1ebda39b8e060c58
2016-07-06 14:30:32 -07:00
Colin Cross
a1ad8d1889 Simplify arch target handling
Soong's multi-architecture building has grown complex, with the
combination of HostOrDevice+HostType+Arch necessary to determine how to
build a variant of a module, and three separate mutators to split each
into its variations.

Combine HostOrDevice+HostType into Os, which will be Linux, Darwin,
Windows, or Android.  Store Os+Arch as a single Target.

Change-Id: I92f2e2dac53617d595a35cc285d2bd348baa0fbd
2016-06-02 19:09:32 -07:00
Colin Cross
b9db480385 Revert "Simplify arch target handling"
This reverts commit 6713fb26cbcadf525cd75e47d7d0cbc23d282b3e.

Change-Id: Ic473cea2563b0b37dc08b0bc5d3a0ac8c4b6afe6
2016-06-03 01:50:47 +00:00
Colin Cross
54c7112c43 Simplify arch target handling
Soong's multi-architecture building has grown complex, with the
combination of HostOrDevice+HostType+Arch necessary to determine how to
build a variant of a module, and three separate mutators to split each
into its variations.

Combine HostOrDevice+HostType into Os, which will be Linux, Darwin,
Windows, or Android.  Store Os+Arch as a single Target.

Change-Id: Iae677eff61a851b65a7192a47f2dc17c1abb4160
2016-06-02 17:37:02 -07:00
Dan Willemsen
c2aa4a9c52 Start using blueprint_go_binary
And install the tools into a more obvious location. soong_env is not
moved, since we need it to exist early, so that we can use it in
soong.bash in case there's a build failure.

Change-Id: I9bd1fa320d84d180b2cf3deb90782d380666f7a6
2016-05-31 18:31:56 -07:00
Colin Cross
635c3b0157 Rename common to android
Rename the "common" package to "android", because common is too
generic.  Also removes all android.Android naming stutter.

Ran:
gomvpkg -from 'android/soong/common' -to 'android/soong/android'
gorename -from '"android/soong/android".AndroidModuleContext' -to 'ModuleContext'
gorename -from '"android/soong/android".AndroidBaseContext' -to 'BaseContext'
gorename -from '"android/soong/android".AndroidModuleBase' -to 'ModuleBase'
gorename -from '"android/soong/android".AndroidBottomUpMutatorContext' -to 'BottomUpMutatorContext'
gorename -from '"android/soong/android".AndroidTopDownMutatorContext' -to 'TopDownMutatorContext'
gorename -from '"android/soong/android".AndroidModule' -to 'Module'

Change-Id: I3b23590b8ce7c8a1ea1139411d84a53163288da7
2016-05-18 15:37:25 -07:00
Renamed from common/config.go (Browse further)