Pārlūkot izejas kodu

chore: support building universal macos package (#3110)

Lucas.Xu 2 gadi atpakaļ
vecāks
revīzija
70914e6228

+ 7 - 1
frontend/appflowy_flutter/macos/Runner.xcodeproj/project.pbxproj

@@ -429,10 +429,12 @@
 				COMBINE_HIDPI_IMAGES = YES;
 				EXCLUDED_ARCHS = "";
 				INFOPLIST_FILE = Runner/Info.plist;
+				INFOPLIST_KEY_CFBundleDisplayName = AppFlowy;
 				LD_RUNPATH_SEARCH_PATHS = (
 					"$(inherited)",
 					"@executable_path/../Frameworks",
 				);
+				MACOSX_DEPLOYMENT_TARGET = 11.0;
 				ONLY_ACTIVE_ARCH = YES;
 				PRODUCT_BUNDLE_IDENTIFIER = com.appflowy.appflowy.flutter;
 				PRODUCT_NAME = AppFlowy;
@@ -563,10 +565,12 @@
 				COMBINE_HIDPI_IMAGES = YES;
 				EXCLUDED_ARCHS = "";
 				INFOPLIST_FILE = Runner/Info.plist;
+				INFOPLIST_KEY_CFBundleDisplayName = AppFlowy;
 				LD_RUNPATH_SEARCH_PATHS = (
 					"$(inherited)",
 					"@executable_path/../Frameworks",
 				);
+				MACOSX_DEPLOYMENT_TARGET = 11.0;
 				PRODUCT_BUNDLE_IDENTIFIER = com.appflowy.appflowy.flutter;
 				PRODUCT_NAME = AppFlowy;
 				PROVISIONING_PROFILE_SPECIFIER = "";
@@ -588,11 +592,13 @@
 				COMBINE_HIDPI_IMAGES = YES;
 				EXCLUDED_ARCHS = "";
 				INFOPLIST_FILE = Runner/Info.plist;
+				INFOPLIST_KEY_CFBundleDisplayName = AppFlowy;
 				LD_RUNPATH_SEARCH_PATHS = (
 					"$(inherited)",
 					"@executable_path/../Frameworks",
 				);
-				ONLY_ACTIVE_ARCH = YES;
+				MACOSX_DEPLOYMENT_TARGET = 11.0;
+				ONLY_ACTIVE_ARCH = NO;
 				PRODUCT_BUNDLE_IDENTIFIER = com.appflowy.appflowy.flutter;
 				PRODUCT_NAME = AppFlowy;
 				PROVISIONING_PROFILE_SPECIFIER = "";

+ 10 - 0
frontend/appflowy_flutter/macos/Runner/DebugProfile.entitlements

@@ -2,8 +2,18 @@
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
+	<key>com.apple.security.app-sandbox</key>
+	<true/>
 	<key>com.apple.security.cs.allow-jit</key>
 	<true/>
+	<key>com.apple.security.files.downloads.read-write</key>
+	<true/>
+	<key>com.apple.security.files.user-selected.read-write</key>
+	<true/>
+	<key>com.apple.security.network.client</key>
+	<true/>
+	<key>com.apple.security.network.server</key>
+	<true/>
 	<key>com.apple.security.temporary-exception.files.absolute-path.read-write</key>
 	<array>
 		<string>/</string>

+ 2 - 0
frontend/appflowy_flutter/macos/Runner/Info.plist

@@ -2,6 +2,8 @@
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
+	<key>LSApplicationCategoryType</key>
+	<string>public.app-category.productivity</string>
 	<key>CFBundleDevelopmentRegion</key>
 	<string>$(DEVELOPMENT_LANGUAGE)</string>
 	<key>CFBundleExecutable</key>

+ 10 - 0
frontend/appflowy_flutter/macos/Runner/Release.entitlements

@@ -2,6 +2,16 @@
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
+	<key>com.apple.security.app-sandbox</key>
+	<true/>
+	<key>com.apple.security.files.downloads.read-write</key>
+	<true/>
+	<key>com.apple.security.files.user-selected.read-write</key>
+	<true/>
+	<key>com.apple.security.network.client</key>
+	<true/>
+	<key>com.apple.security.network.server</key>
+	<true/>
 	<key>com.apple.security.temporary-exception.files.absolute-path.read-write</key>
 	<array>
 		<string>/</string>

+ 0 - 0
frontend/scripts/code_generation/env/generate_env.sh


+ 1 - 1
frontend/scripts/code_generation/generate.sh

@@ -22,7 +22,7 @@ cd freezed
 # Allow execution permissions on CI
 chmod +x ./generate_freezed.sh
 ./generate_freezed.sh "$@"
-cd..
+cd ..
 
 echo "Generating env files using build_runner"
 cd env

+ 27 - 0
frontend/scripts/flutter_release_build/build_universal_package_for_macos.sh

@@ -0,0 +1,27 @@
+# build the universal binary for AppFlowy on macOS
+
+echo '🚀 ---------------------------------------------------'
+echo '🚀 building libdart_ffi.a(x86_64) for AppFlowy on macOS'
+cargo make --profile production-mac-x86_64 appflowy-core-release
+
+echo '🚀 ---------------------------------------------------'
+echo '🚀 building libdart_ffi.a(arm64) for AppFlowy on macOS'
+cargo make --profile production-mac-arm64 appflowy-core-release
+
+echo '🚀 -------------------------------------------------------'
+echo '🚀 building libdart_ffi.a(universal) for AppFlowy on macOS'
+lipo -create \
+    rust-lib/target/x86_64-apple-darwin/release/libdart_ffi.a \
+    rust-lib/target/aarch64-apple-darwin/release/libdart_ffi.a \
+    -output rust-lib/target/libdart_ffi.a
+
+lipo -archs rust-lib/target/libdart_ffi.a
+
+echo '🚀 ------------------------------------------------------------'
+echo '🚀 moving libdart_ffi.a(universal) for AppFlowy Backend Package'
+cp -rf rust-lib/target/libdart_ffi.a \
+    appflowy_flutter/packages/appflowy_backend/macos/
+
+echo '🚀 ---------------------------------------------------'
+echo '🚀 building the flutter application for macOS'
+flutter build macos --release

+ 0 - 9
frontend/scripts/makefile/desktop.toml

@@ -15,15 +15,6 @@ mac_alias = "appflowy-core-dev-macos"
 windows_alias = "appflowy-core-dev-windows"
 linux_alias = "appflowy-core-dev-linux"
 
-[tasks.appflowy-core-dev-android]
-category = "Build"
-dependencies = ["env_check"]
-run_task = { name = [
-  "setup-crate-type",
-  "sdk-build-android",
-  "restore-crate-type",
-] }
-
 [tasks.appflowy-core-dev-macos]
 category = "Build"
 dependencies = ["env_check"]