cocoapods-taobao-environment 1.0.0.3 → 1.0.1.1

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
  SHA1:
3
- metadata.gz: f1bb1dadb505f13c9ce8a3fc2246b6ed4454b54d
4
- data.tar.gz: 44fb048eab17e4989dd2a33595755cc5fd2cb1ad
3
+ metadata.gz: 776b22d090bba7003581ab62dc4567e59ba0e59e
4
+ data.tar.gz: 99a06635d3338e2c2d23bb09353f665a801982a4
5
5
  SHA512:
6
- metadata.gz: d0e26f214f39ef8f91a5e48eb888086631ac959c492fb6c7f23ab56acf35bcbfded63b3fab74cd77d2415f8865e9624a47e6b609f5978a964409fe5a687b7dba
7
- data.tar.gz: 0b25f6d731c25804827f886026ecca388feae01d5adefe6f9cc543861d291735c901fe5a0c747251d26134e616f88c52c999cfb4593479de45f522e24635356f
6
+ metadata.gz: 96ef690481f2542c016e6b0c6edd9df39ad9b50d83a5b336f4500f6be800310babaa00ab7edb8b14457c8ba6245893d84e110e3632c0a74c4f9d8e71f95c0fd0
7
+ data.tar.gz: 6307193ec1e06351fc6fdce81c00fd567b6d54a49b0facf7df0e545941e0a355422e6f2709ab198b65283faf329b654b1b2ce29154c61e6449ac7d8cb4e1d32c
data/README.md CHANGED
@@ -15,7 +15,7 @@
15
15
 
16
16
  ## Installation
17
17
 
18
- 该项目不再提供独立安装方式,已集成到 TaobaoEnv 项目中,如需使用,请访问 http://gitlab.alibaba-inc.com/wireless/package-taobao-environment
18
+ 该项目不再提供独立安装方式,已集成到 TaobaoEnv 项目中,如需使用,请访问 http://gitlab.alibaba-inc.com/PodEnv/package-taobao-environment
19
19
 
20
20
  ## Usage
21
21
 
@@ -2,16 +2,22 @@ require "cocoapods/taobao/environment/version"
2
2
 
3
3
  if PodVersion(">= 0.39")
4
4
  require "cocoapods/taobao/environment/alibaba_source.rb"
5
- require "cocoapods/taobao/environment/integrate_copy_framework_resouces_script.rb"
6
- require "cocoapods/taobao/environment/cocoapods_sync_dependencies.rb"
7
5
  require "cocoapods/taobao/environment/inhibit_pod_warning.rb"
8
6
  require "cocoapods/taobao/environment/dynamic_dependency_for_ios_7.rb"
9
7
  require "cocoapods/taobao/environment/fix_dependency_conflict.rb"
8
+ require "cocoapods/taobao/environment/fix_ruby_2.3.x_support.rb"
9
+ require "cocoapods/taobao/environment/exclude_other_ld_flags.rb"
10
+ require "cocoapods/taobao/environment/cocoapods_sync_dependencies.rb"
11
+ require "cocoapods/taobao/environment/fix_framework_search_path_0.39.rb"
10
12
  if PodVersion("~> 1.0")
11
- require "cocoapods/taobao/environment/fix_framework_search_path_1.0.rb"
12
13
  require "cocoapods/taobao/environment/deintegrate_pods_for_framework_1.0.rb"
13
14
  else
14
- require "cocoapods/taobao/environment/fix_framework_search_path_0.39.rb"
15
15
  require "cocoapods/taobao/environment/deintegrate_pods_for_framework_0.39.rb"
16
16
  end
17
+
18
+ if PodVersion(">= 1.1")
19
+ require "cocoapods/taobao/environment/integrate_copy_framework_resouces_script_1.1.rb"
20
+ else
21
+ require "cocoapods/taobao/environment/integrate_copy_framework_resouces_script.rb"
22
+ end
17
23
  end
@@ -39,7 +39,7 @@ def solve_podfile(file_path)
39
39
  json
40
40
  end
41
41
 
42
- def solve_dependency(file_path)
42
+ def main_dependencies(file_path)
43
43
  return unless File.exists?(file_path)
