Commit graph

338 commits

Author SHA1 Message Date
Jeff Gaston
294356f045 Automatically reorder C/C++ link dependencies in Soong
This uses knowledge of transitive dependencies to reorder
linker command line arguments such that if module A depends
on module B, then module A is automatically listed before
module B in the linker command line.

This should mostly remove the need for Android.bp files to
list all of their static dependencies in link order

Bug: 66260943
Test: reorder the entries of static_libs in an Android.bp and see that linking still succeeds

Change-Id: I20f851ab9f2f30031254e4f30023b6140d15d6c3
2017-10-18 14:30:05 -07:00
Jeff Gaston
af3cc2d23c Some clarifications in preparation to automatically order linker dependencies
Test: Browse the code and determine whether it's easier to understand
Bug: 66260943
Change-Id: I88c24a8a31ef68f428919087d206433659265684
2017-10-18 18:06:02 +00:00
Colin Cross
99967a7b34 Allow arch-specific modules to be disabled in the PDK
Modules may need to be disabled in the PDK for the device but not
the host.

Test: m checkbuild
Change-Id: Ie40555d1437d9f36ceec753884dc4045132998eb
2017-10-17 16:25:26 -07: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
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
92430106c3 Add hostdex support
If hostdex: true is specified for a java library, create an extra
Make module that copies the dex jar to a module with a -hostdex
suffix in the host output directory.

Bug: 67600882
Test: m -j checkbuild
Change-Id: I859dfaabeefdca714b566de94e00f74e03c85939
2017-10-10 08:02:20 -07:00
Colin Cross
05a39cbacc Fix mixing genrule dependencies with globs
Putting a genrule dependency after a glob in a srcs property
was causing the generated files to be treated as globbed files
and hitting an interface conversion panic.

Bug: 67364649
Test: TestGeneratedSources in later patch
Change-Id: I8a076c9998fdd07e53769922be433a793ca575a9
2017-10-09 15:35:47 -07:00
Dan Willemsen
9d93e33b1e Merge "Add target.linux for linux kernel based targets" 2017-10-06 19:43:34 +00:00
Jeff Gaston
60e38b613f Merge "Revert "Some clarifications in preparation to automatically order linker dependencies"" 2017-10-04 21:09:29 +00:00
Jeff Gaston
7b6118be6b Revert "Some clarifications in preparation to automatically order linker dependencies"
This reverts commit 2370af0e23.

Reason for revert: New Build Breakage: aosp-master/aosp_arm64_ab-userdebug @ 4376965

Change-Id: Ibe4b819c4292457c454bf42e6d94fba3071ec04b
2017-10-04 21:07:42 +00:00
Jeff Gaston
2ade0243ae Merge "Some clarifications in preparation to automatically order linker dependencies" 2017-10-04 17:45:40 +00:00
Jeff Gaston
2370af0e23 Some clarifications in preparation to automatically order linker dependencies
Test: Browse the code and determine whether it's easier to understand
Bug: 66260943
Change-Id: Ia3fdb8f38e83ad8225a72c8de2804db23a90ef9b
2017-10-03 17:18:01 -07:00
Colin Cross
19ab372dd8 Merge "Add support for .proto files in java modules" 2017-10-03 23:02:51 +00:00
Dan Willemsen
86fc1ebac3 Add target.linux for linux kernel based targets
This includes android, linux_bionic, and linux_glibc currently.

Test: m nothing
Change-Id: I088eab583eee695c1f61a65a79a302837e5f4577
2017-10-03 14:44:06 -07:00
Dan Willemsen
5746bd481e Remove target.linux
Once this is submitted and we don't have any more references to
target.linux, it can be added back as a common target for all
linux-kernel based targets.

Test: m nothing
Change-Id: Iae5e82eaed65f58950115f21530ae04afd0602b9
2017-10-03 19:44:54 +00: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
Colin Cross
d5934c8bb7 Fix arch specific properties for java modules
Arch specific properties were not being applied to modules
with OS set to Common.

