Commit graph

243 commits

Author SHA1 Message Date
Colin Cross
dcf71b299c Convert java.Dependency to JavaInfo provider
Export information about java dependencies through a Provider
instead of accessing the module directly.

Test: java_test.go
Test: no changes to build.ninja
Change-Id: Ifc5d566bf6f6ebc0ad399e948effaa1ef6a22876
2021-02-09 15:36:25 -08:00
Liz Kammer
356f7d45c1 bp2build: convert paths/module refs to Bazel label
This currently expands all globs, still need to support converting glob
syntax.

Test: go build_conversion_test
Test: GENERATE_BAZEL_FILES=true m nothing
Test: m nothing
Bug: 165114590
Change-Id: If7b26e8e663d17566fad9614ca87a8da1f095284
2021-02-04 13:45:56 -05:00
Paul Duffin
0267d49255 Make OutputPath implement objPathProvider
Needed to allow OutputPath to replace some usages of ModuleOutPath.

Bug: 179124768
Test: m droid
Change-Id: I0f746a11c53ed8c9c9193b57afc0b06c0249ff75
2021-02-02 13:33:51 +00:00
Liz Kammer
a830f3abc2 Refactor android/paths.go to allow reuse
Extracts out the relevant pieces of ModuleContext into a minimal
interfaces necessary for path handling for Modules. This will allow
reuse in queryview by allowing it to implement only the parts of the
module interface necessary for path expansion in order to properly
handle path properties.

Test: go test soong tests
Change-Id: Iea39a365e5a2ff55071e435fb64f9e6464bbcafd
2021-01-26 12:51:02 -05:00
Liz Kammer
2dd9ca422d Refactor queryview.
Splits queryview into queryview and bp2build. The latter runs as a
presingleton (could be converted to a singleton). This prevents needing
to run soong_ui a subsequent time to build the query. Queryview remains
as a separate step to prevent increasing runtime due to this generation
every time Soong runs.

Currently this is running as a presingleton as this gives a translation
of Android.bp files after only LoadHooks have run, no mutators.

Test: go tests
Test: m queryview && bazel query --config=queryview //...
Change-Id: If2ba28c7ef60fbd41f43bda6623d41c8c7d23a1b
2021-01-07 14:34:00 -05:00
Chris Parsons
dbcb1ff469 Use aquery to declare bazel actions in the ninja file.
This effectively moves execution of Bazel actions outside of soong_build
and alongside ninja execution of the actual ninja files, whether that be
by ninja or by Bazel itself.

This almost allows for mixed builds and Bazel-as-Ninja-executor to
coexist, but requires hacks explained in b/175307058.

Test: Treehugger
Test: lunch aosp_flame && USE_BAZEL_ANALYSIS=1 m libc
Test: lunch aosp_flame && USE_BAZEL=1 USE_BAZEL_ANALYSIS=1 m libc,
though this requires a hack of the main BUILD file. See b/175307058

Change-Id: Ia2f6b0f1057e8cea3809de66d8287f13d84b510c
2020-12-15 17:39:23 -05:00
Colin Cross
5d5839522c Export files to install as a depset
Export files to install through a depset instead of a list to reduce
the size at each module.

Bug: 124313442
Test: m checkbuild
Change-Id: I6a51c89acc9f0f3a9c3c792d3ef8a7cfd6b8bef2
2020-12-07 12:27:50 -08:00
Hans Månsson
d3f2bd79e8 WriteFileRule: Chunk long content and merge them to result
sbox.textproto files are created when handling genrule. The command
for the genrule and output files are written to this file in the
following format:

commands <
  command: "...."
  copy_after: <
    from: "out/asm-generic/auxvec.h"
    to: "out/soong/.intermediates/kernel/msm-4.19/qti_generate_kernel_headers_arm/gen/asm-generic/auxvec.h"
  >
  copy_after: <
    from: "out/asm-generic/bitsperlong.h"
     to:
     "out/soong/.intermediates/kernel/msm-4.19/qti_generate_kernel_headers_arm/gen/asm-generic/bitsperlong.h"
  >
  ....
>

This file grow by one copy_after entry for each output file.

When generating kenrnel headers where the number of output files are
~1000 we run into problems as the contents of sbox.textproto files
are written to disk by generating a shell script using the following
template: /bin/bash -c 'echo -e "$$0" > $out' $content
If $content is very long as in the case of generating kernel headers we
run into the issue where the command line is so long that the shell
script return E2BIG.

Fix this issue by chuking contents into smaller files and then merge
them as a final step.

Test: Build
Issue: 174444967
Change-Id: I1a74023b4222d19672e4df7edb19810a9cf2136f
2020-12-02 15:58:48 +01:00
Alex Humesky
29e3bbe8b8 Update comments in genrule.go.
Test: Noop
Change-Id: Ib341899ea0f04e059d5471ee6e5bff8ebba82583
2020-11-30 12:30:20 -05:00
Jingwen Chen
cda22c9bb9 Refactor 'in_make' to mean Kati is not skipped.
In Nougat and before, Make wrote a marker file to indicate that
soong_build was invoked from Make to change certain behaviors of Soong
at build time.
https://cs.android.com/android/platform/superproject/+/android-7.1.2_r36:build/core/soong.mk;l=70-73;drc=ae18638b0406ad107b0882a02a13cdd8b92f2a4e

Things have changed, and now soong_build is invoked from soong_ui, which
supports a --skip-make configuration flag:
https://cs.android.com/android/platform/superproject/+/master:build/soong/ui/build/build.go;l=31-33;drc=680387bf1d3ce7cbc77f535be7c42cec411b1687

Thus, the various remnants of 'EmbeddedInMake' and 'inMake'
configuration are misleading, since soong_build is no longer invoked
from Make. This CL refactors all instances to actually mean that
Kati is enabled (not skipped with --skip-make), and will run after
soong_build finishes, so Kati-specific behavior like the AndroidMk
singleton should run.

Test: TH presubmit

Change-Id: I576ab8e54f99f5c8ddf9feaf9a828019b279e266
2020-11-23 00:29:18 -05:00
Ulya Trafimovich
ccc8c85a7c Add ModuleInstallPathContextForTesting.
Test: m nothing
Change-Id: Ibcd6016cc43300fcc7f0ec511a3159886d0fdc7d
2020-10-29 17:47:34 +00:00
Treehugger Robot
07bc11722b Merge "Fix path conflict for vendor_ramdisk_available" 2020-10-27 06:27:12 +00:00
Treehugger Robot
f26f734867 Merge "InstallPath keeps its partition dir" 2020-10-27 01:33:12 +00:00
Yifan Hong
39143a941f Fix path conflict for vendor_ramdisk_available
... and ramdisk_available modules. If a module is both
vendor_ramdisk_available and ramdisk_available, on a device
that mark recovery_as_boot and move_recovery_resources_to_vendor_boot
simultaneously (and incorrectly),
both will be installed to recovery/root/first_stage_ramdisk. Fix the
path conflict of the two variants by moving the vendor_ramdisk variant
to vendor-ramdisk/first_stage_ramdisk instead.