44
44
 
45
45
  if $config[:fileName].include?("json")
@@ -66,7 +66,7 @@ def download_dependencies(file_path)
66
66
  require 'net/http'
67
67
  require 'open-uri'
68
68
  url = "#{$config[:gitlab]}/api/v3/projects/#{$config[:projectId]}/repository/blobs/#{$config[:branch]}?filepath=#{$config[:fileName]}&private_token=#{$config[:token]}"
69
- Pod::UI.message "正在下载主工程最新依赖..."
69
+ Pod::UI.info "正在下载主工程最新依赖..."
70
70
  url = URI.parse(url)
71
71
  req = Net::HTTP::Get.new(url.to_s)
72
72
  res = Net::HTTP.start(url.host, url.port) { |http|
@@ -90,7 +90,7 @@ def save_cache(data, file_path)
90
90
  require 'fileutils'
91
91
  FileUtils.rm_rf(File.dirname(file_path))
92
92
  FileUtils::mkdir_p(File.dirname(file_path))
93
- Pod::UI.info "缓存路径-> #{relative_path(file_path)}"
93
+ Pod::UI.info "缓存路径 => #{relative_path(file_path)}"
94
94
  File.open(file_path,"w") do |f|
95
95
  f.write(data)
96
96
  end
@@ -129,6 +129,7 @@ def init_config
129
129
  :configFileName => "config.json",
130
130
  :projectPath => Dir.pwd,
131
131
  :exclude => nil,
132
+ :syncMode => "",
132
133
  :configurations => ["Debug", "Release"],
133
134
  :token => ENV["ALIBABA_GITLAB_PRIVATE_TOKEN"]
134
135
  }
@@ -150,6 +151,48 @@ def prepare_config(config)
150
151
  $config.merge!(config)
151
152
  end
152
153
 
154
+ #分析当前target最终需要的依赖信息
155
+ def solve_dependenies(mainDepds)
156
+ depds = {}
157
+ if PodVersion('~> 0.39')
158
+ current_depds = current_target_definition.pods.collect
159
+ else
160
+ current_depds = current_target_definition.pods.map
161
+ end
162
+
163
+ # current_depds.each { |depd| Pod::UI.info "当前依赖 #{depd}"}
164
+ if $config[:syncMode].include?("declared")
165
+ Pod::UI.info "同步模式 => 已声明的依赖同步主工程对应依赖"
166
+ current_depds.each do |depd|
167
+ if depd.class == String
168
+ depds["#{depd}"] = mainDepds["#{depd}"]
169
+ end
170
+ end
171
+ else
172
+ Pod::UI.info "同步模式 => 未声明的依赖同步主工程所有依赖"
173
+ depds = mainDepds
174
+ #remove exclude dependency
175
+ exclude = $config[:exclude]
176
+ excludes = []
177
+ excludes += exclude if exclude.class == Array
178
+ excludes << exclude if exclude.class == String
179
+ excludes.each {|exc| depds.delete(exc)}
180
+
181
+ #remove declare dependency
182
+ current_depds.each do |depd|
183
+ if depd.class == String
184
+ name = depd
185
+ elsif depd.class == Hash
186
+ name = depd.keys[0]
187
+ else
188
+ name = depd.name
189
+ end
190
+ depds.delete(name)
191
+ end
192
+ end
193
+ depds
194
+ end
195
+
153
196
  # public method
154
197
  def cocoapods_sync_dependencies(config)
155
198
  prepare_config(config)
@@ -158,26 +201,18 @@ def cocoapods_sync_dependencies(config)
158
201
  $config[:branch] = CGI.escape($config[:branch]).gsub(".", "%2E")
159
202
 
160
203
  download_dependencies(cache_path)
161
- json = solve_dependency(cache_path)
162
-
163
- exclude = $config[:exclude]
164
- if PodVersion('~> 0.39')
165
- excludes = current_target_definition.pods.collect { |pod| pod.class == String ? pod : pod.keys[0]}
166
- else
167
- excludes = current_target_definition.pods.map {|pod| pod.name }
168
- end
169
- excludes += exclude if exclude.class == Array
170
- excludes << exclude if exclude.class == String
171
- excludes.each {|exc| json["dependencies"].delete(exc)}
204
+ main_dependencies = main_dependencies(cache_path)
172
205
 
173
- json["dependencies"].to_a.each do |key, value|
206
+ real_depds = solve_dependenies(main_dependencies["dependencies"])
207
+ real_depds.to_a.each do |key, value|
208
+ # Pod::UI.info "pod '#{key}','#{value}'"
174
209
  pod(key, value)
175
210
  end
176
211
 
177
212
  configurations = []
178
213
  configurations << $config[:configurations] if $config[:configurations].class == String
179
214
  configurations += $config[:configurations] if $config[:configurations].class == Array
180
- json["configurations"].to_a.each do |config, pods|
215
+ main_dependencies["configurations"].to_a.each do |config, pods|
181
216
  next if configurations.count > 0 && !configurations.include?(config)
182
217
  pods.each do |name|
183
218
  current_target_definition.whitelist_pod_for_configuration(name, config)
@@ -1,3 +1,21 @@
1
+ $disable_link_dynamic_framework = false
2
+
3
+ $link_dynamic_framework_list = []
4
+ def link_dynamic_frameworks(config)
5
+ $link_dynamic_framework_list += config if config.class == Array
6
+ $link_dynamic_framework_list << config if config.class == String
7
+ end
8
+
9
+ module Pod
10
+ class Podfile
11
+ module DSL
12
+ def disable_link_dynamic_framework!
13
+ $disable_link_dynamic_framework = true
14
+ end
15
+ end
16
+ end
17
+ end
18
+
1
19
  module Pod
2
20
  module Generator
3
21
  module XCConfig
@@ -9,17 +27,33 @@ module Pod
9
27
  def self.add_dynamic_dependency_build_settings(target, xcconfig)
10
28
  # 如果目标平台是7.0,则不添加 -framewok xxx 到 xcconfig
11
29
  if target.platform.supports_dynamic_frameworks?
12
- old(target, xcconfig)
30
+ # 如果目标平台支持动态库,但此时设置了 disable_link_dynamic_framework! 也不添加 -framework
31
+ if $disable_link_dynamic_framework
32
+ target.file_accessors.each do |file_accessor|
33
+ if file_accessor.vendored_dynamic_frameworks.count > 0
34
+ # 如果主动设置了一些要 link 的库
35
+ if $link_dynamic_framework_list.include? target.name
36
+ old(target, xcconfig)
37
+ else
38
+ puts "-framework #{target.name} is excluded from OTHER_LDFLAGS"
39
+ end
40
+ end
41
+ end
42
+ else
43
+ old(target, xcconfig)
44
+ end
13
45
  else
14
46
  target.file_accessors.each do |file_accessor|
15
- if file_accessor.vendored_dynamic_frameworks.count >0
16
- # 输出到日志里,方便查看
17
- puts "-framework #{target.name} is excluded from OTHER_LDFLAGS"
47
+ if file_accessor.vendored_dynamic_frameworks.count > 0
48
+ if $disable_link_dynamic_framework and $link_dynamic_framework_list.include? target.name
49
+ old(target, xcconfig)
50
+ else
51
+ puts "-framework #{target.name} is excluded from OTHER_LDFLAGS"
52
+ end
18
53
  end
19
54
  end
20
55
  end
21
56
  end
22
-
23
57
  end
24
58
  end
25
59
  end
