cocoapods-packager-ext 0.0.11 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 975c1587853affa9927f595278b2f4a14dbe1c043994dbffff6e79394d4f9519
4
- data.tar.gz: d11655a9c1fd7dadaf3dd5bdb154b1b014aa7e20c2bde9cbe82bc2bf1d9dd2c2
3
+ metadata.gz: 9d1533e3a81379cabda6ffb6cf8a0ec7ac1e044d42af7f41e94344cd480bd38f
4
+ data.tar.gz: 53da1e28b909db61fa9cdabf3cb242307d2eea126da42dd0381ce481c2e07bea
5
5
  SHA512:
6
- metadata.gz: f8694a1df3a49c9b61d084694137626f95315cd1a42fc3d0a5b1587628c042d51d39f54741be2e9010ed145a2e82d475aea02153bc84ded6f51eb77735db1c3d
7
- data.tar.gz: 525356691709d4ca1be7ec7d8d464c417d0d15dea6f4dcb9d27e17fc17d89c074eb26ee433e33f8a09ace24a53671f831d1e304b08705dfaed2bbdb28f8a7f7c
6
+ metadata.gz: 4ba30867ac2e65c3e0540e9897cbcf06306493786233333b8a90c5ca593c277f7bec718b054c47bd68f79417da06a600a15e46a880280d4905885b5516c74093
7
+ data.tar.gz: 247481474b4035c2c7bbe819edf2080e05f9af133a0c4fea4800b880eb34b44031582290ef0d22e018487e0a37d3ce2f87eca052f891ae42ae856ce9a7880f4e
@@ -20,5 +20,6 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency 'bundler', '~> 1.3'
22
22
  spec.add_development_dependency 'rake'
23
- spec.add_development_dependency 'cocoapods-packager'
23
+ spec.add_runtime_dependency(%q<cocoapods-packager>.freeze,["1.5.1"])
24
+
24
25
  end
@@ -6,6 +6,7 @@ module Pod
6
6
  if @dry_deps
7
7
  prepare
8
8
  resolve_dependencies
9
+ exit 0
9
10
  else
10
11
  install_t!
11
12
  end
@@ -32,25 +33,46 @@ module Pod
32
33
  # @todo Create a PR to add your plugin to CocoaPods/cocoapods.org
33
34
  # in the `plugins.json` file, once your plugin is released.
34
35
  #
36
+ module ClassMethods
37
+ def options
38
+ options = [
39
+ ['--dry-deps','only test depend'],
40
+ ]
41
+ options.concat(super)
42
+ end
43
+ end
35
44
  class Install
45
+
36
46
  def self.options
37
47
  [
38
48
  ['--repo-update', 'Force running `pod repo update` before install'],
39
49
  ['--deployment', 'Disallow any changes to the Podfile or the Podfile.lock during installation'],
40
- ['--clean-install', 'Ignore the contents of the project cache and force a full pod installation. This only ' \
41
- 'applies to projects that have enabled incremental installation'],
50
+ ['--clean-install', 'Ignore the contents of the project cache and force a full pod installation. This only applies to projects that have enabled incremental installation.'],
42
51
  ['--dry-deps','only test depend'],
43
52
  ].concat(super).reject { |(name, _)| name == '--no-repo-update' }
44
53
  end
54
+
55
+ # class << self
56
+ # options_t = instance_method(:options)
57
+ # # alias options_t options
58
+ # define_method(:options) do
59
+ # item = options_t.bind(self).call()
60
+ #
61
+ # [
62
+ # ['--dry-deps','only test depend'],
63
+ # ].concat(item)
64
+ # end
65
+ # end
45
66
  # class << self
46
67
  # alias options_t options
47
68
  # def options
48
- # o = options_t
49
- # o.push(['--dry-deps','only test depend'])
50
- # o.concat(super)
69
+ # o = options_t
70
+ # o.push(['--dry-deps','only test depend'])
71
+ # o.concat(super)
51
72
  # end
52
73
  #
53
74
  # end
75
+
54
76
  def initialize(argv)
55
77
  super
56
78
  @deployment = argv.flag?('deployment', false)
@@ -58,34 +80,16 @@ module Pod
58
80
  @dry_deps = argv.flag?('dry-deps',false)
59
81
  end
60
82
 
