lib/cocoapods-flutter/native/archive/archive.rb in cocoapods-flutter-dt-0.0.2 vs lib/cocoapods-flutter/native/archive/archive.rb in cocoapods-flutter-dt-0.0.3

- old
+ new

@@ -57,10 +57,43 @@ debug release 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 + setup_pod_sources + if @build_run + excute_build_run + end + + build_app mode + + flutter_spec_dir = @product_dir + 'Flutter' + flutter_spec_file = flutter_spec_dir + '/Flutter.podspec.json' + flutter_spec = Pod::Spec.from_file @working_dir + '/.ios/Flutter/engine/Flutter.podspec' + flutter_spec.vendored_frameworks = ['Flutter.framework', 'App.framework'] + plugin_registrant_spec_file = @working_dir + '/.ios/Flutter/FlutterPluginRegistrant/FlutterPluginRegistrant.podspec' + + unless Dir.exist? flutter_spec_dir + FileUtils.mkdir_p flutter_spec_dir + end + + File.open flutter_spec_file, "w+" do |file| + file.write flutter_spec.to_pretty_json + end + + FileUtils.cp_r @working_dir + '/.ios/Flutter/engine/Flutter.framework', flutter_spec_dir + FileUtils.cp_r @working_dir + '/.ios/Flutter/App.framework', flutter_spec_dir + + plugins = fetch_plugins + plugins.append Plugins.new('Flutter',flutter_spec_file,flutter_spec) + plugins.append Plugins.new('FlutterPluginRegistrant',plugin_registrant_spec_file, Pod::Spec.from_file(plugin_registrant_spec_file)) + + plugins + end + private def release app_file, sdk_file = zip_files @plugins, 'Release' upload_files app_file, sdk_file, 'Release' @@ -144,10 +177,17 @@ # FileUtils.remove_dir product_dir, true raise "run build_runner fail" end end + def build_app(mode) + if CommandRunner.run(@flutter_wrapper, 'build','ios',"--#{mode}" ,"--no-codesign") == false + # FileUtils.remove_dir product_dir, true + raise "run build_runner fail" + end + end + def fetch_plugins results = [] flutter_plugins_list = @working_dir + '/.flutter-plugins' lines = IO.readlines(flutter_plugins_list) lines.each do |line| @@ -295,9 +335,10 @@ remote = Remote.new() sdk_download_url = remote.download_url "Flutter", @flutter_version, mode.downcase app_download_url = remote.download_url @module_name, @version, mode.downcase spec = Pod::Spec.new do |s| + s.swift_version = '5.0' s.name = "#{@module_name}_#{mode.downcase}" s.version = @version s.summary = @module_name s.description = @module_name s.homepage = 'http://dreamtracer.top'