diff --git a/cmake/build-tools/aapt2.cmake b/cmake/build-tools/aapt2.cmake index 99c5f7f..c811f84 100644 --- a/cmake/build-tools/aapt2.cmake +++ b/cmake/build-tools/aapt2.cmake @@ -67,6 +67,11 @@ set(INCLUDES # we don't go through target_link_libraries for the protobuf-generated # headers — add abseil's source dir to the include path directly. ${SRC}/abseil-cpp + # Same propagation gap, newer trigger: protobuf (Android 17+) makes + # parse_context.h — a public header reached from every generated + # *.pb.h — include "utf8_validity.h", which lives in protobuf's + # bundled utf8_range copy rather than under src/. Add it directly. + ${SRC}/protobuf/third_party/utf8_range ${SRC}/logging/liblog/include ${SRC}/expat/lib ${SRC}/fmtlib/include diff --git a/patches/androidfw-asset-include-variant.patch b/patches/androidfw-asset-include-variant.patch new file mode 100644 index 0000000..66b08d8 --- /dev/null +++ b/patches/androidfw-asset-include-variant.patch @@ -0,0 +1,20 @@ +# Project: src/base +# Android 17 reworked android::Asset to hold its backing buffer in a +# using Data = std::variant; +# but Asset.h never includes . AOSP's own bionic/libc++ build +# pulls in transitively, so upstream never noticed; under +# glibc + libstdc++ 12 it does not, and the header fails with +# error: 'variant' in namespace 'std' does not name a template type +# cascading into every TU that includes Asset.h (libandroidfw, libaapt, +# aapt2 SymbolTable). Add the include the source should have carried. +diff --git a/libs/androidfw/include/androidfw/Asset.h b/libs/androidfw/include/androidfw/Asset.h +--- a/libs/androidfw/include/androidfw/Asset.h ++++ b/libs/androidfw/include/androidfw/Asset.h +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + #include + #include diff --git a/patches/misc/android_content_res.h b/patches/misc/android_content_res.h index 102c670..cbc9a3d 100644 --- a/patches/misc/android_content_res.h +++ b/patches/misc/android_content_res.h @@ -36,3 +36,4 @@ #define android_content_res_enhanced_debugging() false #define android_content_res_idmap_crc_is_mtime() false #define android_content_res_merge_idmap_binder_transactions() false +#define android_content_res_xml_file_size_limit() false diff --git a/patches/protobuf-include-config.patch b/patches/protobuf-include-config.patch index 8fbcd4b..c73d7a4 100644 --- a/patches/protobuf-include-config.patch +++ b/patches/protobuf-include-config.patch @@ -1,9 +1,15 @@ # Project: src/protobuf -# AOSP's protobuf source has its config.h under config/, but upstream -# protobuf's CMakeLists.txt doesn't add that dir to the include path, -# so src/google/protobuf/stubs/common.cc fails with: +# Optional: true +# AOSP's protobuf through ~25.x (Android 16) keeps its config.h under +# config/, but upstream protobuf's CMakeLists.txt doesn't add that dir +# to the include path, so src/google/protobuf/stubs/common.cc fails with: # fatal error: config.h: No such file or directory # This adds the include path. Same as lzhiyong's protobuf_CMakeLists.txt.patch. +# +# Marked Optional: Android 17 ships protobuf 33.5.0, which dropped the +# generated config.h / config dir entirely (no config.h include left in +# the sources). The patch correctly no longer applies there and is +# skipped quietly rather than flagged STALE. diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt diff --git a/scripts/check_upstream.py b/scripts/check_upstream.py index 65c64cf..2aae339 100755 --- a/scripts/check_upstream.py +++ b/scripts/check_upstream.py @@ -21,8 +21,8 @@ (which has been true since the renaming). If none of the three resolve, the version is `no-source` — Google has -published the binary but AOSP hasn't tagged the source yet (37.0.0 is -the current example). We track it but can't build it. +published the binary but AOSP hasn't tagged the source yet. We track +it but can't build it until the matching android-NN.0.0_rN appears. Output (stdout): JSON manifest of all sdkmanager versions and their resolutions. Output to $GITHUB_OUTPUT (when set): the legacy @@ -53,10 +53,8 @@ # build-tools 36.x lines up with Android 16 (NN = X + 20): (36, 0, 0): "android-16.0.0_r1", # Android 16 GA — verified local + CI (36, 1, 0): "android-16.0.0_r3", # Android 16 QPR1 — verified local + CI - # 37.0.0 is intentionally absent: as of writing, AOSP has no - # `android-17.*` branch or tag, and the sdkmanager binary uses - # proto fields not present in any 16.x snapshot. Will be filled - # in once Google publishes the matching source. + # build-tools 37.x -> Android 17 (same NN = X + 20 rule): + (37, 0, 0): "android-17.0.0_r1", # Android 17 GA — verified local (Pi) + CI } diff --git a/scripts/fetch_sources.py b/scripts/fetch_sources.py index 22c6962..e4f420e 100644 --- a/scripts/fetch_sources.py +++ b/scripts/fetch_sources.py @@ -212,10 +212,14 @@ def apply_patches(src_dir: Path, patch_dir: Path) -> None: log(f"applying patches from {patch_dir}") for p in patches: project = None + optional = False for line in p.read_text().splitlines(): if line.startswith("# Project:"): project = line[len("# Project:"):].strip() - break + elif line.startswith("# Optional:"): + optional = line[len("# Optional:"):].strip().lower() in ("1", "true", "yes") + elif line.startswith(("diff ", "--- ")): + break # reached the diff body; headers sit above it if not project: print(f" !! {p.name} missing '# Project:' header, skipping") continue @@ -248,6 +252,11 @@ def apply_patches(src_dir: Path, patch_dir: Path) -> None: ["git", "apply", "-p1", str(p)], cwd=proj_dir, check=True ) print(f" applied {p.name} -> {project}") + elif optional: + # Optional patches only apply to some source revisions — e.g. + # a fixup for a file or build-system layout that newer AOSP + # dropped. Not applying is expected here, not a breakage. + print(f" skipped {p.name} (optional; not applicable to {project})") else: err = (fwd.stderr or "").strip().split("\n")[-1] print(f" !! STALE {p.name} ({project}): {err}")