61
- # alias run_t run
62
- # def run
63
- # if @dry_deps
64
- # verify_podfile_exists!
65
- # installer = installer_for_config
66
- # installer.repo_update = repo_update?(:default => false)
67
- # installer.update = false
68
- # installer.deployment = @deployment
69
- # installer.clean_install = @clean_install
70
- # installer.dry_deps = @dry_deps
71
- # installer.install!
72
- # else
73
- # run_t
74
- # end
75
- # end
76
- def run
77
- verify_podfile_exists!
78
- installer = installer_for_config
79
- installer.repo_update = repo_update?(:default => false)
80
- installer.update = false
81
- installer.deployment = @deployment
82
- installer.clean_install = @clean_install
83
+ alias installer_for_config_t installer_for_config
84
+ def installer_for_config
85
+ item = installer_for_config_t
83
86
  if @dry_deps
84
- installer.dry_deps = @dry_deps
87
+ item.dry_deps = @dry_deps
85
88
  end
86
- installer.install!
89
+ item
87
90
  end
88
91
 
92
+
89
93
  end
90
94
  end
91
95
  end
@@ -1,3 +1,7 @@
1
+ require 'cocoapods-packager-ext/ext/downloader/lnpath'
2
+ require 'cocoapods-packager-ext/ext/downloader_ext'
3
+ require 'cocoapods-packager-ext/ext/pod_utils'
4
+
1
5
  module Pod
2
6
  class Command
3
7
  # This is an example of a cocoapods plugin adding a top-level subcommand
@@ -19,29 +23,85 @@ module Pod
19
23
  #
20
24
  class Package
21
25
  class << self
22
- alias options_t options
23
- def options
24
- o = options_t
25
- o.push(['--all-deps','add all-depends'])
26
- o.push(['--archs','select archs'])
27
- o.push(['--black-deps','select exclude deps'])
28
- o.concat(super)
26
+
27
+ begin
28
+ alias options_t options
29
+ def options
30
+ o = options_t
31
+ o.push(['--archs','select archs'])
32
+ o.push(['--podfile','select deps version from podfile'])
33
+ o.push(['--platform','select platform'])
34
+ o.concat(super)
35
+ end
36
+ rescue
37
+ return
29
38
  end
39
+
30
40
 
31
41
  end
32
42
 
33
43
  alias initialize_t initialize
34
44
  def initialize(argv)
35
- @all_deps = argv.flag?('all-deps',false)
45
+ @exclude_dep_items = argv.option('exclude-deps','').split(',')
36
46
  @select_archs = argv.option('archs','').split(',')
37
- @black_deps = argv.option('black-deps','').split(',')
47
+ @podfile = argv.option('podfile','')
48
+ @platform = argv.option('platform','')
38
49
  initialize_t argv
39
50
  end
40
51
 
52
+ alias build_in_sandbox_t build_in_sandbox
53
+ def build_in_sandbox(platform)
54
+ config.installation_root = Pathname.new(Dir.pwd)
55
+ config.sandbox_root = 'Pods'
56
+
57
+ static_sandbox = build_static_sandbox(@dynamic)
58
+ static_installer = install_pod(platform.name, static_sandbox)
59
+
60
+ if @dynamic
61
+ dynamic_sandbox = build_dynamic_sandbox(static_sandbox, static_installer)
62
+ install_dynamic_pod(dynamic_sandbox, static_sandbox, static_installer, platform)
63
+ end
64
+
65
+ begin
66
+ perform_build(platform, static_sandbox, dynamic_sandbox, static_installer)
67
+ ensure # in case the build fails; see Builder#xcodebuild.
68
+ if ENV['ENABLE_BACKUP_WORKSPACE']
69
+ target_dir = "#{@source_dir}/#{@spec.name}-#{@spec.version}/workspace_#{platform}"
70
+ Dir.mkdir target_dir
71
+ `mv "#{Dir.pwd}" "#{target_dir}"`
72
+ end
73
+ Pathname.new(config.sandbox_root).rmtree
74
+ FileUtils.rm_f('Podfile.lock')
75
+ end
76
+ end
77
+
78
+ alias build_package_t build_package
79
+ def build_package
80
+ if @platform == ''
81
+ build_package_t
82
+ else
83
+ builder = SpecBuilder.new(@spec, @source, @embedded, @dynamic)
84
+ newspec = builder.spec_metadata
85
+
86
+ @spec.available_platforms.each do |platform|
87
+ if @platform.include?(platform.name.to_s)
88
+ UI.puts 'build package platform:'+platform.name.to_s
89
+ build_in_sandbox(platform)
90
+ newspec += builder.spec_platform(platform)
91
+ else
92
+ UI.puts 'jump build platforms:'+platform.to_s
93
+ end
94
+ end
95
+
96
+ newspec += builder.spec_close
97
+ File.open(@spec.name + '.podspec', 'w') { |file| file.write(newspec) }
98
+ end
99
+
100
+ end
41
101
 