Also update comments for Vendor_ramdisk_available.

Test: m nothing -j
Bug: 156098440

Change-Id: I2b776b6fd8f5a2c361c0f6a89231e3cebc2646f0
2020-10-26 12:50:05 -07:00
Yifan Hong
dd8dacc131 Vendor ramdisk modules install to correct location
Install to recovery/root/first_stage_ramdisk if
BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT,
otherwise vendor-ramdisk. In addition, append /system
if not InstallInRoot().

On devices with dedicated recovery partition,
BOARD_MOVE_RECOVERY_RESOURCES_TO_VENDOR_BOOT is not set,
and this installs to the correct place (under $OUT/vendor-ramdisk).

On devices without a dedicated recovery partition:
- To install a module available before switching root
  to /first_stage_ramdisk, e.g. a binary under /system/bin,
  use recovery{_available} and install the recovery variant
  of the module.
- To install a module available after switching root
  to /first_stage_ramdisk, e.g. a binary under
  /first_stage_ramdisk/system/bin,
  use vendor_ramdisk{_available} and install the vendor_ramdisk
  variant of the module.

Test: pass
Bug: 156098440

Change-Id: I1af3f8889891a3e58263cda36f0680ce2b480499
2020-10-22 10:26:26 -07:00
Yifan Hong
60e0cfb5cb Add vendor-ramdisk image to Soong.
Add vendor_ramdisk_available and vendor_ramdisk attribute to
various rules. When a vendor_ramdisk variant of a module is
generated, it is installed to $OUT/vendor-ramdisk.

It is similar to a ramdisk image.
Test: m nothing -j

Change-Id: Ib2d16459f3094dbe21c3bdb7c016cb4b2bf62765
2020-10-22 10:26:26 -07:00
Jiyong Park
957bcd9c32 InstallPath keeps its partition dir
This change introduces the concept of partition dir for InstallPaths.
It's the path to the partition where the InstallPath is rooted at. For
example, it's out/soong/target/product/<device>/<partitoon> for paths
created for device modules. For host modules, it is defined as
out/soong/host/<host_os>-<host_arch>.

The partition dir is obtained using the new PartitionDir() function.

Another change is that a freshly created InstallPath (usually via
PathForModuleInstall) is the result of joining PartitionDir() and the
remaining path elements. For example, PathForModuleInstall(ctx, "foo",
"bar").Rel() now returns "foo/bar". Previously, that call returned the
relative path from config.buildDir() ("out/soong"). This change is in
line with the behavior of other path-creating functions like
PathForModuleSrc where Rel() returns the path relative to the
contextually determined path like the module source directory.

Notice that the Join() call to InstallPath doesn't change
PartitionDir(), while does change the result of Rel().

p := PathForModuleInstall(ctx, "foo", "bar")
p.PartitionDir() is out/soong/host/linux-x86
p.Rel() is foo/bar

q := p.Join(ctx, "baz")
q.PartitionDir() is still out/soong/host/linux-x86
q.Rel() now returns baz

Bug: N/A
Test: m nothing
Change-Id: I916bb1c782a4bfe0fbd4854e349cd2a2a42f56b6
2020-10-22 22:04:08 +09:00
Jiyong Park
87788b5247 Don't assume host arch is always x86
This change fixes some places where host arch is assumed to be x86 to
form a path element like linux-x86. In preparation for non-x86 host
targets, the host arch part is derived from the context.

In addition, InstallForceOS() is refactored so that it can override not
only OsType, but also ArchType. Without this, the paths for the
robolectic modules will be changed from linux-x86 to linux-common, which
breaks several other places where the old paths are expected.

Bug: 134795810
Test: m
Change-Id: Ib38c715948ae546e55021ece82bac1d82e9e5da0
2020-09-08 15:12:10 +09:00
Ulya Trafimovich
5ab276ad1d Export error reporting function to allow using it in other packages.
Test: lunch aosp_cf_x86_phone-userdebug && m
Change-Id: I3a1d936ac57966b2f47cb1d9a56e0f96f47b807d
2020-08-25 12:45:15 +01:00
Chris Parsons
216e10a0f6 Install data_libs using relative_install_path property
Test: Added to data_libs tests
Test: Manually verified with bionic-unit-tests
Test: Treehugger
Change-Id: I28a8e08e3409f1e7c7bb72f4351310b57f35f513
2020-07-20 13:59:24 -04:00
Colin Cross
70f0b53000 Merge changes from topic "lint-unbundled-apps"
* changes:
  Build a zip of transitive lint reports for apps
  Add DepSets
2020-07-16 23:06:22 +00:00
Colin Cross
c0efd1db13 Build a zip of transitive lint reports for apps
Add a rule to build a zip containing the lint reports from transitive
dependencies for apps, and pass it to Make.

Bug: 153485543
Test: m TARGET_BUILD_APPS=Gallery2 lint-check
Change-Id: I523c09016251377ff89d76084769be7401b95425
2020-07-16 12:51:42 -07:00
Jooyung Han
ecc495fd09 Merge "Apply "excludes" for OutputFileProducer" 2020-07-08 06:40:08 +00:00
Christopher Parsons
0eeff82c98 Merge "Add missing soong_docs inputs" 2020-07-06 22:34:51 +00:00
Jooyung Han
7607dd3564 Apply "excludes" for OutputFileProducer
"excludes" should be applied both SourceFileProducer and
OutputFileProducer. But we've been missing the latter.
(see android/paths_test.go)

There's one more to note. Previously, the exclusion was done by
modifying slice directly, which caused some problem(b/76179848).
The fix was returning a copy from Srcs() method. But there're still many
implementors which just return internal slices directly.

This change creates a new array when it needs to exclude something from
returned slice.

Bug: n/a
Test: m (soong test added)
Change-Id: I1ba91e490cb55fc243020681667278cdc75f59df
2020-07-05 10:23:14 +09:00
Chris Parsons
8f232a2702 Add missing soong_docs inputs
Specifically, make Android.bp.list and soong.variables explicit inputs

While this is not a comprehensive list of all inputs
of this action (as the action depends on all blueprint
files in the source tree), this is closer to the truth.

This is a rollforward CL, which was originally rolled
back, as path validation failed for when OUT_DIR was
an absolute path. Validation has now been relaxed.

Test: Manually verified ninja output, checkbuild approved validation
  for aosp-crosshatch, and manually ran frameworks/rs/build_rs.py with
  patch fix
Change-Id: I4eb0d517f57336dd54eaa4bd31f46df9e93e6da2
2020-06-26 10:36:18 -04:00
Jingwen Chen
40fd90ae52 Support multiple dists per Android.bp module, and dist output selection.
This CL adds "dists" to the base property struct to support multiple
dist file configurations, and generic tag support to dist tagged outputs
of modules.