Test: java_test.go
Change-Id: I8f1b49ca51b0cf96f78006dfcd121672e581d9c5
2017-10-02 23:18:19 -07:00
Colin Cross
0f37af0c15 Add java file resources and flag to include sources
Add a properties to allow including files as resources, including
support for filegroups.  Also add a flag that causes module sources
to be included in the final jar.

Test: java_test.go TestResources
Change-Id: Ida8ee59b28df9fe66952170f46470d3a09fd5d65
2017-09-29 14:02:22 -07:00
Dan Willemsen
866b563d4c Add target.linux_glibc and target.bionic
target.linux_glibc will apply to host builds with glibc, which is
identical to the current target.linux. In a future change, target.linux
will change to affect all targets using the Linux kernel (android,
linux_bionic, and linux_glibc).

target.bionic will apply to all OS variants using Bionic.

Bug: 31559095
Test: Add target.linux_glibc, target.bionic sections to an Android.bp, build
Test: m host
Change-Id: I677a67c22fba148fec264132311e355283f9d88d
2017-09-26 22:41:37 -07:00
Treehugger Robot
968df27a9c Merge changes I28a15bcc,I86cccefc
* changes:
  Add (host|host-cross|target)[-<OS>] phony targets when not using make
  Fix mma/mmma when soong is not embedded in make
2017-09-22 19:33:08 +00:00
Dan Willemsen
61d88b8fca Add (host|host-cross|target)[-<OS>] phony targets when not using make
Test: m --skip-make host-linux_bionic
Test: m --skip-make host
Change-Id: I28a15bcc690245f1a544a051868340b1dc818bb3
2017-09-20 18:23:32 -07:00
Dan Willemsen
d2e95fb295 Fix mma/mmma when soong is not embedded in make
Now `mma --skip-make` works.

Test: mmma --skip-make external/googletest
Change-Id: I86cccefc3c5174773d185c6e16bc52fe2c2010b3
2017-09-20 18:23:32 -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
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
5349941875 Use soong_java_prebuilt.mk to export soong jars to java
Instead of trying to squeeze soong jars through prebuilt_internal.mk,
make a separate soong_java_prebuilt.mk.

Test: m -j checkbuild
Change-Id: Idadef3c21a6f618d573110f04c80d7db3db92031
2017-09-07 20:23:43 +00: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
aa76858e48 Fix path to notice file
Make expects notice files paths to be from the root of the tree.

Test: m -j checkbuild
Change-Id: Ic280a8a97797b9a088aeb4e4a52b79816d2d4197
2017-09-05 15:55:04 -07:00
Colin Cross
5aac362949 Add notice property to all modules
Add a notice property to all modules which, if set, propagates to
LOCAL_NOTICE_FILE in make.

Test: m -j checkbuild, examine out/soong/Android*.mk
Change-Id: I565a5624dfd7b376b976b1a43dac5cea96869026
2017-09-01 13:21:53 -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
Colin Cross
5c51792926 Make binaries executable
Split InstallFileName into InstallExecutable that does chmod +x
after copying the file.  Also remove InstallFile and rename
InstallFileName to InstallFile.

Test: m -j checkbuild
Change-Id: Id41ad4eafe521f6cd5d8cc250b7747ecb3da8dfc
2017-08-31 13:48:52 -07:00
Treehugger Robot
25393ebcc4 Merge "Remove more duplicated flags and dependencies" 2017-08-29 22:38:57 +00:00
Treehugger Robot
d1401c51af Merge "Add a name to API level map for O." 2017-08-29 21:04:31 +00:00
Dan Willemsen
fe92c968b9 Remove more duplicated flags and dependencies
All the stats below are for a hikey960-eng build on AOSP master.

Number of order-only inputs in out/soong/build.ninja:
Before: 2847162
After:   606508

Size of:                       Before  After
out/soong/build.ninja          572MB   233MB  -59%
out/soong/Android-hikey960.mk   15MB     9MB  -40%
out/build-hikey960.ninja       367MB   358MB   -2%

Ninja time in `m nothing`:
Before: 6.9s
After:  5.0s

Soong generation time:
Before: 11.6s
After:   6.6s

Test: m nothing
Test: wrote script that counted inputs, only duplicates were removed
Test: treehugger
Change-Id: I6b7c5ef5b1395014b7bf5fd0b8112d42bee127bf
2017-08-29 13:39:46 -07:00
Dan Albert
e3e4fc8693 Add a name to API level map for O.
O is released, so we don't get this knowledge from the development
codenames list any more.

Test: make ndk # with an API using introduced=O
Bug: None
Change-Id: I21104c5d97c89f2f85157ac7d73de8cd5a478571
2017-08-29 11:50:34 -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
Dmitry Shmidt
dba5419dea Add product_variables.uml
Bug: 64985489
Test: Manual

Change-Id: Ief6f06770b4df54c3630fb8f1904da2336f294ff
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
2017-08-23 15:57:20 -07:00
Dan Albert
fd7141ee24 Merge "Update the minimum NDK target API."
am: fb5a671c7c

Change-Id: I9c144909a9266d2fb45f77179166891c0874a2bc
2017-08-21 21:23:08 +00:00
Dan Albert
990419604a Merge "Expose the minimum supported SDK version to make."
am: fd697f4256

Change-Id: I1a7e7657258e6adbad88f9e51684e8238ab4ed18
2017-08-18 02:44:37 +00: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
Colin Cross
07b79f21dd Merge changes Id9717132,I3e3b7251,I021c7971,I8a117a86,Ia5196f1f, ...
am: b8245ea839

Change-Id: I9cd28715891eb9bbd6e0d1a3e0a3e83da2d1d00f
2017-08-12 01:19:58 +00:00
Colin Cross
0f86d186b1 Allow AndroidMkData.Custom handlers to extend normal values
Pass accumulated AndroidMkData to AndroidMkData.Custom handlers
and expose WriteAndroidMkData so that Custom handlers can write
out the normal make variables and then add their own.

Test: No change to out/soong/Android-aosp_sailfish.mk
Change-Id: Id9717132bbd6c5cf3af8596f3eaa9bbb05d98e40
2017-08-11 15:24:11 -07:00
Colin Cross
a18e9cfa29 Remove error from AndroidMkDataProvider.AndroidMk
It's never anything except nil, and it unnecessarily complicates
the implementations.

Test: m -j checkbuild
Change-Id: I3e3b7251f32ffa84dbdfd0448faf248c306ca808
2017-08-11 15:24:11 -07:00
Colin Cross
91825d2279 Remove error from AndroidMkData.Custom
It's never anything except nil, and it unnecessarily complicates
the implementations.

Test: m -j checkbuild
Change-Id: I021c7971ede3e11bbe08cf1601f4690ed4d1a036
2017-08-11 15:24:11 -07:00
Colin Cross
27a4b05441 Remove error from AndroidMkData.Extra
It's never anything except nil, and it unnecessarily complicates
the implementations.

Test: m -j checkbuild
Change-Id: I8a117a86aa39aeb07d9d8d0686ef869c52784f19
2017-08-11 15:24:11 -07:00
Colin Cross
6416271a1f Bring java support closer to current version of make
Make the javac arguments match what is used by make, and export them
back to make.  A future change will switch make to use the the
exported ones.

This makes a dx.jar compiled with soong have identical class files
as one compiled with make.

Test: manual
Change-Id: Ia5196f1f42bc564e99de22e32e72fd2930e9fbae
2017-08-11 15:24:11 -07:00
Colin Cross
74d73e2bfb Rename java_prebuilt_library to java_import
And make it work like bazel's java_import, using a "jars" property
instead of "srcs", and allowing multiple jars to be listed.