42
102
  alias perform_build_t perform_build
43
- def perform_build(platform, static_sandbox, dynamic_sandbox)
44
- if @all_deps
103
+ def perform_build(platform, static_sandbox, dynamic_sandbox,static_installer)
104
+ if @select_archs.length > 0 || @exclude_dep_items.length > 0
45
105
  static_sandbox_root = config.sandbox_root.to_s
46
106
 
47
107
  if @dynamic
@@ -50,28 +110,29 @@ module Pod
50
110
  end
51
111
 
52
112
  builder = Pod::Builder.new(
53
- @source_dir,
54
- static_sandbox_root,
55
- dynamic_sandbox_root,
56
- static_sandbox.public_headers.root,
57
- @spec,
58
- @embedded,
59
- @mangle,
60
- @dynamic,
61
- @config,
62
- @bundle_identifier,
63
- @exclude_deps,
64
- @all_deps,
65
- @black_deps,
66
- @select_archs
113
+ platform,
114
+ static_installer,
115
+ @source_dir,
116
+ static_sandbox_root,
117
+ dynamic_sandbox_root,
118
+ static_sandbox.public_headers.root,
119
+ @spec,
120
+ @embedded,
121
+ @mangle,
122
+ @dynamic,
123
+ @config,
124
+ @bundle_identifier,
125
+ @exclude_deps,
126
+ @exclude_dep_items,
127
+ @select_archs
67
128
  )
68
129
 
69
- builder.build(platform, @library)
130
+ builder.build(@package_type)
70
131
 
71
132
  return unless @embedded
72
133
  builder.link_embedded_resources
73
134
  else
74
- perform_build_t(platform,static_sandbox,dynamic_sandbox)
135
+ perform_build_t(platform,static_sandbox,dynamic_sandbox,static_installer)
75
136
  end
76
137
  end
77
138
 
@@ -2,104 +2,185 @@ require "fileutils"
2
2
 
3
3
  module Pod
4
4
  class Builder
5
-
6
- def deal_target(path)
7
- for item in @target_type_ext
8
- if File.extname(path) == item
9
- isBlack = false
10
- for black in @black_deps
11
- if File.basename(path).include? black
12
- isBlack = true
13
- end
14
- end
15
- if isBlack
16
- return
17
- end
18
- if File.directory? path
19
- FileUtils.copy_entry(path,"#{@target_dir_ext_ext}/#{File.basename(path)}", false,false, true)
20
- else
21
- FileUtils.cp(path,"#{@target_dir_ext_ext}/#{File.basename(path)}")
22
- end
23
- return
24
- end
25
- end
26
- if File.directory? path
27
- is_black = false
28
- for black in @black_list_ext
29
- if black == path
30
- is_black = true
31
- break
32
- end
33
- end
34
- if is_black
35
- return
36
- end
37
- Dir.foreach(path) do |file|
38
- if file != '.' && file != '..'
39
- deal_target(path+'/'+file)
40
- end
5
+
6
+ alias build_static_library_for_ios_t build_static_library_for_ios
7
+ def build_static_library_for_ios(output)
8
+ if @exclude_dep_items.length > 0
9
+ static_libs = static_libs_in_sandbox('build') + static_libs_in_sandbox('build-sim') + vendored_libraries
10
+ static_libs.reject! {|lib| @exclude_dep_items.any? {|item| lib.to_s.include? item}}
11
+ libs = ios_architectures.map do |arch|
12
+ library = "#{@static_sandbox_root}/build/package-#{arch}.a"
13
+ `libtool -arch_only #{arch} -static -o #{library} #{static_libs.join(' ')}`
14
+ library
41
15
  end
