Skip to content
Snippets Groups Projects
Commit 185c70ca authored by Andri Joos's avatar Andri Joos :blush:
Browse files

wip: add arm64 support

parent d5cdbade
No related branches found
No related tags found
No related merge requests found
Pipeline #7668 canceled with stage
in 16 minutes and 7 seconds
.gclient 0 → 100644
solutions = [
{
"custom_deps": {},
"deps_file": "DEPS",
"managed": False,
"name": "src/flutter",
"safesync_url": "",
"url": "https://github.com/flutter/engine.git",
"custom_vars": {
"download_emsdk": True,
},
},
]
......@@ -12,7 +12,10 @@
"--build-arg",
"FLUTTER_VERSION=${input:flutterVersion}",
"--platform",
"linux/amd64",
"linux/arm64",
"--tag",
"andrijoos/flutter:${input:flutterVersion}-dev",
"--load",
".",
],
},
......
......@@ -17,8 +17,35 @@ RUN apt update \
RUN mkdir -p ${FLUTTER_DIR}
RUN wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${FLUTTER_VERSION}-stable.tar.xz -O ${FLUTTER_DOWNLOAD_FILE} \
&& tar -xf ${FLUTTER_DOWNLOAD_FILE} --strip-components=1 --directory $FLUTTER_DIR;
ENV PATH="$PATH:/opt/depot_tools"
# Use precompiled binaries
RUN if [ "$(uname -m)" = "x86_64" ]; then \
wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${FLUTTER_VERSION}-stable.tar.xz -O ${FLUTTER_DOWNLOAD_FILE} \
&& tar -xf ${FLUTTER_DOWNLOAD_FILE} --strip-components=1 --directory $FLUTTER_DIR; \
fi
COPY .gclient /engine
# RUN if [ "$(uname -m)" = "aarch64" ]; then \
# git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git /opt/depot_tools \
# && git clone --depth 1 https://github.com/flutter/engine.git engine \
# && cd engine \
# && gclient config https://github.com/flutter/engine.git \
# # && git pull upstream master \
# && gclient sync \
# && ./flutter/tools/gn --target-os=linux --linux-cpu=arm64 \
# && ninja -C out/linux_release_arm64; \
# fi
# RUN ls out && exit 1
# apt update && apt install -y git wget python3 xz-utils pkg-config
# PATH="$PATH:/opt/depot_tools" && git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git /opt/depot_tools
# git clone --depth 1 https://github.com/flutter/engine.git engine
# # cd engine && fetch flutter
# cd engine && cp /app/.gclient . && gclient sync
# ./src/flutter/tools/gn --android --android-cpu arm64
# There is no official flutter arm64 release, so we must use the github repo
# Flutter on arch currently has warnings because channel and repository source are not set
......@@ -73,5 +100,7 @@ RUN dart --disable-analytics \
--no-enable-fuchsia \
&& flutter precache --universal
# On arm64, set flutter config local engine
# Test flutter
# RUN flutter doctor --verbose && exit 1
# Currently, only android and linux are supported.
# https://github.com/flutter/engine/blob/main/docs/contributing/Compiling-the-engine.md
# todo: release/profile, linux, maybe copy only flutter.jar?
apt update && apt install -y git wget python3 xz-utils pkg-config openjdk-17-jdk
PATH="$PATH:/opt/depot_tools" && git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git /opt/depot_tools
git clone --depth 1 https://github.com/flutter/engine.git /engine
cp .gclient /engine
cd /engine
rm pubspec.yaml
gclient sync
cd src
flutter/tools/gn --unoptimized --runtime-mode=debug
ninja -C out/host_debug_unopt
flutter/tools/gn --android --android-cpu arm64 --unoptimized --runtime-mode=debug
# flutter/tools/gn --android --android-cpu arm64 --runtime-mode=profile
# flutter/tools/gn --android --android-cpu arm64 --runtime-mode=release
ninja -C out/android_debug_unopt_arm64
# ninja -C out/android_profile_arm64
# ninja -C out/android_release_arm64
# When running on docker, run `docker run --rm --privileged multiarch/qemu-user-static --reset -p yes` to enable emulation
apt update
apt install -y wget xz-utils git curl unzip
# FLUTTER_VERSION="3.27.1"
# FLUTTER_DOWNLOAD_FILE="flutter.zip"
# wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${FLUTTER_VERSION}-stable.tar.xz -O ${FLUTTER_DOWNLOAD_FILE}
# mkdir -p /flutter
# tar -xf ${FLUTTER_DOWNLOAD_FILE} --strip-components=1 --directory /flutter
FLUTTER_DIR=/opt/flutter
FLUTTER_VERSION=3.27.1
git clone --depth 1 https://github.com/flutter/flutter.git ${FLUTTER_DIR}
cd ${FLUTTER_DIR}
git fetch origin tag ${FLUTTER_VERSION}
git checkout tags/${FLUTTER_VERSION}
PATH="${PATH}:${FLUTTER_DIR}/bin"
cd /
flutter precache --universal
# # Test android
apt install -y openjdk-17-jdk
export ANDROID_HOME="/opt/android"
CMDLINETOOLS_DIR="$ANDROID_HOME/cmdline-tools/latest"
CMDLINETOOLS_VERSION="11076708"
CMDLINETOOLS_ZIP="/tmp/cmdline-tools.zip"
wget "https://dl.google.com/android/repository/commandlinetools-linux-${CMDLINETOOLS_VERSION}_latest.zip" -O $CMDLINETOOLS_ZIP
unzip -q $CMDLINETOOLS_ZIP -d /tmp
mkdir -p ${CMDLINETOOLS_DIR}
mv /tmp/cmdline-tools/* $CMDLINETOOLS_DIR
PATH="${PATH}:${ANDROID_HOME}/cmdline-tools/latest/bin:${ANDROID_HOME}/platform-tools"
yes | sdkmanager --sdk_root=${ANDROID_HOME} --licenses
yes "y" | flutter doctor --android-licenses
flutter precache --universal --android
flutter config --local-engine-src-path /out/engine/src/ --local-engine /out/engine/src/out/android_debug_unopt_arm64/ --local-engine-host /out/engine/src/out/host_debug_unopt/
flutter config --enable-android
flutter create --project-name android_test -t app --platforms android android_test
cd android_test/android
./gradlew wrapper --gradle-version=8.1
cd ..
flutter pub get
flutter build appbundle --debug --target-platform android-arm64
# # flutter build appbundle --profile --target-platform android-arm,android-arm64,android-x64
# # flutter build appbundle --release --target-platform android-arm,android-arm64,android-x64
# cd ..
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment