cocoapods-flutter-dt 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5bed8dc160bb69508717eddc4e3f8a7666dec9765a1f23342dfb6c59424a9a4a
4
- data.tar.gz: fb4a26c1694ddbd9cf88ac24b9482aa7208c80b32764added0a40ce348a656c4
3
+ metadata.gz: 18f5e54d76525f37dd069456318eac1d194bb8da3238f85d59ff1cec9ab174e7
4
+ data.tar.gz: 8b07578c4702e2d99be36fb99970afe732275cbf30e89acf269166a401f452eb
5
5
  SHA512:
6
- metadata.gz: 6c07e00b95ae952d155c59f5d8437fb1c59bbfa6f2269c0768efbe2bf2a7f2d3679c5368532c1f242aaabc71aeada7afcbed739996de6d5edbc58ab779074d1b
7
- data.tar.gz: 385c6793709ddfaacdfb954536b83fe6da2e2117b4fa7098edb39722ce60e108e689ed31b5ff8fa774284d2fd8aeefe79572ddbb474e6052387700dea5805cc9
6
+ metadata.gz: 4dcab1bf0b6cabfa622724dbd69764eef0861b76c9e4ddd74030ba002ac5db8b696e759254bb0a09cc306ee985bc9fb217fe99454a3c896ac959b302250f2ef7
7
+ data.tar.gz: 9ecbb88939b5498078b00c5610a7ae7f3945feb651bcfbd80107c8a3b4fa035190ecc34caba83ad4f7dd9b4f33aadd68f49a620653177ca7cf94d0a87c470a80
@@ -1,3 +1,3 @@
1
1
  module CocoapodsFlutter
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -59,6 +59,39 @@ class Archiver
59
59
  Pod::UserInterface.message "All is ready to use!, now you can use 'flutter_pod '#{@module_name}', '#{@version}', :mode=>'debug/release' to use the pod"
60
60
  end
61
61
 
62
+ def make_flutter_pods(mode)
63
+ @pub_upgrade ? pub_upgrade : pub_get
64
+ setup_pod_sources
65
+ if @build_run
66
+ excute_build_run
67
+ end
68
+
69
+ build_app mode
70
+
71
+ flutter_spec_dir = @product_dir + 'Flutter'
72
+ flutter_spec_file = flutter_spec_dir + '/Flutter.podspec.json'
73
+ flutter_spec = Pod::Spec.from_file @working_dir + '/.ios/Flutter/engine/Flutter.podspec'
74
+ flutter_spec.vendored_frameworks = ['Flutter.framework', 'App.framework']
75
+ plugin_registrant_spec_file = @working_dir + '/.ios/Flutter/FlutterPluginRegistrant/FlutterPluginRegistrant.podspec'
76
+
77
+ unless Dir.exist? flutter_spec_dir
78
+ FileUtils.mkdir_p flutter_spec_dir
79
+ end
80
+
81
+ File.open flutter_spec_file, "w+" do |file|
82
+ file.write flutter_spec.to_pretty_json
83
+ end
84
+
85
+ FileUtils.cp_r @working_dir + '/.ios/Flutter/engine/Flutter.framework', flutter_spec_dir
86
+ FileUtils.cp_r @working_dir + '/.ios/Flutter/App.framework', flutter_spec_dir
87
+
88
+ plugins = fetch_plugins
89
+ plugins.append Plugins.new('Flutter',flutter_spec_file,flutter_spec)
90
+ plugins.append Plugins.new('FlutterPluginRegistrant',plugin_registrant_spec_file, Pod::Spec.from_file(plugin_registrant_spec_file))
91
+
92
+ plugins
93
+ end
94
+
62
95
  private
63
96
 
64
97
  def release
@@ -146,6 +179,13 @@ class Archiver
146
179
  end
147
180
  end
148
181
 
182
+ def build_app(mode)
183
+ if CommandRunner.run(@flutter_wrapper, 'build','ios',"--#{mode}" ,"--no-codesign") == false
184
+ # FileUtils.remove_dir product_dir, true
185
+ raise "run build_runner fail"
186
+ end
187
+ end
188
+
149
189
  def fetch_plugins
150
190
  results = []
151
191
  flutter_plugins_list = @working_dir + '/.flutter-plugins'
@@ -297,6 +337,7 @@ end
297
337
  sdk_download_url = remote.download_url "Flutter", @flutter_version, mode.downcase
298
338
  app_download_url = remote.download_url @module_name, @version, mode.downcase
299
339
  spec = Pod::Spec.new do |s|
340
+ s.swift_version = '5.0'
300
341
  s.name = "#{@module_name}_#{mode.downcase}"
301
342
  s.version = @version
302
343
  s.summary = @module_name
