fix: broken aapt2 patch

This commit is contained in:
Lucaskyy 2022-06-16 22:56:43 +02:00
parent cb6a43a035
commit 37803f5ec1
No known key found for this signature in database
GPG Key ID: 1530BFF96D1EEB89
1 changed files with 15 additions and 33 deletions

View File

@ -1,36 +1,3 @@
--- a/src/aapt2/Android.bp
+++ b/src/aapt2/Android.bp
@@ -54,6 +54,7 @@
},
darwin: {
cflags: ["-D_DARWIN_UNLIMITED_STREAMS"],
+ static_libs: ["libc++_static"]
},
},
header_libs: ["jni_headers"],
@@ -210,6 +211,8 @@
name: "aapt2",
srcs: ["Main.cpp"] + toolSources,
use_version_lib: true,
+ stl: "libc++_static",
+ static_executable: true,
static_libs: ["libaapt2"],
defaults: ["aapt2_defaults"],
dist: {
--- a/src/aapt2/ResourceTable.cpp
+++ b/src/aapt2/ResourceTable.cpp
@@ -460,9 +460,8 @@
const bool validate = validation_ == Validation::kEnabled;
const Source source = res.value ? res.value->GetSource() : Source{};
if (validate && !res.allow_mangled && !IsValidResourceEntryName(res.name.entry)) {
- diag->Error(DiagMessage(source)
- << "resource '" << res.name << "' has invalid entry name '" << res.name.entry);
- return false;
+ // Apktool: Allow invalid entry names.
+ return true;
}
if (res.id.has_value() && !res.id->first.is_valid()) {
--- a/src/aapt2/ResourceUtils.cpp
+++ b/src/aapt2/ResourceUtils.cpp
@@ -222,7 +222,7 @@
@ -120,3 +87,18 @@
priv_attr_type->entries = std::move(private_attr_entries);
}
return true;
--- a/src/aapt2/ResourceTable.cpp
+++ b/src/aapt2/ResourceTable.cpp
@@ -375,11 +375,7 @@ bool ResourceTable::AddResourceWithIdMangled(const ResourceNameRef& name, const
bool ResourceTable::ValidateName(NameValidator name_validator, const ResourceNameRef& name,
const Source& source, IDiagnostics* diag) {
const StringPiece bad_char = name_validator(name.entry);
- if (!bad_char.empty()) {
- diag->Error(DiagMessage(source) << "resource '" << name << "' has invalid entry name '"
- << name.entry << "'. Invalid character '" << bad_char << "'");
- return false;
- }
+ // Apktool: Allow invalid entry names.
return true;
}