Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cmake/build-tools/aapt2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions patches/androidfw-asset-include-variant.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Project: src/base
# Android 17 reworked android::Asset to hold its backing buffer in a
# using Data = std::variant<base::MappedFile, ...>;
# but Asset.h never includes <variant>. AOSP's own bionic/libc++ build
# pulls <variant> 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 <functional>
#include <memory>
#include <optional>
+#include <variant>

#include <android-base/unique_fd.h>
#include <util/map_ptr.h>
1 change: 1 addition & 0 deletions patches/misc/android_content_res.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 9 additions & 3 deletions patches/protobuf-include-config.patch
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 4 additions & 6 deletions scripts/check_upstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}


Expand Down
11 changes: 10 additions & 1 deletion scripts/fetch_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}")
Expand Down
Loading