From 50c20b8d26da63cc0b537066f8ea5ba7c852df82 Mon Sep 17 00:00:00 2001 From: jdz Date: Wed, 28 Oct 2026 22:56:19 +0800 Subject: [PATCH] =?UTF-8?q?fix(build):=20=E4=BF=AE=E5=A4=8D=E8=B7=A8?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E8=B5=84=E6=BA=90=E8=B7=AF=E5=BE=84=E4=B8=8E?= =?UTF-8?q?=20Android=2016KB=20=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitattributes | 3 + .github/workflows/android-release.yml | 110 ++++++++++++++++++ android/build.gradle.kts | 10 ++ ohos/scripts/generate-build-profile.mjs | 4 +- pubspec.yaml | 5 +- .../environment_isolation_test.dart | 4 +- .../architecture/platform_contract_test.dart | 6 +- 7 files changed, 136 insertions(+), 6 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..cdef0c6d --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +# CMake embeds a digest of these exact source bytes into the prebuilt reader. +# Keep checkouts identical on Windows and Linux so the artifact check is stable. +ohos/entry/src/main/cpp/** text eol=lf diff --git a/.github/workflows/android-release.yml b/.github/workflows/android-release.yml index 0fe63891..c11c35b2 100644 --- a/.github/workflows/android-release.yml +++ b/.github/workflows/android-release.yml @@ -267,6 +267,116 @@ jobs: exit 1 fi + # Prebuilt plugin JNI can remain 4 KB aligned even with a new NDK. + python3 - "$apk" --zipalign "$(dirname "$aapt")/zipalign" <<'PY_16KB' + #!/usr/bin/env python3 + """Check 64-bit ELF LOAD alignment and uncompressed APK library offsets. + + Read-only; uses Python's standard library. Optionally also run SDK zipalign. + This verifies packaging/linker alignment, not runtime page-size assumptions. + """ + + import argparse + import struct + import subprocess + import sys + import zipfile + from pathlib import Path + + PAGE_SIZE = 16384 + MACHINES = {"arm64-v8a": 183, "x86_64": 62} + + + def check_elf(stream, abi): + header = stream.read(64) + if (len(header) < 64 or header[:4] != b"\x7fELF" or + header[4:6] != b"\x02\x01"): + raise ValueError("expected little-endian ELF64") + if struct.unpack_from(" !file.path.endsWith('data/api/decrypted_http_trace.dart'), + (file) => !file.path + .replaceAll('\\', '/') + .endsWith('data/api/decrypted_http_trace.dart'), )) { expect( file.readAsStringSync(), diff --git a/test/campus_card/architecture/platform_contract_test.dart b/test/campus_card/architecture/platform_contract_test.dart index fe6afee2..cd78ab32 100644 --- a/test/campus_card/architecture/platform_contract_test.dart +++ b/test/campus_card/architecture/platform_contract_test.dart @@ -91,7 +91,11 @@ void main() { ); for (final entity in presentation.listSync(recursive: true)) { if (entity is! File || !entity.path.endsWith('.dart')) continue; - if (entity.path.endsWith('/icons/platform_icons.dart')) continue; + if (entity.path + .replaceAll('\\', '/') + .endsWith('/icons/platform_icons.dart')) { + continue; + } expect( entity.readAsStringSync(), isNot(contains('CupertinoIcons.')),