Commit graph

127 commits

Author SHA1 Message Date
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
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