fix: you better work now
This commit is contained in:
parent
af77ac0826
commit
cb6a43a035
|
@ -23,6 +23,12 @@ jobs:
|
|||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
repository: 'RohitVerma882/build-tools'
|
||||
path: 'build-tools'
|
||||
|
||||
- name: Set up JDK 1.8
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
|
@ -37,10 +43,10 @@ jobs:
|
|||
|
||||
- name: Build aapt2
|
||||
env:
|
||||
NDK_TOOLCHAIN: "${{ env.ANDROID_HOME }}/ndk/${{ env.NDK_VERSION }}"
|
||||
NDK_TOOLCHAIN: "${{ env.ANDROID_HOME }}/ndk/${{ env.NDK_VERSION }}/toolchains/llvm/prebuilt/linux-x86_64"
|
||||
run: ./build.sh
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: dist
|
||||
path: sdk-tools-source/dist/
|
||||
path: build-tools/dist/
|
109
build.sh
109
build.sh
|
@ -1,22 +1,93 @@
|
|||
function buildAapt() {
|
||||
arch=$1
|
||||
python3 build.py \
|
||||
--ndk="$NDK_TOOLCHAIN" \
|
||||
--arch "$arch" \
|
||||
--build "dist/$arch" \
|
||||
--target aapt2 || exit 1
|
||||
#!/bin/bash
|
||||
|
||||
installDeps() {
|
||||
echo "Installing dependencies..."
|
||||
sudo apt-get update
|
||||
sudo apt-get upgrade git -y
|
||||
sudo apt-get install build-essential unzip nasm cmake ninja-build -y || exit 1
|
||||
}
|
||||
|
||||
echo "Installing dependencies..."
|
||||
sudo apt-get update
|
||||
sudo apt-get upgrade -y
|
||||
sudo apt-get install build-essential unzip nasm cmake ninja-build -y || exit 1
|
||||
echo "Downloading sources..."
|
||||
wget https://github.com/Lzhiyong/sdk-tools/releases/download/33.0.1/sdk-tools-source.zip -q -O sdk-tools-source.zip
|
||||
unzip -q sdk-tools-source.zip
|
||||
cd sdk-tools-source
|
||||
compileAapt2() {
|
||||
arch="$1"
|
||||
c_compiler=""
|
||||
cxx_compiler=""
|
||||
case $arch in
|
||||
"arm64-v8a")
|
||||
c_compiler="aarch64-linux-android30-clang"
|
||||
cxx_compiler="aarch64-linux-android30-clang++"
|
||||
;;
|
||||
"armeabi-v7a")
|
||||
c_compiler="armv7a-linux-androideabi30-clang"
|
||||
cxx_compiler="armv7a-linux-androideabi30-clang++"
|
||||
;;
|
||||
"x86")
|
||||
c_compiler="i686-linux-android30-clang"
|
||||
cxx_compiler="i686-linux-android30-clang++"
|
||||
;;
|
||||
"x86-64")
|
||||
c_compiler="x86_64-linux-android30-clang"
|
||||
cxx_compiler="x86_64-linux-android30-clang++"
|
||||
;;
|
||||
*)
|
||||
echo "Unknown architecture: $arch"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
currentdir="$(pwd)"
|
||||
outdir="$currentdir/dist/$arch"
|
||||
|
||||
for arch in "aarch64" "arm" "x86"; do
|
||||
echo "Building aapt for $arch"
|
||||
buildAapt $arch
|
||||
done
|
||||
if [ -d "$outdir" ]; then
|
||||
echo "Skipping compilation against target $arch because it already exists."
|
||||
echo "Please delete $outdir and re-run this script to recompile against target $arch."
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "Compiling against target: $arch"
|
||||
echo "NDK toolchain: ${NDK_TOOLCHAIN}"
|
||||
echo "Output will be saved in: $outdir"
|
||||
echo "Compiling..."
|
||||
rm -rf "build"
|
||||
mkdir "build" && cd "build" || exit 1
|
||||
|
||||
cmake -G 'Ninja' \
|
||||
-DCMAKE_C_COMPILER="$NDK_TOOLCHAIN/bin/$c_compiler" \
|
||||
-DCMAKE_CXX_COMPILER="$NDK_TOOLCHAIN/bin/$cxx_compiler" \
|
||||
-DCMAKE_BUILD_WITH_INSTALL_RPATH=True \
|
||||
-DCMAKE_SYSROOT="$NDK_TOOLCHAIN/sysroot" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DARCH="$arch" \
|
||||
.. || exit 1
|
||||
|
||||
ninja -j16 || exit 1
|
||||
|
||||
mkdir -p "$outdir"
|
||||
"$NDK_TOOLCHAIN/bin/llvm-strip" --strip-unneeded "aapt2"
|
||||
mv "aapt2" "$outdir"
|
||||
cd "$currentdir" || exit 1
|
||||
}
|
||||
|
||||
buildAapt2() {
|
||||
echo "Building aapt2, this may take a while..."
|
||||
cd build-tools || exit 1
|
||||
|
||||
echo "Applying patches..."
|
||||
git apply ../patches/*.patch || exit 1
|
||||
|
||||
mkdir -p "dist"
|
||||
for arch in "arm64-v8a" "armeabi-v7a" "x86"; do
|
||||
compileAapt2 $arch
|
||||
done
|
||||
}
|
||||
|
||||
main() {
|
||||
if [[ -z "${NDK_TOOLCHAIN}" ]]; then
|
||||
echo "Please specify the Android NDK you want to use in environment variable \"NDK_TOOLCHAIN\"."
|
||||
exit 1
|
||||
fi
|
||||
echo "Building aapt2 executable..."
|
||||
installDeps
|
||||
buildAapt2
|
||||
echo "All done!"
|
||||
}
|
||||
|
||||
main
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
--- a/base/tools/aapt2/Android.bp
|
||||
+++ b/base/tools/aapt2/Android.bp
|
||||
--- a/src/aapt2/Android.bp
|
||||
+++ b/src/aapt2/Android.bp
|
||||
@@ -54,6 +54,7 @@
|
||||
},
|
||||
darwin: {
|
||||
|
@ -17,8 +17,8 @@
|
|||
static_libs: ["libaapt2"],
|
||||
defaults: ["aapt2_defaults"],
|
||||
dist: {
|
||||
--- a/base/tools/aapt2/ResourceTable.cpp
|
||||
+++ b/base/tools/aapt2/ResourceTable.cpp
|
||||
--- 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{};
|
||||
|
@ -31,8 +31,8 @@
|
|||
}
|
||||
|
||||
if (res.id.has_value() && !res.id->first.is_valid()) {
|
||||
--- a/base/tools/aapt2/ResourceUtils.cpp
|
||||
+++ b/base/tools/aapt2/ResourceUtils.cpp
|
||||
--- a/src/aapt2/ResourceUtils.cpp
|
||||
+++ b/src/aapt2/ResourceUtils.cpp
|
||||
@@ -222,7 +222,7 @@
|
||||
}
|
||||
|
||||
|
@ -42,8 +42,8 @@
|
|||
}
|
||||
|
||||
if (entry.empty()) {
|
||||
--- a/base/tools/aapt2/cmd/Link.cpp
|
||||
+++ b/base/tools/aapt2/cmd/Link.cpp
|
||||
--- a/src/aapt2/cmd/Link.cpp
|
||||
+++ b/src/aapt2/cmd/Link.cpp
|
||||
@@ -2326,9 +2326,9 @@
|
||||
if (package_id_int > std::numeric_limits<uint8_t>::max()
|
||||
|| package_id_int == kFrameworkPackageId
|
||||
|
@ -80,8 +80,8 @@
|
|||
// Turn off auto versioning for static-libs.
|
||||
if (context.GetPackageType() == PackageType::kStaticLib) {
|
||||
options_.no_auto_version = true;
|
||||
--- a/base/tools/aapt2/cmd/Link.h
|
||||
+++ b/base/tools/aapt2/cmd/Link.h
|
||||
--- a/src/aapt2/cmd/Link.h
|
||||
+++ b/src/aapt2/cmd/Link.h
|
||||
@@ -71,6 +71,7 @@
|
||||
bool do_not_compress_anything = false;
|
||||
std::unordered_set<std::string> extensions_to_not_compress;
|
||||
|
@ -99,8 +99,8 @@
|
|||
AddOptionalSwitch("--no-compress", "Do not compress any resources.",
|
||||
&options_.do_not_compress_anything);
|
||||
AddOptionalSwitch("--keep-raw-values", "Preserve raw attribute values in xml files.",
|
||||
--- a/base/tools/aapt2/java/JavaClassGenerator.cpp
|
||||
+++ b/base/tools/aapt2/java/JavaClassGenerator.cpp
|
||||
--- a/src/aapt2/java/JavaClassGenerator.cpp
|
||||
+++ b/src/aapt2/java/JavaClassGenerator.cpp
|
||||
@@ -58,6 +58,8 @@
|
||||
"true", "false", "null"};
|
||||
|
||||
|
@ -110,8 +110,8 @@
|
|||
return sJavaIdentifiers.find(symbol) == sJavaIdentifiers.end();
|
||||
}
|
||||
|
||||
--- a/base/tools/aapt2/link/PrivateAttributeMover.cpp
|
||||
+++ b/base/tools/aapt2/link/PrivateAttributeMover.cpp
|
||||
--- a/src/aapt2/link/PrivateAttributeMover.cpp
|
||||
+++ b/src/aapt2/link/PrivateAttributeMover.cpp
|
||||
@@ -81,7 +81,6 @@
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue