Updated iOS dest path
This commit is contained in:
parent
8c1f0e6b90
commit
cc71d53f5f
1 changed files with 19 additions and 18 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
|
@ -9,8 +9,8 @@ if [ "$#" -ne 2 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Convert to absolute paths
|
# Convert to absolute paths
|
||||||
RUST_PROJECT_FOLDER="$(cd "$1" && pwd)"
|
RUST_PROJECT_FOLDER=$(cd "$1" && pwd)
|
||||||
FLUTTER_PROJECT_FOLDER="$(cd "$2" && pwd)"
|
FLUTTER_PROJECT_FOLDER=$(cd "$2" && pwd)
|
||||||
|
|
||||||
# Supported targets for Android
|
# Supported targets for Android
|
||||||
ANDROID_ARCHS=("arm64-v8a" "armeabi-v7a" "x86_64" "x86")
|
ANDROID_ARCHS=("arm64-v8a" "armeabi-v7a" "x86_64" "x86")
|
||||||
|
|
@ -18,7 +18,7 @@ ANDROID_TARGETS=("aarch64-linux-android" "armv7-linux-androideabi" "x86_64-linux
|
||||||
IOS_TARGETS=("aarch64-apple-ios" "x86_64-apple-ios")
|
IOS_TARGETS=("aarch64-apple-ios" "x86_64-apple-ios")
|
||||||
|
|
||||||
# Check if on macOS for iOS targets
|
# Check if on macOS for iOS targets
|
||||||
if [[ "${OSTYPE:-}" == "darwin"* ]]; then
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
INCLUDE_IOS_TARGETS=true
|
INCLUDE_IOS_TARGETS=true
|
||||||
else
|
else
|
||||||
INCLUDE_IOS_TARGETS=false
|
INCLUDE_IOS_TARGETS=false
|
||||||
|
|
@ -26,11 +26,11 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Enter the Rust project folder
|
# Enter the Rust project folder
|
||||||
cd "$RUST_PROJECT_FOLDER" || exit 1
|
cd "$RUST_PROJECT_FOLDER" || exit
|
||||||
|
|
||||||
# Function to check and install missing targets
|
# Function to check and install missing targets
|
||||||
install_missing_targets() {
|
install_missing_targets() {
|
||||||
for target in "$@"; do
|
for target in "${@}"; do
|
||||||
if ! rustup target list --installed | grep -q "$target"; then
|
if ! rustup target list --installed | grep -q "$target"; then
|
||||||
echo "Installing target: $target"
|
echo "Installing target: $target"
|
||||||
rustup target add "$target"
|
rustup target add "$target"
|
||||||
|
|
@ -64,10 +64,11 @@ if [ "$INCLUDE_IOS_TARGETS" = true ]; then
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Copy compiled libraries to Flutter project for Android
|
# Copy compiled libraries to Flutter project for Android
|
||||||
for i in "${!ANDROID_ARCHS[@]}"; do
|
for i in "${!ANDROID_ARCHS[@]}"; do
|
||||||
arch="${ANDROID_ARCHS[$i]}"
|
arch=${ANDROID_ARCHS[$i]}
|
||||||
target="${ANDROID_TARGETS[$i]}"
|
target=${ANDROID_TARGETS[$i]}
|
||||||
RELEASE_DIR="target/$target/release"
|
RELEASE_DIR="target/$target/release"
|
||||||
LIB_FILE=$(find "$RELEASE_DIR" -maxdepth 1 -name "lib*.so" | head -n 1)
|
LIB_FILE=$(find "$RELEASE_DIR" -maxdepth 1 -name "lib*.so" | head -n 1)
|
||||||
|
|
||||||
|
|
@ -75,7 +76,7 @@ for i in "${!ANDROID_ARCHS[@]}"; do
|
||||||
DEST_DIR="$FLUTTER_PROJECT_FOLDER/android/app/src/main/jniLibs/$arch"
|
DEST_DIR="$FLUTTER_PROJECT_FOLDER/android/app/src/main/jniLibs/$arch"
|
||||||
mkdir -p "$DEST_DIR"
|
mkdir -p "$DEST_DIR"
|
||||||
cp "$LIB_FILE" "$DEST_DIR/"
|
cp "$LIB_FILE" "$DEST_DIR/"
|
||||||
echo "Copied $arch library to $DEST_DIR"
|
echo "Copied $arch library to $2/android/app/src/main/jniLibs/$arch"
|
||||||
else
|
else
|
||||||
echo "No .so files found for $arch in $RELEASE_DIR"
|
echo "No .so files found for $arch in $RELEASE_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
@ -83,17 +84,17 @@ done
|
||||||
|
|
||||||
# Copy compiled libraries to Flutter project for iOS
|
# Copy compiled libraries to Flutter project for iOS
|
||||||
if [ "$INCLUDE_IOS_TARGETS" = true ]; then
|
if [ "$INCLUDE_IOS_TARGETS" = true ]; then
|
||||||
IOS_DEST_DIR="$FLUTTER_PROJECT_FOLDER/ios"
|
IOS_DEST_DIR="$FLUTTER_PROJECT_FOLDER/ios/Runner"
|
||||||
mkdir -p "$IOS_DEST_DIR"
|
mkdir -p "$IOS_DEST_DIR"
|
||||||
for target in "${IOS_TARGETS[@]}"; do
|
for target in "${IOS_TARGETS[@]}"; do
|
||||||
RELEASE_DIR="target/$target/release"
|
RELEASE_DIR="target/$target/release"
|
||||||
LIB_FILE=$(find "$RELEASE_DIR" -maxdepth 1 -name "lib*.a" | head -n 1)
|
LIB_FILE=$(find "$RELEASE_DIR" -maxdepth 1 -name "lib*.so" | head -n 1)
|
||||||
if [ -n "$LIB_FILE" ]; then
|
if [ -n "$LIB_FILE" ]; then
|
||||||
cp "$LIB_FILE" "$IOS_DEST_DIR/"
|
cp "$LIB_FILE" "$IOS_DEST_DIR/"
|
||||||
echo "Copied $target library to $IOS_DEST_DIR"
|
echo "Copied $target library to $IOS_DEST_DIR"
|
||||||
else
|
else
|
||||||
echo "No library found for $target in $RELEASE_DIR"
|
echo "No library found for $target in $RELEASE_DIR"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue