Commit graph

4043 commits

Author SHA1 Message Date
Usta Shrestha
8c64fa9a8e Merge "Minor refactoring of Append/PrependProperties() methods Test: m nothing and compare ninja file Bug: n/a" 2021-11-24 15:18:37 +00:00
Jingwen Chen
0a9d09f8f4 Add //build/bazel/examples/soong_config_variables/... to bp2build
allowlist.

Test: CI
Bug: 203677881
Change-Id: Id95f272005c356b22b1f24f932cb1ef6c3363d03
2021-11-24 07:00:11 +00:00
Jingwen Chen
4ad40d99b0 Add a mutex for soong config var map writes.
Fixes: 207572723
Test: CI
Change-Id: Ide4ca9961b8615186c3ab703c461b6ef53ef656e
2021-11-24 03:42:35 +00:00
Cole Faust
701ca2545e Change type of Unbundled_build_apps from bool to []string
Unbundled_build_apps is supposed to be a list of apps to
build as unbundled, not just a simple boolean. Change it
to properly reflect what it is, because the starlark
product configuration relies on soong's interpretation
of variables types.

Bug: 201700692
Test: Presubmits
Change-Id: I85d40d58fe519f9f6e5a382b8f3ec9014f990aa1
2021-11-23 19:06:01 -08:00
Usta
ef3676c94b Minor refactoring of Append/PrependProperties() methods
Test: `m nothing` and compare ninja file
Bug: n/a

Change-Id: If6e4a0de0a8f4f479fe3cbe044cf50d07648c8d9
2021-11-23 17:31:51 -05:00
Jingwen Chen
d43d4a4cdf Temporarily disable //system/apex from bp2build due to flaky failures.
Bug: 207466993
Test: CI
Change-Id: Ie8fad3e34113e037271cd9f869babe7630d434ad
2021-11-23 12:41:17 +00:00
Jingwen Chen
01812020c1 Add support for writing all Soong config variables into @soong_injection.
Also remove the need to use bp2build_available on
soong_config_module_types as we want to convert every single of them
into the tree for a complete soong_injection soong_config_variables.bzl
file.

The variables are split into their bool, value and string types
respectively, as they all need to be handled differently on the Bazel
product_platform side, as well as for generating constraint values and
settings. For example, value variables need to integrate with
TemplateVariableInfo, and string variables need to include the string
value itself into the select key/constraint value.

Sample soong_config_variables.bzl file: https://gist.github.com/jin/cef700bfb20c8656a931306dd71d47e1

Test: CI
Bug: 198556411
Change-Id: I8665dd1269a507edb37de62407ed3641564bea5c
2021-11-23 08:37:30 +00:00
Jingwen Chen
58ff6801f4 Fix bp2build select generation for inter-attribute soong config
variable usage.

There's bug a in the current soong_config_variable handling
implementation where a soong_config_variable sets conditions_default
value for an attr, and a non-conditions_default value for another attr.
This results in the former attr not properly setting the zero value for
the non-conditions_default select key, resulting in the pretty printer
omitting the attribute totally.

The current implementation in this CL ensures that the zero value is set
whenever this happens at the module level. This is seen in
library_linking_strategy_cc_defaults (see comments in code, and the new
tests)

Test: CI
Bug: 198556411

Change-Id: Ibaeb94508c51a7429fb7a08df610cbb5470f76d2
2021-11-23 08:37:30 +00:00
Jingwen Chen
228ef1e370 Allowlist //system/apex.
This bp2builds the one cc_binary in that package that uses
library_linking_strategy_cc_defaults. That target is buildable, but
there's still a bp2build_available allowlist bug that causes the select
statements and static_libs deps to not show up for the target (only
dynamic_deps are), due to how bp2build_available is special cased for
soong_config_module_type in the loadhook.

Test: b build //system/apex:library_linking_strategy_sample_binary
Change-Id: Ic38a1bfaa476108db63348d030e196d8561300ca
2021-11-23 08:37:30 +00:00
Jingwen Chen
84817de033 Add support for merging defaults soong_config_module_types into bp2build
select statements.

This supports defaults from the same or different namespaces, and
transitively defaults as well.

Test: soong unit tests
Test: CI
Change-Id: I99435bacfcfbfe20ad753b8021a1779531d7595a
2021-11-23 08:37:30 +00:00
Colin Cross
d5e7af9003 Switch default for InstallBypassMake to true
Enable InstallBypassMake for all module types by switching its default
to true.

Bug: 204136549
Test: m checkbuild
Change-Id: Ied082995e74d71dee6aecea99689ac3f63600d3b
2021-11-22 21:57:36 -08:00
Jooyung Han
4a8f41081e Set min_sdk_version (system/core)
Many modules requiring min_sdk_version have been used without setting
it, but hard-coded in allowlist.

Bug: 158059172
Test: m
Change-Id: Ibb09ddfdb11df0791a28eb8a0a49f1780084fd95
2021-11-23 11:10:38 +09:00
Jooyung Han
4f71e12cc7 Set min_sdk_version (packages/modules/adb)
Many modules requiring min_sdk_version have been used without setting
it, but hard-coded in allowlist.

Bug: 158059172
Test: m
Change-Id: I6d11425f9c5db11cd52dd81f7500e4424555bfb5
2021-11-22 10:20:53 +09:00
Yuntao Xu
ac69c239d1 Merge "Revert^2 "Add seapp_contexts to allowlist of makefile goal"" 2021-11-19 19:24:55 +00:00
Yuntao Xu
feb0756d41 Revert^2 "Add seapp_contexts to allowlist of makefile goal"
e87a81673e

Change-Id: I461f3ecdd0b0ea0a4b7b12531cf8b561e170df55
2021-11-18 22:33:02 +00:00
Vova Sharaienko
e87a81673e Revert "Add seapp_contexts to allowlist of makefile goal"
Revert submission 1795972-Convert security/Android.mk to Android.bp

Reason for revert: http://b/206976319 Broken build 7928060 on aosp-master on sdk_arm64-sdk
Reverted Changes:
I0e0e7f677:Split property and file contexts modules
I5596d6f00:Add seapp_contexts to allowlist of makefile goal
If685e5ccc:Convert security/Android.mk to Android.bp

Change-Id: I8cf8c0bc2f88172bb3bfa850bbd7ce6daa170c3d
2021-11-18 17:29:01 +00:00
Colin Cross
50ed1f9ccb Install android_app_set modules in Soong
Add support for installing extra files from a zip file when installing
a primary file, and use it to support installing android_app_set modules,
which install a primary APK and then an unknown set of additional splits
APKs.

Test: app_set_test.go
Test: install test android_app_set
Bug: 204136549
Change-Id: Ia92f7e5c427adcef3bcf59c82a2f83450905c01d
2021-11-17 19:55:33 -08:00
Liz Kammer
c31929962b Quote aquery commands.
Bazel run shell actions begin `bin/bash -c <command>`, without escaping,
the command can be treated as an argument to `bin/bash`.

Test: build/bazel/mixed_droid.sh
Change-Id: I423cb393da2e6ac97448ec77b2596f12670dfd31
2021-11-16 17:31:05 -05:00
Wei Li
455ba83a94 Fix the output handling of Bazel aquery for py_binary targets so soong's python_binary_host modules can be converted to py_binary and built with Bazel dependent targets in mixed build.
Test: USE_BAZEL_ANALYSIS=1 m genfunctosyscallnrs
Test: USE_BAZEL_ANALYSIS=1 m func_to_syscall_nrs
Test: USE_BAZEL_ANALYSIS=1 m libseccomp_policy
Bug: 201094425
Bug: 197135289
Bug: 204949078
Change-Id: If98630830d687ca814d6ae09c1e610f2c3a371b1
2021-11-16 20:49:28 +00:00
Treehugger Robot
59a5cb072b Merge "Refactor ProductConfigProperties to use a struct key instead of an string key with hardcoded patterns." 2021-11-16 04:55:15 +00:00
Jingwen Chen
25825ca08d Refactor ProductConfigProperties to use a struct key instead of an
string key with hardcoded patterns.

This fixes a bug with label list conditions_default attrs where the
attribute values get clobbered in a map with the keys
"conditions_default" (with a default empty list) and
"acme__feature__conditions_default" (with a non-empty list) when
generating the LabelListAttribute.

Test: CI
Change-Id: I5429e40f747b7a0ed559f8a468a4831cd32df2c0
2021-11-16 02:50:22 +00:00
Ivan Lozano
3e1bc6cc0d Merge "Use new soong_cc_rust_prebuilt.mk" 2021-11-15 22:19:46 +00:00
Rupert Shuttleworth
c0d9f8bd5e Merge "Allow libbuildversion to build with Bazel, but skip its 'tests' subdir for now." 2021-11-15 09:00:12 +00:00
Ivan Lozano
d06cc748c1 Use new soong_cc_rust_prebuilt.mk
soong_{cc,rust}_prebuilt.mk has been merged. Use the new file.

Bug: N/A, clean-up
Test: m
Change-Id: I3f03e866815f6394aacd8cb0deba04f381b78c29
2021-11-12 13:27:58 -05:00
Colin Cross
b5399c84ff Add .PHONY for dist-for-goals targets
Mac builds don't include build/make/core/tasks/general-tests.mk
which causes the general-tests target not to be marked phony.  Have
Soong mark all dist-for-goals targets as phony so it doesn't rely
on other makefiles being present.

Bug: 205928834
Test: forrest
Change-Id: I9394c9c794fc83cde9649aa12a3039526d8206f3
2021-11-12 00:36:58 +00:00
Chris Parsons
393002a913 Remove modules from denylist after host C++ support
Test: mixed_droid
Change-Id: If9b04625b0ad4fce52283eb683f1342e24bb97f2
2021-11-11 13:56:56 -05:00
Chris Parsons
494eef3dc8 Support host platform cc builds
This involves handling of linux-* platforms (identifying them
appropriately as host), disabling unsupported Windows platform, and
denylisting of still-problematic modules.

Test: mixed_droid, with verification that shared library artifacts
originate from bazel-out

Change-Id: Ib52db49a2d2a3c1ff9b76af23fd4f22cfc9182d0
2021-11-10 21:57:15 +00:00
Colin Cross
02ce1e7833 Merge changes Ib3f4ee14,Iac22c9fd,Ibd78758c,I40d8696c,I2a2b10e4, ...
* changes:
  Fix InstallBypassMake symlink dependencies
  Add tests for ctx.InstallFile
  Fix OutDir vs SoongOutDir in tests
  Fix go vet error
  Add missing os.MkdirAll to WriteFileToOutputDir
  Use pathtools.WriteFileIfChanged in translateAndroidMk
