Commit graph

143 commits

Author SHA1 Message Date
Dan Shi
3194912150 Add support of test data to python_host_test
Bug: none
Test: m -j vts_vndk_abi_test
confirm abi_dump.zip found next to test binary

Change-Id: I834dddfc13eb9e7addd234307b085b16124db234
2020-09-21 14:36:43 -07:00
Jingwen Chen
fc16b6684e Merge "Fix droiddoc disting when WITHOUT_CHECK_API is true." 2020-08-10 05:22:24 +00:00
Jingwen Chen
7b27ca7dad Fix droiddoc disting when WITHOUT_CHECK_API is true.
When WITHOUT_CHECK_API=true, the droidstubs apiFile can be nil. Fix this
by defensively checking for nil paths when making the TaggedDistFiles,
and also in android.MakeDefaultDistFiles.

The error message reported in r.android.com/1335521 was:

"internal error: panic in GenerateBuildActions for singleton androidmk
  Dist file should not be nil for the default tag in
  android.net.ipsec.ike.stubs.source in translateAndroidMkModule for
  module android.net.ipsec.ike.stubs.source variant android_common"

Test: WITHOUT_CHECK_API=true m droid dist

Bug: 152834186
Signed-off-by: Jingwen Chen <jingwen@google.com>
Change-Id: I1b1f7c0b7a0e1c0ed5e15957d0162c47fd3ec197
2020-07-28 11:53:57 +00:00
Colin Cross
08dca38eb0 Build transitive lint reports for apex modules
Build and export transitive lint report zips for apex modules.

Bug: 153485543
Test: m TARGET_BUILD_APPS=com.google.android.wifi lint-check dist
Change-Id: I5a1805440452301a7e2c4ca91482b989638b54fb
2020-07-22 20:16:14 -07:00
Jingwen Chen
8481186d56 Fix dist(s)-with-tag and add tests to prevent regression.
While AndroidMkEntries' DistFiles were populated from java_library
properly, there was a bug in the conditionals that dropped the tagged
DistFiles.

Fixes b/152834186
Fixes b/161339864

Test: soong tests, m sdk dist (creates out/dist/test.jar with
aosp/1363578)

Signed-off-by: Jingwen Chen <jingwen@google.com>
Change-Id: Id895282256fd367b2f46dcb7a643465fa66c9456
2020-07-21 12:30:39 +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
Treehugger Robot
0c6f111d7b Merge changes Ifd2858dd,I2585dd99,I65e7a456
* changes:
  apex: use SubName for requiredDeps
  apex: support "vendor: true"
  apex: AndroidMk writes common properties
2020-06-29 02:20:56 +00: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
Jooyung Han
2ed99d00b4 apex: AndroidMk writes common properties
AndroidMkEntries handles bunch of common properties(e.g. LOCAL_INIT_RC,
LOCAL_VINTF_FRAGMENTS, etc).

However apex defines its own Custom() writer, so those properties should
be handled manually.

For example, when an apex defines "init_rc" properties, the value should
be passed to Make via LOCAL_INIT_RC.

Bug: 159211312
Test: m
Change-Id: I65e7a456486c9f5fe70c91b78ff181425035fcf2
2020-06-25 15:30:26 +09:00
Jiyong Park
89e850ab84 mark platform un-availability
A module is marked unavailable for platform when 1) it does not have
"//apex_available:platform" in its apex_available property, or 2)
it depends on another module that is unavailable for platform.

In that case, LOCAL_NOT_AVAILABLE_FOR_PLATFORM is set to true for the
module in the Make world. Later, that flag is used to ensure that there
is no module with the flag is installed to the device.

The reason why this isn't entirely done in Soong is because Soong
doesn't know if a module will be installed to the device or not. To
explain this, let's have an example.

cc_test { name: "mytest", static_libs: ["libfoo"]}
cc_library_static { name: "libfoo", static_libs: ["libbar"]}
cc_library { name: "libbar", apex_available: ["com.android.xxx"]}

Here, libbar is not available for platform, but is used by libfoo which
is available for platform (apex_available defaults to
"//apex_available:platform"). libfoo is again depended on by mytest
which again is available for platform. The use of libbar should be
allowed in the context of test; we don't want to make libbar available
to platform just for the dependency from test because it will allow
non-test uses of the library as well.