16
+
17
+ `lipo -create -output #{output} #{libs.join(' ')}`
42
18
 
19
+ # static_libs = static_libs_in_sandbox('build')
20
+ # sim_libs = static_libs_in_sandbox('build-sim')
21
+ # for item in @black_deps
22
+ # static_libs.delete_if do |obj|
23
+ # obj.include? item
24
+ # end
25
+ # sim_libs.delete_if do |obj|
26
+ # obj.include? item
27
+ # end
28
+ # end
29
+ # UI.puts "links statics:#{static_libs.join(' ')}, sim_libs:#{sim_libs.join(' ')}"
30
+ # `xcrun -r libtool -no_warning_for_no_symbols -static -o #{output} #{static_libs.join(' ')} #{sim_libs.join(' ')}`
31
+ else
32
+ build_static_library_for_ios_t output
43
33
  end
44
34
  end
45
35
 
46
- alias build_library_t build_library
47
- def build_library(platform, defines, output)
48
- deal_target(@static_sandbox_root)
49
-
50
36
 
51
- build_library_t platform,defines,output
37
+ alias static_linker_flags_in_sandbox_t ios_architectures
38
+ def static_linker_flags_in_sandbox
39
+ static_libs = static_libs_in_sandbox('build') + static_libs_in_sandbox('build-sim') + vendored_libraries
40
+ linker_flags = static_libs.map do |lib|
41
+ lib = lib.chomp('.a').split('/').last
42
+ lib.slice!('lib')
43
+ "-l#{lib}"
44
+ end
45
+ linker_flags.reject { |e| e == "-l#{@spec.name}" || e == '-lPods-packager' }
52
46
  end
53
47
 
54
- alias ios_build_options_t ios_build_options
55
48
  def ios_build_options
49
+ if ENV['DISABLE_BITCODE']
50
+ "ARCHS=\'#{ios_architectures.join(' ')}\' OTHER_CFLAGS=\'-Qunused-arguments\'"
51
+ else
52
+ "ARCHS=\'#{ios_architectures.join(' ')}\' OTHER_CFLAGS=\'-fembed-bitcode -Qunused-arguments\'"
53
+ end
54
+ end
55
+
56
+ def static_linker_defines
57
+ static_libs = static_libs_in_sandbox('build') + static_libs_in_sandbox('build-sim')
58
+ static_libs = static_libs.map { |path| Pathname("#{Dir.pwd}/#{path}").parent.to_s }
59
+ vendored_libs = vendored_libraries.map { |path| Pathname(path).parent.to_s }
60
+ link_paths = static_libs + vendored_libs
61
+ link_paths.uniq.join(" ")
62
+ end
63
+ alias build_dynamic_framework_for_ios_t build_dynamic_framework_for_ios
64
+ def build_dynamic_framework_for_ios(defines, output)
65
+ # Specify frameworks to link and search paths
66
+ linker_flags = static_linker_flags_in_sandbox
67
+ defines = "#{defines} OTHER_LDFLAGS='$(inherited) #{linker_flags.join(' ')}'"
68
+
69
+ # Build Target Dynamic Framework for both device and Simulator
70
+ device_defines = "#{defines} LIBRARY_SEARCH_PATHS=\"#{static_linker_defines}\""
71
+ device_options = ios_build_options << ' -sdk iphoneos'
72
+ xcodebuild(device_defines, device_options, 'build', @spec.name.to_s, @dynamic_sandbox_root.to_s)
73
+ if @select_archs.size == 0 || @select_archs.include?('i386') || @select_archs.include?('x86_64')
74
+ sim_defines = "#{defines} LIBRARY_SEARCH_PATHS=\"#{Dir.pwd}/#{@static_sandbox_root}/build-sim\" ONLY_ACTIVE_ARCH=NO"
75
+ xcodebuild(sim_defines, '-sdk iphonesimulator', 'build-sim', @spec.name.to_s, @dynamic_sandbox_root.to_s)
76
+ # Combine architectures
77
+ `lipo #{@dynamic_sandbox_root}/build/#{@spec.name}.framework/#{@spec.name} #{@dynamic_sandbox_root}/build-sim/#{@spec.name}.framework/#{@spec.name} -create -output #{output}`
78
+ else
79
+ `mv #{@dynamic_sandbox_root}/build/#{@spec.name}.framework/#{@spec.name} #{output}`
80
+ end
81
+
82
+ FileUtils.mkdir(@platform.name.to_s)
83
+ `mv #{@dynamic_sandbox_root}/build/#{@spec.name}.framework #{@platform.name}`
84
+ `mv #{@dynamic_sandbox_root}/build/#{@spec.name}.framework.dSYM #{@platform.name}`
85
+ end
86
+
87
+ alias ios_architectures_t ios_architectures
88
+ def ios_architectures
56
89
  if @select_archs.size != 0