Test: soong tests
Change-Id: Ida2ace6412bd77b4feb423646000a1401004e0ea
2017-08-11 15:24:11 -07:00
Colin Cross
7fcfcb180f Merge changes I047d103b,I35de5d93,I3327d275
am: ec0aca3a84

Change-Id: If2db96c28fe9276eacab1e39982546ce6eb39edf
2017-08-08 04:45:08 +00:00
Treehugger Robot
ec0aca3a84 Merge changes I047d103b,I35de5d93,I3327d275
* changes:
  Add prebuilts/misc to root.bp
  Export java modules to make
  Fix java prebuilts
2017-08-08 04:38:45 +00:00
Dan Albert
7e73d5f3c6 Adapt to PLATFORM_VERSION_FUTURE_CODENAMES.
am: 31384debd7

Change-Id: Ib27259053a381f98a73b4dbc0421efce3ef31516
2017-08-03 02:27:44 +00: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
Dan Albert
35f9c2290d Merge changes from topic 'ndk-weak-stubs'
am: bbe3ff4c50

Change-Id: I00a2f6b59ee9e1dfa1f5dbf27e0dea332e686637
2017-08-01 23:19:34 +00:00
Treehugger Robot
bbe3ff4c50 Merge changes from topic 'ndk-weak-stubs'
* changes:
  Add NDK API codenames for old releases.
  Add support for weak symbols in the NDK stubs.
2017-08-01 23:11:12 +00:00
Colin Cross
5ea9bcc50b Fix java prebuilts
The java prebuilt tests weren't registering the prebuilts mutators,
which hid an issue where prebuilts modules weren't getting renamed
to avoid collisions with source modules of the same name, which
ended up causing the prebuilt module to try to add a dependency
on itself.

Test: java_test.go
Change-Id: I3327d27533591cb08a4b8b8b5e1668a6f72be8df
2017-07-31 23:50:01 -07:00
Junmo Park
30486cb174 Merge "Add support for Exynos-M1"
am: ed2c78ef4e

Change-Id: Icd449eec1dc95e456725e03e0663979c698c4a49
2017-08-01 01:07:07 +00:00
Treehugger Robot
ed2c78ef4e Merge "Add support for Exynos-M1" 2017-08-01 01:00:37 +00:00
Dan Albert
151027107d Add NDK API codenames for old releases.
Without these, we'd need to go rewrite all the stub templates to stop
using the codename and use the number instead whenever an API is
released.

Test: changed something in libc to use introduced=L, make ndk
Bug: None
Change-Id: I1b8703655664c567f8a5c36219e73f11ba27d99a
2017-07-28 12:31:28 -07:00
Josh Gao
eb08b587b1 Merge "Delete output files before copying to them."
am: 074a5d35bf

Change-Id: I37673bb2aae7076a18788b36a917625d95474302
2017-07-27 02:04:38 +00:00
Treehugger Robot
074a5d35bf Merge "Delete output files before copying to them." 2017-07-27 01:53:56 +00:00
Josh Gao
ae15271392 Delete output files before copying to them.
Avoid ETXTBSY when copying over a file that's being executed.

Test: manual
Test: m -j
Change-Id: I0427b5018e67e12f685bce95028831b5661eee2c
2017-07-26 15:38:40 -07:00
Dan Willemsen
a9d4cf2323 Use a unified ninja builddir
am: 05f17764c3

Change-Id: I61cc01591b05b476b7d1d5c495753edc7b5eb9aa
2017-07-25 12:50:49 +00:00
Dan Willemsen
05f17764c3 Use a unified ninja builddir
Instead of calling SetNinjaBuildDir, pass it to bootstrap.bash, so that
the bootstrap package can set it consistently during bootstrapping and
normal execution.