@@ -0,0 +1,21 @@
1
+ $other_ld_flags_excludes = []
2
+ def exclude_other_ld_flags(config)
3
+ $other_ld_flags_excludes += config if config.class == Array
4
+ $other_ld_flags_excludes << config if config.class == String
5
+ end
6
+
7
+ module Pod
8
+ module Generator
9
+ module XCConfig
10
+ class AggregateXCConfig
11
+ alias_method :old_generate_other_ld_flags, :generate_other_ld_flags
12
+ def generate_other_ld_flags
13
+ old_generate_other_ld_flags
14
+ $other_ld_flags_excludes.each do |e|
15
+ @xcconfig.libraries.delete(e)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,11 @@
1
+ module Pod
2
+ class Specification
3
+ class Set
4
+ class LazySpecification < BasicObject
5
+ def respond_to_missing?(method, include_all = false)
6
+ specification.respond_to?(method, include_all)
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,56 @@
1
+ module Pod
2
+ class AggregateTarget < Target
3
+ # @return [Pathname] The absolute path of the copy framewrok resources script.
4
+ #
5
+ def copy_framework_resources_script_path
6
+ support_files_dir + "copy-framework-resources.rb"
7
+ end
8
+
9
+ # @return [String] The path of the copy framework resources script relative to the
10
+ # root of the user project.
11
+ #
12
+ def copy_framework_resources_script_relative_path
13
+ "${SRCROOT}/#{relative_to_srcroot(copy_framework_resources_script_path)}"
14
+ end
15
+ end
16
+ end
17
+
18
+ module Pod
19
+ class Installer
20
+ class Xcode
21
+ class PodsProjectGenerator
22
+ class AggregateTargetInstaller < TargetInstaller
23
+ alias_method :old_create_copy_resources_script, :create_copy_resources_script
24
+ def create_copy_resources_script
25
+ old_create_copy_resources_script
26
+ path = target.copy_framework_resources_script_path
27
+ script_path = File.expand_path('../../../../../XCodeScript/CopyFrameworkResources/copy-framework-resources.rb', __FILE__)
28
+ FileUtils.cp(script_path, path)
29
+ add_file_to_support_group(path)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ module Pod
38
+ class Installer
39
+ class UserProjectIntegrator
40
+ class TargetIntegrator
41
+ alias_method :old_add_copy_resources_script_phase, :add_copy_resources_script_phase
42
+ def add_copy_resources_script_phase
43
+ old_add_copy_resources_script_phase
44
+ phase_name = 'Copy Framework Resources'
45
+ targets = PodVersion("~>1.0") ? native_targets : native_targets_to_integrate
46
+ targets = targets.select { |t| EMBED_FRAMEWORK_TARGET_TYPES.include?(t.symbol_type) }
47
+ targets.each do |native_target|
48
+ phase = create_or_update_build_phase(native_target, phase_name)
49
+ script_path = target.copy_framework_resources_script_relative_path
50
+ phase.shell_script = %(bash -l -c "ruby \\"#{script_path}\\"")
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -1,7 +1,7 @@
1
1
  module Cocoapods
2
2
  module Taobao
3
3
  module Environment
4
- VERSION = "1.0.0.3"
4
+ VERSION = "1.0.1.1"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-taobao-environment
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.3
4
+ version: 1.0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - 梅忘
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-24 00:00:00.000000000 Z
11
+ date: 2016-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -73,11 +73,14 @@ files:
73
73
  - lib/cocoapods/taobao/environment/deintegrate_pods_for_framework_0.39.rb
74
74
  - lib/cocoapods/taobao/environment/deintegrate_pods_for_framework_1.0.rb
75
75
  - lib/cocoapods/taobao/environment/dynamic_dependency_for_ios_7.rb
76
+ - lib/cocoapods/taobao/environment/exclude_other_ld_flags.rb
76
77
  - lib/cocoapods/taobao/environment/fix_dependency_conflict.rb
77
78
  - lib/cocoapods/taobao/environment/fix_framework_search_path_0.39.rb
78
79
  - lib/cocoapods/taobao/environment/fix_framework_search_path_1.0.rb
80
+ - lib/cocoapods/taobao/environment/fix_ruby_2.3.x_support.rb
79
81
  - lib/cocoapods/taobao/environment/inhibit_pod_warning.rb
80
82
  - lib/cocoapods/taobao/environment/integrate_copy_framework_resouces_script.rb
83
+ - lib/cocoapods/taobao/environment/integrate_copy_framework_resouces_script_1.1.rb
81
84
  - lib/cocoapods/taobao/environment/version.rb
82
85
  - lib/cocoapods_plugin.rb
83
86
  homepage: ''