Fixes: b/152834186
Test: soong tests and `m sdk dist`

Change-Id: I80c86bc9b7b09e671f640a4480c45d438bdd9a2a
Signed-off-by: Jingwen Chen <jingwen@google.com>
2020-06-25 12:42:07 +00:00
Christopher Parsons
cd767eefe5 Revert "Add Android.bp.list and soong.variables to inputs for soong_docs action"
This reverts commit 67eee7cae4.

Reason for revert: Broke renderscript build

Change-Id: Ie26b3c7a78afe44d719f399520e643174109593f
2020-06-18 21:49:48 +00:00
Chris Parsons
67eee7cae4 Add Android.bp.list and soong.variables to inputs for soong_docs action
While this is not a comprehensive list of all inputs of this action (as the action
depends on all blueprint files in the source tree), this closer to the truth.

Test: Manually verified ninja output, checkbuild approved validation for aosp-crosshatch
Change-Id: I77a0f612afb025232bee7d3ac31257b808991829
2020-06-18 12:06:37 -04:00
Colin Cross
5e6a797982 Allow tests to bypass PathForSource existence checks
Forcing every test to specify every file it wants to pass to
PathForSource or PathForModuleSrc is painful to maintain and
doesn't add any value.  Allow tests to reference paths through
PathForSource and PathForModuleSrc without specifying them in
the mock FS.

Test: all soong tests
Change-Id: Ia8a8fd965a338d0645b3721314bf91f50146ad21
2020-06-09 14:23:11 -07:00
Jiyong Park
33c7736936 Notice file embededd in APEX is deterministic
Bug: 157724521
Test: m
Change-Id: I25f6cd9dd0679af6acfc2594314d11fa53ae2151
2020-05-29 22:00:16 +09:00
Ulya Trafimovich
8640ab9c26 Raise an error instead of panic in SplitApexJarPairs.
Test: aosp_walleye-userdebug boots
Change-Id: I9a1c4ec5c8862b1936820b3cee6db9a85015cb0e
2020-05-12 12:27:50 +01:00
Nicolas Geoffray
1228e9c0ba Add a nice install paths for module SDKs and exports.
Following how NDK also creates its own install path.

Bug: 142935992
Test: cc_sdk_test.go, java_sdk_test.go
Change-Id: I98a3656903f37f6d7c90e6cf609431b2461a6161
2020-03-04 14:20:46 +00:00
Colin Cross
27027c765e Optimize FirstUniqueStrings and FirstUniquePaths
FirstUniquePaths is called on some long lists where the O(n^2)
behavior is problematic.  Use a map-based implementation for
longer lists.

Test: TestFirstUniqueStrings
Change-Id: I7181aba869e5ccc0f99c2fa7b8f03839f06e4307
2020-03-02 15:00:15 -08:00
Colin Cross
609c49a389 Add pathForInstall and InstallPaths
pathForInstall will allow code in the android package to get paths
to the install directory.

InstallPaths provides helpers for handling lists of install paths.

Test: m checkbuild
Change-Id: I058201b205bc8bc67f3c1f62952aaaf758c47fd8
2020-02-24 15:51:18 +00:00
Colin Cross
6e3594003b Add InstallForceOS, fix testcases for host
Robolectric tests compile against device modules but are installed
and run as host modules.  Allow a module to override its install
OS.

Test: TestPathForModuleInstall
Change-Id: Icf37bb3d4cc1222a9b079602c6a5fdb8b51c86ed
2020-02-19 20:41:22 +00:00
Colin Cross
d63c9a7fc1 Allocate OutputPath.String in PathForOutput
In an AOSP aosp_blueline-userdebub build, OutputPath.String was
allocating 802MB of strings in filepath.Join to prepend the
out dir to each path.  Allocate the joined string in PathForOutput
instead, which results in ~57MB of new allocations in PathForOutput
but no allocations in OutputPath.String.

Test: all soong tests
Change-Id: Id452e0c46a2aeda71bfac11a227bb6edb8e3523d
2020-01-29 16:56:37 -08:00
Yifan Hong
82db735fbc Ramdisk modules install to correct location
Install to recovery/root/first_stage_ramdisk if BOARD_USES_RECOVERY_AS_BOOT,
otherwise ramdisk. In addition, append /system if not InstallInRoot().

Test: pass
Bug: 147347110
Change-Id: Ie5895ac61a3d5d85f5d958a27c7980d6c79d997e
2020-01-22 16:54:18 -08:00
Yifan Hong
1b3348d50a Add ramdisk image.
It is similar to recovery image.
Test: m nothing -j

Change-Id: I11389777c6bfb0c0d73bbb4c70091c1e70f44077
2020-01-22 16:54:18 -08:00
Colin Cross
988414c2cf Sandbox soong_build by changing to root directory
This relands I12a0f907753fefd1997ab8b4ea2ac331234093cf along with
a fix to blueprint for absolute paths.

Store the current working directory and then change to the root
directory so that all file accesses must go through helpers in
the android package that properly track dependencies.

Change-Id: I24ac485677aa102eec1a2521d16820da6ee1ae77
Fixes: 146437378
Test: m checkbuild
Test: m OUT_DIR=/tmp/out nothing
2020-01-11 01:11:46 +00:00
Colin Cross
47e4f9e1e8 Revert "Sandbox soong_build by changing to root directory"
This reverts commit 05c25ccb4a.

Reason for revert: broke absolute OUT_DIR
Bug: 146437378

Change-Id: I523ed79d40e1c1ef040212ba794a7a084abea75d
2020-01-10 18:51:04 +00:00
Colin Cross
05c25ccb4a Sandbox soong_build by changing to root directory
Store the current working directory and then change to the root
directory so that all file accesses must go through helpers in
the android package that properly track dependencies.

Fixes: 146437378
Test: m checkbuild
Change-Id: I12a0f907753fefd1997ab8b4ea2ac331234093cf
2020-01-09 14:19:46 -08:00
Colin Cross
1184b647d5 Add EarlyModuleContext for LoadHookContext
Make LoadHookContext embed a new EarlyModuleContext instead of
BaseModuleContext to reduce its API surface in preparation for
moving it to run during parsing instead of mutators.

Test: m checkbuild
Change-Id: I1cd3ff3b636e7e24991a9184d7521903473e505a
2020-01-04 08:40:55 -08:00
Paul Duffin
9b478b0831 Generate .srcjar for prebuilt_stubs_sources
Changes prebuilt_stubs_sources to generate a .srcjar from its input
instead of just exposing the srcs it is given. This ensures that it can
be used as a drop in replacement for a droidstubs module.

Updates the test for prebuilt_stubs_sources to be more representative
of the actual use made of it by sdk snapshot which outputs a directory
not a glob pattern. Added some documentation of the
prebuilts_stubs_sources srcs property to make it clear that it is
supposed to be a set of directories.

Extracts common code from sdk/testing.go for normalizing path/paths
for testing.

