Commit graph

223 commits

Author SHA1 Message Date
Cole Faust
a963b94cde Make the enabled property configurable
This allows using select statements with it.

Bug: 323382414
Test: m nothing --no-skip-soong-tests
Change-Id: I6f3efaaa3d82505e38a91ee4ba0e18e404360191
Merged-In: If355d24506e3f117d27b21442a6c02bca3402dc7
2024-05-02 15:41:24 -07:00
Cole Faust
5fda87b822 Keep replace_instead_of_append in arch prop structs
replace_instead_of_append is read by proptools.ExtendProperties() /
proptools.ExtendMatchingProperties(). These functions are called on
arch property structs, so we need to preserve it when creating the
arch property structs.

Bug: 323382414
Test: m nothing --no-skip-soong-tests
Change-Id: Ic08704d8a2b710f5a5d99b62d3f8a37730bb6013
2024-04-24 11:21:14 -07:00
Colin Cross
a17792e2eb Merge "Remove more unused code" into main 2024-04-22 18:50:08 +00:00
Colin Cross
76d1b42c9f Remove more unused code
Bug: 315353489
Test: builds
Change-Id: I34cf772ba3c927bbbc141afb149cf0501ca6351f
2024-04-12 13:45:35 -07:00
Cole Faust
02dd6e5640 Add tests for android:replace_instead_of_append
Bug: 323382414
Test: m nothing --no-skip-soong-tests
Change-Id: Ideb739b3f1a6a5854453db7d51bdee73a3979fd4
2024-04-04 15:09:04 -07:00
Cole Faust
0aa21cc8e2 Add the ability to select on arch
Bug: 323382414
Test: go test
Change-Id: I0d4cf391a1a625c5160456db1f4f7fa424c2141e
2024-03-25 17:18:08 -07:00
Colin Cross
1e7e0432fa Follow signature update to ExtendMatchingProperties
The order function passed to ExtendMatchingProperites no longer takes
a property, dstValue or srcValue parameter.

Test: builds
Change-Id: I19fc554f705fbf42100f0a38df87e2d1fb2454ec
2024-02-02 15:56:32 -08:00
Colin Cross
984223fd04 Optimize mutator contexts
Mutator contexts are created for every module, and in the case of
transition mutator contexts for every dependency of every module.
Unlike the Blueprint mutator contexts that they wrap, the Soong
mutator contexts can be relatively large.  Add global pools for all
of them that can avoid the repeated allocations.

Test: SOONG_PROFILE_MEM=/tmp/mem.pprof m nothing
Change-Id: I64a5f3c91292cff6352300f99c11ac50c713f96d
2024-02-02 15:56:32 -08:00
Cole Faust
8fc38f3761 Add sdk_genrule
Some users want to repackage the results of an sdk module.
Genrules have 3 variants: linux, android, and common_os. The common_os
one produces a snapshot zip file that users want. In order to get
access to it, we need a genrule in the same variant, so create
an sdk_genrule for that.

The sdk_genrule shouldn't have linux/android variants either, because
those other variants would get errors when trying to depend on the
sdk modules because the snapshot zip doesn't exist in those other
variants. The code in arch.go needs to be tweaked to allow a common_os
variant without the other variants.

Bug: 315962165
Test: m dist out/dist/art_release.zip
Change-Id: Idc9b3cae7a525d71aed6bafa0f8724a89f75a94b
2023-12-13 14:11:24 -08:00
Colin Cross
b63d7b3af7 Remove infrastructure to run bp2build
Bug: 315353489
Test: m blueprint_tests
Change-Id: Idcf6377d389b94c39e4e6ff4b8efa8a9f9e78b17
2023-12-08 13:51:07 -08:00
Colin Cross
b5e3f7dad5 Export ReverseSliceInPlace and ReverseSlice
... and add tests.

Test: TestReverseSliceInPlace, TestReverseSlice
Change-Id: I70f811207fdb2af891f7ef3fe19cbe5c7276135a
2023-07-06 16:36:50 -07:00
Elliott Hughes
f7d3109972 Generate NDK stubs for riscv64 too.
These will only be provisional, but there are enough different groups
that want *something* to make a start on porting that it's probably
time...

