Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

[flutter]: release build with x86

appflowyd2a8f89668b2
diff --git a/Makefile.toml b/Makefile.toml
index 17da5d5a5f..895d884aa5 100644
--- a/Makefile.toml
+++ b/Makefile.toml
@@ -1,3 +1,5 @@
+#https://github.com/sagiegurari/cargo-make
+
extend = [
{ path = "scripts/makefile/desktop.toml" },
{ path = "scripts/makefile/protobuf.toml" },
@@ -12,66 +14,61 @@ 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-ios]
-DEV = false
-PROD = true
-TARGET_OS = "ios"
-CRATE_TYPE = "staticlib"
+[env.production-desktop-mac-x86]
BUILD_FLAG = "release"
-FLUTTER_PLATFORM = "ios"
+TARGET_OS = "macos"
+RUST_COMPILE_TARGET = "x86_64-apple-darwin"
FLUTTER_OUTPUT_DIR = "Release"
-PRODUCT_EXT = "ipa"
+PRODUCT_EXT = "app"
-[env.production-android]
-DEV = false
-PROD = true
-TARGET_OS = "android"
-CRATE_TYPE = "cdylib"
+[env.production-desktop-windows-x86]
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.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]
+BUILD_FLAG = "release"
+TARGET_OS = "ios"
+CRATE_TYPE = "staticlib"
+BUILD_FLAG = "release"
+FLUTTER_OUTPUT_DIR = "Release"
+PRODUCT_EXT = "ipa"
+
+
[tasks.setup-crate-type]
private = true
script = [
diff --git a/app_flowy/macos/Runner.xcodeproj/project.pbxproj b/app_flowy/macos/Runner.xcodeproj/project.pbxproj
index 4b8ede5a81..685b2f6ab9 100644
--- a/app_flowy/macos/Runner.xcodeproj/project.pbxproj
+++ b/app_flowy/macos/Runner.xcodeproj/project.pbxproj
@@ -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";
};
diff --git a/scripts/makefile/desktop.toml b/scripts/makefile/desktop.toml
index df93c9043f..ffcd4570f2 100644
--- a/scripts/makefile/desktop.toml
+++ b/scripts/makefile/desktop.toml
@@ -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
diff --git a/scripts/makefile/flutter.toml b/scripts/makefile/flutter.toml
index 6ca0fc04c5..36d93f0969 100644
--- a/scripts/makefile/flutter.toml
+++ b/scripts/makefile/flutter.toml
@@ -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}
""",
]