feat: only build the specify archs in macOS platform

This commit is contained in:
tsuiyuenhong 2022-06-08 00:54:21 +08:00
parent 03879a7262
commit 786cfc5164
2 changed files with 20 additions and 0 deletions

View File

@ -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"

View File

@ -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!