Ignore missing dependencies in build-ndk-prebuilts.sh for now, because
various pieces (that the NDK doesn't care about) are still missing.

Bug: http://b/273792258
Test: build/soong/scripts/build-ndk-prebuilts.sh
Change-Id: I39202a953a73dc449a10a887d497d09079c43402
2023-03-17 18:49:18 +00:00
Liz Kammer
992918d21f Export ndk/aml arches to Bazel
Test: lunch ndk-eng; b build //bionic/libc --config=android
Change-Id: I1ec6f7d0f084aafe948f27111275537b6d9e9637
2022-11-11 15:27:56 -05:00
Elliott Hughes
c55b58692d The NDK _does_ assume neon now.
This lets us simplify more of our build configuration for stuff like
libm and libz.

Test: treehugger
Change-Id: I823c7df8117f068aeeb7067e8e197863b0fb517f
2022-10-27 23:46:22 +00:00
Colin Cross
f05b0d35d2 Add riscv64-linux-android support
Add barebones riscv64-linux-android support.  This should be enough
to add riscv64-specific entries to Android.bp files, but can't
actually compile anything until there are riscv64 toolchains.

Test: arch_test.go
Change-Id: I0dcc7e797d9352dd38243be908a7f19004ff3db1
2022-10-03 08:43:13 -07:00
Cole Faust
c843b99b71 Support arch features in bp2build
Bug: 189972518
Test: New soong test
Change-Id: I05d77c8f63ffe6697d8e0300226864658055e116
2022-09-02 15:20:54 -07:00
Treehugger Robot
e773613367 Merge "Make FirstTarget treat HostCross separately from Host" 2022-08-23 14:14:45 +00:00
Colin Cross
c0f0eb86db Make FirstTarget treat HostCross separately from Host
Use Target.Os and Target.HostCross as the key in FirstTarget so that
it returns a separate target for host and host cross architectures.
This is useful when host and host cross are both linux_musl, but
host cross is an independenct architecture like arm64.

Also filter the targets returned by ctx.MultiTargets() to match
the HostCross value of ctx.Target() to prevent the newly created
HostCross variants from colliding with Host variants in JNI or
test data attached to Java targets using a common arch.

This relands If75790001afe9d0f9d4d8166f207847851812297 with the
addition of the ctx.MultiTargets() filtering.

Bug: 236052820
Test: TestArchMutator
Change-Id: Ia6fe1185915d174d0ad6b401c227e0e57bee5c24
2022-08-22 14:36:13 -07:00
Colin Cross
d079e0b270 Reformat build/soong for go 1.19
Test: none
Change-Id: I132368f0fcbdb5ea088b5b84dbe4ccfdd9e94cad
2022-08-17 10:43:13 -07:00
Liz Kammer
ff966b137e Remove unused bp2build logic from arch.go
Test: go test soong tests
Change-Id: I8a99e3d22b835f6e0d0b16543c738315c6abc4ce
2022-08-01 16:07:45 -04:00
Colin Cross
3b56c92977 Revert "Make FirstTarget treat HostCross separately from Host"
This reverts commit c5d7ad6b68.

Reason for revert: Speculatively reverting as likely cause of mac build breakage

Change-Id: I30fbbaaac28f3a2fe8bc1c05775d3de248199b29
2022-07-20 17:37:37 +00:00
Colin Cross
c5d7ad6b68 Make FirstTarget treat HostCross separately from Host
Use Target.Os and Target.HostCross as the key in FirstTarget so that
it returns a separate target for host and host cross architectures.
This is useful when host and host cross are both linux_musl, but
host cross is an independenct architecture like arm64.

Bug: 236052820
Test: cross compile linux_musl-arm64
Change-Id: If75790001afe9d0f9d4d8166f207847851812297
2022-07-19 14:44:34 -07:00
Christopher Ferris
98f102269d Add ability to force compile as 64 bit.
When trying to build a single 64 bit and 32 bit image, there are
a few executables that are prefer32. When set, this will force all
of those targets to be compiled as 64 bit.

Test: With this option, drmserver/mediaserver are built as 64 bit.
Test: Without this option, drmserver/mediaserver are built as 32 bit.
Change-Id: I1c3dbe229f9b612ff76b857ca7163b14e7dc92c5
2022-07-14 13:34:14 -07:00
Colin Cross
39a1814f24 Don't package host cross modules in javaFuzzPackager
Normally the host cross OS is windows, which only builds a few opted-in
modules.  When the host cross OS is set to linux_musl it builds all
modules that haven't explicitly opted out, producing linux_musl_common
variants of java modules.  Filter these out of javaFuzzPackager to
avoid conflicts with the linux_glibc_common modules.

Host cross common variants targets were missing the HostCross flag,
so also set it in getCommonTargets.

Bug: 236052820
Test: builds with linux_musl arm64 host cross enabled
Change-Id: I58c846076091bee7df50016c240a176c039c42e9
2022-06-28 15:16:15 -07:00
Colin Cross
a9b2aacf07 Add linux_musl arm+arm64
Add toolchains to support cross compiling to aarch64-linux-musl and
arm-linux-musleabihf.

Bug: 236052820
Test: build arm and arm64 musl sysroots
Change-Id: I47a9322929baff2492c6e8db989ece01fcbeb133
2022-06-24 13:46:36 -07:00
Sam Delmerico
cc271e2065 add multilib data_device_bins properties
Some targets need to be able to specify the specific architecture for a
data_device_bin module. This commit adds new properties to allow
specification of first, both, 32, or 64 multilib properties.

Bug: 231448797
Bug: 232408185
Test: go test ./java -run TestDataDeviceBinsBuildsDeviceBinary
Change-Id: I457cf4b1a9ccb28b46042f874c96bd0a87009fab
2022-06-06 20:11:46 +00:00
Colin Cross
e91ea2a94a Remove linux_glibc musl hack
Stop using linux_glibc properties when musl is enabled.

Bug: 223257095
Test: m USE_HOST_MUSL host-native -k
Change-Id: I63cd485ef64c617bd81f3e598395da21bd71ccbb
2022-03-29 22:42:11 -07:00
Colin Cross
a98d36de64 Add host_linux target properties
Add host_linux to the target properties, which will apply to linux_glibc,
linux_bionic or linux_musl.  This will eventually undo the hack that
makes the linux_glibc properties apply to linux_musl.

Bug: 223257095
Test: TestArchProperties
Change-Id: Iccf51ed13c363ce1da04333a277fa49c33d45b9a
2022-03-07 14:56:33 -08:00
Colin Cross
2d295a2de2 Add musl_x86 and glibc_x86 style properties to bazel configurations
Bug: 223257095
Test: build/bazel/ci/mixed_libc.sh
Change-Id: Ia2427f54cdaafc657e29a7ae7a7575bec2b71338
2022-03-07 14:56:32 -08:00
Liz Kammer
e8303bd0ae Export variant/features via soong_injection
Test: build/bazel/ci/bp2build.sh
Change-Id: If70043dc9d020d5f4a243ba4b192b99c9c7e8563
2022-02-28 14:17:15 -05:00
Liz Kammer
b7f3366cbb Improve clarity of arch decoding.
Test: CI
Change-Id: I31789f962259e917e99ac6f778644729199f42ed
2022-02-28 14:17:15 -05:00
Treehugger Robot
cda344f120 Merge "Fix typos in arch_list and do variant validation" 2022-02-23 17:34:51 +00:00
Usta Shrestha
0b52d83b60 typos fixed
Bug: N/A
Test: m nothing
Change-Id: Ia3abc4b9db2b811bf589447e32a7f29f341f2307
2022-02-18 22:19:12 -05:00
Liz Kammer
2c2afe26ea Fix typos in arch_list and do variant validation
Test: m nothing
Change-Id: Icfbc9f886a1e16abe02bf6c61671b8187a699942
2022-02-15 17:26:35 -05:00
Colin Cross
1aa45b083e Add musl_<arch> and glibc_<arch> properties
Add musl_<arch> and glibc_<arch> properties similar to bionic_<arch>.

Bug: 215802826
Test: m checkbuild
Change-Id: Icfc42ad7b54ee1052f84a46b7c0acffb0a27b236
2022-02-10 11:36:31 -08:00
Usta
851a3271ce Use Module.GetProperties() instead of ModuleBase.generalProperties
ModuleBase.generalProperties served the pupose of being a subset
of ModuleBase.customizableProperties. But now with the removal of
the latter, the former is simply a redirection to Module.GetProperties()

Bug: 206961391
Test: m nothing and diff the ninja files
Change-Id: I6dd8b7ba74eb5e7ffb61029b0f9129eec2ccfdaf
2022-01-08 03:09:52 +00:00
Usta
dca0219965 Remove customizableProperties from android.ModuleBase
- customizableProperties was being used to access all properties,
i.e. basically `GetProperties()`

- generalProperties was a subset of properties,
i.e. `initArchModule()` would only add new arch-specific properties
to `customizableProperties` (and `archProperties`) but not `generalProperties`

This PR sets generalProperties to contain all properties,
which then makes customizableProperties redundant.
And in arch.go, any iteration is done via `archProperties` instead.

Bug: 206961391
Test: m nothing and diff the ninja files
Change-Id: Ieb72b31c0a447fcbf34c92a04f002d7b9d777a86
2022-01-04 13:33:51 -05:00
Usta
eabf0f36f3 cosmetic changes
base.module = module is redundant in InitDefaultsModule() becase of the preceding initAndroidModuleBase()
minor reformat of initArchModel()

Test: m nothing
Bug: n/a

Change-Id: I16d5a400a33098a81ffbf6c81eba5b13db6debf1
2021-12-13 13:33:15 -05:00
Dan Willemsen
4745007bb1 Add Darwin x86_64+arm64 universal binary support
This is configured from Make by setting up Darwin+Arm64 as a HOST_CROSS
target (which is largely true, as binaries can't be executed on X86_64
machines). On the Soong side, it's a bit blurier, as we don't current
have any other users that are the same OS but not natively executable
(Linux/musl is executable, Windows/x86 is a different OS).

Instead of requiring cc_binary/etc to become multi-architecture-aware
and using something like common_first/MultiTarget, this defaults all
non-multi-architecture-aware modules to be built with both
architectures. It then adds a dependency with the
DarwinUniversalVariantTag so that supporting modules can get the outputs
of the other variant.

Cc uses that dependency tag to run lipo on shared libraries and binaries
so that the output of the x86_64 variant is actually a fat binary
including both architectures.

Bug: 203607969
Test: build sdk-repo targets on a Mac
Change-Id: Icbddb0a177c0ba19d3e0d11f8cf568e0d1ea3245
2021-12-07 22:01:25 -08: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
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
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
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
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
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
Liz Kammer
135bf55281 Handle arch-specific/not properties the same.
Refactor arch-handling code to return a "no-config" axis which allows
handling non-arch configed properties the same way as arch-configed
properties.

Test: build/bazel/ci/bp2build.sh
Change-Id: I485b35fd91c28501fe2055234dc9b278488bf4b5
2021-08-17 13:06:54 -04:00
Colin Cross
528d67e523 Reland "Split the x86 host toolchain into glibc and musl variants"
Split the x86 host toolchain into glibc and musl variants

Create new musl toolchains that are based on the existing glibc
toolchains, and add the necessary flags for musl compiles.

This relands Ifc02f9e5afa61ff758be98b0c962f3a4b53d0546 with changes
for I46672e3a096b6ea94ff4c10e1c31e8fd010a163c.

Bug: 190084016
Change-Id: Iaa9f7a50ff601155ecd73acc5701a2c226be66dc
Test: TestArchMutator
2021-07-23 22:25:36 +00:00
Colin Cross
5d6904e1cf Revert "Split the x86 host toolchain into glibc and musl variants"
This reverts commit 4fb4ef2242.

Reason for revert: crossed with aosp/1775072

Change-Id: Ied922850b810d82627ba4f9ee42f672cfe286c91
2021-07-23 22:20:29 +00:00