57
- return "ARCHS=\'#{@select_archs.join(' ')}\' OTHER_CFLAGS=\'-fembed-bitcode -Qunused-arguments\'"
90
+ return @select_archs
91
+ else
92
+ return ios_architectures_t
93
+ end
94
+ end
95
+ alias copy_headers_t copy_headers
96
+ def copy_headers
97
+ headers_source_root = "#{@public_headers_root}/#{@spec.name}"
98
+
99
+ Dir.glob("#{headers_source_root}/**/*.h").
100
+ each { |h| `ditto #{h} #{@fwk.headers_path}/#{h.sub(headers_source_root, '')}` }
101
+
102
+ # If custom 'module_map' is specified add it to the framework distribution
103
+ # otherwise check if a header exists that is equal to 'spec.name', if so
104
+ # create a default 'module_map' one using it.
105
+ if !@spec.module_map.nil?
106
+ module_map_file = @file_accessors.flat_map(&:module_map).first
107
+ module_map = File.read(module_map_file) if Pathname(module_map_file).exist?
108
+ elsif File.exist?("#{@public_headers_root}/#{@spec.name}/#{@spec.name}.h")
109
+ module_map = <<MAP
110
+ framework module #{@spec.name} {
111
+ umbrella header "#{@spec.name}.h"
112
+
113
+ export *
114
+ module * { export * }
115
+ }
116
+ MAP
58
117
  else
59
- return "ARCHS=\'x86_64 i386 arm64 armv7\' OTHER_CFLAGS=\'-fembed-bitcode -Qunused-arguments\'"
118
+
119
+ f = File.new(File.join("#{@fwk.headers_path}","#{@spec.name}.h"), "w+")
120
+ f.puts("#import <UIKit/UIKit.h>")
121
+ f.puts("#import <Foundation/Foundation.h>")
122
+ Dir.foreach(@fwk.headers_path) do |filename|
123
+ if filename != "." and filename != ".."
124
+ f.puts("#import \"#{filename}\"")
125
+ end
126
+ end
127
+ f.close
128
+
129
+ module_map = <<MAP
130
+ framework module #{@spec.name} {
131
+ umbrella header "#{@spec.name}.h"
132
+
133
+ export *
134
+ module * { export * }
135
+ }
136
+ MAP
137
+ end
138
+
139
+ unless module_map.nil?
140
+ @fwk.module_map_path.mkpath unless @fwk.module_map_path.exist?
141
+ File.write("#{@fwk.module_map_path}/module.modulemap", module_map)
142
+ end
143
+ end
144
+
145
+ alias copy_resources_t copy_resources
146
+ def copy_resources
147
+ if @exclude_deps
148
+ bundles = @static_installer.pod_targets.flat_map(&:file_accessors).flat_map{|item|item.resources}
149
+ else
150
+ bundles = @static_installer.pod_targets.reject { |t| @exclude_dep_items.any?{|item|t.pod_name == item}}.flat_map(&:file_accessors).flat_map{|item|item.resources}
151
+ end
152
+ if @dynamic
153
+ resources_path = "ios/#{@spec.name}.framework"
154
+ bundles.tap{|path| FileUtils.cp_r path,resources_path}
155
+ `cp -rp #{@static_sandbox_root}/build/*.bundle #{resources_path} 2>&1`
156
+ else
157
+ `cp -rp #{@static_sandbox_root}/build/*.bundle #{@fwk.resources_path} 2>&1`
158
+ resources = expand_paths(@spec.consumer(@platform).resources)
159
+ if resources.count == 0 && bundles.count == 0
160
+ @fwk.delete_resources
161
+ return
162
+ end
163
+ if resources.count > 0
164
+ `cp -rp #{resources.join(' ')} #{@fwk.resources_path}`
165
+ end
60
166
  end