Bug: 63720725
Test: m -j nothing
Test: mkdir o; ../bootstrap.bash; ./soong
Change-Id: Ica88d2d5f1461b5be49bfe6316c6ec4ef4d89d49
2017-07-24 15:58:20 -07:00
Junmo Park
8ea4959279 Add support for Exynos-M1
Change-Id: Ie57507a5d0ea9101db603ff3538c51853083a314
Signed-off-by: Junmo Park <junmoz.park@samsung.com>
2017-07-24 07:14:55 +09:00
Junmo Park
8e0416b422 Merge changes I646f303b,I294ca692
am: 99cd671ac3

Change-Id: I435d78bc24058cb84fc2dcc9e687e03967112b74
2017-07-22 02:13:40 +00:00
Treehugger Robot
99cd671ac3 Merge changes I646f303b,I294ca692
* changes:
  Add support for Exynos-M2.
  Override mcpu option of ToolingCFlags when mcpu is eyxnos-m2.
2017-07-22 02:08:18 +00:00
Junmo Park
d86c902470 Add support for Exynos-M2.
Change-Id: I646f303b460556a9b36a44574f25dd992d42906c
Signed-off-by: Junmo Park <junmoz.park@samsung.com>
2017-07-22 09:16:31 +09:00
Colin Cross
2947e85c2c Add support for java_defaults modules
am: 89536d4948

Change-Id: Ie88290932bd250629cfb7a02193d127bf212990f
2017-07-20 07:59:53 +00:00
Colin Cross
89536d4948 Add support for java_defaults modules
Test: java_test.go
Change-Id: I6dba1671c7eb019183af94bb7b10810296740101
2017-07-20 05:47:27 +00:00
Colin Cross
b6b050c4cf Merge "Don't pass same argument twice for defaults modules initialization"
am: 25167cdc7a

Change-Id: I46a2d77a2bb5f6597cc98eaffaa3f2f59ce21209
2017-07-20 04:01:39 +00:00
Colin Cross
1f44a3aa4f Don't pass same argument twice for defaults modules initialization
InitDefaultsModule and InitDefaultableModule were requiring the
module to be passed in as an argument twice, once as a
android.Module and once as an android.DefaultableMOdule.  Use
a type assertion instead.

Test: builds
Change-Id: I57d721e68a4f016e02c17a678af5f2ba25a9a430
2017-07-19 23:14:36 +00:00
Dan Willemsen
737623108d Merge "Switch owner to *string to disable concat"
am: 1651953ca5

Change-Id: I020d7e1ed733ccfc3035aca98fda0417771ecfda
2017-07-19 04:33:38 +00:00
Dan Willemsen
efac4a87ee Switch owner to *string to disable concat
If owner is specified in a defaults module, we shouldn't concat that
with the owner specified in a module using that defaults module. A
string pointer will produce the correct behavior (overriding the default)

Bug: 37330627
Test: out/soong/Android-*.mk looks correct after this change
Change-Id: I64574e2ba81c11b042248d7a44702ec4534ee932
2017-07-18 19:42:09 -07:00
Ivan Lozano
9f32b6b23b Merge "Allow integer_overflow sanitizer path exclusion."
am: 335565d300

Change-Id: Id19a2328970b540fcbcddb9421a2973eada302a7
2017-07-19 01:14:29 +00: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
daf9154992 Merge "Add integration testing infrastructure"
am: dddf50039a

Change-Id: I7e378c07ae859e45ad461545401f69fade6137f0
2017-07-18 00:07:20 +00: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
fc728d9598 add device_kernel_headers module for vendor-specific kernel headers
am: d773eb3e86

Change-Id: I5df3aded9d8ba25cde31eee61ca337eb74113ef4
2017-07-08 03:18:59 +00: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
1523dadc8b Add integer_overflow sanitization build option.
am: 0c3a1efae4

Change-Id: I5fcdec7b89b8104e532b945f30a966dc95c80518
2017-07-07 20:12:58 +00: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
b24b042eee Merge "Fix install location for vendor tests"
am: e9425b0277