Bug: 143678475
Test: m conscrypt-module-sdk conscrypt-module-host-sdk conscrypt-module-test-sdk
      unzip those in place of external/conscrypt
	  build core-current-stubs-source which expects it to provide a .srcjar.
Change-Id: I8204a022557a9b0b45e19eac79ecba98ff95213d
2019-12-20 08:13:45 +00:00
Treehugger Robot
6b295312f6 Merge "Remove unused testWritablePath and associated methods" 2019-12-19 23:14:55 +00:00
Paul Duffin
3eb9dfe136 Remove unused testWritablePath and associated methods
Bug: 143678475
Test: m checkbuild
Change-Id: I4855f97499d3e4f3f5024fd67069b1bb2f9c349f
2019-12-19 20:38:53 +00:00
Colin Cross
5e70805690 Add helper functions for getting output files from modules
Add OutputFileForModule and OutputFilesForModules to get paths from
OutputFileProducers.

Bug: 122332855
Test: m checkbuild
Change-Id: I2e9aeeb55987742077250390cdb804ba22e79442
2019-12-19 17:52:50 +00:00
Colin Cross
98be1bb00f Move filesystem into Config
The filesystem object was available through ModuleContext.Fs(), but
gives too much access to the filesystem without enforicing correct
dependencies.  In order to support sandboxing the soong_build
process move the filesystem into the Config.  The next change will
make it private.

Bug: 146437378
Test: all Soong tests
Change-Id: I5d3ae9108f120fd335b21efd612aefa078378813
2019-12-18 08:19:10 -08:00
Paul Duffin
57b9e1da75 Improve handling of generated include dirs
The exported include dirs includes both source and generated
directories (e.g. containing aidl generated headers). The latter are
always arch specific so if they are present they make all the include
directories arch specific.

This change separates the source and generated include dirs so that
the source include dirs (which are probably not arch specific) can be
optimized separately from the arch specific generated include dirs.

The FilterPathList() func was refactored to extract the more general
FilterPathListPredicate() func.

A number of tests needed to be updated to reflect the more optimal
snapshot creation.

Bug: 142918168
Test: m checkbuild
Change-Id: Id1a23d35a45b250ae2168834f9c2a65c86a5fd77
2019-12-13 09:59:48 +00:00
Ulya Trafimovich
4d2eeed0da Use boot image extension for framework libraries.
This patch splits the system boot image in two parts:

  - The ART boot image. This is the primary boot image that is
    included in the ART apex and contains dexpreopted Core Libraries.

  - The framweork boot image extension. It depends on the ART boot
    image and contains framework libraries.

The third "apex" boot image (used in the JIT-zygote experiment)
remains unchanged; it is a monolithic primary boot image that
contains both libcore and framework libraries.

Dexpreopting of APKs now uses the framework boot image extension
(which in turn pulls in the ART boot image as a dependency).

Test: m
Test: phone boots:
    lunch aosp_walleye-userdebug && m \
        && adb reboot bootloader && fastboot flashall -w

Bug: b/119800099

Exempt-From-Owner-Approval: rebased after getting approval.

Change-Id: Ida40dfae8c83bf7c2e737d5c7ea418e1197ad826
2019-12-03 13:59:25 +00:00
Colin Cross
ff6c33d885 Replace RelPathString() with ToMakePath()
Add a ToMakePath() method that returns a new path that points out
out/ instead of out/soong/, and replace the
"$(OUT_DIR)/" + path.RelPathString()
pattern with
path.ToMakePath().String()

Bug: 141877526
Test: m checkbuild
Change-Id: I391b9f2ed78c83a58d905d48355ce9b01d610d16
2019-10-03 10:07:53 -07:00
Colin Cross
70dda7e3da Separate InstallPath from OutputPath
Create a new type InstallPath that is similar to OutputPath to
differentiate intermediates output paths from installed output
paths.

RelPathString is a poorly defined, undocumented function that is
primarily used to get an install path relative to out/soong to
generate an equivalent install path for Make relative to $(OUT_DIR).
Move it to InstallPath for now, and fix the one remaining user on
OutputPath.

Add a method to create an NDK install path so that ndk_sysroot.go
doesn't have to do it manually with PathForOutput.

Bug: 141877526
Test: m checkbuild
Change-Id: I83c5a0bd1fd6c3dba8d3b6d20d039f64f353ddd5
2019-10-03 10:07:53 -07:00
Colin Cross
90ba5f4e98 Add InstallInRoot to allow modules to install into root partition
If InstallInRoot() returns true the module will be installed to
$OUT/root or $OUT/recovery/root.

Bug: 141877526
Test: m checkbuild
Test: no change to build.ninja or Android-${TARGET_PRODUCT}.mk
Test: TestPathForModuleInstall
Change-Id: Id6e435c6019f11eeb5806528fd464dbf220b88d9
2019-10-03 10:07:46 -07:00
Jaewoong Jung
0949f31657 Fix android_test install path.
Test: m nothing + diff soong mk and ninja files.
Bug: 140795853
Change-Id: I3667eac951dea7e447cf73219ff89199fca9ed63
2019-09-27 16:42:20 -07:00
Treehugger Robot
792942de47 Merge changes I75b4a761,I779f28c6,If1422372,I26307dd1
* changes:
  Introduce inject_bssl_hash library property.
  BoringSSL FIPS build - introduce extraLibFlags and use for STL libs.
  Allow linker scripts when building objects.
  Allow .o files as srcs.
2019-08-23 00:15:08 +00:00
Pete Bentley
fcf55bf656 Allow .o files as srcs.
Test: m nothing
Test: TreeHugger
Bug: 134581881
Bug: 137267623

Change-Id: I26307dd1129e58878f0468da3b61c53f074bd674
2019-08-22 13:21:37 -07:00
Hsin-Yi Chen
eef3366ab3 Merge "Add tags to the list of lsdump paths" 2019-08-15 02:20:30 +00:00
Hsin-Yi Chen
5348964723 Add tags to the list of lsdump paths
This commit adds tags, such as NDK, VNDK-core, and PLATFORM, to
LSDUMP_PATHS. The script updating the reference ABI dumps uses the tags
to determine the directories where the dumps should be created.

Test: make findlsdumps
Bug: 133176785
Change-Id: I8540286238cf0ec55c65e1c4f60cb9c12e5e57a1
2019-08-07 13:40:11 +08:00
Colin Cross
607d8587e4 Add InstallBypassMake
Allow modules to mark themselves as InstallBypassMake, which will
cause android.PathForModuleInstall to return a path in $OUT_DIR
instead of $OUT_DIR/soong.  This can be used for modules that
can handle installation to the final location on their own.  The
main blocker for most modules is support for the "required" property,
which requires adding dependencies on the installed location of
other modules.

