Commit graph

72 commits

Author SHA1 Message Date
Spandan Das
a5e26d3cd6 Add an apex_contributions_defaults module to module sdk
This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.

Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
    name: "art-module-host-exports.contributions",
    contents: [
        "prebuilt_art.module.api.annotations",
        "prebuilt_dex2oat",
        "prebuilt_dex2oatd",
        "prebuilt_dexdump",
        "prebuilt_hiddenapi",
        "prebuilt_oatdump",
        "prebuilt_profman",
        "prebuilt_veridex",
        "prebuilt_libartpalette",
        "prebuilt_libartbase",
    ],
}

Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
2024-03-20 21:41:57 +00:00
Cole Faust
37bfb07722 Replace starlark_import with hardcoded map
With roboleaf being cancelled, we don't need the api levels to be
present in starlark.

Bug: 315353489
Test: Presubmits
Change-Id: I21ea61ced00a5b0ae066a9ca99a88a512bf115ac
2024-03-06 15:59:18 -08:00
Spandan Das
38c64f62cf Restrict verify_overlaps to pre S modules
The runtime in S and above does not have the same constraints that
require the hiddenapi flags to be generated in a monolithic manner.
This CL restricts the verify_overlaps to pre S modules. This will
filter out hiddenapi signature discrepancies that do not require
any action.

Test: verify_overlaps diff with this change https://diff.googleplex.com/#key=xxB0ky93hZRn
Test: presubmits
Bug: 313672880

Change-Id: Ie626a6779fc924563bec90b6c1ab0c7e8b4b23c2
2024-02-13 02:33:12 +00:00
Elliott Hughes
10363161e7 "master" was renamed "main".
Test: N/A
Change-Id: I86d5578eaac260e55a9583db7ab49812b4ba1f5d
2024-01-09 22:09:07 +00:00
Todd Lee
2ec7e1c55c Support for incremetal platform prebuilt APIs
This change provides support for prebuilt incremental platform API (i.e.
API changes associated with a QPR, as opposed to a major dessert
releas).

This feature is provided via the existing prebuilt_apis module with the
introduction of a new attribute:

    allow_incremental_platform_api

While typical platform prebuilt APIs are presumed to be under a
directory structure that follows the pattern:

<version>/<scope>/<module>.jar
<version>/<scope>/api/<module>.txt

Where <version> is limited to a single integer signifying the API level.

For modules where allow_incremental_platform_api is set to 'true' (false
by default) the pattern is the same, however <version> is presumed to be
of the form MM.m, where MM aligns with the existing API level and m
signifies the incremental release (e.g. QPR).

Bug: b/280790094
Test: platform build check with both incremental & non-incremental API
      cd build/soong && go test ./java
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:eee6995093485497bc29cdce01c2a86765ffb4eb)
Change-Id: I67e293006ccfa210d0dcc0a294db894632f1b6cb
2023-08-25 18:03:44 +00:00
Dan Albert
94dd5651d7 Remove libandroid_support support.
This hasn't been needed since Android dropped API 19/20 support.

Bug: None
Test: m
Change-Id: I2749d6a706d4aa2fe13cac9816b4a2be9743ad24
2023-07-20 18:17:04 +00:00
LaMont Jones
0c10e4dcc0 Parallelize singleton execution
Bug: 281536768
Test: manual, presubmits
Change-Id: I57fdc76ba6b277e88e196b506af87127a530fd37
2023-05-19 20:31:32 +00:00
Cole Faust
3486740cc5 Use api_levels_released_versions from starlark
Instead of exporting it to soong_injection.

Bug: 279095899
Test: m nothing
Change-Id: I7b93af233b7450848a475512b5f5682ece773c09
Merged-In: I7b93af233b7450848a475512b5f5682ece773c09
2023-05-02 01:05:07 +00:00
Alix
fb502512cb Simplify logic in Soong ApiLevelFromUserWithConfig
Currently, ApiLevelFromUser calls ReplaceFinalizedCodename(raw).
This function checks whether raw is in the getFinalCodenamesMap which is
equivalent to ApiLevelsMapReleasedVersion with an additional entry for current.