61
167
  end
62
168
 
63
169
  alias build_sim_libraries_t build_sim_libraries
64
- def build_sim_libraries(platform, defines)
170
+ def build_sim_libraries(defines)
65
171
  if @select_archs.size != 0 && !@select_archs.include?('i386') && !@select_archs.include?('x86_64')
66
172
  return
67
173
  else
68
174
  UI.puts 'start build sim'
69
- build_sim_libraries_t platform,defines
175
+ build_sim_libraries_t defines
70
176
  end
71
177
  end
72
178
 
73
- alias build_static_lib_for_ios_t build_static_lib_for_ios
74
- def build_static_lib_for_ios(static_libs, _defines, output)
75
- if @all_deps
76
- return if static_libs.count == 0
77
- sim_libs = static_libs_in_sandbox('build-sim')
78
- for item in @black_deps
79
- static_libs.delete_if do |obj|
80
- obj.include? item
81
- end
82
- sim_libs.delete_if do |obj|
83
- obj.include? item
84
- end
85
- end
86
- UI.puts "links statics:#{static_libs.join(' ')}, sim_libs:#{sim_libs.join(' ')}"
87
- `xcrun -r libtool -no_warning_for_no_symbols -static -o #{output} #{static_libs.join(' ')} #{sim_libs.join(' ')}`
88
- else
89
- build_static_lib_for_ios static_libs,_defines,output
90
- end
91
-
92
- end
93
-
94
179
  alias initialize_t initialize
95
- def initialize(source_dir, static_sandbox_root, dynamic_sandbox_root, public_headers_root, spec, embedded, mangle, dynamic, config, bundle_identifier, exclude_deps, all_deps,black_deps,select_archs)
96
- @all_deps = all_deps
97
- @black_deps = black_deps
180
+ def initialize(platform, static_installer, source_dir, static_sandbox_root, dynamic_sandbox_root, public_headers_root, spec, embedded, mangle, dynamic, config, bundle_identifier, exclude_deps,exclude_dep_items=[],select_archs=[])
181
+ @exclude_dep_items = exclude_dep_items
98
182
  @select_archs = select_archs
99
- @target_type_ext = ['.a','.bundle']
100
- @target_dir_ext_ext = "#{static_sandbox_root}/build"
101
- @black_list_ext = ["#{static_sandbox_root}/build","#{static_sandbox_root}/build-sim"]
102
- initialize_t(source_dir, static_sandbox_root, dynamic_sandbox_root, public_headers_root, spec, embedded, mangle, dynamic, config, bundle_identifier, exclude_deps)
183
+ initialize_t(platform, static_installer,source_dir, static_sandbox_root, dynamic_sandbox_root, public_headers_root, spec, embedded, mangle, dynamic, config, bundle_identifier, exclude_deps)
103
184
  end
104
185
  end
105
186
  end
@@ -0,0 +1,19 @@
1
+ require 'cocoapods-downloader/remote_file'
2
+
3
+ module Pod
4
+ module Downloader
5
+ class LocalPath < RemoteFile
6
+ DEFAULT_PORT = 22
7
+
8
+ private
9
+
10
+ executable :ln
11
+
12
+ def download_file(full_filename)
13
+
14
+ ln! "-s",url, full_filename
15
+ end
16
+
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,38 @@
1
+ module Pod
2
+ module Downloader
3
+ autoload :LocalPath,'cocoapods-packager-ext/ext/downloader/lnpath'
4
+ class << self
5
+ alias downloader_class_by_key_t downloader_class_by_key
6
+ def downloader_class_by_key
7
+ keys = downloader_class_by_key_t
8
+ keys[:lnpath] = LocalPath
9
+ return keys
10
+ end
11
+ end
12
+ class RemoteFile
13
+ executable :ln
14
+
15
+ alias filename_with_type_t filename_with_type
16
+ def filename_with_type(type = :zip)
17
+ if not type
18
+ "file"
19
+ else
20
+ filename_with_type_t type
21
+ end
22
+ end
23
+ alias extract_with_type_t extract_with_type
24
+ def extract_with_type(full_filename, type = :zip)
25
+ if not type
26
+ unpack_from = url
27
+ unpack_to = @target_path
28
+ FileUtils.rm_rf(unpack_to) if File.exist?(unpack_to)
29
+ FileUtils.rm_rf(unpack_to) if Dir.exist?(unpack_to)
30
+ ln! '-s',unpack_from,unpack_to
31
+ else
32
+ extract_with_type_t full_filename,type
33
+ end
34
+
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,57 @@
1
+ module Pod
2
+ class Command
3
+ class Package
4
+
5
+ # @param [Pod::Installer] static_installer
6
+ #
7
+ # @return [Pod::PodTarget]
8
+ #
9
+ alias build_dynamic_target_t build_dynamic_target
10
+
11
+ def build_dynamic_target(dynamic_sandbox, static_installer, platform)
12
+ spec_targets = static_installer.pod_targets.select do |target|
13
+ target.name == @spec.name
14
+ end
15
+ static_target = spec_targets[0]
16
+
17
+ file_accessors = create_file_accessors(static_target, dynamic_sandbox)
18
+
19
+ archs = []
20
+ dynamic_target = Pod::PodTarget.new(dynamic_sandbox, BuildType.dynamic_framework, static_target.user_build_configurations, archs, platform, static_target.specs, static_target.target_definitions, file_accessors)
21
+ dynamic_target
22
+ end
23
+ alias copy_dynamic_target_t copy_dynamic_target
24
+ def copy_dynamic_target(static_sandbox, _dynamic_target, dynamic_sandbox)
25
+ command = "ln -sf #{static_sandbox.root}/#{@spec.name} #{dynamic_sandbox.root}"
26
+ `#{command}`
27
+ end
28
+
29
+ alias write_pod_project_t write_pod_project
30
+ def write_pod_project(dynamic_project, dynamic_sandbox)
31
+ UI.message "- Writing Xcode project file to #{UI.path dynamic_sandbox.project_path}" do
32
+ dynamic_project.pods.remove_from_project if dynamic_project.pods.empty?
33
+ dynamic_project.development_pods.remove_from_project if dynamic_project.development_pods.empty?
34
+ dynamic_project.sort(:groups_position => :below)
35
+ dynamic_project.recreate_user_schemes(false)
36
+
37
+ # Edit search paths so that we can find our dependency headers
38
+ dynamic_project.targets.first.build_configuration_list.build_configurations.each do |config|
39
+ header_path = Dir.glob("#{Dir.pwd}/Pods/Static/Headers/*/*")
40
+ header_path.push "#{Dir.pwd}/Pods/Static/Headers/Public"
41
+ header_path.push "#{Dir.pwd}/Pods/Static/Headers/Private"
42
+ header_path.reject! {|item|item.split('/').last == dynamic_project.targets.first.name}
43
+ header_path = header_path.join " "
44
+ config.build_settings['HEADER_SEARCH_PATHS'] = "$(inherited) #{header_path}"
45
+ config.build_settings['USER_HEADER_SEARCH_PATHS'] = "$(inherited) #{header_path}"
46
+ config.build_settings['OTHER_LDFLAGS'] = '$(inherited) -ObjC'
47
+
48
+ if ENV['DISABLE_BITCODE']
49
+ config.build_settings['ENABLE_BITCODE'] = 'NO'
50
+ end
51
+ end
52
+ dynamic_project.save
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -1,3 +1,3 @@
1
1
  module CocoapodsPackagerExt
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.22"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-packager-ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - kyle.zhou
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-03 00:00:00.000000000 Z
11
+ date: 2021-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: cocoapods-packager
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
47
+ version: 1.5.1
48
+ type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 1.5.1
55
55
  description: A short description of cocoapods-packager-ext.
56
56
  email:
57
57
  - kyle.zhou@qq.com
@@ -70,6 +70,9 @@ files:
70
70
  - lib/cocoapods-packager-ext/command/install_ext.rb
71
71
  - lib/cocoapods-packager-ext/command/package_ext.rb
72
72
  - lib/cocoapods-packager-ext/ext/builder.rb
73
+ - lib/cocoapods-packager-ext/ext/downloader/lnpath.rb
74
+ - lib/cocoapods-packager-ext/ext/downloader_ext.rb
75
+ - lib/cocoapods-packager-ext/ext/pod_utils.rb
73
76
  - lib/cocoapods-packager-ext/gem_version.rb
74
77
  - lib/cocoapods_plugin.rb
75
78
  - spec/command/ext_spec.rb