Bug: 122332855
Test: m checkbuild
Change-Id: I85238d937ff30335167d4b3fec79bbefc734b5e1
2019-08-06 09:45:04 -07:00
Paul Duffin
036cacee51 Fixed minor typo
Bug: 138207002
Test: m nothing
Change-Id: Idc6bc6ae9d7e4052da0c0bde6247bff47eab60be
2019-07-25 14:44:56 +01:00
Justin Yun
d5f6c8261a Rename product_services to system_ext
Bug: 134359158
Test: build and check if system_ext.img is created
Change-Id: Ice3229baf97a94c24a6eea22e7d4571941d7f843
2019-07-09 08:57:05 +00:00
Colin Cross
dc35e21124 Consolidate *MutatorContext and ModuleContext into BaseModuleContext
Following 99bdb2ab4fd5168a71a20aecf10611425be47ec4 in build/blueprint,
move more methods into BaseModuleContext.

This reapplies I9f8df94f1ae2b55d3cccf7b9468247f3e7cb2ebd after fixing
missing errors thrown for missing defaults modules when
AllowMissingDependencies == true.

Test: m checkbuild
Test: defaults_test.go
Change-Id: Ia17b2bcbf2bac6889c419b2e73953946f6aa40ad
2019-06-10 16:30:35 -07:00
Colin Cross
380c69aab4 Revert "Consolidate *MutatorContext and ModuleContext into BaseModuleContext"
This reverts commit 7e0a2cb590.

Reason for revert: broke TARGET_BUILD_APPS builds

Change-Id: I5316a62f77bb38f6195e3df5e31b073dbd1eb682
2019-06-10 17:49:58 +00:00
Colin Cross
7e0a2cb590 Consolidate *MutatorContext and ModuleContext into BaseModuleContext
Following 99bdb2ab4fd5168a71a20aecf10611425be47ec4 in build/blueprint,
move more methods into BaseModuleContext.

Test: m checkbuild
Change-Id: I9f8df94f1ae2b55d3cccf7b9468247f3e7cb2ebd
2019-06-07 13:29:12 -07:00
Colin Cross
0ea8ba82fc Consolidate baseContext, BaseContext, and BaseModuleContext
blueprint.BaseModuleContext is the set of methods available to all
module-specific calls (GenerateBuildActions or mutators).  The
android package split the same functionality across baseContext (nee
androidBaseContext), BaseModuleContext, and BaseContext.
Consolidate all of them into android.BaseModuleContext.

Test: m checkbuild
Change-Id: I2d7f5c56fd4424032cb93edff6dc730ff33e4f1e
2019-06-06 20:01:31 -07:00
Colin Cross
25de6c30d3 Remove repetition in android package names
Types in the android package don't need to be prefixed with 'android'.

Test: m checkbuild
Change-Id: Ieefcfc1a2c4161d9c412f40ef31867149ec21aec
2019-06-06 17:24:01 -07:00
Colin Cross
41955e8895 Support tagged module references
There are cases where a module needs to refer to an intermediate
output of another module instead of its final output.  For example,
a module may want to use the .jar containing .class files from
another module whose final output is a .jar containing classes.dex
files.  Support a new ":module{.tag}" format in any property that
is annotated with `android:"path"`, which will query the target
module for its ".tag" output(s).

Test: path_properties_test.go, paths_test.go
Test: no unexpected changes in build.ninja
Change-Id: Icd3c9b0d83ff125771767c04046fcffb9fc3f65a
2019-06-04 10:22:51 -07:00
Logan Chien
41eabe63e8 Support opt-in ABI checks
This commit allows a module to opt in for ABI checks even when it is
not an LLNDK/VNDK module.

Bug: 131421213
Test: Add `header_abi_checker { enabled: true, }` to some module
Change-Id: Ie09d262e651cbb44d7d0eba652f55dc1e1e52962
2019-04-27 01:55:50 +08:00
Dan Willemsen
633c502295 Support RuleBuilder.Sbox to wrap commands in sbox
This essentially allows you to declare that everything in a directory
will be created by the rule, and we'll ensure that your command actually
writes out all of the claimed outputs, and remove any other files that
previously existed in that directory.

Test: built-in tests
Change-Id: I990dce2b3a0d89ebd2736ac1a0cadfb5864c6e73
2019-04-15 14:52:05 -07:00
Colin Cross
ba71a3fb11 Fix missing genrule srcs and tools with ALLOW_MISSING_DEPENDENCIES=true
Set the location label for missing srcs and tools to avoid
nonsensical errors when parsing the command.

Test: genrule_test.go
Test: paths_test.go
Test: unbundled branch with missing framework-res module needed by robolectric genrule
Change-Id: I9c1f1cd82a80f048c0e903b8e93910b1ae34b0b1
2019-04-07 19:40:02 +00:00
Colin Cross
8a49795df1 Replace ctx.ExpandSources with android.PathsForModuleSrc
Move the logic from ctx.ExpandSources into android.PathsForModuleSrc
and ctx.ExpandSource into android.PathForModuleSrc, and deprecate
them.  When combined with the pathDepsMutator this will let all
properties that take source paths also take filegroups or genrule
outputs, as long as they are tagged with `android:"path"`.

Test: All soong tests
Change-Id: I01625e76b5da19240e9649bf26a014eeeafcab8f
2019-03-20 19:36:13 +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
Colin Cross
2fafa3ec49 Remove ExpandSourcesSubDir and ModuleSrcPath.WithSubDir
Replace ExpandSourcesSubDir with ExpandSources plus
PathsWithModuleSrcSubDir, which loops over the paths and uses
Join to create paths relative to subdir on any results that
are ModuleSrcPaths.

Test: All soong tests
Change-Id: I11a7face88641e2c26ccdca0a3117d5c38ab588e
2019-03-20 19:35:52 +00:00
Colin Cross
2cdd5df7cc Fix Rel() after ReplaceExtension or InSameDir
Copying p.rel doesn't work, as rel needs to match the end of the
value in path.  Apply the same transformation to p.rel as p.path.

Test: paths_test.go
Change-Id: I42d676c6c4fc18d9852c1a73f25e5a791d7553d0
2019-02-27 20:23:25 +00:00
Colin Cross
40e3373d41 Add more paths helper methods
Add PathsForOutput to convert multiple strings into WritablePaths.

Add OutputPath.InSameDir to build a new OutputPath pointing to a
file in the same directory as an existing OutputPath.

Add WritablePathForTesting and WritablePathsForTesting that mirror
PathForTesting and PathsForTesting but return WritablePaths.

Add PathContextForTesting to return a minimal PathContext
implementation.

Test: paths_test.go
Change-Id: I9708eb164b273514a96dae0a260ef9a963fb9bcf
2019-02-16 17:08:07 -08:00
Colin Cross
8854a5a805 Add OutputPath.ReplaceExtension()
Add a helper method that returns a new OutputPath with the
extension replaced.

