[flutter]: release build with x86

This commit is contained in:
appflowy 2021-11-15 15:53:08 +08:00
parent b0a818b813
commit d2a8f89668
4 changed files with 43 additions and 43 deletions

View File

@ -1,3 +1,5 @@
#https://github.com/sagiegurari/cargo-make
extend = [
{ path = "scripts/makefile/desktop.toml" },
{ path = "scripts/makefile/protobuf.toml" },
@ -12,65 +14,60 @@ CARGO_MAKE_EXTEND_WORKSPACE_MAKEFILE = true
CARGO_MAKE_CRATE_FS_NAME = "dart_ffi"
CARGO_MAKE_CRATE_NAME = "dart-ffi"
VERSION = "0.0.1"
FEATURES = "flutter,http_server"
FEATURES = "flutter"
PRODUCT_NAME = "AppFlowy"
#CRATE_TYPE: https://doc.rust-lang.org/reference/linkage.html
CRATE_TYPE = "cdylib"
[env.development-mac]
DEV = true
PROD = false
TARGET_OS = "macos"
RUST_COMPILE_TARGET = "x86_64-apple-darwin"
CRATE_TYPE = "cdylib"
BUILD_FLAG = "debug"
FLUTTER_PLATFORM = "macos"
FLUTTER_OUTPUT_DIR = "Debug"
FEATURES = "flutter"
PRODUCT_EXT = "app"
[env.production-mac]
DEV = false
PROD = true
[env.production-desktop-mac-aarch64]
BUILD_FLAG = "release"
TARGET_OS = "macos"
RUST_COMPILE_TARGET = "aarch64-apple-darwin"
CRATE_TYPE = "cdylib"
BUILD_FLAG = "release"
FLUTTER_PLATFORM = "macos"
FLUTTER_OUTPUT_DIR = "Release"
FEATURES = "flutter"
PRODUCT_EXT = "app"
[env.production-desktop-mac-x86]
BUILD_FLAG = "release"
TARGET_OS = "macos"
RUST_COMPILE_TARGET = "x86_64-apple-darwin"
FLUTTER_OUTPUT_DIR = "Release"
PRODUCT_EXT = "app"
[env.production-desktop-windows-x86]
BUILD_FLAG = "release"
TARGET_OS = "windows"
RUST_COMPILE_TARGET = "x86_64-pc-windows-gnu"
FLUTTER_OUTPUT_DIR = "Release"
PRODUCT_EXT = "exe"
[tasks.echo_env]
script = [
'''
echo BUILD_FLAG: ${BUILD_FLAG}
echo TARGET_OS: ${TARGET_OS}
echo RUST_COMPILE_TARGET: ${RUST_COMPILE_TARGET}
echo FEATURES: ${FEATURES}
echo PRODUCT_EXT: ${PRODUCT_EXT}
echo ${platforms}
'''
]
[env.production-ios]
DEV = false
PROD = true
BUILD_FLAG = "release"
TARGET_OS = "ios"
CRATE_TYPE = "staticlib"
BUILD_FLAG = "release"
FLUTTER_PLATFORM = "ios"
FLUTTER_OUTPUT_DIR = "Release"
PRODUCT_EXT = "ipa"
[env.production-android]
DEV = false
PROD = true
TARGET_OS = "android"
CRATE_TYPE = "cdylib"
BUILD_FLAG = "release"
FLUTTER_PLATFORM = "apk"
FLUTTER_OUTPUT_DIR = "Release"
PRODUCT_EXT = "apk"
[env.production-window]
DEV = false
PROD = true
TARGET_OS = "windows"
RUST_COMPILE_TARGET = "x86_64-pc-windows-gnu"
CRATE_TYPE = "cdylib"
BUILD_FLAG = "release"
FLUTTER_PLATFORM = "windows"
FLUTTER_OUTPUT_DIR = "Release"
PRODUCT_EXT = "exe"
[tasks.setup-crate-type]
private = true

View File

@ -406,6 +406,7 @@
MACOSX_DEPLOYMENT_TARGET = 10.11;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
STRIP_STYLE = "non-global";
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
};
@ -488,6 +489,7 @@
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
STRIP_STYLE = "non-global";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
};
@ -534,6 +536,7 @@
MACOSX_DEPLOYMENT_TARGET = 10.11;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
STRIP_STYLE = "non-global";
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
};

View File

@ -3,11 +3,11 @@
[tasks.flowy-sdk]
category = "Build"
condition = { channels = ["nightly"] }
dependencies = ["flowy-sdk-build"]
dependencies = ["echo_env", "flowy-sdk-build"]
run_task = { name = ["copy-to-sys-tmpdir"] }
[tasks.flowy-sdk-build]
condition = { channels = ["nightly"] }
condition = { env_set = [ "BUILD_FLAG", "RUST_COMPILE_TARGET", "CRATE_TYPE", "TARGET_OS"] }
run_task = { name = ["setup-crate-type","sdk-build", "post-desktop", "restore-crate-type"] }
[tasks.sdk-build]
@ -15,7 +15,7 @@ description = "Build desktop targets."
script = [
"""
cd rust-lib/
if [ ${PROD} == true ]
if [ ${BUILD_FLAG} == release ]
then
cargo build --${BUILD_FLAG} --package=dart-ffi --target ${RUST_COMPILE_TARGET} --features=${FEATURES}
else

View File

@ -10,7 +10,7 @@ script = [
cd app_flowy/
flutter clean
flutter pub get
flutter build ${FLUTTER_PLATFORM} --${BUILD_FLAG} --build-name=${VERSION}
flutter build ${TARGET_OS} --${BUILD_FLAG} --build-name=${VERSION}
""",
]
script_runner = "@shell"
@ -28,7 +28,7 @@ script = [
product=${PRODUCT_NAME}.${PRODUCT_EXT}
cp -R ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/build/${FLUTTER_PLATFORM}/Build/Products/${FLUTTER_OUTPUT_DIR}/${product} \
cp -R ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/app_flowy/build/${TARGET_OS}/Build/Products/${FLUTTER_OUTPUT_DIR}/${product} \
${output_path}/${product}
""",
]