lib/cocoapods-flutter/native/archive/archive.rb in cocoapods-flutter-dt-0.1.0 vs lib/cocoapods-flutter/native/archive/archive.rb in cocoapods-flutter-dt-0.2.0
- old
+ new
@@ -30,21 +30,22 @@
end
end
public
- def initialize(module_name, version, sources, flutter_wrapper, pub_upgrade, flutter_version, build_run, working_dir, repo)
+ def initialize(module_name, version, sources, flutter_wrapper, pub_upgrade, flutter_version, build_run, working_dir, repo, build_modes)
@module_name = module_name
@version = version
@sources = sources
@flutter_wrapper = flutter_wrapper
@pub_upgrade = pub_upgrade
@flutter_version = flutter_version
@build_run = build_run
@working_dir = working_dir
@product_dir = "#{@working_dir}/.product/"
@pod_repo = repo
+ @build_modes = build_modes
end
def archive
@pub_upgrade ? pub_upgrade : pub_get
@@ -57,12 +58,19 @@
if @build_run
excute_build_run
end
build_framework
@plugins = fetch_plugins
- debug
- release
+
+ if @build_modes.include?('debug')
+ debug
+ end
+
+ if @build_modes.include?('release')
+ release
+ end
+
Pod::UserInterface.message "All is ready to use!, now you can use 'flutter_pod '#{@module_name}', '#{@version}', :mode=>'debug/release' to use the pod"
end
def make_flutter_pods(mode)
@pub_upgrade ? pub_upgrade : pub_get
@@ -191,13 +199,30 @@
raise "Error running #{@flutter_wrapper} packages pub run build_runner build --delete-conflicting-outputs"
end
end
def build_framework
- if CommandRunner.run(@flutter_wrapper, 'build','ios-framework','--no-profile',"--output=#{@product_dir}") == false
+
+ commands = [
+ @flutter_wrapper,
+ 'build',
+ 'ios-framework',
+ "--output=#{@product_dir}",
+ '--no-profile'
+ ]
+
+ if @build_modes.include?('debug') == false
+ commands.append '--no-debug'
+ end
+
+ if @build_modes.include?('release') == false
+ commands.append '--no-release'
+ end
+
+ if CommandRunner.run(*commands) == false
# FileUtils.remove_dir product_dir, true
- raise "Error running #{@flutter_wrapper} build ios-framework --no-profile --output=#{@product_dir} "
+ raise "Error running #{commands.join ' '} "
end
end
def build_app(mode)
if CommandRunner.run(@flutter_wrapper, 'build','ios',"--#{mode}" ,"--no-codesign") == false
@@ -364,13 +389,13 @@
s.description = @module_name
s.homepage = 'http://dreamtracer.top'
s.license = { :type => 'BSD' }
s.author = { 'Dreamtracer' => 'http://dreamtracer.top' }
s.source = { :http => app_download_url }
- s.ios.deployment_target = '9.0'
+ s.ios.deployment_target = '10.0'
s.prepare_command = "ruby download_sdk.rb #{sdk_download_url}"
- s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
- s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
+ s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64 x86_64' }
+ s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64 x86_64' }
vendored_frameworks = ["App.framework", "Flutter.framework", "FlutterPluginRegistrant.framework"]
@plugins.each do |plugin|
vendored_frameworks.append "#{plugin.name}.framework"
end
s.vendored_frameworks = vendored_frameworks