Test: paths_test.go
Change-Id: I7f93b3475031a19b53652022740488373a1b7d97
2019-02-12 17:07:35 -08:00
Mikhail Naganov
ab1f518fb0 Improve error messages about paths
Quote the path parameter in the message to distinguish it
from the text. This makes messages more understandable.

Before: source path include does not exist
After:  source path "include" does not exist

Test: build Android
Change-Id: I99dbbce3cf090682a230d05bf120549a2cc7af3c
2019-02-08 13:32:08 -08:00
Colin Cross
0ddae7fddd Allow disabling implicit resource_dirs and asset_dirs
Specifying [] for resource_dirs or asset_dirs will prevent using
the default "res" or "assets" directories.

Test: TestResourceDirs
Bug: 124035856
Change-Id: I96e38ac1319260db43950299a8b1774da68ea85e
2019-02-08 00:24:01 +00:00
Colin Cross
7b3dcc31eb Avoid filepath.Abs
filepath.Abs is surprisingly expensive, it calls os.Getwd every
time, which involves multiple syscalls, a lock, and and allocations.
Use IsAbs and prefix matching instead.

Test: paths_test.go
Change-Id: Ia6cf34d6bef24c694702af1e7a6ff08ffd2d822b
2019-01-24 21:35:16 +00: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
359e6436be Revert "Fix MaybeRel when OUT is absolute"
This reverts commit fee2bff77c.

Test: none
Bug: 119412419
2018-12-14 11:49:58 -08:00
Colin Cross
fee2bff77c Fix MaybeRel when OUT is absolute
MaybeRel was failing with an error when comparing an absolute out
path to a relative source path.  Make it return false instead, and
add tests.

Bug: 119412419
Test: paths_test.go
Change-Id: I462182638bd57b1367b5bfb0718e975c11ae66f7
2018-12-13 21:05:18 +00: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
Dan Willemsen
2d31a44b8a Stop using DIST_DIR in Soong
We're only using it to distribute files in case of failure, which isn't
well supported currently, but can be handled for now by using the
DIST_DIR environment variable during the command execution.

This was at least one cause that we'd be re-running Soong during every
build server build, as the DIST_DIR values are unique.

Test: m dist
Change-Id: Ibd5e6b6c46695350de80b745bfb6a6aa685033a0
2018-10-20 21:33:41 -07:00
Colin Cross
3f4d116496 Update soong for ShouldFollowSymlinks argument to pathtools.Glob
pathtools.Glob now takes a ShouldFollowSymlinks argument.  Add
pathtools.FollowSymlinks to all the calls to pathtools.Glob to
maintain current behavior.

Test: m checkbuild
Change-Id: I0215efb212be4ba4513669612d88c2baade43747
2018-09-21 16:08:16 -07:00
Colin Cross
fe4bc36f87 Allow '$' in some paths
The icu resource directories contain filenames that have '$'
characters.

Allow paths returned by the Glob functions to contain '$', on the
assumption that real paths on disk are unlikely to contain strings
that are valid ninja variables.  Fix the Build rules to escape any
paths that are passed as Path arguments.  Fix the resource rules to
manually escape the paths that are passed as strings.

Test: m checkbuild
Change-Id: Ie631bc6d96259e592adb280491a365c0df7ed0e2
2018-09-13 18:27:50 +00:00
Colin Cross
e3924e180b Allow paths containing glob characters in glob results
Some paths contain glob characters.  For now allow paths with glob
characters as long as they are in glob results.  In the future we
may need to allow escaping glob characters.

Test: m checkbuild
Test: paths_test.go
Change-Id: I1cbeea658e8fc4975ca0b6a50a8c24ac2de026c5
2018-08-16 17:03:56 -07:00
Colin Cross
3063b78ea5 Make :module provide the output file for java modules
Make :module on a java_library provide the output file, which is
normally the implementation jar.  For java_library modules with
installable: true or compile_dex: true this will be the dexjar
instead.  For android_app modules this will be the apk.

Bug: 80144045
Test: no change to out/soong/build.ninja
Change-Id: I739674aee60a38bfccb859369e4414b46f293d82
2018-08-16 16:13:58 -07: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
Logan Chien
7eefdc4ed2 Support text ABI dump file format
This commit adds an option to read ABI reference dump in text file
format directly from `prebuilts/abi-dumps`.  If both the text file and
the gzip format exist, an error will be emitted.

Bug: 78650426
Test: create libexif.lsdump.gz and it works as usual
Test: create libexif.lsdump (decompressed) and it works
Test: touch both libexif.lsdump.gz and libexif.lsdump and it errors
Change-Id: I420a5953fb80855cb5c07e5a4d347fb6709f0340
2018-07-11 18:37:50 +08:00
Logan Chien
5237bed1c4 Remove vndkVsNdk()
This commmit removes `vndkVsNdk()`, which is essentially
`!inList(ctx.baseModuleName(), llndkLibraries)`.

Test: lunch aosp_arm64_ab-userdebug && make
Change-Id: I8e2352f302df30057997944678f176f4550d3f75
2018-07-11 17:30:39 +08:00
Logan Chien
83c415f955 Remove isSourceDump from PathForVndkRefAbiDump()
This commit removes `isSourceDump` from `PathForVndkRefAbiDump()`
because the binary dump paths are not being used at all.

Test: lunch aosp_arm64_ab-userdebug && make
Change-Id: I7a6bb9053a6b052590fb1152982949fee897df8d
2018-07-11 15:27:36 +08:00
Jiyong Park
2e6743176a Recovery partition has same layout as system
Recovery partition has same layout as system. In other words,
executables are installed to <recovery_root>/system/bin and libs are
installed to ../system/lib.

This is made possible because the recovery partition is now
self-contained, i.e., shell, adbd, etc. are hosted in the recovery
partition and thus we no longer has to mount the real system.img
to /system. So /system is now available to executables built for
recovery mode.

Bug: 63673171
Test: `adb reboot recovery; adb devices` shows the device ID
Test: Select 'mount /system' in the recovery mode, then `adb shell`.
$ lsof -p `pidof adbd` shows that libm.so, libc.so, etc. are loaded from
the /lib directory.

Change-Id: I6c4f903ad21fd3dd10a07c4588be85d3d678c099
2018-06-09 01:57:00 +09:00
Jiyong Park
f9332f1c86 Support recovery and recovery_available
`recovery: true` installs a module to the recovery partition.
`recovery_available: true` makes a module to be available to other
`recovery:true` or `recovery_available: true` modules.

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

Bug: 67916654
Bug: 64960723
Test: m -j, toybox_recovery is installed to the recovery/root/sbin
Change-Id: Iaebe0593de16c69fa70de251a61f4d018a251509
2018-05-15 16:27:12 +09:00
Colin Cross
a140bb05f1 Reverse RRO dir paths when passing to Make
LOCAL_RESOURCE_DIRS puts the highest priority overlay first, but
aapt2 expects the highest priority overlay last.  Soong stores the
list in aapt2 order (low to high priority), but that means when it
exports to Make as LOCAL_SOONG_RRO_DIRS, which goes to
build_rro_package.mk and then package_internal.mk, it gets reversed
again and comes out backwards.

