瀏覽代碼

feat: only build the specify archs in macOS platform

tsuiyuenhong 2 年之前
父節點
當前提交
786cfc5164
共有 2 個文件被更改,包括 20 次插入0 次删除
  1. 3 0
      frontend/Makefile.toml
  2. 17 0
      frontend/app_flowy/macos/Podfile

+ 3 - 0
frontend/Makefile.toml

@@ -68,6 +68,7 @@ RUST_COMPILE_TARGET = "aarch64-apple-darwin"
 FLUTTER_OUTPUT_DIR = "Release"
 PRODUCT_EXT = "app"
 APP_ENVIRONMENT = "production"
+BUILD_ARCHS = "arm64"
 
 [env.production-mac-x86_64]
 BUILD_FLAG = "release"
@@ -76,6 +77,7 @@ RUST_COMPILE_TARGET = "x86_64-apple-darwin"
 FLUTTER_OUTPUT_DIR = "Release"
 PRODUCT_EXT = "app"
 APP_ENVIRONMENT = "production"
+BUILD_ARCHS = "x86_64"
 
 [env.development-windows-x86]
 TARGET_OS = "windows"
@@ -146,6 +148,7 @@ script = [
     echo PRODUCT_EXT: ${PRODUCT_EXT}
     echo APP_ENVIRONMENT: ${APP_ENVIRONMENT}
     echo ${platforms}
+    echo ${BUILD_ARCHS}
     '''
 ]
 script_runner = "@shell"

+ 17 - 0
frontend/app_flowy/macos/Podfile

@@ -26,6 +26,23 @@ require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelpe
 
 flutter_macos_podfile_setup
 
+def build_specify_archs_only
+  if ENV.has_key?('BUILD_ARCHS')
+    xcodeproj_path = File.dirname(__FILE__) + '/Runner.xcodeproj'
+    project = Xcodeproj::Project.open(xcodeproj_path)
+    project.targets.each do |target|
+      if target.name == 'Runner'
+        target.build_configurations.each do |config|
+          config.build_settings['ARCHS'] = ENV['BUILD_ARCHS']
+        end
+      end
+    end
+    project.save()
+  end
+end
+
+build_specify_archs_only()
+
 target 'Runner' do
   use_frameworks!
   use_modular_headers!