Soong by itself can't tell whether libfoo and libbar are used only in the
context of a test. There could be another module depending them, e.g.,

cc_library_shared { name: "mylib", static_libs: ["libfoo"] }

can exist and it might be installed to the device, in which case
we really should trigger an error.

Since Make has the knowledge of what's installed and what's not,
the check should be done there.

Bug: 153073816
Test: m
Test: remove "//apex_available:platform" from libmdnssd (it is currently
installed to /system/lib), and check that `m system_image` fails

Change-Id: Ia304cc5f41f173229e8a154e90cea4dce46dcebe
2020-04-24 21:40:13 +09:00
Paul Duffin
8c3fec4c37 Enable androidmk processing in sdk testing
Previously, while sdk tests would pass the sdk code would often fail
in androidmk processing. This change makes the tests more realistic
and will catch the errors earlier.

Bug: 142935992
Test: m nothing
Change-Id: Ifd0b2d7cf24e941c919f6b6e0beb2403a67d4308
2020-03-06 09:45:54 +00:00
Bob Badour
a75b057e17 Unless overridden include LICENSE files in notices.
As a second step to removing the go/android3p instructions to copy or
to link NOTICE to LICENSE, include LICENSE files in the notices, which
will allow deleting all of the copied/linked NOTICE files.

The change causes a few additions to the system image notice files.

Test: manually built and compared before and after notices
Change-Id: Ia7bc58e2eba7bed5e63934881b5298201a93bc3e
2020-02-21 20:40:43 +00: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
Jiyong Park
0b0e1b9804 AndroidMkEntries() returns multiple AndroidMkEntries structs
AndroidMkEntries now returns multiple AndroidMkEntires so that a module
can emit multiple Make modules if needed.

Bug: 128708192
Test: m

Change-Id: I56b6f76d22943b80329951c5acb80a1b932441ad
2019-12-11 17:25:27 +09:00
Jooyung Han
43240b1191 Remove unused "product_services_specific" prop
product_services_specific is not used any longer.

Bug: 135957588
Test: m
Change-Id: I6c09d3c09773034085a1419cbffe86954066df4e
2019-11-12 17:07:52 +09:00
Colin Cross
0f7d2ef3ac Add method to determine variations from a Target
The arch variants are hardcoded in every module type.  Refactor
them out into a Target.Variations() method in preparation for
splitting the arch mutator into two, which will require using
different variations.

Test: m checkbuild
Change-Id: I28ef7cd5168095ac888fe77f04e27f9ad81978c0
2019-10-16 14:52:30 -07:00
Jaewoong Jung
9a1e8bdd0b Migrate java/androidmk.go to new system #2
This change migrates remaining AndroidMk()s in java/androidmk.go to
AndroidMkEntries().

Test: Soong tests
Test: Built a system image
Test: Manual inspection of diffs
Change-Id: Ib1107fafb175fdfd8539bf6158548224e4c87a6d
2019-09-27 08:10:39 -07:00
Jaewoong Jung
b0c127cfd7 Migrate java/androidmk.go to new system #1
This change migrates some of AndroidMk()s in java/androidmk.go to
AndroidMkEntries(), mainly focusing on deduping test-related helper
funcs.

Test: Soong tests
Test: Built a system image
Test: Manual inspection of diffs
Change-Id: I7810085521600d9ea2df078837688ade41c04825
2019-09-10 07:38:31 -07:00
Jaewoong Jung
e0dc8dfd22 AndroidMkEntries minor refactoring.
This includes a few changes that make AndroidMkEntries more resemble
AndroidMkData, especially in terms of how extra entries are added.
Most importantly it can now have multiple custom functions.

Test: Soong tests
Change-Id: Ibf9102624d16d0c1c9894a2794fc7c797bb34c9a
2019-08-28 13:07:03 -07:00
Dimitry Ivanov
2ca7a8835e Merge "Make relative path for native_bridge binaries configurable" 2019-07-16 09:17:35 +00:00
dimitry
8d6dde8831 Make relative path for native_bridge binaries configurable
This change introduces NativeBridgeRelativePath and
NativeBridgeSecondaryRelativePath product variables to
make relative path to native_bridge binaries configurable.

It also removes moves information about native bridge
host architecture to Target and sets it during decodeTargetProductVariables

Test: make PRODUCT-cf_x86_phone-userdebug dist
Change-Id: Ie736e81eae507e1775566ce9f29135011b12af27
2019-07-15 20:04:07 +02:00
Jooyung Han
12df5fb471 soong: Fix AndroidMk with *Required properties
java.Module is using "Custom" function to write Android.mk.
And if "hostdex" is set to "true", it writes "hostdex" module definition
as well as original module.

As of now, Required/Host_required/Target_required props are filled in
the AndroidMkEntries structure(aosp/939505). But these are not
passed to old AndroidMkData.Custom function.

So, if a java_library declares "hostdex:true" and "required:[...]"
together, "required" is not applied to the "hostdex" variant.

This change copies *Required props from AndroidMkEntries to
AndroidMkData before calling its Custom callback.

Test: m (runs soong unit tests)
Change-Id: I5f85714f721a2a0917ab18072dbea52294c770e7
2019-07-16 02:28:29 +09: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
dimitry
4320449c97 Apply native_bridge suffix to all cc_modules
This fixes the problem with cc_object not having this suffix and
as a result overriding non-bridged variants for modules using mk files.

Bug: http://b/77159578
Test: build 4arch product
Change-Id: Ie958f997c6f54f93d8b2987ca5ba605004e1eb70
2019-05-23 13:31:10 +02:00
dimitry
1f33e40972 Add native_bridge target to Android.bp
This allows us to build guest libraries for the native bridge for
arm/arm64 architectures.

Bug: http://b/77159578
Test: make
Change-Id: I35520ca456105ddadd456c78a4eb1e6de39147c5
2019-05-03 15:33:28 +02:00
Jaewoong Jung
9aa3ab1f3f New AndroidMk authoring system based on entry map.
The new system collects all Android.mk variable assignments using a map
and writes them to io.Writer. Compared to the previous system, which
directly writes all entries to buffers, this new system is more robust
and test-friendly.

Test: Built without prebuilt_etc.go change and diffed the mk output.
Test: prebuilt_etc_test.go
Change-Id: Idd28443d129ff70053295015e69328a8fa3eca47
2019-04-22 15:32:44 -07:00
Sasha Smundak
b6d230515e Implement host_required and target_required properties.
They are counterparts of LOCAL_HOST_REQUIRED_MODULES and
LOCAL_TARGET_REQUIRED_MODULES respectively.

Fixes: 128693436
Test: treehugger, convert cts/hostsidetests/devicepolicy/Android.bp
Change-Id: Id66ffca6edffe18993ac51e8930f1d0e78178249
2019-04-04 11:24:01 -07:00
Jiyong Park
52818fcde8 Notice support for APEX
Notice file for an APEX is created by merging notice files for the
modules included in it (plus the notice file for the APEX itself if
specified).

Notice files having the same content are not duplicated; it is emitted
only once.

Bug: 128701495
Test: m (apex_test is amended)
Test: m and inspect $(PRODUCT_OUT)/obj/NOTICE.txt to check there are
license entries for /system/apex/*.apex files

Change-Id: I169d91038291a6c71615de97cf5b03174afab5d4
2019-03-21 08:05:50 +09:00
Colin Cross
1ad8142bd3 Fix androidmk module ordering
Java binary modules expect the order of modules in Soong's Android.mk
to match the variant order.  Instead of sorting by name and then
subdir, which will alphabetize the variants, only sort by name and
use sort.Stable to keep the ordering of modules with the same name.

Test: m
Change-Id: Icf3d22bdc9f9c73945d01c2c47468cc1c361035d
2019-01-14 12:47:35 -08:00
Jaewoong Jung
62707f79ab Add filegroup support to notice property.
Also, replace all notice file references with the parent directory
pattern(../) with filegroups. This new version has
ALLOW_MISSING_DEPENDENCIES support, so shouldn't break branches that
don't contain the libwinpthread project.

Bug: 118899640
Test: Manual build + forrest runs on previously failed branches.
Change-Id: I13e70e8dab547f82c1c8f15eccc7ae116e480ad5
2018-11-27 09:45:18 -08:00
Dan Willemsen
569edc5f66 Add dist support to Soong
When dist'ing a library or binary that has use_version_lib set, always
distribute the stamped version, even for the device.

Test: m test_build_version_test dist
Change-Id: I2995ec516b1d182ce18f099aeaa4d186ffbcf01f
2018-11-19 15:26:14 -08:00
Jaewoong Jung
491fe5ffd8 Revert "Add filegroup support to notice property."
This reverts commit ff7a1a47d9.

Reason for revert: Broke ART buildbot

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

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

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

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

Reason for revert: Yet another broken build.

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

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

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

Reason for revert: This broke few builds.

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

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

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

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

Bug: 36073965
Test: cc_test.go
Change-Id: Ic63ca523b40acac82bbe876f7aa40ecd495907c5
2018-11-01 22:45:59 +00:00
Dan Willemsen
0ef639bb59 Allow generating modules once per OS instead of once per Class
When building with two OSes of the same class (Host, etc) enabled,
independently produce variants of each module for each OS, instead of
making `compile_multilib: "first"` select just one of the OSes.

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

Bug: 31559095
Test: enable host bionic, see a linux(_glibc) and linux_bionic
      definition for binaries
Change-Id: I55e7f046758b3dc2a31da2c4b20274ec68ece0a0
2018-10-22 15:46:03 -07:00
Colin Cross
2465c3d998 Add phony targets for go binary modules
Add custom handling to androidmk.go for the bootstrap.GoBinaryTool
interface in order to create .PHONY targets for each tool written
in go.

Bug: 64539926
Test: m checkbuild
Test: m androidmk
Test: m multiproduct_kati
Change-Id: Ic65faa27a6ee4dfbd54ed6d208091db7c1d657a2
2018-09-28 10:25:45 -07:00
Colin Cross
953d3a2b28 Wrap panics that occur in AndroidMkDataProviders
Annotate panics that come from an AndroidMkDataProvider with the
module and variant that it was running on.

Test: m checkbuild
Change-Id: I4a2f32b1987dc028c446e9379a0738059e7679b1
2018-09-07 01:10:11 +00:00
Dario Freni
95cf767918 s/product-services/product_services/g
Attempting to reduce the number of different spellings we have for
"product services" partition in the codebase.

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

Bug: 80741439
Test: m -j both with and without enabling the new partition
Change-Id: I72b335ad38baff5848cd3da7489343f8cf98ff16
2018-07-19 14:04:30 +01:00
Logan Chien
43d34c38d8 Introduce runtime_libs to cc_binary and cc_library
This commit adds `runtime_libs` to cc_binary and cc_library.

Similar to the `required` property, if a module specifies the
`runtime_libs` properties and it is installed, then the modules
specified in `runtime_libs` will be installed as well.

Differnt from the `required` property, if a module is using VNDK and the
module names specified in `runtime_libs` are resolved to the modules
with both core and vendor variants, then '.vendor' will be appended to
those module names.

For example, if `libb` is vendor_available and `libd` is a vendor lib,
then LOCAL_REQUIRED_MODULES will contain `libb.vendor` (instead of
`libb`).

Bug: 72343507
Test: lunch aosp_arm64_ab-userdebug && make  # this runs the unit tests
Test: Create a vendor module with runtime_libs property to a
vendor_available shared library and check the generated Android.mk.

Change-Id: I9e245d80004dab597a5d3db5acd8a09117118db7
2018-04-25 14:47:50 +08: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
Steven Moreland
57a23d2f20 Add vintf_fragments.
Bug: 66917623
Test: fragments are loaded in the right place
Test: boot device which is depending on fragments
Test: androidmk file which uses LOCAL_VINTF_FRAGMENTS properly
    converted
Change-Id: I366b731cf8d5ecf51851866f441ff1c517da75cf
2018-04-05 20:33:01 +00: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
5beccee92c Split logtags implementations for cc and java
Logtags files in cc and java are treated fundamentally differently.
In cc, they are not used for compiling at all, but need to be passed
to Make to be combined into the global logtags list, and logtag files
are listed in a logtags property.  In java they are listed in srcs
and produce generated code that is compiled in, and so shouldn't
also need to be listed in a logtags property.

Move the logtags property to cc and export it to Make from there,
and have java extract logtags files from srcs to be exported to
Make.

Test: m checkbuild
Change-Id: I31d49289efe72db60d2f33566df771b4a3ebc8a0
2017-12-07 15:32:30 -08:00
Jeff Gaston
088e29ed38 Revert "Revert "Soong support for namespaces""
This mostly reverts commit 178d5fefc0
and mostly reapplies change I6d3e52ef62c4cabe85b9a135a54de0e1a6aab29c .

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

Change-Id: I32baae00277a547fdcdd1c2219fe6625ee0e45d7
2017-12-04 17:44:29 -08:00
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
Jeff Gaston
178d5fefc0 Revert "Soong support for namespaces"
This reverts commit 63a250a336.

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

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

Change-Id: I6d3e52ef62c4cabe85b9a135a54de0e1a6aab29c
2017-11-29 13:03:40 -08:00
Colin Cross
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
Nan Zhang
0007d810e2 Change bool, and string properties to *bool, and *string for cc
there's no use case for prepending/appending to bool, and string
properties within module struct. Declearing "*bool" and "*string" almost
cover everything user need.

I did see one case that user specify relative_install_path as
path prefix in cc_defaults, and concatenate with the one in real module
to get the final relative install path in Android.bp <bionic/tests/libs>.

Test: m -j checkbuild
Bug: b/68853585
Change-Id: If3a7a2689c3fc307aae136af6bc9c57f27a1e1a0
2017-11-07 15:57:16 -08:00
Colin Cross
7d716baedf Revert "Revert "Make some common properties overridden when used in defaults modules""
This reverts commit 5c3c768187.

This reapplies I70e45caa92f65dc6a3bc81ae33a5a8f34ad11890 along with
additional changes in other projects to match the new types.

Bug: 68337468
Test: m checkbuild
Change-Id: I2d2d876b291869f834a6468d3e2ad99148f94a15
2017-11-01 14:24:48 -07:00
Nicolas Geoffray
5c3c768187 Revert "Make some common properties overridden when used in defaults modules"
Bug: 68337468

Breaks HOST_PREFER_32BIT=true

This reverts commit 617016a6f2.

Change-Id: Ifb20f41cdf93dbfd73a3aac5b055e595e334350b
2017-11-01 09:32:53 +00:00
Colin Cross
617016a6f2 Make some common properties overridden when used in defaults modules
Switch commonProperties to *string and *bool so that defining them
in a module correctly overrides instead of appends to values set
in defaults modules.

Bug: 68337468
Test: m checkbuild
Change-Id: I70e45caa92f65dc6a3bc81ae33a5a8f34ad11890
2017-11-01 05:28:36 +00: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
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
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
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
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
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
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
Nan Zhang
db0b9a3cf3 Supported python build in host side.
The base module handles all the common functionalites, such as version
compatibilty check, version variations split, source file format check,
source/data file duplicate check.

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

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

Change-Id: I06608369f350f7195873d459e1c8d1bdb811e77e
2017-05-05 13:27:56 -07:00
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
Nan Zhang
280802c102 Fixed the issue that phony module was broken.
Phony module was broken since it reached the code line to try to
invoke some specific arch functions which caused the runtime panic
error.

Bug: 36739664
Test: mm -j32 -k
phony {
     name: "shell_and_utilities",
     required: [
         "grep",
         "gzip",
         "mkshrc",
         "reboot",
         "sh",
         "toolbox",
         "toybox",
     ],
}
in system/core/shell_and_utilities/Android.bp

Change-Id: Idf7da17d431aae5f0c56b08f5e5eef14ae4eef50
2017-03-29 17:43:47 -07:00
Colin Cross
55708f3fb3 Support owner property
Support owner properties in Android.bp files and propagate the value
to make using LOCAL_MODULE_OWNER.

Bug: 36413696
Test: builds
Change-Id: Iac1cf7f2a14c9e3e6d85d6e09d5adb08a7078d00
2017-03-20 13:33:45 -07:00
Dan Willemsen
01a405a481 Add LinuxBionic toolchain and switch
This adds a toolchain definition for LinuxBionic that only supports
Clang/64-bit. It pulls pieces from the x86_linux_host and x86_64_device
configs, and uses the android clang triple, with some manual overrides.

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

 {"Host_bionic": true}

Bug: 31559095
Test: out/soong/{Android,make-vars}-aosp_arm64.mk the same with or
      without host bionic turned on
Test: No change to out/soong/build.ninja before/after this change
Change-Id: Id97dda8bd9aa670c32aed31fbe6aaa8175e70b59
2017-03-15 14:18:42 -07:00
Nan Zhang
6d34b308ff Added phony module type for soong.
The "required" field within "phony" module in .bp file has to be
non-empty. And "phony" module doesn't contain any "src" files.
Bug: b/32981153
Test: make -j out/soong/build.ninja

Change-Id: Iaa2009467c44702572b97ca9cbd02c1d368c8d83
2017-02-06 22:23:19 -08:00
Dan Willemsen
7ed1ae3fa4 Import/Export LOCAL_PROPRIETARY_MODULE
Test: androidmk hardware/broadcom/libbt/Android.mk
Test: m -j vulkan.default, inspect out/soong/Android-aosp_flounder.mk
Change-Id: I8a9553f772a1d434eb0069c1575e1b0d6db36bc9
2016-12-05 17:20:57 -08:00
Colin Cross
cc4f3e3f94 Don't generate Android.mk data if the module is disabled
Move the calls to the AndroidMkProvider to after checking if the
module is disabled.  Disabled modules may not have all the state
necessary to generate the data.

Test: m -j libLLVM
Change-Id: Iab27a26e604f3810bcc2d9f61b1839aa7bc428b4
2016-11-29 15:29:34 -08:00
Colin Cross
ce75d2c6a2 Initial prebuilt support
Support prebuilt shared libraries as an initial proof-of-concept of
prebuilts.  Future changes will support binaries and static libraries,
and the ability to select which to use based on something besides
blueprint properties.

Test: TestPrebuilts run during m -j
Change-Id: I6e84da667e9005ae11844bad01d25cbe4ced1ce3
2016-10-13 14:52:47 -07:00
Colin Cross
798bfce9d0 Move registration into android package
Mutator registration is tightly coupled with the android package, move
all registration from the soong package to the android package.

Test: build.ninja identical
Change-Id: Ie183d0b52cc7431c9e05b231934d189208ef1efe
2016-10-12 14:30:44 -07:00
Colin Cross
69617d3b7d Extend multilib
Allow multilib to be set to "prefer32", which will compile as 32-bit if
available, otherwise as 64-bit.

Add target.device.compile_multilib and target.host.compile_multilib.  If
set, they override the top-level compile_multlib property.

Change-Id: If658a035b5f441547bc74526feb1d34f773776ff
2016-09-06 13:26:37 -07:00
Chris Wolfe
998306e525 Support required property
This adds LOCAL_REQUIRED_MODULES to the generated Android.mk for any
dependencies in the "required" list of a module.

Change-Id: Ibcfe89dce7d247eb441af94e37388a59e71a75a9
2016-08-15 17:10:47 -04:00
Dan Willemsen
2277bcbc2a Add init_rc property, equivalent to LOCAL_INIT_RC
Change-Id: I914bfff8cbdf71b6cfb2271199a964b2cdcb72d0
2016-07-29 15:24:08 -07:00
Dan Willemsen
70e17fa6a5 Dump Soong module type statistics to Make
Make will combine this information with statistics gathered from the
Make build, then dump it out to a build artifact.

Change-Id: I2bd84d4f8a8d145c37e3a4c4fcc8fece99e2a1de
2016-07-25 16:00:20 -07:00
Dan Albert
6a0476930a Remove the implicit "_" in subnames.
The NDK stub libraries need to use subname, but should use "." instead
of "_".

Test: Still builds.
Change-Id: Ib4b0303531e03968c55671ea167ab987adebd783
2016-07-18 23:31:18 -07:00
Colin Cross
a1ad8d1889 Simplify arch target handling
Soong's multi-architecture building has grown complex, with the
combination of HostOrDevice+HostType+Arch necessary to determine how to
build a variant of a module, and three separate mutators to split each
into its variations.

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

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

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

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

Change-Id: Iae677eff61a851b65a7192a47f2dc17c1abb4160
2016-06-02 17:37:02 -07:00
Dan Willemsen
0fda89f4a8 Add support for logtags
This lets modules declare logtags files, which will then be exported to
make using LOCAL_LOGTAGS_FILES. Make still generates event-log-tags and
the java code.

Bug: 28989759
Change-Id: Ie6be79d3ef8a17a74d42eba681a25a08b4c0e7ae
2016-06-01 15:31:28 -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/androidmk.go (Browse further)