Bug: 78032566
Test: m checkbuild
Change-Id: If72bf929fbf1d126f9051a2f21ec1eb4e3030e6e
2018-04-17 10:53:54 -07: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
bc0c509267 Add DistPath to reference the dist folder
Instead of open-coding the logic of whether there is one, or where to
find it.

Test: diff out/soong/build.ninja without dist
Test: diff out/soong/build.ninja with dist specified
Change-Id: Ia3f1ef335e2d6e2175343338d04867d778a50300
2018-03-12 15:48:30 -07: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
Jayant Chowdhary
ac066c6b90 For abi diffing, factor in arch variant and primary arch.
binder_size_t has a different size for builds with different primary
arches.

Also maintain seperate reference dumps for different arch variants,
since different cflags may be legally specified for them (similar to
what GSI does)

Test: create reference dump for libjpeg at
      prebuilts/abi-dumps/vndk/current/arm64/arm64_armv8-a/source-based/libjpeg.so.lsdump.gz
      mm -j64; header-abi-diff gets invoked.

Change-Id: I55eae4d4811c9754fe8dbd1009c7929fea119eeb
2018-03-01 17:19:25 -08:00
Dan Willemsen
540a78c1ce Turn GlobFiles into a Glob for files, use it
GlobFiles had allowed results to be anywhere in the source tree,
restrict it to results within the current module directory.

Then use it for ExpandSources and other places where we only want files.
This fixes using '*' in cc_test's `data` property, which can only
support files.

The only thing this changes today is that java_resource_dirs and
java_resources no longer pass directories to soong_zip's -f argument.
core-libart previously added some icu directories, now it only passes
files.

Bug: 71906438
Test: only expected changes in out/soong/build.ninja
Test: add data: ["**/*"] to a cc_test, build successfully
Change-Id: Iff1bd8c005a48e431c740706d7e23f4f957d8b1d
2018-03-01 14:05:20 -08:00
Colin Cross
192e97a95c Move AllowMissingDependencies check from PathsForSource to PathForSource
This reapplies Id7925999a27ea75a05e9301bbf1eb9f9a6bc4652 with
additional fixes to not use PathForSource in PathForModuleSrc.

PathsForSource was handling the AllowMissingDependencies case, but
PathForSource was not.  Refactor PathForSource and
ExistentPathForSource, and add logic to PathForSource to fall back
to behavior similar to ExistentPathForSource when
AllowMissingDependencies is set.

PathForModuleSrc uses PathForSource, which causes too many
globs (>50k).  The AllowMissingDependencies check doesn't make
much sense for PathForModuleSrc, since we already know the
project containing the definition of the module exists, we can
expect its local source files to exist.  Use pathForSource and
do an manual existence check instead.

Test: paths_test.go
Test: m ALLOW_MISSING_DEPENDENCIES=true
Change-Id: If1690a708393964d3030cb908beaf7b6897c0084
2018-02-23 11:31:45 -08:00
Colin Cross
461b445d62 Pass nil instead of []string{} to ctx.Glob* functions
[]string{} is unnecessary, just use nil.

Test: m ALLOW_MISSING_DEPENDENCIES=true
Change-Id: Ia9aeb2ffc483429787da0e473a7f1bc87eb4cad1
2018-02-23 11:31:45 -08:00
Colin Cross
c48c14369c Revert "Move AllowMissingDependencies check from PathsForSource to PathForSource"
This reverts commit 94a321045a.

Reason for revert: Broke builds with ALLOW_MISSING_DEPENDENCIES=true

Change-Id: I9604887f796a79809ef8d6c741597796219dcaf3
2018-02-23 07:09:15 +00:00
Colin Cross
94a321045a Move AllowMissingDependencies check from PathsForSource to PathForSource
PathsForSource was handling the AllowMissingDependencies case, but
PathForSource was not.  Refactor PathForSource and
ExistentPathForSource, and add logic to PathForSource to fall back
to behavior similar to ExistentPathForSource when
AllowMissingDependencies is set.

Test: paths_test.go
Change-Id: Id7925999a27ea75a05e9301bbf1eb9f9a6bc4652
2018-02-22 14:43:36 -08:00
Colin Cross
1ccfcc36bd Propagate errors out of validatePath
The next patch will need to more complicated custom error handling,
so make validatePath return an error and let the caller handle it.

Test: paths_test.go
Change-Id: I4fe11c3f319303d779596709f4819e828b5bdb9b
2018-02-22 14:43:36 -08:00
Colin Cross
32f3898f0b Remove unused intermediates parameter from ExistentPathForSource
Test: m checkbuild
Change-Id: Id2c0a5039c2ec3b3795385c135ffec022ccd691e
2018-02-22 14:43:36 -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
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
Colin Cross
74e3fe4cd4 Fix PathForPhony
PathForPhony was prefixing out/soong to all of the phony targets.

Test: m checkbuild
Change-Id: If54d9c692b79751a09eef76c734dd2a1f7db325b
2017-12-11 16:30:14 -08:00
Colin Cross
0db5568612 Make (Source|Output)Path.Join("foo").Rel() return "foo"
This allows TestModule.Output("foo") to be used to find
a file called "foo" that was installed using ctx.InstallFile.

Test: soong tests
Change-Id: I04833c9ee8ac5baa6b6afd35715d1191c1622a78
2017-12-06 04:16:00 +00:00
Colin Cross
6510f91a1c Replace ModuleContext.AConfig() with Config()
AConfig() now duplicates Config().  Replace the uses of AConfig()
with Config().  Leave AConfig() for now until code in other
projects is cleaned up.

Test: m checkbuild
Change-Id: Ic88be643049d21dba45dbd1a65588ed94bf43bdc
2017-11-30 00:44:18 +00:00
Colin Cross
aabf67968c Make *Context.Config return a Config instead of a interface{}
In Soong, a Config() method will always return a Config.  Make
ModuleContext, SingletonContext, TopDownMutatorContext and
BottomUpMutatorContext's Config() methods explictly return
a Config to avoid having to type-assert everywhere.  Overriding
the Config method requires duplicating the list of methods in
blueprint.BaseModuleContext and blueprint.BottomUpMutatorContext,
following the same pattern used by the other *Contexts.

Config() obsoletes the AConfig() method used in some places, which
will be cleaned up in the next patch.

Test: m checkbuild
Change-Id: Ibe21efde933959811d52443496967ab8ce71215e
2017-11-30 00:44:11 +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
Colin Cross
0875c52de7 Wrap PackageContext and SingletonContext
Wrap blueprint.PackageContext so that the *Func methods can provide
an android.Config instead of an interface{}.  The modified signatures
means that every method in ModuleContext and SingletonContext
that takes a blueprint.PackageContext now needs to be wrapped to
take an android.PackageContext.