Since ApiLevelFromUserWithConfig already returned on the raw = "current"
we only care about ApiLevelsMapReleasedVersion and can avoid the unecessary
use of strconv.Atoi(strconv.Itoa(raw)) that calling ReplaceFinalizedCodename
ends up doing.

Also makes the function look more like the Bazel version in
build/bazel/rules/common/api.bzl

Change-Id: I8c03fc159d7f63298273624f030d1956e2307615
Test: m bp2build
2023-03-31 14:55:13 +00:00
Dan Albert
8c7a994dfc Generate api_levels.json from the preview codenames.
When the branch is configured as something less than the max codename
(for example, right now AOSP is U but V is also in development), the
active codenames list will not include V.

Bug: None
Test: None
Change-Id: Ia22388a8ba94ff00d053acb33363c3cdce7677d0
2023-03-27 20:34:01 +00:00
Spandan Das
8c9ae7ed67 Update min_sdk_version from SdkSpec to ApiLevel
This relands aosp/2457063. The original change broke T and U since those
branches still contain soong modules of type (kind+level). Those soong
modules have been cleaned up now

Test: Used go/abtd to test T and U branches with this change

Bug: 208456999
Change-Id: I0ef7933c055f88cb512a02108f1173e51156ef1c
2023-03-22 20:15:45 +00:00
Spandan Das
dd7057c715 Create EffectiveVersion* functions for ApiLevel
This relands aosp/2457062. The original CL was submitted as part of a
stack that broke tm and udc. Those branches still contain soong modules
with min_sdk_version of type (kind+level).

Bug: 208456999
Test: m nothing on tm and udc (via go/abtd)
Change-Id: I10e8bea59cd5914d36b2c9539ee1556e55b82e53
2023-03-21 17:37:57 +00:00
Spandan Das
15da5887fe Create two sentinel api levels
This relands aosp/2470068. The original CL was submitted as part of a
stack that broke tm and udc. Those branches still contain soong modules
with min_sdk_version of type (kind+level).

Test: m nothing on tm and udc (via go/abtd)
Bug: 208456999

Change-Id: I8e013ec10530372f70f0ab0505b7eebeee2b360b
2023-03-21 17:37:49 +00:00
Spandan Das
ac96191f22 Revert "Create two sentinel api levels"
Revert submission 2457063

Reason for revert: Broken udc-dev

Reverted changes: /q/submissionid:2457063

Change-Id: Ide8e1b23d5a575c57be44ebd801846dc5caf2e83
2023-03-21 01:36:46 +00:00
Spandan Das
51dc6859ac Revert "Create EffectiveVersion* functions for ApiLevel"
Revert submission 2457063

Reason for revert: Broken udc-dev

Reverted changes: /q/submissionid:2457063

Change-Id: Ib0f6930ff292d25fee2640901b158ac4bb7b879b
2023-03-21 01:36:46 +00:00
Spandan Das
b74d1e1d91 Revert "Update min_sdk_version from SdkSpec to ApiLevel"
Revert submission 2457063

Reason for revert: Broken udc-dev

Reverted changes: /q/submissionid:2457063

Change-Id: Id6349fc1318877044af713c914a0afd437d3d2d5
2023-03-21 01:36:47 +00:00
Spandan Das
e773739787 Update min_sdk_version from SdkSpec to ApiLevel
min_sdk_version signifies device version and does not need an sdkKind to
describe it fully. Update the type and cleanup existing usages. As a
side benefit, we also get better error handling since users can no
longer enter something like `public_30` as a valid min_sdk_version in bp
files

Will do a similar cleanup for targetSdkVersion and maxSdkVersion in a
followup CL

Test: m nothing
Test: no change in ninja files (this should be a no-op)
Bug: 208456999

Change-Id: Ie6ae7e267d093c5e4787e82685daaca1021d202e
2023-03-20 16:51:32 +00:00
Spandan Das
5780039180 Create EffectiveVersion* functions for ApiLevel
These functions already exist on SdkSpec(kind+level) and are used for
computing the effective version for vendor modules compiling against
current or system_current which depends on the sdkKind

Create these functions for ApiLevel to support migrating MinSdkVersion
from SdkSpec to ApiLevel. Since the "api level" of vendor modules depend
on the sdk_kind as well, these functions will continue to exist on
SdkSpec.

Test: m nothing
Test: no diff in ninja files (this should be a no-op)
Bug: 208456999

Change-Id: Iee5a936e72b02b4fab9e457082d46fb8358eff16
2023-03-20 16:40:08 +00:00
Spandan Das
7ee04614cd Create two sentinel api levels
InvalidApiLevel:
This will be used for error handling if a user provided api level is
not recognized

PrivateApiLevel:
This will be used to differentiate the api level of sdk_version:"" from
sdk_version:"current" or sdk_version:"<active_codename>" (all used to be
FutureApiLevel previously). This was not necessary previously since the
type of min_sdk_version was SdkSpec(kind+level). Since it had access to
kind, it could check that it was not SdkSpecPrivate

Test: m nothing
Change-Id: I628b443c34bf2ec258d947dfec09f38b126bc6bb
2023-03-20 16:40:08 +00:00
Alix
fb7f7b99ff Comments to keep Starlark/soong api logic in sync
Test: none, added comments
Change-Id: I706c516a3601716a439bd775666a93b63c5c4f27
2023-03-02 19:36:51 +00:00
Alix Espino
4fd7e74140 Revert^2 "refactor of api_levels map for soong injection"
a865f4e905

Change-Id: Ifea020ac83725df7131773ca587c56931f5cdf03
2023-02-24 14:46:43 +00:00
Matthias Männich
a865f4e905 Revert "refactor of api_levels map for soong injection"
Revert submission 2441746-api_levels_refactor

Reason for revert: broke Android kernel build tools build: https://ci.android.com/builds/branches/aosp_kernel-build-tools/grid?

Reverted changes: /q/submissionid:2441746-api_levels_refactor

Change-Id: I35206879b93ec95ae325025cb764c6c34880dccf
2023-02-23 17:10:27 +00:00
Alix
c566ad8a4f refactor of api_levels map for soong injection
Change-Id: I58449fc84617e46727f23ab3d8dd5f118d2ee0d2
Bug: 249265719
Test: go test ./bp2build and locally ran bazel tests
2023-02-21 18:55:37 +00:00
Cole Faust
2b4402d43f Merge "Revert^2 "Fix erroneous "Field requires API level 33 (current min is 32)" warnings"" am: 100c7ad7f2
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2143082

Change-Id: I393938d1bf83b8dc734761679fbd5df10caf1c93
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-07-01 23:06:03 +00:00
Cole Faust
100c7ad7f2 Merge "Revert^2 "Fix erroneous "Field requires API level 33 (current min is 32)" warnings"" 2022-07-01 22:48:49 +00:00
Cole Faust
e5bf3fb4c2 Revert^2 "Fix erroneous "Field requires API level 33 (current min is 32)" warnings"
This reverts commit 5d80d895b6.

Reason for revert: The issue that broke the build the first time this was submitted has been fixed in ag/19125702. Also the errorprone build was added to presubmit for changes to these files so we should hopefully catch any other issues at presubmit now: cl/458501206

Change-Id: I80ca08df49c58a1ad70de917822301368d49fc67
2022-07-01 19:39:14 +00:00
Xin Li
313fdb5812 Merge tm-dev-plus-aosp-without-vendor@8763363
Bug: 236760014
Merged-In: I1421fb0dbcdb759281259abfae7bddc9aecdaa56
Change-Id: If059be00e6bdaaa94171b456afae1d585540639c
2022-06-28 21:23:06 +00:00
Vinh Tran
f192474a60 Replace API level codename with number
This CL fixes a bug when Soong pass `-target` with a non-digit suffix in Clang. As mentioned in b/236753843, Clang's version parsing expects to see an integer in the target string so it ignores the
S suffix.

