#!/usr/bin/env sh # get script directory script_dir="$(cd "$(dirname "$0")" && pwd)" # change working directory to script directory cd $script_dir # clean previous build rm -rf ./MyLib.Managed/bin rm -rf ./MyLib.Managed/obj rm -rf ./MyLib.Generated/bin rm -rf ./MyLib.Generated/obj # set up log file log_file="$script_dir/build.log" rm -f $log_file cd ./MyLib.Managed dotnet publish >> $log_file 2>&1 cd ../ beyondnetgen beyondnetgen.config.json >> $log_file 2>&1 cd ./MyLib.Generated ./build-android-arm64.sh >> $log_file 2>&1 # Create the directory if it doesn't exist mkdir -p ../flutter_example/android/app/src/main/jniLibs/arm64-v8a # Copy the generated library to the Android project cp ./bin/Release/net8.0/linux-bionic-arm64/native/MyLib.Generated.so \ ../flutter_example/android/app/src/main/jniLibs/arm64-v8a/libMyLib.so ./build-android-x64.sh >> $log_file 2>&1 # Create the directory if it doesn't exist mkdir -p ../flutter_example/android/app/src/main/jniLibs/x86_64 # Copy the generated library to the Android project cp ./bin/Release/net8.0/linux-bionic-x64/native/MyLib.Generated.so \ ../flutter_example/android/app/src/main/jniLibs/x86_64/libMyLib.so cp Hello.h ../flutter_example/Hello.h cd ../flutter_example dart run ffigen --config ffigen.yaml