2021-11-10 18:49:08 +00:00
Treehugger Robot
8a709b149b Merge changes from topic "soong-java-install"
* changes:
  Revert "Temporarily add method to get java binary tool"
  Move java module installation into Soong
  Fix ctx.InstallFile calls for java modules
  Make HostJavaToolPath use pathForInstall
2021-11-10 17:05:51 +00:00
Rupert Shuttleworth
2ac9c48ee6 Allow libbuildversion to build with Bazel, but skip its 'tests' subdir for now.
Bug: 198241918

Test: build/bazel/scripts/run_presubmits.sh

Change-Id: I9ab423bf8131de855cf0c380cd42e9fd662c7bfb
2021-11-10 11:16:05 -05:00
Colin Cross
64002afc56 Fix InstallBypassMake symlink dependencies
Host symlinks cannot use order-only dependencies because they may be
used as part of the dependency chain on a tool, and an order-only
dependency would cause the target of the symlink not to be updated.
Use regular dependencies instead.

Bug: 204136549
Fixes: 205674000
Test: TestInstallBypassMake
Change-Id: Ib3f4ee143e94d1995ec6c60d314e7c91e57cc775
2021-11-09 17:25:57 -08:00
Colin Cross
6ac9576eef Add tests for ctx.InstallFile
Add tests that cover Soong-only installation as well as installation with
InstallBypassMake.

Bug: 204136549
Test: TestInstall
Test: TestInstallBypassMake
Change-Id: Iac22c9fdf99994e06b419623ee5fa399ef6957fb
2021-11-09 17:25:57 -08:00
Colin Cross
7b6a55f5a2 Fix OutDir vs SoongOutDir in tests
Tests were using the same value for OutDir and SoongOutDir, separate
them to allow a test that needs to distinguish between them.

Test: all soong tests
Change-Id: Ibd78758c133a7f07bead3f51b699052676f92fbd
2021-11-09 17:25:57 -08:00
Colin Cross
d642113643 Add missing os.MkdirAll to WriteFileToOutputDir
Fix tests when out/soong doesn't already exist by adding os.MkdirAll
to WriteFileToOutputDir.

Test: soong tests
Change-Id: I2a2b10e43b967d0c61d0dbe6a3f8bf381babe73c
2021-11-09 17:25:57 -08:00
Colin Cross
836e387323 Use pathtools.WriteFileIfChanged in translateAndroidMk
pathtools.WriteFileIfChanged was reimplemented in translateAndroidMk,
but without a call to os.MkDirsAll.  Reuse pathtools.WriteFileIfChanged.

Test: soong tests
Change-Id: If3f6a7bfc172b4a1a8945109801146c2b7e72b96
2021-11-09 17:25:57 -08:00
Jingwen Chen
8c10020ffd Merge "bp2build: add support for soong_config_module_type." 2021-11-09 06:59:34 +00:00
Jingwen Chen
a47f28d28e bp2build: add support for soong_config_module_type.
Test: CI, go unit test
Bug: 198556411
Change-Id: Idf862904d51d822f92af0c072341c31b7a02fc64
2021-11-08 13:38:28 +00:00
Colin Cross
c899d7808e Revert "Temporarily add method to get java binary tool"
Java binaries and cc binaries are in the same directory again, the
separate method can be removed.

Bug: 204136549
Test: m checkbuild
Change-Id: I2e7ca82448aba5c7e54d3c3c376fe14a953ef4af
2021-11-05 14:26:53 -07:00
Colin Cross
24cc4be60b Move java module installation into Soong
Move java module installation rules into Soong by overriding
InstallBypassMake.  Update the locations that find host java tools
to look in the Make installation directory instead of the Soong
installation directory, which will no longer be used.

Bug: 204136549
Test: m checkbuild
Change-Id: I5af6d764c97e7ddb5ee121fc9830166c25d831b1
2021-11-05 14:24:51 -07:00
Colin Cross
1d0eb7a9d0 Fix ctx.InstallFile calls for java modules
Call ctx.InstallFile on the primary install file last so that the
primary install file can depend on the extra install files, and so that
the primary install file can be inferred from the last installed file.

Add missing ctx.InstallFile calls for the dexpreopt and hostdex outputs.

Fix the install subdirectory for modules installing to the testcases
directory.

Bug: 204136549
Test: m checkbuild
Change-Id: I7edd7647be27439d3ca0ecc589ca5e89d4ba8474
2021-11-05 14:20:28 -07:00
Colin Cross
ae5330a2d9 Make HostJavaToolPath use pathForInstall
Use pathForInstall instead of PathForOutput for HostJavaToolPath
so that it internally produces an InstallPath that can later support
being converted to Make installpath.

Bug: 204136549
Test: m checkbuild
Change-Id: If4f5d3552b27ffe6b9bc709c4a08d9513c49ef7d
2021-11-05 14:20:28 -07:00
Inseob Kim
a92d10bdf2 Add seapp_contexts to allowlist of makefile goal
This is an interim solution before seapp_contexts and seapp_neverallows
are migrated into Soong. CtsSecurityHostTests needs these two modules.

Bug: 194096505
Test: build
Change-Id: I5596d6f00b957afd86c752501c1e83b3d4089d9e
2021-11-05 05:10:26 +00:00
Colin Cross
acfcc1f682 Move cc module installation into Soong
Move cc module installation rules into Soong by overriding
InstallBypassMake.  Update the locations that find host tools
to look in the Make installation directory instead of the Soong
installation directory, which will no longer be used.

The methods that find host tools are also used on go binaries,
so update the config methods that tell Blueprint where to install
go binaries to the Make installation directory too.

Bug: 204136549
Test: m checkbuild
Change-Id: Id172592c195e506102982a4af0084f6d9c68a896
2021-11-04 10:28:58 -07:00
Colin Cross
3e3eda6eb6 Temporarily add method to get java binary tool
cc binaries are moving from out/soong/host/linux-x86/bin to
out/host/linux-86/bin first, to be followed by java binaries.
Temporarily add a method that gets the java binary path while
it is different from the cc binary path.

Bug: 204136549
Test: m checkbuild
Change-Id: I04a7e741436da6be68078f23d074870413a5bb5e
2021-11-04 10:28:58 -07:00
Treehugger Robot
c37663aad9 Merge "Convert .meta_lic files to textproto" 2021-11-03 18:31:02 +00:00
Treehugger Robot
a3bd963988 Merge changes Id11f4fb1,Id573d970,Ia94a0b5c
* changes:
  Fix //conditions:default excludes computation for LabelListAttribute.
  bp2build: split Bazel conversion context into smaller ones, and change TopDownMutatorContext signatures to use Bazel conversion context.
  Add an error check in `bazelPackage` for malformed labels.
2021-11-03 15:36:28 +00:00
Paul Duffin
8380ee66a5 Merge "Use module-lib system modules when building from prebuilts" 2021-11-03 15:32:42 +00:00
Liz Kammer
5506c1658c Merge "Update bp2build denylist cause" 2021-11-03 14:19:16 +00:00
Wei Li
c989eaf4c3 Keep the following targets disabled in mixed build since there are errors in mixed_droid CI after go/oag/1861755 is submitted.
func_to_syscall_nrs
libseccomp_policy_app_zygote_sources
libseccomp_policy_app_sources
libseccomp_policy_system_sources

Test: CI
Bug: 204949078

Change-Id: Iaf9d7cd8831da984bcee82399be138ebe3aab9e8
2021-11-03 04:15:36 +00:00
Liz Kammer
b84b8c9c9a Update bp2build denylist cause
The binary is converted; however, there are still issues with the host
toolchain.

Test: build/bazel/ci/bp2build.sh
Change-Id: Idf864ea6c64c0c7bbbaa0c9d43d6eac5120e0268
2021-11-02 15:03:12 -04:00
Wei Li
664a4fd0af Fix python_binary_host module in mixed build.
Test: USE_BAZEL_ANALYSIS=1 m genfunctosyscallnrs
Test: USE_BAZEL_ANALYSIS=1 m func_to_syscall_nrs
Test: USE_BAZEL_ANALYSIS=1 m libseccomp_policy
Bug: 201094425, 197135289

Change-Id: Ibc8b99a92149410c8a879b7a4facf6c8961a7b9f
2021-11-02 17:04:38 +00:00
Jingwen Chen
55bc820d66 bp2build: split Bazel conversion context into smaller ones,
and change TopDownMutatorContext signatures to use Bazel conversion context.

This minimizes the context interfaces/functions actually needed to
convert a module, and makes such interfaces easier to mock/test.

Test: CI
Change-Id: Id573d97023d59e06ef70e1f54437024d3f7aadbd
2021-11-02 06:51:27 +00:00
Jingwen Chen
80b6b64db5 Add an error check in bazelPackage for malformed labels.
Bug: 204281595
Test: CI
Change-Id: Ia94a0b5c8dd3a0294475e9bc816a19ae03f7342d
2021-11-02 06:24:31 +00:00
Colin Cross
34c7832aaa Convert .meta_lic files to textproto
Make it easier to write tools against .meta_lic files and store complex
data by writing them in textproto.

Test: builds

Change-Id: I54bb82cc5581d17078fd0f56eed43a7364dc70db
2021-11-01 16:32:31 -07:00
Dan Willemsen
8528f4ec5e Add Darwin+Arm64 toolchain support
This just sets up the toolchain and allows Darwin+Arm64 to be specified
as a HostCross target. These variants will not be exported to Make, or
be installed on a Soong-only build. A future CL will add support for
universal binaries using these variants.

This config is a bit stranger than the regular 64/32 multilib, as it's
two primary 64-bit configs. And on a Darwin/X86 machine, the Arm64
versions are HostCross (doesn't work on the current machines), while a
Darwin/Arm64 machine, either version works (if Rosetta is installed).

Bug: 203607969
Change-Id: Iacaed77d267773672da027cd74917e33fb1c1e94
2021-11-01 15:07:37 -07:00
Colin Cross
1caea35278 Merge "Export Soong install rules to Make" 2021-11-01 21:31:56 +00:00
Paul Duffin
004547facd Use module-lib system modules when building from prebuilts
When building from source the build uses the java system modules for
the public or module APIs as needed. However, previously when building
from prebuilts it would always use the public API. That difference lead
to build failures when building from prebuilts.

This change makes the selection of java system modules when building
from prebuilts consistent with the selection when building from
sources.

As API levels 30 and 31 (which are the only previous releases to
provide system modules) did not provide separate java system modules
for the module-lib API those levels always use the public APIs.

Bug: 204189791
Test: - before applying these change
      m TARGET_BUILD_APPS=framework-connectivity
      - build fails with compilation error due to missing module APIs
      m sdk dist
      cp out/dist/system-modules/module-lib/core-for-system-modules.jar prebuilts/sdk/current/module-lib/core-for-system-modules.jar
      - apply these changes
      m TARGET_BUILD_APPS=framework-connectivity
      - build passes as expected
Change-Id: Id113ff014e7892b1009fbcaad89b1ae23a7c3b79
2021-11-01 16:40:28 +00:00
Colin Cross
91eaa6316a Merge changes I04f2f558,Ie16a6264,I83a3be9f,Icb3eeef3
* changes:
  Rename amod variable in AndroidMkEntries.fillInEntries to base
  Make HostToolPath, HostJNIToolPath and sboxPathForToolRel use pathForInstall
  Add PathForGoBinary
  Remove PathForOutput from InstallPathToOnDevicePath
2021-10-30 19:19:53 +00:00
Chih-hung Hsieh
7b2239f648 Merge "Add -{checkbuild,tidy} targets only for modules in mm" 2021-10-30 03:57:06 +00:00
Chih-Hung Hsieh
a3d135b1af Add -{checkbuild,tidy} targets only for modules in mm
Test: lunch aosp_coral-userdebug; WITH_TIDY=1
      make 7-libgptutils.coral-checkbuild 7-libgptutils.coral-tidy
Test: only coral libgptutils in out/build-aosp_coral.ninja
Test: lunch aosp_arm64-eng; make has no *libgptutils* tagets
Test: no libgptutils in out/build-aosp_arm64.ninja
Test: lunch aosp_cf_arm64_phone-userdebug; make libskia-checkbuild
Test: lunch aosp_arm64-eng; WITH_TIDY=1 make tidy-soong

Bug: 202763874
Change-Id: I2d5a3fdc627d62e43c3f10e61b338a03c10440be
2021-10-29 18:02:27 -07:00
Colin Cross
6301c3cffa Export Soong install rules to Make
Previously Soong's install rules have been disabled when embedded
in Make (ctx.Config().KatiEnabled() == true).  The primary blocker
for moving installation into Soong has been the `required` proeprty,
which is too vague to be easily handled in Soong.  Keeping
installation in Make has resulted in two host bin directories,
the Make-owned directory (e.g. out/host/linux-x86/bin), and the
Soong-owned directory (e.g. out/soong/host/linux-x86/bin).  The
lack of knowledge in Soong about the final, Make-owned installation
location makes it hard to support NOTICE files entirely in Soong.

This patch begins to solve this problem by supporting the creation of
the installation rules into Soong, but rather than writing the rules
to the ninja file it writes them to a Makefile and lets Kati convert
them to ninja.  This allows Kati to inject extra dependencies to
handle the `required` property.

Converting all modules to create their installation rules in Soong
would be too complex, so only modules that return true from
InstallBypassMake will use the Soong installation rules.  This
is currently only set for robolectric tests.

Bug: 204136549
Test: m checkbuild
Change-Id: I28af9fa7fadece8ea1f98f5efd140c823751cae7
2021-10-29 16:34:55 -07:00
Colin Cross
f1f763a981 Rename amod variable in AndroidMkEntries.fillInEntries to base
AndroidMkEntries.fillInEntries calls its android.ModuleBase amod,
despite also handling an android.Module.  Rename amod to base to
match other locations, and add a new amod for the android.Module.
This will simplify the next patch that needs to access the
android.Module.

Bug: 204136549
Test: m checkbuild
Change-Id: I04f2f558959def22e8b3f5b8c534b8d655b06a4e
2021-10-29 16:34:55 -07:00
Colin Cross
790ef35d1e Make HostToolPath, HostJNIToolPath and sboxPathForToolRel use pathForInstall
Use pathForInstall instead of PathForOutput for HostToolPath,
HostJNIToolPath and sboxPathForToolRel so that they internally produce
an InstallPath that can later support being converted to Make install
path.

Bug: 204136549
Test: m checkbuild
Change-Id: Ie16a62641d113873daeec4d1dd4261251bc0d0eb
2021-10-29 16:34:55 -07:00
Colin Cross
a44551fec6 Add PathForGoBinary
Add PathForGoBinary that uses pathForInstall to return the install
path of a GoBinaryTool.  This will replace various places that used
PathForOutput to reconstruct a path to a Go tool, and will support
moving Go tools to the Make install directory outside of the
PathForOutput directory in a future patch.

Bug: 204136549
Test: m checkbuild
Change-Id: I83a3be9f5c621975540f5ed601a0b9e2611c98b9
2021-10-29 16:34:55 -07:00
Colin Cross
b1692a3468 Remove PathForOutput from InstallPathToOnDevicePath
The next patches will make more InstallPaths use the Make output
directory, which is not inside PathForOutput.  Fix the assumption
that the InstallPath is relative to PathForOutput by storing
enough information in the InstallPath to find the on-device path
without PathForOutput.

Bug: 204136549
Test: soong tests
Change-Id: Icb3eeef3f1c72f773f333267f8a7dfc503feacb5
2021-10-29 16:34:55 -07:00
Paul Duffin
12e311d958 Add tests for prebuilts of all API surfaces
Previously, the tests only covered checking the sdk dependencies added
when using a prebuilt current (public) and system SDKs, i.e. with
sdk_version set to "current_30" or "system_30". This change adds tests
to cover other APIs, e.g. "test_30", "module_30" and
"system_server_30". It adds tests for "module" and "system-server" up
to API level 32 as following changes will give them different behavior
as API levels less than or equal to 31 do not have a separate
core-for-system-modules.jar file for the module-lib API.

Bug: 204189791
Test: m nothing
Change-Id: I585a88615439a24abf75250114a86113b5f5da57
2021-10-29 17:57:12 +01:00
Treehugger Robot
c9e85ca825 Merge "Make a pass over our codebase cleaning up non-precise / non-inclusive language." 2021-10-28 20:51:17 +00:00
Joe Onorato
b4638c1ac3 Make a pass over our codebase cleaning up non-precise / non-inclusive language.
Test: treehugger
Bug: 204369779
Change-Id: I6e63cae824d323535cdb14b493edd868df47738d
2021-10-28 10:32:07 -07:00
Chih-hung Hsieh
4dceb3705f Merge "Do not add .tidy files as RBE link inputs" 2021-10-27 20:29:04 +00:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
34d60d6672 Remove vestigial GetPrebuiltCcStaticLibraryFiles
Test: mixed_{libc,droid}.sh
Change-Id: Ie6e22e1994f8abf1b66f4abfd834bf38a1f097b2
2021-10-26 15:03:18 +00:00
Chih-Hung Hsieh
3bb934f0ad Do not add .tidy files as RBE link inputs
* RBE adds implicit dependent files as inputs
  and creates too long commands.
* Adds .tidy files as validation paths.
* Change type of tidyFiles to WritablePaths.

Bug: 203577539
Test: lunch aosp_cf_arm64_phone-userdebug; USE_RBE=true WITH_TIDY=1 make
Test: USE_RBE=true WITH_TIDY=1 mm in external/skia
Change-Id: I5fc9d6f8c9c58abcd3721ca9fbae1bc785e4e609
2021-10-25 12:24:30 -07:00
Jiyong Park
d163d4d7f5 Add the device config GenerateAidlNdkPlatformBackend
The config is used to force the generation of the AIDL ndk_platform
backend which will eventually be removed in favor of the ndk backend.
The switch is needed as an escape hatch for some devices whose BSP
(outsourced and thus hardly modifiable) depends on the ndk_backend
libraries.

Bug: 161456198
Test: m
Merged-In: Ie11ca62be05754bb2593da16e1380103c670b393
Change-Id: Ie11ca62be05754bb2593da16e1380103c670b393
(cherry picked from commit 65d9718328)
2021-10-25 08:55:57 +09:00
Liz Kammer
2dafba7da9 Merge "bp2build: Add support for cc_binary." 2021-10-20 14:02:39 +00:00
Chris Parsons
787fb36189 Add OS to configuration key in mixed builds
This also removes the special-case filegroup from mixed builds
buildroot; no special handling is required. Since we're currently
hardcoding linux_x86_64 as our host platform, it should be fine
to continue assumping that hardcoded host for now.

Test: USE_BAZEL_ANALYSIS=1 m adbd
Change-Id: I35509f4eb33ba7a243fab4c34b35958f6f2fceab
2021-10-19 16:55:52 -04:00
Liz Kammer
2b8004b1ef bp2build: Add support for cc_binary.
Bug: 197920036
Test: build/bazel/ci/bp2build.sh
Change-Id: I2c4200967653af15a330ab8cbaf796b70d43f32d
2021-10-19 14:12:39 -04:00
Dan Willemsen
2a109db10b Merge "Reduce modules exposed to Make in Mac builds" 2021-10-19 00:32:54 +00:00
Liz Kammer
503f65da36 Merge "Add tests for defaults used in conditions_default" 2021-10-18 22:03:33 +00:00
Dan Willemsen
def7b5d198 Reduce modules exposed to Make in Mac builds
Device builds are no longer supported on Mac, but we do support building
various host tools, including the SDK build-tools and platform-tools
packages. These have dependencies on [java] device modules, so we don't
completely disable device modules, only hide them from Make (which makes
them more difficult to trigger from the command line).

Also fix the mac build of multiproduct_kati, so that `m blueprint_tools`
works on Mac.

Bug: 187222815
Test: `m`, `m dist`, etc on Mac
Change-Id: I92f16605d5cd173d431cbcb79081234d45cc6e2e
2021-10-18 12:44:45 -07:00
Liz Kammer
bdce0dfbdf Add tests for defaults used in conditions_default
Bug: 203123704
Test: go test soong tests
Change-Id: Ia12c51d01108ad1f311d738b182d4bb94c500810
2021-10-18 12:49:41 +00:00
Jingwen Chen
df27b7a1e0 Denylist genrules that create the same file in the same package.
Test: bp2build presubmits

Bug: 194642721
Bug: 203369847
Change-Id: Id0faff5fcf4136fac5236980dd60c5d8e54d9547
2021-10-18 06:33:16 +00:00
Treehugger Robot
adf2b3e68f Merge "Add android_sdk_repo_host to build platform-tools&build-tools" 2021-10-15 02:04:45 +00:00
Liz Kammer
2fc348986c Add missing directories to bp2build.
Added directories with deps of adbd that were not converted and added
them to be converted via bp2build.

Test: bp2build.sh
Test: mixed_droid.sh
Change-Id: Iacb634b23e1fdc2767a0923882b71f482ebca53d
2021-10-13 17:07:41 -04:00
Lev Rumyantsev
1eda2bd946 Merge "Support 64-bit arm_on_x86_64" 2021-10-13 19:42:49 +00:00
Lev Rumyantsev
34581212a4 Support 64-bit arm_on_x86_64
hasArmAndroidArch only checked for 32-bit arm target and thus didn't
work properly on 64-bit only systems.

Test: CtsRsCppTestCases 64-bit only arm on x86
Bug: 194800662
Change-Id: I87332d793dcdd4859766c9067b9fd53f9e4c2516
2021-10-13 09:55:10 -07:00
Liz Kammer
fdd72e6351 bp2build: Add special arch-variant targets.
Soong supports additional arch-variant targets based on arch/os aside
from strictly arch/os names. Handle the unconverted cases based solely
on arch/os.

Test: build/bazel/ci/bp2build.sh
Change-Id: I8dc987b1aa4a4ea646dd5b03a94b84297ba6113a
2021-10-13 09:01:56 -04:00
Dan Willemsen
9fe1410213 Add android_sdk_repo_host to build platform-tools&build-tools
The Android SDK has been built with Make up until now, monolithically,
then split up into several sdk-repo zip files for different purposes.
The Mac and Windows SDKs really only need to contain the platform-tools
and build-tools pieces, but due to this monolithic sdk zip, we had to
build the whole SDK first.

This adds an `android_sdk_repo_host` module that can build these
platform-tools and build-tools zips.

Bug: 187222815
Change-Id: I55809e1d7447dd65e22461f921b2b8abb6d5f822
2021-10-13 01:25:02 -07:00
Liz Kammer
8cdd6f007d Merge "Restrict mixed build cquery to deps of depth 2." 2021-10-08 17:04:02 +00:00
Xin Li
800112b97f Merge "Merge Android 12" 2021-10-07 23:50:21 +00:00
Jingwen Chen
8f22274297 Stop relying on target.kind in mixed builds.
target.kind was a field that existed for only a few months, and have
been removed from Bazel. This is needed to update to a newer Bazel version.

Also, this reverts filegroups to be queried for a specific arch again,
but leaving file targets in the common arch (which is correct, anyway).

Fixes: b/199363072
Test: mixed_libc
Test: presubmits
Change-Id: I3b8e5c43a39516d977d327a44a75750b2f251be3
2021-10-07 14:04:38 +00:00
Liz Kammer
c19d5cdcff Restrict mixed build cquery to deps of depth 2.
This will be the list of targets directly being requested + additional
targets necessary for mixed_root. This reduces the size of the cquery
file by ~300Kb. Additionally, it removes unnecessary targets, making it
ever so slightly easier to find what one is looking for in cquery.out
for debugging purposes.

Test: build/bazel/ci/mixed_droid.sh
Change-Id: I6d0e337c9ab7c13388459dee16415be0ab3c0506
2021-10-06 18:16:58 -04:00
Christopher Parsons
f5a385f171 Merge "Remove more out-of-date items from denylist" am: b19d4cda2e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1844513

Change-Id: Ic7a0cebac496ca1d07145b4cd28439b4fd373e70
2021-10-04 19:44:07 +00:00
Christopher Parsons
b19d4cda2e Merge "Remove more out-of-date items from denylist" 2021-10-04 19:31:36 +00:00
Treehugger Robot
3e745e63f3 Merge "Bp2Build common properties auto-handling" am: d905146590
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1815376

Change-Id: I38f1063302ea90583a51e625076e6232b4364ab7
2021-10-04 19:20:28 +00:00
Treehugger Robot
d905146590 Merge "Bp2Build common properties auto-handling" 2021-10-04 19:02:07 +00:00
Treehugger Robot
70e2b79d9c Merge "Make RuleBuilder fail fast when passed a nil Path" am: b5e3a79358
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1844300

Change-Id: I6fe77f48ff5fd9b225bf577bc20821a05633067f
2021-10-04 18:25:44 +00:00
Treehugger Robot
b5e3a79358 Merge "Make RuleBuilder fail fast when passed a nil Path" 2021-10-04 18:12:04 +00:00
Chris Parsons
b97a817fdb Remove more out-of-date items from denylist
Test: mixed_droid CI
Change-Id: Ifc5bb10328860a5d979eb627a5347d8c23203155
2021-10-04 12:48:29 -04:00
Christopher Parsons
349f4963df Merge "Remove out-of-date items from bp2build denylist" am: 9c03ef7790
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1843716

Change-Id: I611dc8b307b7ac38e97f84a3bf4139e1260e1bd3
2021-10-04 14:45:06 +00:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
447f6c99c9 Bp2Build common properties auto-handling
Introduce `commonAttributes` & `fillCommonBp2BuildModuleAttrs used in
CreateBazelTargetModule

Adapt `bp2BuildInfo` to use `commonAttrs` instead of `Name`.
And thus also all downstream users of `CreateBazelTargetModule`.

As initial user, the Soong `required` property will be
translated to Bazel's `data`.

Bug: 198146582, 196091467
Test: build_converstion_test.go:TestCommonBp2BuildModuleAttrs
Test: go test
Test: mixed_{libc,droid}.sh
Change-Id: Ib500e40f7e2cb48c459f1ebe3188962fc41ec124
2021-10-04 14:43:04 +00:00
Paul Duffin
3866b89d15 Make RuleBuilder fail fast when passed a nil Path
Previously, the RuleBuilder would add all supplied Paths directly to
one of its lists of Paths without checking to make sure it was not nil
only to panic somewhere in its Build() method when it attempted to
convert it to a string. Deferring the failure made it harder to debug.
This change fails fast by checking every Path when it is passed to the
RuleBuilder.

Test: m nothing
Change-Id: I06b35da02101f6dfab80d2daaf3d8e44ded8b6be
2021-10-04 12:56:10 +01:00
Christopher Parsons
86a0c43017 Merge "bp2build: Handle target.linux" am: d6558d15bc
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1843713

Change-Id: I89c7a1211cd22141b42333ad2c55e24b5caa6584
2021-10-01 22:08:28 +00:00
Chris Parsons
c39f63358b Remove out-of-date items from bp2build denylist
Test: mixed_droid CI
Change-Id: Ic51cf7ed193641882dbe0018818d8e3bcab53507
2021-10-01 18:01:11 -04:00
Chris Parsons
2dde0cb3de bp2build: Handle target.linux
Also refactor target.bionic to be handled not as its own configuration
axis, but instead to be grouped into os selects handling.

This allows us to remove libbase and its dependencies from the bp2build
denylist.

Test: mixed_droid.sh CI
Change-Id: I92f30074d286306207653fe37589835ae3db16c4
2021-10-01 14:56:39 -04:00
Liz Kammer
55f82b0f02 Correct path for removing old bazel artifacts am: d7d5b72e4e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1842591

Change-Id: I62f4c92912921fd0c372d8ce3eb5520561eec77e
2021-10-01 15:36:37 +00:00
Liz Kammer
d7d5b72e4e Correct path for removing old bazel artifacts
Test: mixed_libc.sh
Bug: 201767767
Change-Id: Ie34ac3a583dbefb6c4b79ea0756acef623116af7
2021-10-01 10:33:12 -04:00
Ulyana Trafimovich
ab70bc55c5 Merge "Remove unused variable SKIP_BOOT_JARS_CHECK." am: 1b5262bd69
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1841576

Change-Id: Ice0247fa07797d12f2c1911bee3569cffed5dee1
2021-10-01 07:34:21 +00:00
Ulyana Trafimovich
1b5262bd69 Merge "Remove unused variable SKIP_BOOT_JARS_CHECK." 2021-10-01 07:21:39 +00:00
Chris Parsons
c4f917591c Temporarily disable libbase am: b1f405e66d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1842754

Change-Id: I154119390d6bfb641f2fd44040e6f658134f815c
2021-09-30 22:12:37 +00:00
Chris Parsons
b1f405e66d Temporarily disable libbase
This should unbreak the build and give me some time to investigate the
root cause.

Test: USE_BAZEL_ANALYSIS=1 m libandroidfw
Change-Id: Ia843ae5b92a70131b4989b4bdebc063866cb1075
2021-09-30 17:25:32 -04:00
Chris Parsons
486b80a0d5 Support building libcrypto via mixed builds am: a37e195182
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1839353

Change-Id: I34a5ec794874856a415e2c5415ef8b08ef3a7e21
2021-09-30 20:10:15 +00:00
Chris Parsons
a37e195182 Support building libcrypto via mixed builds
This required the following fixes to bp2build:
  - Correctly handle Bionic_* and Linux_* targets
  - Correctly handle cc_object's selects
  - Generate linker_script, stl, and system_dynamic_deps for cc_object in bp2build

Test: USE_BAZEL_ANALYSIS=1 m adbd
Change-Id: I753fd18df8ae551fb69df07e4174527c5388f289
2021-09-30 12:30:36 -04:00
Ulya Trafimovich
fbe51fe0ec Remove unused variable SKIP_BOOT_JARS_CHECK.
The variable is no longer used after https://r.android.com/1737753.

Bug: 189298093
Test: m
Change-Id: I7f660fb205212d109f3e9ce2c805508ef481da24
2021-09-30 14:03:09 +01:00
Liz Kammer
4b8b9b7e52 Add deps of protos to bp2build. am: 0f3b7d2fc4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1838060

Change-Id: I9b9735e5396cedbb027187a054515e783901ef9a
2021-09-29 16:55:55 +00:00
Liz Kammer
87517e2637 Sort bp2build directory allowlist. am: 55682fea4b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1838059

Change-Id: I8e5591d7c6e19309eab7234ea98ac1148fb69138
2021-09-29 16:55:52 +00:00
Liz Kammer
0f3b7d2fc4 Add deps of protos to bp2build.
Update BazelOutPath to implement genPathProvider. This allows Bazel
outputs (incl filegroup) to be used as an input to generating a file
(e.g. proto).

Test: bp2build.sh
Test: mixed_build.sh
Bug: 200601772
Change-Id: I5ad67ade193025652100b214996b26ce9ca9bf83
2021-09-29 10:31:27 -04:00
Liz Kammer
55682fea4b Sort bp2build directory allowlist.
Test: bp2build.sh
Change-Id: I48157fd4e02fef3a6917f0a40418cc929168ffff
2021-09-29 10:30:35 -04:00
Jingwen Chen
8d1e0849fa bp2build //system/core/libasyncio:libasyncio am: b59f6e2397
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1838474

Change-Id: I9e3acde8ba150d51717b595952a8576cdf0d2eca
2021-09-28 23:26:34 +00:00
Jingwen Chen
3b99edfa96 bp2build //external/lz4/lib:liblz4. am: 8385250f4f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1838473

Change-Id: I7869e7f6d8ab661a25dbedc98550f1b4a040fd90
2021-09-28 23:26:30 +00:00
Jingwen Chen
b59f6e2397 bp2build //system/core/libasyncio:libasyncio
Test: presubmits
Change-Id: Ie748d2017eaf9043392975ca0db8ae4f673ba059
2021-09-28 00:48:14 +00:00
Jingwen Chen
8385250f4f bp2build //external/lz4/lib:liblz4.
Fixes: 198241792
Test: presubmits
Test: USE_BAZEL_ANALYSIS=1 m adbd
Change-Id: Ifc0326805f39259f06348dcc0b1b4a7c86afc856
2021-09-28 00:05:20 +00:00
Romain Jobredeaux
572a87d1e4 Merge "Exclude WallpaperPicker app and pom2bp-generated BUILD files from bp2build." am: 3bafa69336
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1832976

Change-Id: I5cc98dae403f67999798ae25a1ac4c8af6bfb414
2021-09-27 21:06:50 +00:00
Romain Jobredeaux
3bafa69336 Merge "Exclude WallpaperPicker app and pom2bp-generated BUILD files from bp2build." 2021-09-27 20:54:51 +00:00
Treehugger Robot
68e36bfa00 Merge "Add more sepolicy variables to soong_config" am: 208d2962f0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1826065

Change-Id: I25a8e93236a4bc76ea5654d7e999561b477d7fc9
2021-09-27 11:20:39 +00:00
Treehugger Robot
208d2962f0 Merge "Add more sepolicy variables to soong_config" 2021-09-27 11:05:19 +00:00
Paul Duffin
5e253253ff Merge "Insert imageVariantSpecificInfo between arch and link info" am: 99df906e34
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1834874

Change-Id: If7af6edbc91844e96d8132384cf98fbd926a83a7
2021-09-25 09:29:58 +00:00
Paul Duffin
99df906e34 Merge "Insert imageVariantSpecificInfo between arch and link info" 2021-09-25 09:13:14 +00:00
Christopher Ferris
51beb6b7c8 Merge "Add two new variables to Malloc_not_svelte." am: d8fd124227
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1836134

Change-Id: Ib816cc29bcc07920dca08736c301ad9429d9b84a
2021-09-25 01:54:53 +00:00
Christopher Ferris
d8fd124227 Merge "Add two new variables to Malloc_not_svelte." 2021-09-25 01:36:48 +00:00
Christopher Parsons
a64586fb74 Merge "Add stl property support for bp2build" am: 0bb4ac55d6
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1834858

Change-Id: I9c45eab96c5e62667bd78d0fa48601ab140357a0
2021-09-24 20:08:41 +00:00
Christopher Ferris
dea6617bc5 Add two new variables to Malloc_not_svelte.
Add the srcs and header_libs for the system/core/debuggerd
change to support removing scudo code on svelte configs.

Bug: 201007100

Test: Builds.
Change-Id: Iec083dc5cbfbc63334a72e2e77a53067786a85ca
2021-09-24 11:55:51 -07:00
Chris Parsons
a967f253e6 Add stl property support for bp2build
Test: mixed_libc
Test: USE_BAZEL_ANALYSIS=1 m libbase
Change-Id: If56d4a728de3ae4022cc9dadadc9bf8b952f9eaf
2021-09-24 13:51:56 -04:00
Paul Duffin
b42fa67a47 Insert imageVariantSpecificInfo between arch and link info
Previously, the archTypeSpecificInfo included an array of
*linkTypeSpecificInfo. This change replaces that array with an array of
*imageVariantSpecificInfo which themselves contain an array of
*linkTypeSpecificInfo.

That allows the sdk snapshot to handle image variants correctly, i.e.
collate their properties, optimize their properties and then detect if
there are any image variant specific properties for any image variant
other than the CoreImageVariant ("") and report it as an error.

The latter case is treated as an error because while Soong needs to
handle image specific variants there is currently no requirement to
handle generating a prebuilt with image specific properties. A follow
up change will test the error handling.

Image specific variants are needed because the "jni_headers"
cc_library_headers module provides a number of image variants (e.g.
recovery) that are used outside the ART module. Therefore, the sdk
snapshot needs to do the same.

At the moment image variants like the recovery variant are supported by
copying the property that creates the variant (e.g. recovery_available)
through to the prebuilt but that is not safe for a couple of reasons:
1. It ignores any differences between the recovery variant and the
   other variants which could cause compatibility issues in modules
   that build against the prebuilts.
2. It marks modules in the snapshot with recovery_available even when
   they do not need it.

This change will allow follow up changes to address both those issues.

Bug: 195754365
Test: m nothing
Change-Id: I1c187d814f44b2cb7607cd43a6b215134be0faad
2021-09-24 17:32:03 +01:00
Liz Kammer
6fe2d9a3aa Merge "bp2build: Add support for export_.*headers props" am: 6244df2a24
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1835374

Change-Id: I10252c15de0bbc6691a69fb214461f6d56d000ff
2021-09-24 13:29:34 +00:00
Liz Kammer
6244df2a24 Merge "bp2build: Add support for export_.*headers props" 2021-09-24 13:13:05 +00:00
Martin Stjernholm
40fc93fb3c Merge changes I957f3df8,I68986dcc am: cf6bf37d04
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1829372

Change-Id: Ifcf471f2746c1037b83c2a11b8f5120b86fd6cb2
2021-09-24 09:44:00 +00:00
Martin Stjernholm
cf6bf37d04 Merge changes I957f3df8,I68986dcc
* changes:
  Consolidate the code to resolve a deapexer module dependency.
  Propagate the dex jar path as an OptionalPath which is either valid or invalid with a message.
2021-09-24 09:32:24 +00:00
Treehugger Robot
d17a3ad9f2 Merge "For mixed build bazel actions, remove old outputs" am: e1bb74e724
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1834860

Change-Id: I32be5f8098a6161aad6d2bdabfb848fd374eeed1
2021-09-23 22:48:05 +00:00
Treehugger Robot
e1bb74e724 Merge "For mixed build bazel actions, remove old outputs" 2021-09-23 22:38:12 +00:00
Chris Parsons
e37a4de773 For mixed build bazel actions, remove old outputs
This should fix incrementality issues in cases where actions don't wipe
the old output. (Looking at you, llvm-ar)

Test: mixed_libc.sh
Change-Id: I4b6639e74c72921a5a703d73fd36f766f121c6ad
2021-09-23 17:25:10 -04:00
Liz Kammer
7a210ac233 bp2build: Add support for export_.*headers props
Soong supports export_.*_headers properties, the libraries contained in
this list must also be within a shared/static/whole_static/header libs
property. For bp2build, we eliminate this duplication. The libraries
not listed in an export_.*_headers property will migrate to an attribute
prepended with implementation_, those in export_.*_headers will not have
a prefix.

Test: build/bazel/ci/bp2build.sh
Test: build/bazel/ci/mixed_libc.sh
Bug: 198241472
Change-Id: I3eb84c983ec5d241c8a568e411dfd5619d3184a7
2021-09-23 16:07:45 -04:00
Christopher Parsons
f75a32998e Merge "Disable mixed builds for non-device OS" am: 4ea6052650
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1834999

Change-Id: I7bdd47462db00faeaa85917d47f310c17b134aae
2021-09-23 20:02:36 +00:00
Wei Li
0e504d7dc9 Merge "Add bp2build converter for cc_genrule." am: a06db33ebd
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1829492

Change-Id: I73b0abd1f86d7dfc17a683595585aff4b5ffb91e
2021-09-23 18:17:04 +00:00
Chris Parsons
1826621bdd Disable mixed builds for non-device OS
We don't currently support propagation of OS in mixed builds, and our
host toolchains are not properly configured.

This allows us to continue to make progress on device OS until host is
supported.

Test: mixed_libc CI
Test: USE_BAZEL_ANALYSI=1 m adbd
Change-Id: I2bf8b3f9ca7928dd33bf2fb3d4fa067da0f593f3
2021-09-23 14:11:42 -04:00
Wei Li
a06db33ebd Merge "Add bp2build converter for cc_genrule." 2021-09-23 18:04:03 +00:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
0a72e89916 Merge "Annotate FIXME for b/200678898" am: fda604ab7c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1832335

Change-Id: I73c2f65504a17a0b866ccb498ba1f20fcfd2b6f8
2021-09-23 17:22:51 +00:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
fda604ab7c Merge "Annotate FIXME for b/200678898" 2021-09-23 17:18:49 +00:00
Martin Stjernholm
4482560cc7 Consolidate the code to resolve a deapexer module dependency.
It will get more logic in upcoming CLs.

Add a property to DeapexerInfo for the APEX name, for use in error
messages.

Test: m nothing
Bug: 192006406
Change-Id: I957f3df8b34543a38cde38768dac93e78132d672
2021-09-23 17:19:55 +01:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
fd0c03c315 Annotate FIXME for b/200678898
Bug: 200678898
Test: TBD
Change-Id: I433f3187714d5ea19b081ed5e3fe758de0a29ddd
2021-09-23 15:12:03 +00:00
Treehugger Robot
f40148060b Merge changes I67c5022b,I3baa2535 am: 2e65f41953
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1832259

Change-Id: Idd0df37d03a2ac22c1e9e03a34cee680c4ad37c9
2021-09-23 14:37:07 +00:00
Treehugger Robot
2e65f41953 Merge changes I67c5022b,I3baa2535
* changes:
  Detect duplicates in sdkRegistry
  Dedup SdkMemberType/TraitRegistry
2021-09-23 14:21:05 +00:00
Paul Duffin
ba27bee268 Merge "Removes usages of SdkMemberTrait/TypeRegistry outside android/sdk.go" am: 0a7428073c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1832257

Change-Id: I76136aafd4443f43731d82760fdc36f7be6dbc3b
2021-09-23 13:07:55 +00:00
Paul Duffin
0a7428073c Merge "Removes usages of SdkMemberTrait/TypeRegistry outside android/sdk.go" 2021-09-23 13:05:41 +00:00
Jerome Gaillard
8467166b0c Merge "Fix path to layoutlib project" am: f346429e0e
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1834613

Change-Id: I931d20bb43cf0c3294c5c2746da828ac06914e17
2021-09-23 13:03:27 +00:00
Paul Duffin
adaec6a171 Merge "Add support to sdk/module_exports to specify required traits" am: 95a1d1672f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1827876

Change-Id: I459f5843376c4ec281b6bbced07e6b60657c4070
2021-09-23 13:03:13 +00:00
Jerome Gaillard
f346429e0e Merge "Fix path to layoutlib project" 2021-09-23 12:57:32 +00:00
Jerome Gaillard
655ee02d29 Fix path to layoutlib project
It is in the 'frameworks/layoutlib' folder and not in 'framework/layoutlib'.

Change-Id: I437558a0afa8bfaac0226b1e4c5a7c0a983b180a
2021-09-23 11:38:11 +00:00
Paul Duffin
581f2e5f79 Detect duplicates in sdkRegistry
Bug: 195754365
Test: m nothing
Change-Id: I67c5022b7cc61891fd6b90365f8271d97d7bcd98
2021-09-23 11:37:57 +01:00
Paul Duffin
30c830b82a Removes usages of SdkMemberTrait/TypeRegistry outside android/sdk.go
In preparation for a refactoring that will dedup the registry code.

Bug: 195754365
Test: m nothing
Change-Id: I93e8485d588f5b4d6b5e2967da5dbef7b6c831ad
2021-09-23 11:37:57 +01:00
Paul Duffin
f04033be81 Dedup SdkMemberType/TraitRegistry
Bug: 195754365
Test: m nothing
Change-Id: I3baa2535fd21a47bea2229f13cf5eb166396fe79
2021-09-23 11:37:57 +01:00
Paul Duffin
d19f894512 Add support to sdk/module_exports to specify required traits
Currently, every sdk member of a specific module type has to be treated
in the same way as every other sdk member of that type. e.g. it is not
possible for an sdk member to use different variants to other members
of the same type.

Adding a new member type for each different way to treat the members is
not scalable as if there were N different ways treat a member then it
would require 2^N types for all the possible combinations.

This adds a new traits mechanism that allows the behavior of member
types to be customized per sdk member. Each member type can specify a
list of supported traits and customize its behavior based on which
traits are required for each member. A trait can be supported by
multiple different member types.

Bug: 195754365
Test: m nothing
Change-Id: I165ac80d208c0402d2a9ffa8085bba29562c19b7
2021-09-23 11:37:51 +01:00
Wei Li
bcd399479a Add bp2build converter for cc_genrule.
Test: cc_genrule_conversion_test.go

Change-Id: I19290b417d6336020a15ba7fa772ee0c76c58225
2021-09-23 05:41:20 +00:00
Romain Jobredeaux
a2c081413a Exclude WallpaperPicker app and pom2bp-generated BUILD files from bp2build.
Bug: 198418951
Test: b build packages/apps/WallpaperPicker
Change-Id: I86eb64c734eb262a497595f525027534cdabdf32
2021-09-22 14:43:43 -04:00
Romain Jobredeaux
9ba010c641 Merge "Exclude directories with manual BUILD files from bp2build." am: f05bea080b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1822113

Change-Id: I6543f9c9829b02e5e5a3ef50779d4f5b6d6cdc96
2021-09-22 17:48:17 +00:00
Romain Jobredeaux
f05bea080b Merge "Exclude directories with manual BUILD files from bp2build." 2021-09-22 17:28:31 +00:00
Christopher Parsons
5a5ceb553e Merge "bp2build: reference static variants directly" am: ce0944fc96
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1832014

Change-Id: I6314b59c55d7dcc65444d44f631d39ff566c49d9
2021-09-21 15:32:04 +00:00
Christopher Parsons
ce0944fc96 Merge "bp2build: reference static variants directly" 2021-09-21 15:13:43 +00:00
Chris Parsons
953b35623a bp2build: reference static variants directly
Previously, when referencing a cc_library as a static_lib from a
converted module, the corresponding target would depend on the "root
target" of that cc_library. This resulted in a superfluous dependency on
the shared target of the cc_library dependency. This superfluous
dependency could sometimes result in cycles.

This change ensures the static target name is directly specified in such
cases.

Test: mixed_libc.sh CI
Test: USE_BAZEL_ANALYSIS=1 m fmtlib
Change-Id: I36ee9f0a9017b1e9d73df9e3174669107f0afd4f
2021-09-20 15:15:29 -04:00
Martin Stjernholm
e576120738 Merge "Show less ambiguous paths in the error when it fails to match the given output file." am: bacf6a1a6a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1830039

Change-Id: I247387b90d0508e22f24adb941b005b5a5df1b7e
2021-09-20 18:10:48 +00:00
Martin Stjernholm
bacf6a1a6a Merge "Show less ambiguous paths in the error when it fails to match the given output file." 2021-09-20 17:44:01 +00:00
Martin Stjernholm
804f4d1117 Merge changes I464e6ebd,Iaf7655e4 am: 3536614edd
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1826777

Change-Id: I7e03d04afbc809544d964548caa1646bc36aa353
2021-09-20 13:17:53 +00:00
Martin Stjernholm
a4aaa47a00 Show less ambiguous paths in the error when it fails to match the given
output file.

PathRelativeToTop should give an unambiguous path that can be used for
matching, as opposed to Rel().

Test: `m nothing` with a test with an invalid Output() call
Change-Id: I6d501df6acb0a1700f1480bd4250320f69278c39
2021-09-20 14:17:09 +01:00
Martin Stjernholm
c32dd1c0ab Make it possible to pass an error message with an invalid optional path.
This is useful to delay errors until the paths need to be used.

Test: m nothing
Change-Id: I464e6ebd04b06c5e17617e8ee4e65a3320f1168f
2021-09-20 14:02:11 +01:00
Martin Stjernholm
2fee27f3c9 Replace OptionalPath.valid flag by checking the path itself.
Test: m nothing
Change-Id: Iaf7655e4676d2beeb7c7ac3bcba11a7dad4a01a3
2021-09-20 14:02:11 +01:00
Martin Stjernholm
f9dd87304f Add a function to match modules through a variation map. am: 14cdd71152
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1825132

Change-Id: I9b6765ee40d47bb9470bdb0f0f09bb572d700343
2021-09-18 00:48:46 +00:00
Martin Stjernholm
14cdd71152 Add a function to match modules through a variation map.
Can be a more convenient alternative than specifying the full subdir
concatenation of the variants. E.g. common arch and os variations don't
have to be hardcoded.

Test: `m nothing` with https://r.android.com/1801128
Change-Id: Ic2966e109d61dfee6a2b4fcbcbf8f73274babca9
2021-09-17 23:52:03 +01:00
Jingwen Chen
48a3e911c9 Merge "Remove __bp2build__ prefix trimming." am: 30204afc67
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1829614

Change-Id: I394b1881f71929c1567ac8631c09eb4a2702858b
2021-09-17 13:11:32 +00:00
Jingwen Chen
30204afc67 Merge "Remove __bp2build__ prefix trimming." 2021-09-17 13:01:17 +00:00
Jiakai Zhang
23a5cba0af Merge changes I9c94a54a,Idc0c73a7 am: 2c6ede11cc
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1824513

Change-Id: I1f3ce39cd3b3988e676791a59f0c70e2bc80015d
2021-09-17 11:33:22 +00:00
Jiakai Zhang
dc2c1c2625 Merge "Revert^2 "Preopt APEX system server jars."" am: c9f9d56ed4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1828115

Change-Id: I2a991341934af96455f136cbe44ef824f5e3e7f5
2021-09-17 11:33:13 +00:00
Jiakai Zhang
2c6ede11cc Merge changes I9c94a54a,Idc0c73a7
* changes:
  Preopt system server jars with updatable bootclasspath.
  Preopt APEX system server jars from prebuilts.
2021-09-17 11:20:10 +00:00
Jiakai Zhang
c9f9d56ed4 Merge "Revert^2 "Preopt APEX system server jars."" 2021-09-17 11:19:51 +00:00
Jingwen Chen
16d90a8954 Remove __bp2build__ prefix trimming.
This is no longer needed after r.android.com/1792714

Test: CI
Change-Id: I808c3124cf1a4f3ebe5d25e41f346a818c3cc57c
2021-09-17 07:16:59 +00:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
d4e77a6137 Create bp2build converter for cc_shared_library am: ac5097fcf4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1816758

Change-Id: Iad57cc75670f0e747c162758c029179ae93af3e4
2021-09-16 18:20:48 +00:00
Alex Márquez Pérez Muñíz Díaz Púras Thaureaux
ac5097fcf4 Create bp2build converter for cc_shared_library
Factor out shareable code with cc_static_library

Remove `Linkstatic` field for shared cases,
because it's redundant with the rule

Bug: 198241907
Test: cc_library_shared_conversion_test.go
Test: mixed_{libc,droid}.sh
Change-Id: I5be3b66f812893bce41edb425fbd143ab22d9051
2021-09-16 15:00:56 +00:00
Paul Duffin
de86d8badd Improve the documentation in the android/sdk.go file am: 9428970dac
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1826228

Change-Id: I0ecae7204ac3657dda2c8126a1c0e1063dd7c5e2
2021-09-16 11:35:34 +00:00
Paul Duffin
9428970dac Improve the documentation in the android/sdk.go file
Makes it adhere to the go standard practice of prefixing documentation
comments with the name of the type/func/method.

Bug: 195754365
Test: m nothing
Change-Id: Idf3fe827edc9b6d67d12a99a4b27539ac938ea95
2021-09-16 09:06:50 +01:00
Jiakai Zhang
519c5c82e5 Revert^2 "Preopt APEX system server jars."
This reverts commit 92346c4832.

Reason for revert: Fixed build error.

The build error is fixed by ag/15841934. This CL remains unchanged. This
CL will be submitted AFTER ag/15841934 is submitted.

Bug: 200024131
Test: 1. Patch this CL and ag/15841934 into internal master.
  2. sudo vendor/google/build/build_test.bash

Change-Id: I5f2b8357846fc7dda56e25ebe6ffb095e8047ec8
2021-09-16 06:25:26 +00:00
Treehugger Robot
6e5aabb91b Merge "Share cFlags, tidyFlags, etc. in a module" am: b1a12462a9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1824024

Change-Id: Iaf6050178f9d172a5a17103504e8f081277df9cf
2021-09-16 02:35:38 +00:00
Chih-Hung Hsieh
b8082295b6 Share cFlags, tidyFlags, etc. in a module
* In builder.go, share common flags in a module.
  * This replaces the sharing of cflags/cppflags/asflags in cc.go.
  * A unit test in apex_test.go now fails and is commented out.
    It is a failing test hidden by old optimization in cc.go.
* In module.go, expand the reference variable $someflags<n>,
  or ${someflags<n>} to keep many existing unit tests work as is.
* The build.ninja size was reduced from 8.1GB to 6.2GB,
  for aosp_arm64-eng WITH_TIDY=1 USE_RBE=true,
  and from 7.5GB to 5.6GB when USE_RBE is 0.
  Content of build.ninja is also more readable and searchable.
  Read/write build.ninja times are also reduced,
  depending on disk I/O speed.

Test: make WITH_TIDY=1
Change-Id: I17f96adf4844136d52e5d40f57a19d9e290162b7
2021-09-15 16:05:41 -07:00
Adrian Roos
755a09490f Merge "Revert "Preopt APEX system server jars."" am: 79839d94c1
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1827535

Change-Id: I2281010a93a89b69b859272627c7eac0d7e6d3ed
2021-09-15 14:53:58 +00:00
Adrian Roos
79839d94c1 Merge "Revert "Preopt APEX system server jars."" 2021-09-15 14:31:42 +00:00
Adrian Roos
92346c4832 Revert "Preopt APEX system server jars."
This reverts commit ca9bc98e0c.

Reason for revert: breaks build
Bug: 200024131

Change-Id: Ide07b4c4d267370ae31107b1598b2f878c701282
2021-09-15 14:11:07 +00:00
Liz Kammer
a191dc0520 Merge "Expand handling of unconverted deps in bp2build" am: 83d07a4c41
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1811096

Change-Id: Ib53f05fd0b7bbfdc7256abaf7b5d8eef7722f848
2021-09-15 14:03:58 +00:00
Liz Kammer
83d07a4c41 Merge "Expand handling of unconverted deps in bp2build" 2021-09-15 13:49:48 +00:00
Paul Duffin
9771209aee Merge "Avoid direct access to Native_bridge_supported property" am: 5ef58a302f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1826226

Change-Id: I472f1af991cd6a04ed42d5cc1b0dbca28ce5b699
2021-09-15 13:44:10 +00:00
Paul Duffin
063ad070c0 Merge "Rename SdkMemberTypeDependencyTag to SdkMemberDependencyTag" am: c2c7f3e49b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1826225

Change-Id: I304997b8488094a28ef8b75baaf0d9c4341b1512
2021-09-15 13:44:01 +00:00
Paul Duffin
5ef58a302f Merge "Avoid direct access to Native_bridge_supported property" 2021-09-15 13:29:32 +00:00
Paul Duffin
c2c7f3e49b Merge "Rename SdkMemberTypeDependencyTag to SdkMemberDependencyTag" 2021-09-15 13:29:23 +00:00
Jiakai Zhang
83d0d8ac1c Preopt APEX system server jars. am: ca9bc98e0c
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1821984

Change-Id: If42b905c0636b10881b372efafd3e2f9bc84923c
2021-09-15 10:48:53 +00:00
Jiakai Zhang
ca9bc98e0c Preopt APEX system server jars.
The path to the artifacts will in the form of
/system/framework/oat/<arch>/<encoded-jar-path>@classes.{odex,vdex,art},
where <encoded-jar-path> is the path to the jar file with "/" replaced
by "@". For example,
/system/framework/oat/x86_64/apex@com.android.art@javalib@service-art.jar@classes.odex

There will be a follow-up CL to update ART runtime to recognize
artifacts in that path.

Test: m com.android.art
Bug: 194150908
Change-Id: Ic89fd63c4b1cd565684cead83fc91dae3bc97a4c
2021-09-15 09:01:07 +00:00
Jiakai Zhang
204356f3b5 Preopt APEX system server jars from prebuilts.
Similar to the previous CL, but for jars from prebuilts.

Test: manual - 1. Patch aosp/1818020 and aosp/1810840.
  2. m SOONG_CONFIG_art_module_source_build=false com.android.art
Bug: 194150908
Change-Id: Idc0c73a78045a602ad3a91cb5071d291bd611015
2021-09-15 09:01:07 +00:00
Treehugger Robot
780f559584 Merge "Add system/sepolicy/apex to bp2build allowlist" am: 709f02707d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1826628

Change-Id: If90417ce5553bac5acaf448987a661b757665d5f
2021-09-15 08:24:02 +00:00
Treehugger Robot
709f02707d Merge "Add system/sepolicy/apex to bp2build allowlist" 2021-09-15 08:10:14 +00:00
Inseob Kim
a10ef270eb Add more sepolicy variables to soong_config
Bug: 33691272
Test: m selinux_policy on sc-dev
Change-Id: I4a7288d5f4ff99233fbdb56a8fd92da2d6f2ef7d
2021-09-15 03:04:53 +00:00
Liz Kammer
37997c404b Add system/sepolicy/apex to bp2build allowlist
Technically, tzdata apex depends on
//system/sepolicy/apex:com.android.tzdata-file_contexts. Builds suceeded
regardless due to bp2build generating a filegroup for all files in a
directory.

This also requires an update to the check in apex/builder.go to address
the fact that outputs (including filegroups) from Bazel in mixed builds
will be in a Bazel out subdirectory. This change also corrects a
potential bug that would not support all subdirectories under
system/sepolicy as golang's path.Match does not treat ** as recursive.

Test: go test apex tests
Test: build/bazel/ci/mixed_droid.sh
Change-Id: I1076d60cf271e4cdd1ea990156ab0a39fcfa6535
2021-09-14 18:00:22 -04:00
Liz Kammer
6eff323206 Expand handling of unconverted deps in bp2build
Support three options for converting modules with unconverted
dependencies
1. (default) Warn when converting a module if it has unconverted deps.
2. Error when encountering a module with unconverted deps. (not hooked
up yet)

Test: build/bazel/ci/bp2build.sh
Test: build/bazel/ci/mixed_libc.sh
Test: BP2BUILD_ERROR_UNCONVERTED=1 build/bazel/ci/bp2build.sh with
      unconverted deps -- get appropriate error
Bug: 181155349
Change-Id: Ifaabf0cd2e43e963366dc137159c705294165c3d
2021-09-14 19:55:55 +00:00
Treehugger Robot
9b08c6021f Merge "Improve the error when srcs field has the wrong type." am: 309a1acb27
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1822025

Change-Id: I3b34c8520bd0aa6da3fedfcaba458989b1cd9f0e
2021-09-14 18:14:03 +00:00
Treehugger Robot
309a1acb27 Merge "Improve the error when srcs field has the wrong type." 2021-09-14 17:55:33 +00:00
Paul Duffin
e3d1ae48e5 Avoid direct access to Native_bridge_supported property
Bug: 195754365
Test: m nothing
Change-Id: If7557187400be36b6c36116c61634449da6529a3
2021-09-14 17:26:14 +01:00
Paul Duffin
f7b3d0d317 Rename SdkMemberTypeDependencyTag to SdkMemberDependencyTag
Bug: 195754365
Test: m nothing
Change-Id: Id4ef6f8be54c60a1f269d7e7c46a8dcb715fcca4
2021-09-14 17:26:14 +01:00
Rob Seymour
dc2cc0d8d7 Merge "Add module based host-tools snapshot" am: f6c37cc87d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1793067

Change-Id: I3a2bb2459677c14e3e99d654ed5ffb9b7dd09b21
2021-09-14 15:04:01 +00:00
Rob Seymour
f6c37cc87d Merge "Add module based host-tools snapshot" 2021-09-14 14:47:03 +00:00
Martin Stjernholm
25a69de8de Improve the error when srcs field has the wrong type.
In particular it's useful to print the module, since the panic is
delayed from the init call.

#codehealth

Test: m nothing
Change-Id: Ia91127be83d8a9ce08cf0c08bc3f13fce7be14af
2021-09-14 00:33:47 +01:00
Rob Seymour
925aa09ea1 Add module based host-tools snapshot
Add new module:
host_snapshot {
    name: "host-snapshot"
    deps: [
      (list of host tools)
    ],
    ...
}

Package host tools using android.PackagingBase to capture host tools and transitive packaging data.
Add JSON meta data to snapshot that allows snapshot to be installed via development/vendor_snapshot/update.py

Add support to generate a fake host snapshot of all host modules that is used to detect required
modules via development/vendor_snapshot/update.py.

Bug: 192556798
Bug: 194799048
Bug: 192896149
Test: m HOST_FAKE_SNAPSHOT_ENABLE=true host-fake-snapshot dist -- check snapshot exists in dist

Change-Id: I849c4db801cd858408f6fe6a3ce69262a23a5be9
2021-09-13 21:29:14 +00:00
Treehugger Robot
ec01d2d719 Merge "Change default to require licenses property." am: 7bb0238418
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1818661

Change-Id: Ie6e749f3f9acd03c287b845c4e54a326383240b4
2021-09-13 19:39:03 +00:00
Treehugger Robot
7bb0238418 Merge "Change default to require licenses property." 2021-09-13 19:25:57 +00:00
Treehugger Robot
03f327c83e Merge "Avoid duplicate module names in the error from ModuleForTests." am: eee562f950
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1823277

Change-Id: I0c4865071f4aba40f63ab34e0f9676be1063e634
2021-09-10 09:29:42 +00:00
Treehugger Robot
eee562f950 Merge "Avoid duplicate module names in the error from ModuleForTests." 2021-09-10 09:15:06 +00:00
Martin Stjernholm
98e0d88aac Avoid duplicate module names in the error from ModuleForTests.
#codehealth

Test: m nothing
Change-Id: Ia7c3191440452ce04782701bc6ef99251e55af4d
2021-09-09 21:34:02 +01:00
Bob Badour
65ee90a362 Change default to require licenses property.
Please do not roll back.

If you have recently created a new Soong module type, please make sure
it supports the `licenses` property.

If your build on an older branch fails due to this change, please
configure your build to set `ANDROID_REQUIRE_LICENSES=false` in the
environment.

If running from the command line, the following will work:

export ANDROID_REQUIRE_LICENSES=false; m -j ...

Previously defaulted to not require property unless overridden in env.

Bug: 151177513

Test: m all

Change-Id: Ib295658f978511d07197c295f04a6f25f7d83686
2021-09-09 18:26:56 +00:00
Treehugger Robot
16010fe5cd Merge "Cleanup unused code for bp2build conversion." am: 4011ebb12d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1819237

Change-Id: I41d4bdf23a5d17c74e1897a6d42a0b3a22fd865e
2021-09-09 13:17:31 +00:00
Treehugger Robot
4011ebb12d Merge "Cleanup unused code for bp2build conversion." 2021-09-09 13:12:04 +00:00
Treehugger Robot
1309335a4c Merge changes I6df9a14d,I830c53ef am: 62b843b90f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1818018

Change-Id: I30c26d7caca2f2cffe1779b686ea160c1683fb84
2021-09-09 10:07:19 +00:00
Jingwen Chen
1e347860d5 bp2build: allowlist //external/libcap/...
This builds cap_names.list.h, which uses an eponymous filegroup
"generate_cap_names_list.awk" in Soong, but uses the file target
directly in Bazel.

This also improve filegroup support for mixed builds, by issuing a
cquery call _without_ arch. Filegroups in Soong don't have configurable
properties, so don't generate Bazel filegroups into buildroot's
config_nodes (which was x86_64 by default).

The mixed_build_root now looks like this:

```
config_node(...)
config_node(...)
config_node(...)
config_node(...)

...

filegroup(name = "common",
    srcs = ["@//bionic/linker:linker_sources_x86",
            "@//bionic/libc:kernel_input_headers",
            "@//system/timezone/apex:com.android.tzdata-androidManifest",
            "@//external/libcap:generate_cap_names_list.awk",
            "@//bionic/linker:linker_sources_arm64",
            "@//bionic/linker:linker_sources",
            "@//bionic/libc:libc_sources_shared_arm",
            "@//bionic/linker:linker_sources_x86_64",
            "@//bionic/libc:all_kernel_uapi_headers",
            "@//build/bazel/examples/apex/minimal:build.bazel.examples.apex.minimal-file_contexts",
            "@//system/core/libcutils:android_filesystem_config_header",
            "@//bionic/libc:libc_sources_static",
            "@//bionic/linker:linker_sources_arm",
            "@//bionic/libc/tools:bionic-gensyscalls",
            "@//bionic/tools:bionic-generate-version-script",
            "@//bionic/libc:libc_sources_shared"],
)

mixed_build_root(name = "buildroot",
    deps = [":x86",
            ":arm64",
            ":arm",
            ":common",
            ":x86_64"],
)
```

Test: CI
Fixes: 198595323
Fixes: 198235838
Change-Id: I6df9a14da556cf358d96e6a99b514f66a2638295
2021-09-09 07:54:16 +00:00
Jingwen Chen
5146ac02a1 bp2build: don't generate filegroups (or error) if it contains a file
with the same name.

Also add capability to test for errors raised in bp2build mutators /
contexts.

This CL does two things to filegroups:

1) If the filegroup has only 1 source file with the same name as itself,
don't generate a filegroup target. Instead, dependents will depend
directly on the Bazel file target instead.

2) If the filegroup has more than 1 source file and 1 of them has the
same name as itself, the bp2build mutator will error out. If bp2build
on CI passes, it means that the source tree / product we're testing
against does not have such a case (which seems to be true for most
source trees).

Either way, this will allow us to be unblocked for most of the errant
filegroups (case 1) in the tree.

Test: CI
Test: New test cases in filegroup_conversion_test.go

Fixes: 194762573
Change-Id: I830c53efc8808569afe3c5f9f08436855bcdafed
2021-09-09 07:12:13 +00:00
Lukács T. Berki
c08fff0423 Merge "Implement cleanups requested in aosp/1818245:" am: 4b221b3cf9
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1821792

Change-Id: Icb9161bb48a4f8fed83cdb115ba7c8412625c3b6
2021-09-09 06:24:32 +00:00
Lukács T. Berki
4b221b3cf9 Merge "Implement cleanups requested in aosp/1818245:" 2021-09-09 06:09:38 +00:00
Treehugger Robot
550ec33096 Merge "Add tidy-soong, tidy-dir-path, module-tidy targets" am: f49df213f8
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1820636

Change-Id: I03c50ff5676e52fd296c58aeebc9866601040e08
2021-09-09 03:38:56 +00:00
Treehugger Robot
f49df213f8 Merge "Add tidy-soong, tidy-dir-path, module-tidy targets" 2021-09-09 03:22:59 +00:00
Romain Jobredeaux
9e09bba237 Exclude directories with manual BUILD files from bp2build.
Test: b build packages/apps/QuickSearchBox
Change-Id: I2534a328e28a6fff1385bfccdc3b461198bc1f88
2021-09-08 18:09:02 +00:00
Lukacs T. Berki
b42d232951 Refactor the creation of soong_build calls. am: 89fcdcb788
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1818245

Change-Id: I224e6b7417ba9f6c9a7f2f2e4804c98d5faa3a52
2021-09-08 13:39:23 +00:00
Lukacs T. Berki
e5d3519643 Invoke soong_docs from the bootstrap Ninja file. am: c6012f36e1
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1818237

Change-Id: I9343de3836415c8b59b3a1ae8d61d9e09cda84ba
2021-09-08 13:39:20 +00:00
Lukacs T. Berki
e1df43fafe Implement cleanups requested in aosp/1818245:
- Remove useValidations: whenever it was used, it was turned on, so
there was no point in keeping that knob
- Use the new soong_build invocation name constants

Test: Presubmits.
Change-Id: Ia3e8928d30d3de1e0adaa741111771304e56b139
2021-09-08 15:33:37 +02:00
Lukacs T. Berki
89fcdcb788 Refactor the creation of soong_build calls.
They were a bit repetitive.

In addition, make the environment checks more correct; they could
probably use an integration test or two to make sure that when the
environment changes, exactly those outputs are rebuilt that need to be,
but for now, this is an improvement already.

Test: Presubmits.
Change-Id: Idd79b81ca6975d57d00e5bf4699d266152505ff8
2021-09-08 09:36:22 +02:00
Lukacs T. Berki
c6012f36e1 Invoke soong_docs from the bootstrap Ninja file.
This makes soong_ui the only place where soong_build is invoked, thus
greatly simplifying the conceptual model of the build.

It comes with the slight limitation that now soong_docs (and queryview
and the JSON module graph) are not Make targets anymore, but I suppose
that's an acceptable loss.

The only place where someone depended on soong_docs from a Makefile is
removed in a separate change.

Test: Presubmits.
Change-Id: I3f9ac327725c15d84de725d05e3cdde1da3dcbe2
2021-09-08 09:31:52 +02:00
Lukács T. Berki
371b2ce724 Merge "Pass StopBefore as an argument to RunBlueprint." am: 144bf84677
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1818249

Change-Id: I59d85749a604a3b0db8a6c6b299276de842be6c2
2021-09-08 06:37:14 +00:00
Chih-Hung Hsieh
d0f82fee44 Add tidy-soong, tidy-dir-path, module-tidy targets
* When WITH_TIDY=1, these targets allow quick check of C/C++
  source code with clang-tidy, without building C/C++ binaries.
* For each module with tidy rules, add a module-tidy target, e.g.,
  libart-tidy, libartd-tidy, bionic-benchmarks-tidy, libnativehelper-tidy, etc.
* Add a tidy-soong phony target that depends on all module-tidy targets.
* For each directory X/Y add a tidy-X-Y phony target that depends
  on all *-tidy targets in X/Y and tidy-X-Y-Z for all X/Y/Z directories,
  e.g., tidy-bionic, tidy-bionic-benchmarks, tidy-libnativehelper, etc.
* Only soong modules are collected for now.
  Tidy rules in .mk files will be collected later.
* Some comment lines reformatted by gofmt.

Test: WITH_TIDY=1 make <some_module>-tidy tidy-<some_directory>
Test: WITH_TIDY=1 make tidy-soong
Bug: 199169329
Change-Id: I45aef3875f70288a8e070761e5f083dbbdfa6e94
2021-09-07 14:56:44 -07:00
Liz Kammer
7cbf7738f2 Cleanup unused code for bp2build conversion.
This code to support bp2build-specific modules is no longer necessary as
we do not create bp2build modules after https://r.android.com/1792714

Test: build/bazel/ci/bp2build.sh
Change-Id: I20d3c42f7e3516554cfb537fef05ba40d222dbeb
2021-09-07 13:19:21 -04:00
Lukacs T. Berki
ffc9e8d812 Pass StopBefore as an argument to RunBlueprint.
Its value is a function of the call site, so it doesn't make a lot of
sense to plumb it through the configuration.

Test: Presubmits.
Change-Id: If928b34de075969fd42932212ce9187808cbdf86
2021-09-07 18:14:07 +02:00
Lukacs T. Berki
ab4aada2b1 Invoke queryview from the bootstrap Ninja file. am: 3a82169a55
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1818236

Change-Id: I1780da93fb21a8e6c0c9c309c250716fc1f0a6a4
2021-09-07 06:17:27 +00:00
Lukacs T. Berki
3a82169a55 Invoke queryview from the bootstrap Ninja file.
It used to be invoked from out/soong/build.ninja, which required two
soong_build invocations one after the other (ne to generate
out/soong/build.ninja, one to generate the queryview workspace). This
was slower and required some shell-quoted-in-ninja-quoted-in-Go .

Test: Presubmits.
Change-Id: Idda79c067606663b66e9f94626fa24f3b5af4114
2021-09-06 17:10:49 +02:00
Treehugger Robot
09b9eadefb Merge "Fix typo in exempt from licenses property list." am: bdd7b3de94
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1818660

Change-Id: Ib644086c2ba8114d818a5b74fcbfa79093671e0d
2021-09-03 23:45:27 +00:00
Treehugger Robot
bdd7b3de94 Merge "Fix typo in exempt from licenses property list." 2021-09-03 23:29:13 +00:00
Lukács T. Berki
69b9caf11a Merge "Do not modules in files called "Blueprints"." am: 399dbe0699
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1817961

Change-Id: I754c8b72284ac8a22851f58ad1d03c8e2a90ec3d
2021-09-03 18:38:54 +00:00
Lukács T. Berki
399dbe0699 Merge "Do not modules in files called "Blueprints"." 2021-09-03 18:20:39 +00:00
Bob Badour
bae8421fea Fix typo in exempt from licenses property list.
Bug: 151177513

Test: m all
Change-Id: If794ccc814379e383db87f0deb587114b743d952
2021-09-03 17:25:35 +00:00
Treehugger Robot
b8d4e69927 Merge "Allows prebuilts in override_apex." am: e267bc8f74
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1811097

Change-Id: I732915686e54509c30f6855ea29d562bc83cf680
2021-09-03 16:13:56 +00:00
Treehugger Robot
e267bc8f74 Merge "Allows prebuilts in override_apex." 2021-09-03 16:01:31 +00:00
Daniel Norman
5a3ce13c6a Allows prebuilts in override_apex.
Bug: 197787336
Test: Create an override_apex that uses a different `prebuilts` than its
      base. Observe built contents.
Test: apex_test.go
Change-Id: I7666ed6cfe3f2fa5dd81e5f8c1961477dabbbd3c
2021-09-02 09:28:52 -07:00
Lukács T. Berki
e908fea7d2 Merge "Make OutDir() and SoongOutDir() be consistent." am: 5eeb6fc3f2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1815792

Change-Id: Ib28188151307381391cce50c6ee2ae998bf0c9be
2021-09-02 15:48:56 +00:00