Test: m gwp_asan_crash_handler && make sure -target is aarch64-linux-androidS instead of aarch64-linux-android31
Test: go test -run ^TestNonDigitMinSdkVersionInClangTriple$ android/soong/cc
Bug: 236753843
Change-Id: I258ecc52083dbf3471d23cf310e0ad54440f1908
2022-06-28 01:33:18 +00:00
Victor Chang
197ec71ec9 Merge "Revert "Fix erroneous "Field requires API level 33 (current min is 32)" warnings"" am: 99666e2720 am: 611f75ea9a
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2081278

Change-Id: Ib989959b0b864c46f519d57295c5647321db009c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-29 18:16:50 +00:00
Nataniel Borges
5d80d895b6 Revert "Fix erroneous "Field requires API level 33 (current min is 32)" warnings"
This reverts commit 8b7f627f30.

Reason for revert: b/230821289

Change-Id: I3032103b174c78586b38b64d2748ec5a42fa9522
2022-04-29 09:49:16 +00:00
Treehugger Robot
35e5179349 Merge "Fix erroneous "Field requires API level 33 (current min is 32)" warnings" am: fcf0b686aa am: 587f8c3425
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2072628

Change-Id: I7cc60174e9e525181cbf51dfd20e2e3e89f5c241
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-04-27 23:30:58 +00:00
Cole Faust
8b7f627f30 Fix erroneous "Field requires API level 33 (current min is 32)" warnings
Bug: 215567981
Bug: 204776549
Test: m out/soong/.intermediates/frameworks/base/framework-minus-apex/android_common/lint/lint-report.xml, then check that that file doesn't have any of these warnings
Change-Id: I39aa2228474630c93250bf5833ac6bd9bbadcc7f
2022-04-27 12:20:08 -07:00
Yurii Zubrytskyi
6114bd54eb platform/build/soong - Tiramisu is now 33
Bug: 225745567
Test: Build
Change-Id: I647b3e979ea9df622d86784f84f1155759e9ac0e
2022-04-12 08:23:14 -07:00
Sam Delmerico
7f88956c16 refactor Bazel variable export
Most of the variable export code for cc modules can be re-used for
exporting variables for java modules. Refactor this code into a more
composable structure for reuse.

Test: build/bazel/bp2build.sh
Test: manual comparison of
  out/soong/soong_injection/cc_toolchain/constants.bzl
  with previous output
Change-Id: Ie5a6fee08cc888b7dc69c3e324e5c3f8aa269a8f
2022-04-06 14:48:32 +00:00
Yu Liu
fc603167f4 Support tailoring clang --target flag based on min sdk version.
Bug: 215748260
Test: Tested using aquery to verify the --target flag; add added unit

Change-Id: Ifb13509db7d1e110316aa44d55ec9cccaa4b83d1
2022-03-18 01:16:52 +00:00
Xin Li
daf686db06 Merge sc-v2-dev-plus-aosp-without-vendor@8084891
Bug: 214455710
Merged-In: I4fecfba711c0d3d7a22f4fdf7684924a9457b464
Change-Id: I0587f395e4eef309d76e70764e6b5eaafec0e401
2022-02-11 06:56:21 +00:00
Jingwen Chen
0ee88a6b65 Implement stubs.symbol_file and stubs.versions for cc_library_shared bp2build.
This CL turns the stubs.symbol_file and stubs.versions properties into
stubs_symbol_file and stubs_version attributes on the cc_shared_library
target. See associated build/bazel change on how these attributes are
used to generate stub libraries.

Bug: 207812332

Test: New tests
Test: CI
Change-Id: Ie23eafb9903a131d92ff4e251215e998cea0a763
2022-01-17 13:03:12 +00:00
Artur Satayev
659c3144b5 Merge "Test SdkSpecForm." am: a71eabb705 am: 1fc2cf0ef6 am: 48fe6ad1cd
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1907852