@@ -0,0 +1,42 @@
1
+
2
+ def update_flutter_app_debug(path, url, ref)
3
+ if !File.exist?(path)
4
+ `git clone #{url} #{path}`
5
+ `cd #{path} && git fetch --all -v && \
6
+ git reset --hard origin/master && \
7
+ git pull && \
8
+ git checkout #{ref} && \
9
+ cd #{path} && \
10
+ sh build_ios.sh -m release`
11
+ end
12
+ puts "Flutter project is already existed, remove '.flutter' folder and `pod install` again the flutter project will be rebuilded with new code."
13
+ end
14
+
15
+ def install_debug_flutter_app(url, ref)
16
+
17
+ puts "Compiling☕️️️️️☕️☕️\n"
18
+
19
+ flutter_application_path = __dir__ + "/.flutter"
20
+ flutter_application_url = ""
21
+ flutter_application_branch = 'master'
22
+
23
+ if url != nil
24
+ flutter_application_url = url
25
+ if ref != nil
26
+ flutter_application_branch = ref
27
+ end
28
+ else
29
+ raise "Error: 请在'Podfile'里增加Flutter App git地址配置,配置格式请查看'flutterhelper.rb'文件"
30
+ end
31
+
32
+ update_flutter_app_debug(flutter_application_path, flutter_application_url, flutter_application_branch)
33
+
34
+ if $?.to_i == 0
35
+
36
+ flutter_package_path = "#{flutter_application_path}/.build_ios/product"
37
+ # 开始安装
38
+ install_release_flutter_app_pod(flutter_package_path)
39
+ else
40
+ raise "Error: 编译 Flutter App失败"
41
+ end
42
+ end
@@ -1,6 +1,7 @@
1
1
  require 'digest'
2
2
  require 'open-uri'
3
3
  require 'json'
4
+ require 'cocoapods-flutter/native/archive/archive'
4
5
 
5
6
  module Pod
6
7
  class Podfile
@@ -14,22 +15,59 @@ module Pod
14
15
  unless name
15
16
  raise StandardError, 'A dependency requires a name.'
16
17
  end
17
-
18
+ # {
19
+ # :git => {
20
+ # :url => '',
21
+ # :ref => '',
22
+ # :wrapper => 'flutterw'
23
+ # }
24
+ # }
18
25
  flutter_project_name = name
19
26
  flutter_project_mode = parse_key(:mode, requirements)
20
27
  flutter_project_path = parse_key(:path, requirements)
28
+ flutter_project_repo = parse_key(:git, requirements)
29
+ flutter_project_repo_url = flutter_project_repo[:url]
30
+ flutter_project_repo_ref = flutter_project_repo[:ref]
31
+ flutter_command_wrapper = flutter_project_repo[:wrapper]
21
32
  flutter_project_version = parse_version requirements
22
33
  if flutter_project_mode.nil?
23
34
  flutter_project_mode = "release"
24
35
  end
25
36
 
26
37
  unless flutter_project_path.nil?
27
- UI.info "Using local flutter project.."
38
+ UI.info "Using local flutter project..."
28
39
  load File.join(flutter_project_path, '.ios', 'Flutter', 'podhelper.rb')
29
40
  install_all_flutter_pods flutter_project_path
30
41
  return
31
42
  end
32
43
 
44
+ unless flutter_project_repo.nil?
45
+ UI.info "Using git source..."
46
+ if flutter_project_repo_ref.nil?
47
+ flutter_project_repo_ref = 'master'
48
+ end
49
+
50
+ if flutter_command_wrapper.nil?
51
+ flutter_command_wrapper = 'flutter'
52
+ end
53
+
54
+ flutter_application_path = Dir.pwd + + "/.flutter"
55
+
56
+ CommandRunner.run 'git', 'clone', flutter_project_repo_url, flutter_application_path
57
+ Dir.chdir flutter_application_path do |dir|
58
+ CommandRunner.run 'git', 'fetch', '--all', '-v'
59
+ CommandRunner.run 'git', 'reset', '--hard', 'origin/master'
60
+ CommandRunner.run 'git', 'pull'
61
+ CommandRunner.run 'git', 'checkout', flutter_project_repo_ref
62
+ archiver = Archiver.new(flutter_project_name,flutter_project_version,sources,flutter_command_wrapper,true ,"",true ,dir, "")
63
+ pods = archiver.make_flutter_pods flutter_project_mode
64
+ pods.each do |p|
65
+ pod p.name, :path => p.path
66
+ end
67
+ end
68
+ return
69
+ end
70
+
33
71
  pod "#{flutter_project_name}_#{flutter_project_mode}", flutter_project_version
34
72
 
35
73
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-flutter-dt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - "\bDreamtracer"
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-05 00:00:00.000000000 Z
11
+ date: 2020-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel
@@ -131,6 +131,7 @@ files:
131
131
  - lib/cocoapods-flutter/native/archive/command_runner.rb
132
132
  - lib/cocoapods-flutter/native/archive/remote.rb
133
133
  - lib/cocoapods-flutter/native/archive/zip_tool.rb
134
+ - lib/cocoapods-flutter/native/flutterhelper.rb
134
135
  - lib/cocoapods-flutter/native/pod_source_preparer.rb
135
136
  - lib/cocoapods-flutter/native/podfile.rb
136
137
  - lib/cocoapods-flutter/native/specification/consumer.rb