aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2024-05-02 20:27:32 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2024-05-02 20:27:32 +0000
commit295ee3630ec67e26f61fbe79485645f7752319d4 (patch)
treed64ce770d1b0697280e2f5c425ac2950bae749bd
parentaf91864614d3bc10ef70722e9b182da4e207a398 (diff)
parent5c6312e6278165774b6323f7437f1f4ffec12fb5 (diff)
downloadbuild-tools-release.tar.gz
Merge "Make change and version bump to RBT1.240502.001 Snap for 11794311 from b9ffad83764e48894d853510abb62c29e815e109 to build-tools-release" into build-tools-releasebuild-tools-release
-rw-r--r--core/build_id.mk2
-rw-r--r--core/proguard/kotlin.flags4
-rw-r--r--target/product/base_system.mk5
-rw-r--r--target/product/go_defaults.mk2
-rw-r--r--tools/check-flagged-apis/src/com/android/checkflaggedapis/CheckFlaggedApisTest.kt57
-rw-r--r--tools/check-flagged-apis/src/com/android/checkflaggedapis/Main.kt31
-rw-r--r--tools/releasetools/create_brick_ota.py8
-rwxr-xr-xtools/whichgit61
8 files changed, 121 insertions, 49 deletions
diff --git a/core/build_id.mk b/core/build_id.mk
index ce1b6fa724..5756983e1b 100644
--- a/core/build_id.mk
+++ b/core/build_id.mk
@@ -18,4 +18,4 @@
# (like "CRB01"). It must be a single word, and is
# capitalized by convention.
-BUILD_ID=RBT1.240501.002
+BUILD_ID=RBT1.240502.001
diff --git a/core/proguard/kotlin.flags b/core/proguard/kotlin.flags
index 70dbaa7e81..ef6bf0e9e3 100644
--- a/core/proguard/kotlin.flags
+++ b/core/proguard/kotlin.flags
@@ -10,7 +10,9 @@
# Kotlin DebugMetadata has no value in release builds, these two rules, will
# allow AppReduce to strip out DebutMetadata.
--checkdiscard interface kotlin.coroutines.jvm.internal.DebugMetadata
+# TODO(b/302383328): Restore the below checkdiscard after resolving transitive
+# inclusion of kotlin-stdlib from androidx.annotation library deps.
+# -checkdiscard interface kotlin.coroutines.jvm.internal.DebugMetadata
-assumenosideeffects class kotlin.coroutines.jvm.internal.DebugMetadataKt {
*** getDebugMetadataAnnotation(...);
}
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index 57e8275270..22284b1c18 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -486,6 +486,11 @@ PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\
# Enable dirty image object binning to reduce dirty pages in the image.
PRODUCT_PACKAGES += dirty-image-objects
+# Enable go/perfetto-persistent-tracing for eng builds
+ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
+ PRODUCT_PRODUCT_PROPERTIES += persist.debug.perfetto.persistent_sysui_tracing_for_bugreport=1
+endif
+
$(call inherit-product, $(SRC_TARGET_DIR)/product/runtime_libart.mk)
# Ensure all trunk-stable flags are available.
diff --git a/target/product/go_defaults.mk b/target/product/go_defaults.mk
index b7174868ee..a10cfa858f 100644
--- a/target/product/go_defaults.mk
+++ b/target/product/go_defaults.mk
@@ -17,6 +17,8 @@
# Inherit common Android Go defaults.
$(call inherit-product, build/make/target/product/go_defaults_common.mk)
+PRODUCT_RELEASE_CONFIG_MAPS += $(wildcard vendor/google/release/go_devices/release_config_map.mk)
+
# Add the system properties.
TARGET_SYSTEM_PROP += \
build/make/target/board/go_defaults.prop
diff --git a/tools/check-flagged-apis/src/com/android/checkflaggedapis/CheckFlaggedApisTest.kt b/tools/check-flagged-apis/src/com/android/checkflaggedapis/CheckFlaggedApisTest.kt
index 0569bfd71b..2f76b2a5a7 100644
--- a/tools/check-flagged-apis/src/com/android/checkflaggedapis/CheckFlaggedApisTest.kt
+++ b/tools/check-flagged-apis/src/com/android/checkflaggedapis/CheckFlaggedApisTest.kt
@@ -34,6 +34,9 @@ private val API_SIGNATURE =
ctor @FlaggedApi("android.flag.foo") public Clazz();
field @FlaggedApi("android.flag.foo") public static final int FOO = 1; // 0x1
method @FlaggedApi("android.flag.foo") public int getErrorCode();
+ method @FlaggedApi("android.flag.foo") public boolean setData(int, int[][], @NonNull android.util.Utility<T, U>);
+ method @FlaggedApi("android.flag.foo") public boolean setVariableData(int, android.util.Atom...);
+ method @FlaggedApi("android.flag.foo") public boolean innerClassArg(android.Clazz.Builder);
}
@FlaggedApi("android.flag.bar") public static class Clazz.Builder {
}
@@ -49,6 +52,9 @@ private val API_VERSIONS =
<method name="&lt;init>()V"/>
<field name="FOO"/>
<method name="getErrorCode()I"/>
+ <method name="setData(I[[ILandroid/util/Utility;)Z"/>
+ <method name="setVariableData(I[Landroid/util/Atom;)Z"/>
+ <method name="innerClassArg(Landroid/Clazz${"$"}Builder;)"/>
</class>
<class name="android/Clazz${"$"}Builder" since="2">
</class>
@@ -89,11 +95,20 @@ class CheckFlaggedApisTest {
fun testParseApiSignature() {
val expected =
setOf(
- Pair(Symbol("android.Clazz"), Flag("android.flag.foo")),
- Pair(Symbol("android.Clazz.Clazz()"), Flag("android.flag.foo")),
- Pair(Symbol("android.Clazz.FOO"), Flag("android.flag.foo")),
- Pair(Symbol("android.Clazz.getErrorCode()"), Flag("android.flag.foo")),
- Pair(Symbol("android.Clazz.Builder"), Flag("android.flag.bar")),
+ Pair(Symbol("android/Clazz"), Flag("android.flag.foo")),
+ Pair(Symbol("android/Clazz/Clazz()"), Flag("android.flag.foo")),
+ Pair(Symbol("android/Clazz/FOO"), Flag("android.flag.foo")),
+ Pair(Symbol("android/Clazz/getErrorCode()"), Flag("android.flag.foo")),
+ Pair(
+ Symbol("android/Clazz/setData(I[[ILandroid/util/Utility;)"),
+ Flag("android.flag.foo")),
+ Pair(
+ Symbol("android/Clazz/setVariableData(I[Landroid/util/Atom;)"),
+ Flag("android.flag.foo")),
+ Pair(
+ Symbol("android/Clazz/innerClassArg(Landroid/Clazz/Builder;)"),
+ Flag("android.flag.foo")),
+ Pair(Symbol("android/Clazz/Builder"), Flag("android.flag.bar")),
)
val actual = parseApiSignature("in-memory", API_SIGNATURE.byteInputStream())
assertEquals(expected, actual)
@@ -111,11 +126,14 @@ class CheckFlaggedApisTest {
fun testParseApiVersions() {
val expected: Set<Symbol> =
setOf(
- Symbol("android.Clazz"),
- Symbol("android.Clazz.Clazz()"),
- Symbol("android.Clazz.FOO"),
- Symbol("android.Clazz.getErrorCode()"),
- Symbol("android.Clazz.Builder"),
+ Symbol("android/Clazz"),
+ Symbol("android/Clazz/Clazz()"),
+ Symbol("android/Clazz/FOO"),
+ Symbol("android/Clazz/getErrorCode()"),
+ Symbol("android/Clazz/setData(I[[ILandroid/util/Utility;)"),
+ Symbol("android/Clazz/setVariableData(I[Landroid/util/Atom;)"),
+ Symbol("android/Clazz/innerClassArg(Landroid/Clazz/Builder;)"),
+ Symbol("android/Clazz/Builder"),
)
val actual = parseApiVersions(API_VERSIONS.byteInputStream())
assertEquals(expected, actual)
@@ -136,14 +154,23 @@ class CheckFlaggedApisTest {
fun testFindErrorsDisabledFlaggedApiIsPresent() {
val expected =
setOf<ApiError>(
- DisabledFlaggedApiIsPresentError(Symbol("android.Clazz"), Flag("android.flag.foo")),
+ DisabledFlaggedApiIsPresentError(Symbol("android/Clazz"), Flag("android.flag.foo")),
DisabledFlaggedApiIsPresentError(
- Symbol("android.Clazz.Clazz()"), Flag("android.flag.foo")),
- DisabledFlaggedApiIsPresentError(Symbol("android.Clazz.FOO"), Flag("android.flag.foo")),
+ Symbol("android/Clazz/Clazz()"), Flag("android.flag.foo")),
+ DisabledFlaggedApiIsPresentError(Symbol("android/Clazz/FOO"), Flag("android.flag.foo")),
DisabledFlaggedApiIsPresentError(
- Symbol("android.Clazz.getErrorCode()"), Flag("android.flag.foo")),
+ Symbol("android/Clazz/getErrorCode()"), Flag("android.flag.foo")),
DisabledFlaggedApiIsPresentError(
- Symbol("android.Clazz.Builder"), Flag("android.flag.bar")),
+ Symbol("android/Clazz/setData(I[[ILandroid/util/Utility;)"),
+ Flag("android.flag.foo")),
+ DisabledFlaggedApiIsPresentError(
+ Symbol("android/Clazz/setVariableData(I[Landroid/util/Atom;)"),
+ Flag("android.flag.foo")),
+ DisabledFlaggedApiIsPresentError(
+ Symbol("android/Clazz/innerClassArg(Landroid/Clazz/Builder;)"),
+ Flag("android.flag.foo")),
+ DisabledFlaggedApiIsPresentError(
+ Symbol("android/Clazz/Builder"), Flag("android.flag.bar")),
)
val actual =
findErrors(
diff --git a/tools/check-flagged-apis/src/com/android/checkflaggedapis/Main.kt b/tools/check-flagged-apis/src/com/android/checkflaggedapis/Main.kt
index 0c078a0b93..e8b1b65fce 100644
--- a/tools/check-flagged-apis/src/com/android/checkflaggedapis/Main.kt
+++ b/tools/check-flagged-apis/src/com/android/checkflaggedapis/Main.kt
@@ -41,21 +41,29 @@ import org.w3c.dom.Node
* a Java symbol slightly differently. To keep things consistent, all parsed APIs are converted to
* Symbols.
*
- * All parts of the fully qualified name of the Symbol are separated by a dot, e.g.:
+ * Symbols are encoded using the format similar to the one described in section 4.3.2 of the JVM
+ * spec [1], that is, "package.class.inner-class.method(int, int[], android.util.Clazz)" is
+ * represented as
* <pre>
- * package.class.inner-class.field
- * </pre>
+ * package.class.inner-class.method(II[Landroid/util/Clazz;)
+ * <pre>
+ *
+ * Where possible, the format has been simplified (to make translation of the
+ * various input formats easier): for instance, only / is used as delimiter (#
+ * and $ are never used).
+ *
+ * 1. https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3.2
*/
@JvmInline
internal value class Symbol(val name: String) {
companion object {
- private val FORBIDDEN_CHARS = listOf('#', '$')
+ private val FORBIDDEN_CHARS = listOf('#', '$', '.')
/** Create a new Symbol from a String that may include delimiters other than dot. */
fun create(name: String): Symbol {
var sanitizedName = name
for (ch in FORBIDDEN_CHARS) {
- sanitizedName = sanitizedName.replace(ch, '.')
+ sanitizedName = sanitizedName.replace(ch, '/')
}
return Symbol(sanitizedName)
}
@@ -170,7 +178,6 @@ The tool will exit with a non-zero exit code if any flagged APIs are found to be
}
internal fun parseApiSignature(path: String, input: InputStream): Set<Pair<Symbol, Flag>> {
- // TODO(334870672): add support for metods
val output = mutableSetOf<Pair<Symbol, Flag>>()
val visitor =
object : BaseItemVisitor() {
@@ -195,11 +202,7 @@ internal fun parseApiSignature(path: String, input: InputStream): Set<Pair<Symbo
append(".")
append(method.name())
append("(")
- // TODO(334870672): replace this early return with proper parsing of the command line
- // arguments, followed by translation to Lname/of/class; + III format
- if (!method.parameters().isEmpty()) {
- return
- }
+ method.parameters().joinTo(this, separator = "") { it.type().internalName() }
append(")")
}
val symbol = Symbol.create(name)
@@ -255,7 +258,9 @@ internal fun parseApiVersions(input: InputStream): Set<Symbol> {
"Bad XML: <field> element without name attribute"
}
val className =
- requireNotNull(field.getParentNode()?.getAttribute("name")) { "Bad XML: top level <field> element" }
+ requireNotNull(field.getParentNode()?.getAttribute("name")) {
+ "Bad XML: top level <field> element"
+ }
output.add(Symbol.create("${className.replace("/", ".")}.$fieldName"))
}
@@ -271,7 +276,7 @@ internal fun parseApiVersions(input: InputStream): Set<Symbol> {
if (methodSignatureParts.size != 3) {
throw Exception("Bad XML: method signature '$methodSignature'")
}
- var (methodName, methodArgs, methodReturnValue) = methodSignatureParts
+ var (methodName, methodArgs, _) = methodSignatureParts
val packageAndClassName =
requireNotNull(method.getParentNode()?.getAttribute("name")) {
"Bad XML: top level <method> element, or <class> element missing name attribute"
diff --git a/tools/releasetools/create_brick_ota.py b/tools/releasetools/create_brick_ota.py
index 9e040a53d4..bf50f71049 100644
--- a/tools/releasetools/create_brick_ota.py
+++ b/tools/releasetools/create_brick_ota.py
@@ -45,10 +45,10 @@ def CreateBrickOta(product_name: str, output_path: Path, extra_wipe_partitions:
partitions_to_wipe = PARTITIONS_TO_WIPE
if extra_wipe_partitions is not None:
partitions_to_wipe = PARTITIONS_TO_WIPE + extra_wipe_partitions.split(",")
- ota_metadata = ["ota-type=BRICK", "post-timestamp=9999999999",
- "pre-device=" + product_name]
- if serialno is not None:
- ota_metadata.append("serialno=" + serialno)
+ ota_metadata = ["ota-type=BRICK", "post-timestamp=9999999999",
+ "pre-device=" + product_name]
+ if serialno is not None:
+ ota_metadata.append("serialno=" + serialno)
# recovery requiers product name to be a | separated list
product_name = product_name.replace(",", "|")
with zipfile.ZipFile(output_path, "w") as zfp:
diff --git a/tools/whichgit b/tools/whichgit
index 8cf84f5629..55c8c6fb5a 100755
--- a/tools/whichgit
+++ b/tools/whichgit
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import argparse
+import itertools
import os
import subprocess
import sys
@@ -10,15 +11,34 @@ def get_build_var(var):
check=True, capture_output=True, text=True).stdout.strip()
+def get_all_modules():
+ product_out = subprocess.run(["build/soong/soong_ui.bash", "--dumpvar-mode", "--abs", "PRODUCT_OUT"],
+ check=True, capture_output=True, text=True).stdout.strip()
+ result = subprocess.run(["cat", product_out + "/all_modules.txt"], check=True, capture_output=True, text=True)
+ return result.stdout.strip().split("\n")
+
+
+def batched(iterable, n):
+ # introduced in itertools 3.12, could delete once that's universally available
+ if n < 1:
+ raise ValueError('n must be at least one')
+ it = iter(iterable)
+ while batch := tuple(itertools.islice(it, n)):
+ yield batch
+
+
def get_sources(modules):
- result = subprocess.run(["./prebuilts/build-tools/linux-x86/bin/ninja", "-f",
- "out/combined-" + os.environ["TARGET_PRODUCT"] + ".ninja",
- "-t", "inputs", "-d", ] + modules,
- stderr=subprocess.STDOUT, stdout=subprocess.PIPE, check=False, text=True)
- if result.returncode != 0:
- sys.stderr.write(result.stdout)
- sys.exit(1)
- return set([f for f in result.stdout.split("\n") if not f.startswith("out/")])
+ sources = set()
+ for module_group in batched(modules, 40_000):
+ result = subprocess.run(["./prebuilts/build-tools/linux-x86/bin/ninja", "-f",
+ "out/combined-" + os.environ["TARGET_PRODUCT"] + ".ninja",
+ "-t", "inputs", "-d", ] + list(module_group),
+ stderr=subprocess.STDOUT, stdout=subprocess.PIPE, check=False, text=True)
+ if result.returncode != 0:
+ sys.stderr.write(result.stdout)
+ sys.exit(1)
+ sources.update(set([f for f in result.stdout.split("\n") if not f.startswith("out/")]))
+ return sources
def m_nothing():
@@ -57,13 +77,13 @@ def main(argv):
# Argument parsing
ap = argparse.ArgumentParser(description="List the required git projects for the given modules")
ap.add_argument("--products", nargs="*",
- help="The TARGET_PRODUCT to check. If not provided just uses whatever has"
- + " already been built")
+ help="One or more TARGET_PRODUCT to check, or \"*\" for all. If not provided"
+ + "just uses whatever has already been built")
ap.add_argument("--variants", nargs="*",
help="The TARGET_BUILD_VARIANTS to check. If not provided just uses whatever has"
+ " already been built, or eng if --products is supplied")
ap.add_argument("--modules", nargs="*",
- help="The build modules to check, or droid if not supplied")
+ help="The build modules to check, or \"*\" for all, or droid if not supplied")
ap.add_argument("--why", nargs="*",
help="Also print the input files used in these projects, or \"*\" for all")
ap.add_argument("--unused", help="List the unused git projects for the given modules rather than"
@@ -72,22 +92,33 @@ def main(argv):
modules = args.modules if args.modules else ["droid"]
+ match args.products:
+ case ["*"]:
+ products = get_build_var("all_named_products").split(" ")
+ case _:
+ products = args.products
+
# Get the list of sources for all of the requested build combos
- if not args.products and not args.variants:
+ if not products and not args.variants:
+ m_nothing()
+ if args.modules == ["*"]:
+ modules = get_all_modules()
sources = get_sources(modules)
else:
- if not args.products:
+ if not products:
sys.stderr.write("Error: --products must be supplied if --variants is supplied")
sys.exit(1)
sources = set()
build_num = 1
- for product in args.products:
+ for product in products:
os.environ["TARGET_PRODUCT"] = product
variants = args.variants if args.variants else ["user", "userdebug", "eng"]
for variant in variants:
- sys.stderr.write(f"Analyzing build {build_num} of {len(args.products)*len(variants)}\r")
+ sys.stderr.write(f"Analyzing build {build_num} of {len(products)*len(variants)}\r")
os.environ["TARGET_BUILD_VARIANT"] = variant
m_nothing()
+ if args.modules == ["*"]:
+ modules = get_all_modules()
sources.update(get_sources(modules))
build_num += 1
sys.stderr.write("\n\n")