SingletonContext wasn't previously wrapped at all, but as long
as it is, wrap everything like ModuleContext does.  This requires
updating every Singleton to use the android-specific methods.

Test: builds, all Soong tests pass
Change-Id: I4f22085ebca7def6c5cde49e8210b59d994ba625
2017-11-29 05:04:30 +00:00
Colin Cross
5e6cfbead9 Add searchable android.DirectorySortedPaths
Add an android.DirectorySortedPaths that stores paths sorted such
that all paths in a directory including subdirectories are in a
contiguous subslice.  This will allow efficient O(log(N)) finding
of all paths in a directory using a binary search on the directory
prefix.

Test: TestDirectorySortedPaths in paths_test.go
Change-Id: I5a06a89351ae06e88c06526be54a6b79075361b7
2017-11-13 15:11:08 -08:00
Colin Cross
b671544973 Move first/last unique elements utility functions to android package
Move firstUniqueElements to android.FirstUniqueStrings,
lastUniqueElements to android.LastUniqueStrings, and lastUniquePaths
to android.LastUniquePaths.

Test: m checkbuild
Change-Id: Ieac840405126c7f8f98afb4a4ef35c01a18fe7fb
2017-10-24 12:12:32 -07:00
Colin Cross
702e0f8ab0 Use full relative paths to get module outputs in tests
Make Rel() on ModuleOutPath and ModuleGenPath return the path
relative to the module out and module gen directories respectively,
and make TestingModule.Output() match against the full relative
path to the module.

Test: java_test.go still passes
Change-Id: Id5b2ec3fdef41d4169b943e68d032fc64a2b6f92
2017-10-19 20:44:11 +00:00
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
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
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
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 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
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
Jayant Chowdhary
715cac3971 Optimizations to abi checking.
We now add export_static_lib_headers, export_generated_headers to the
filters while dumping the abi of a library using header-abi-dumper
(through -I<dir> additions to the invocation of header-abi-dumper and
header-abi-linker)

Also add support for zipped reference source based abi dumps.

Test: mm -j64 in hardware/interfaces/nfc/default/1.0 produces
android.hardware.nfc@1.0.so.lsdump with abi filtered out using generated
headers.

Test: Copied the linked abi dumps produced by mm -j64 in bionic/libc to
prebuilts/abi-dumps/ndk and gzipped them. Ran mm -j64 again in
bionic/libc and verified header-abi-diff getting invoked.

Bug: 32750600

Change-Id: I26210af908c87a6143e39fa25f50307acb68a387
2017-05-25 14:46:58 -07:00
Jeff Gaston
734e3809ad Clarify paths.go somewhat
Bug: 35562758
Test: make

Change-Id: I4cf05ffdd0962186f490467829e3576b4e269c47
2017-05-15 11:31:48 -07:00
Colin Cross
5b52959c99 Use ctx.ModuleBuild for darwin ar
Test: builds
Change-Id: If90975c8545158012bc6201acadd136363c21260
2017-05-09 14:32:45 -07:00
Jayant Chowdhary
3e231fd8bd Add header-abi-checker for Vndk abi checks.
header-abi-dumper: dumps abi exported by source files for Vndk.
header-abi-linker: links abi dumps produced by header-abi-dumper.
header-abi-diff: compares linked dumps.

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

Change-Id: Iccad6908fe68a80f47230751671d156893b96ead
2017-04-14 19:48:10 -07:00
Dan Willemsen
aa118f95a6 Implement vendor as a synonym of proprietary
The vendor image will have more than just proprietary modules in it
under Treble, so let's stop marking open source code as proprietary just
to move it to vendor.

Bug: 36452052
Bug: 37134596
Test: compare build.ninja before/after, no changes.
Test: Set vendor: true, ensure it works.
Change-Id: I44b0ec7007d0e311bdcbd44b238b1ef2d05cc6ff
2017-04-07 14:59:18 -07:00
Vishwath Mohan
1dd8839286 Refactor sanitized library on-disk layout - Soong.
This CL moves the location of ASAN-ified libraries on disk in the
following manner:
/data/lib* --> /data/asan/system/lib*
/data/vendor/* --> /data/asan/vendor/*

There are a couple of advantages to this, including better isolation
from other components, and more transparent linker renaming and
SELinux policies.

Bug: 36574794
Bug: 36674745
Test: m -j40 && SANITIZE_TARGET="address" m -j40 and the device
boots. All sanitized libraries are correctly located in /data/asan/*.

Change-Id: I06bf459260ec451d4495a02562f640ad622f34c2
2017-03-31 01:03:56 +00:00
Colin Cross
faeb7aa135 Support data properties for test binaries
Allow tests to specify a data property that lists files or filegroup
modules that will be packaged alongside the test.  Also add a path
property to filegroup modules to allow shifting the path of the
packaged files, and add ExpandSourcesSubDir to expand the filegroup
sources while including a shifted relative path in the Paths objects.

Test: soong tests, manually adding data to a module
Change-Id: I52a48942660e12755d313ef13279313361b4fc35
2017-02-02 16:23:30 -08:00
Colin Cross
294941bee9 Update soong to use pathtools.FileSystem
Update soong to follow changes in
https://github.com/google/blueprint/pull/141

Test: soong tests
Change-Id: I49a9b83cac7590dc75b26b31136b8707c188bc4a
2017-02-02 16:19:56 -08:00
Colin Cross
7fc17dbfce Remove extra basePath from ModuleSrcPath
ModuleSrcPath contains an embedded basePath as well as a
SoucePath that contains another basePath.  Remove the embedded
basePath, and make the SourcePath embedded.

Test: no change to build.ninja
Change-Id: I3cdf3477eca41ed35fac08a892aab22cbcdb2224
2017-02-01 15:14:31 -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
7f19f37443 Move globbing to Blueprint
Move Soong's globbing-with-dependencies support into Blueprint so it can
be used for subdirs= lines in Android.bp files.

Blueprint has a slight change in behavior around subname= lines, it now
always uses the subname and doesn't fall back to Blueprints.  To support
the Blueprints files in build/blueprint, use them directly with build=.

Test: build, add source file that matches glob, rebuild
Change-Id: Ifd0b0d3bc061aae0a16d6c7ca9a1cd8672656b4d
2016-11-04 04:54:16 +00:00
Dan Willemsen
21ec49068f Add subdir to GenPath
We were emulating this for proto files, standardize it and make the
other generators use it as well.

Test: Compare out/soong/build.ninja before/after change
Test: mmma -j system/tools/hidl
Change-Id: I1888c7b981749060a398387bbb9b481270bf6d75
2016-11-02 21:19:11 -07:00
Colin Cross
4f6fc9c1d8 Add Path.Base helper
Add Path.Base to return the basename of a Path object.

Test: builds
Change-Id: I2bf1519dc5039bedb1586e7ec18297a293e32e11
2016-10-27 15:18:17 -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
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/paths.go (Browse further)