Change-Id: Ia44a50350f0980cb1bec364088e53b6e0d39a388
2017-07-07 03:38:25 +00:00
Treehugger Robot
e9425b0277 Merge "Fix install location for vendor tests" 2017-07-07 03:30:13 +00: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
Nan Zhang
9cfe44255b Merge "Fixed the unexpected scenario for "device_supported""
am: 195fb4183c

Change-Id: Ideac7ca40ce3e514e76356305ee456b7d8ad5447
2017-07-06 18:36:08 +00:00
Nan Zhang
1a0f09bc56 Fixed the unexpected scenario for "device_supported"
cc_defaults {
    name: boo,
    device_supported: false,
}

cc_library_static {
    name: foo,
    defaults: [boo],
}

Soong still tried to build foo_android_arm/arm64 device target which is not what we
expected.

Test: m -j checkbuild

Change-Id: I26a67c9ea024f5458f0818def0fa10cecc5fb7cf
2017-07-05 10:37:57 -07:00
Colin Cross
c59a0042a1 Refactor factories
am: 36242850fd

Change-Id: Ied58f93022523557a5d28edbcd79a76b8e2fb875
2017-06-30 22:54:46 +00:00
Colin Cross
36242850fd Refactor factories
Change module factories from returning a blueprint.Module and a list
of property structs to returning an android.Module, which holds the
list of property structs.

Test: build.ninja identical except for Factory: comment lines
Change-Id: Ica1d823f009db812c518f271a386fbff39c9766f
2017-06-30 21:08:36 +00:00
Colin Cross
7c9bfa1f00 Fix panic in builds with no device am: 20e1365e61
am: 414e59cb8b

Change-Id: Id56046edf8bdb5a674f2517d9aba8d8757a536fb
2017-06-23 20:33:07 +00: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
bdbcdda527 Have Soong try to enforce that genrules declare all their outputs. am: efc1b412f1
am: fe4bf0f9a7

Change-Id: Ib9276c8ed8c72103cc1cc6ead64c976cfaf22eb3
2017-06-09 22:20:57 +00: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
Vishwath Mohan
24f4655075 Merge "Fix install path for sanitized native tests. (Soong)" am: d20ac72951
am: 9132b17c47

Change-Id: I4724d2113177e89352f20eb9284ebe4d04888204
2017-06-08 03:02:25 +00:00
Vishwath Mohan
87f3b24418 Fix install path for sanitized native tests. (Soong)
This CL fixes a bug with how Soong builds the install path for native
tests. Tests are installed in /data/nativetest* by default, but the
logic was wrongly redirecting sanitized versions to
/data/asan/system/nativetest*. With this fix, they are correctly
redirected to /data/asan/data/nativetest* instead.

Bug: 37942061
Test: lunch marlin_asan-userdebug && \
        SANITIZE_TARGET="address" m -j70  \
        # nativetests are generated in /data/asan/data/nativetest*

Change-Id: I0c132af5d443151c44219d231770049fddf79bbe
2017-06-07 12:31:57 -07:00
Chris Larsen
48f2ffabb1 Merge "MIPS: Lower LibartImgDeviceBaseAddress() to fix ART tests." am: d55aa7bdad am: e75269a157
am: 24375a84ab

Change-Id: I73abfc65eabf6b0effef8d5e3ab2d888eb0d56a0
2017-05-31 11:47:21 +00:00
Treehugger Robot
d55aa7bdad Merge "MIPS: Lower LibartImgDeviceBaseAddress() to fix ART tests." 2017-05-31 11:32:31 +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
Colin Cross
550b646480 Merge "Add pdk product variable" am: e5598169b3 am: 8a328382bf
am: 6a30684b33

Change-Id: Ie60495934426998d523f5f2c670c052fb08c22fb
2017-05-26 19:45:26 +00:00