Change-Id: I90ebac8f747498b0e174adfe7f01316295d3c808
2021-12-02 15:56:22 +00:00
satayev
0ee2f913ef Test SdkSpecForm.
Bug: 190818041
Test: presubmit
Change-Id: Ib8cd891f03537712d709ed063dd76dee55221118
2021-12-01 17:43:00 +00:00
Michael Wright
44af49bf3a S V2 is now 32 am: 08dd45a3b5
Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/16140643

Change-Id: I1f3e05582a9adc0d5b37b6c7fbf73b10a65f40d0
2021-11-06 16:06:51 +00:00
Michael Wright
08dd45a3b5 S V2 is now 32
Bug: 204295952
Test: N/A
Change-Id: Ib13f30c27cf79c2903e05d3c2cd27d79c4a28668
Merged-In: Ib13f30c27cf79c2903e05d3c2cd27d79c4a28668
2021-11-05 19:39:17 +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
Jeff Sharkey
7412091dcc platform/build/soong - S is now 31
Bug: 171506470
Test: Build
Change-Id: I7b02ab24d12ea07463efd319a7ff059751416990
2021-06-01 06:49:05 -06:00
Elliott Hughes
0e9cdb04df cc/linker.go: check min_sdk_version.
Checking sdk_version broke mainline code that compiles against a current
API level but needs to be able to run on an older API level.

Bug: http://b/187907243
Test: treehugger
Change-Id: If1192ef2809e39b043f0a384775b6c9e3a8bd619
2021-05-17 17:52:26 +00:00
Jiyong Park
f1691d2a2c Move java.sdkSpec to the android package
... in preparation for making the handling of sdk versions consistent
across java and cc modules.

Bug: 175678607
Test: m
Change-Id: I598f0454bce9b7320621022115412fbe97403945
2021-04-03 08:25:12 +09:00
Jooyung Han
11b0fbdbf6 cc: fix version macro for stubs
When a cc module is built against a stub, compiler passes version macro
of the stub lib. Version macro should be numeric, so codenames or
"current" should be mapped to numbers just like how ndkstubgen maps to.

* "current" -> future (10000)
* codenames -> look up api_level.json
* otherwise -> cast to int

Bug: 179329813
Test: m / soong test / manually check the output build.ninja
Change-Id: Ic0e1dd904984e161694a0b77fad5559c06a4462f
2021-02-05 11:27:57 +09:00
Jooyung Han
ed124c308f apex: checks min_sdk_version for preview/current
If we don't check "current", it won't be checked even in the finalized
branch.

If we don't check "preview", it should be done during the SDK
finalization. It'd be better done before the SDK finalization regarding
that setting min_sdk_version is to get approval from deps library owners.

Bug: 177833148
Test: m (soong tests)
Change-Id: I712b61cfe5a134fbb69c73956d26fb3a1e5c011e
2021-01-26 12:09:07 +09:00
Colin Cross
cf371cc1f7 Replace android.WriteFile rule with android.WriteFileRule
The android.WriteFile rule takes careful escaping to produce the
right contents.  Wrap it in an android.WriteFileRule that handles
the escaping.

Test: compare all android.WriteFile outputs
Change-Id: If71a5843af47a37ca61714e1a1ebb32d08536c31
2020-11-14 16:26:00 -08:00
Colin Cross
9f720ce52a Fix apex_test.go and add it to Android.bp
apex_test.go wasn't listed in the Android.bp file, which allowed
it to bitrot.  Make the API level methods take a PathContext
so that they can be called from a test using configErrorWrapper.
Also fix an int that was converted to a string.

Test: apex_test.go
Change-Id: I1ff87134c837bd5d344d22550baabde10d1b0b2e
2020-10-02 13:00:14 -07:00
Dan Albert
4f378d75aa Convert more versions in config to ApiLevel.
The test case I removed is invalid. The codename has had its int
assigned, but the config claims it is not final.

If this ever does need to be supported it's just a matter of making
sure the Q -> 29 mapping (or whatever) in the finalized codenames map
in android/api_levels.go.

Test: treehugger
Bug: http://b/154667674
Change-Id: I4f42ec2fd4a37750519ee3937938a1c65b6bb1e8
2020-09-22 16:01:56 -07:00