cocoapods-fy-bin 0.0.6 → 0.0.9

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: 0f997f5805fe2021dcdb957dc7c15c75bbfb42bc4181a3152bdeb2c2b1d2fa4a
4
- data.tar.gz: 483058815c66ae0be5959a186a43360267fca942d55afc43a2a98556c303f49e
3
+ metadata.gz: 349f56acd81d29471129eed2a459165a89fbd3b8558b118f9b531441bae5d8cc
4
+ data.tar.gz: 21b8eca394a490c8df72db1aed106272ad877065e18b6420da0a75e75edfc930
5
5
  SHA512:
6
- metadata.gz: 70fa4b07e016a67b21db0746ba02ed782da66a4167a281e3ce0443ec256a98564673932e9ca84f01e556c487d1dfea189d3e5c5382bb940c3af43e3c90ebcfad
7
- data.tar.gz: 1af79a69601f69b34b5abb8521680f6db52d7d9cd62a14622d97de4b688ae53b2b37fc690215452494cd3025482943a18266194e16f9adec0f1ec3183eb8ddbc
6
+ metadata.gz: 238a5aca517a885d3d08ac700c8af22607511e1c3dc7beb4d1f199b3afdaadec6e57d0974463f14db8f4e22ce88a6d3028179102ccbb77b8a6d68ceff4e992b2
7
+ data.tar.gz: ce69f0aa064cbac03c582852b1b667b69838d8042eb15a5b6fe3e4c3a06afb7165dfdc576853352086ace3ef29f5a4d62224336565440bee826004f5ee8b14c5
@@ -31,7 +31,8 @@ module Pod
31
31
  ['--no-zip', '不压缩静态库 为 zip'],
32
32
  ['--configuration', 'Build the specified configuration (e.g. Debug). Defaults to Release'],
33
33
  ['--env', "该组件上传的环境 %w[debug release]"],
34
- ['--archs', "需要二进制组件的架构"]
34
+ ['--archs', "需要二进制组件的架构"],
35
+ ['--pre_build_shells', "xcodebuild前的脚本命令"]
35
36
  ].concat(Pod::Command::Gen.options).concat(super).uniq
36
37
  end
37
38
 
@@ -40,7 +41,7 @@ module Pod
40
41
  ]
41
42
 
42
43
  def initialize(argv)
43
- @env = argv.option('env') || 'debug'
44
+ @env = argv.option('env') || 'release'
44
45
  CBin.config.set_configuration_env(@env)
45
46
  UI.warn "====== cocoapods-fy-bin #{CBin::VERSION} 版本 ======== \n "
46
47
  UI.warn "====== #{@env} 环境 ======== \n "
@@ -54,6 +55,7 @@ module Pod
54
55
  @sources = argv.option('sources') || []
55
56
  @platform = Platform.new(:ios)
56
57
  @archs = argv.option('archs', 'armv7,arm64')
58
+ @pre_build_shells = argv.option('pre_build_shells', '')
57
59
  @config = argv.option('configuration', 'Release')
58
60
 
59
61
  @framework_path
@@ -88,6 +90,7 @@ module Pod
88
90
  @zip,
89
91
  @spec,
90
92
  @archs,
93
+ @pre_build_shells,
91
94
  CBin::Config::Builder.instance.white_pod_list.include?(@spec.name),
92
95
  @config)
93
96
  builder.build
@@ -21,7 +21,8 @@ module Pod
21
21
  ['--all-make', '对该组件的依赖库,全部制作为二进制组件'],
22
22
  ['--configuration', 'Build the specified configuration (e.g. Release ). Defaults to Debug'],
23
23
  ['--env', "该组件上传的环境 %w[debug release]"],
24
- ['--archs', "需要二进制组件的架构"]
24
+ ['--archs', "需要二进制组件的架构"],
25
+ ['--pre_build_shells', "xcodebuild前的脚本命令"]
25
26
  ].concat(Pod::Command::Gen.options).concat(super).uniq
26
27
  end
27
28
 
@@ -39,9 +40,11 @@ module Pod
39
40
  @all_make = argv.flag?('all-make', false)
40
41
  @verbose = argv.flag?('verbose', true)
41
42
  @archs = argv.flag?('archs', 'arm64')
43
+ @pre_build_shells = argv.flag?('pre_build_shells', '')
42
44
  @config = argv.option('configuration', 'Debug')
43
45
  @additional_args = argv.remainder!
44
46
 
47
+
45
48
  super
46
49
  end
47
50
 
@@ -125,6 +128,9 @@ module Pod
125
128
  if @archs
126
129
  argvs += ["--archs=#{@archs}"]
127
130
  end
131
+ if @pre_build_shells
132
+ argvs += ["--pre_build_shells=#{@pre_build_shells}"]
133
+ end
128
134
  argvs += ["--configuration=#{@config}"]
129
135
 
130
136
  archive = Pod::Command::Bin::Archive.new(CLAide::ARGV.new(argvs))
@@ -11,12 +11,13 @@ module CBin
11
11
 
12
12
  def template_hash
13
13
  {
14
- 'configuration_env' => { description: '编译环境', default: 'debug', selection: %w[debug release] },
14
+ 'configuration_env' => { description: '编译环境', default: 'release', selection: %w[debug release] },
15
15
  'code_repo_url' => { description: '源码私有源 Git 地址', default: 'https://gitlab.fuyoukache.com/iosThird/swiftThird/FYSwiftSpecs.git' },
16
16
  'binary_repo_url' => { description: '二进制私有源 Git 地址', default: 'https://gitlab.fuyoukache.com/iosThird/swiftThird/fybinaryspecs.git' },
17
17
  'binary_download_url' => { description: '二进制下载主机地址,内部会依次传入组件名称、版本、打包模式', default: 'https://mobilepods.fuyoukache.com' },
18
18
  # 'binary_type' => { description: '二进制打包类型', default: 'framework', selection: %w[framework library] },
19
- 'download_file_type' => { description: '下载二进制文件类型', default: 'zip', selection: %w[zip tgz tar tbz txz dmg] }
19
+ 'download_file_type' => { description: '下载二进制文件类型', default: 'zip', selection: %w[zip tgz tar tbz txz dmg] },
20
+ 'clean_white_list' => { description: 'framework清空白名单, 二进制切换到源码会删除framework,避免这些库被删除重新下载', default: 'Bugly,LookinServer'}
20
21
  }
21
22
  end
22
23
 
@@ -37,12 +38,19 @@ module CBin
37
38
 
38
39
  def configuration_env
39
40
  #如果是debug 再去 podfile的配置文件中获取,确保是正确的, pod update时会用到
40
- if @configuration_env == "debug" || @configuration_env == nil
41
- if Pod::Config.instance.podfile
42
- configuration_env ||= Pod::Config.instance.podfile.configuration_env
43
- end
44
- configuration_env ||= "debug"
45
- @configuration_env = configuration_env
41
+ # if @configuration_env == "release" || @configuration_env == nil
42
+ # if Pod::Config.instance.podfile
43
+ # configuration_env ||= Pod::Config.instance.podfile.configuration_env
44
+ # end
45
+ # configuration_env ||= "release"
46
+ # @configuration_env = configuration_env
47
+ # end
48
+ if @configuration_env == nil
49
+ if Pod::Config.instance.podfile
50
+ configuration_env ||= Pod::Config.instance.podfile.configuration_env
51
+ end
52
+ configuration_env ||= "release"
53
+ @configuration_env = configuration_env
46
54
  end
47
55
  @configuration_env
48
56
  end
@@ -1,6 +1,6 @@
1
1
 
2
2
  module CBin
3
- VERSION = '0.0.6'
3
+ VERSION = '0.0.9'
4
4
  end
5
5
 
6
6
  module Pod
@@ -20,6 +20,7 @@ module CBin
20
20
  zip,
21
21
  rootSpec,
22
22
  archs,
23
+ pre_build_shells,
23
24
  skip_archive = false,
24
25
  build_model="Release")
25
26
  @spec = spec
@@ -28,6 +29,7 @@ module CBin
28
29
  @rootSpec = rootSpec
29
30
  @isRootSpec = rootSpec.name == spec.name
30
31
  @archs = archs
32
+ @pre_build_shells = pre_build_shells
31
33
  @skip_archive = skip_archive
32
34
  @framework_output = framework_output
33
35
  @zip = zip
@@ -56,7 +58,7 @@ module CBin
56
58
  source_dir = Dir.pwd
57
59
  file_accessor = Sandbox::FileAccessor.new(Pathname.new('.').expand_path, @spec.consumer(@platform))
58
60
  Dir.chdir(workspace_directory) do
59
- builder = CBin::Framework::Builder.new(@spec, file_accessor, @platform, source_dir, @archs, @isRootSpec, @build_model)
61
+ builder = CBin::Framework::Builder.new(@spec, file_accessor, @platform, source_dir, @archs, @pre_build_shells, @isRootSpec, @build_model)
60
62
  @@build_defines = builder.build if @isRootSpec
61
63
  begin
62
64
  @framework_path = builder.lipo_build(@@build_defines) unless @skip_archive
@@ -70,7 +72,7 @@ module CBin
70
72
  source_dir = zip_dir
71
73
  file_accessor = Sandbox::FileAccessor.new(Pathname.new('.').expand_path, @spec.consumer(@platform))
72
74
  Dir.chdir(workspace_directory) do
73
- builder = CBin::Library::Builder.new(@spec, file_accessor, @platform, source_dir , @archs, @framework_path)
75
+ builder = CBin::Library::Builder.new(@spec, file_accessor, @platform, source_dir , @archs, @pre_build_shells, @framework_path)
74
76
  builder.build
75
77
  end
76
78
  end
@@ -10,7 +10,7 @@ module CBin
10
10
  class Builder
11
11
  include Pod
12
12
  #Debug下还待完成
13
- def initialize(spec, file_accessor, platform, source_dir, archs, isRootSpec = true, build_model="Debug")
13
+ def initialize(spec, file_accessor, platform, source_dir, archs, pre_build_shells, isRootSpec = true, build_model="Debug")
14
14
  @spec = spec
15
15
  @source_dir = source_dir
16
16
  @file_accessor = file_accessor
@@ -18,6 +18,7 @@ module CBin
18
18
  @build_model = build_model
19
19
  @isRootSpec = isRootSpec
20
20
  @archs = archs
21
+ @pre_build_commands = pre_build_shells
21
22
  #vendored_static_frameworks 只有 xx.framework 需要拼接为 xx.framework/xx by slj
22
23
  vendored_static_frameworks = file_accessor.vendored_static_frameworks.map do |framework|
23
24
  path = framework
@@ -74,6 +75,7 @@ module CBin
74
75
 
75
76
  # archs = %w[i386 x86_64]
76
77
  archs = ios_architectures_sim
78
+ pre_build_shell
77
79
  archs.map do |arch|
78
80
  xcodebuild(defines, "-sdk iphonesimulator ARCHS=\'#{arch}\' ", "build-#{arch}",@build_model)
79
81
  end
@@ -174,6 +176,7 @@ module CBin
174
176
  # if is_debug_model
175
177
  archs = ios_architectures
176
178
  # archs = %w[arm64 armv7 armv7s]
179
+ pre_build_shell
177
180
  archs.map do |arch|
178
181
  # -fembed-bitcode支持bitcode BUILD_LIBRARY_FOR_DISTRIBUTION=YES 构建向后兼容的framework
179
182
  xcodebuild(defines, "ARCHS=\'#{arch}\' OTHER_CFLAGS=\'-fembed-bitcode -Qunused-arguments\' DEBUG_INFORMATION_FORMAT=\'dwarf-with-dsym\' BUILD_LIBRARY_FOR_DISTRIBUTION=YES","build-#{arch}",@build_model)
@@ -199,6 +202,27 @@ module CBin
199
202
  end
200
203
  end
201
204
 
205
+ # 编译前需执行的的shell脚本
206
+ def pre_build_shell
207
+ command_args = @pre_build_commands.split(",")
208
+ command_args.each do |command_arg|
209
+ command = "sh #{command_arg}"
210
+ puts command
211
+ UI.message "command = #{command}"
212
+ output = `#{command}`.lines.to_a
213
+
214
+ if $CHILD_STATUS.exitstatus != 0
215
+ raise <<~EOF
216
+ Shell command failed: #{command}
217
+ Output:
218
+ #{output.map { |line| " #{line}" }.join}
219
+ EOF
220
+
221
+ Process.exit
222
+ end
223
+ end
224
+ end
225
+
202
226
  def xcodebuild(defines = '', args = '', build_dir = 'build', build_model = 'Debug')
203
227
 
204
228
  unless File.exist?("Pods.xcodeproj") #cocoapods-generate v2.0.0
@@ -206,6 +230,7 @@ module CBin
206
230
  puts command
207
231
  else
208
232
  command = "xcodebuild #{defines} #{args} CONFIGURATION_BUILD_DIR=#{build_dir} clean build -configuration #{build_model} -target #{target_name} -project ./Pods.xcodeproj 2>&1"
233
+ puts command
209
234
  end
210
235
 
211
236
  UI.message "command = #{command}"
@@ -11,13 +11,14 @@ module CBin
11
11
  class Builder
12
12
  include Pod
13
13
 
14
- def initialize(spec, file_accessor, platform, source_dir, archs, framework_path)
14
+ def initialize(spec, file_accessor, platform, source_dir, archs, pre_build_shells, framework_path)
15
15
  @spec = spec
16
16
  @source_dir = source_dir
17
17
  @file_accessor = file_accessor
18
18
  @platform = platform
19
19
  @framework = framework_path
20
20
  @archs = archs
21
+ @pre_build_shells = pre_build_shells
21
22
  @source_files = "#{@source_dir}/#{library.name_path}"
22
23
  @source_zip_file = "#{@source_files}.zip"
23
24
  end
@@ -122,7 +122,6 @@ module CBin
122
122
  @spec.vendored_libraries = binary_vendored_libraries
123
123
  @spec.resources = binary_resources if @spec.attributes_hash.keys.include?("resources")
124
124
  @spec.description = <<-EOF
125
- 「 converted automatically by plugin cocoapods-fy-bin @厦门美柚 - slj 」
126
125
  #{@spec.description}
127
126
  EOF
128
127
  @spec
@@ -3,11 +3,17 @@ require 'parallel'
3
3
  require 'cocoapods'
4
4
  require 'xcodeproj'
5
5
  require 'cocoapods-fy-bin/native/pod_source_installer'
6
+ require 'cocoapods-fy-bin/config/config'
6
7
 
7
8
  module Pod
8
9
  class Installer
9
10
  attr_reader :removed_frameworks
10
- attr_reader :clean_white_list
11
+
12
+ def clean_white_list
13
+ clean_white_string = CBin.config.clean_white_list
14
+ clean_white = clean_white_string.split(",")
15
+ clean_white
16
+ end
11
17
 
12
18
  def cache_descriptors
13
19
  @cache_descriptors ||= begin
@@ -39,7 +45,6 @@ module Pod
39
45
 
40
46
  # 清除本地资源 /Users/dengrui/Library/Caches/CocoaPods/Pods/Release/
41
47
  def clean_pod_cache
42
- clean_white_list = ['Bugly', 'LookinServer']
43
48
  podfile = Pod::Config.instance.podfile
44
49
  root_specs.sort_by(&:name).each do |spec|
45
50
  descriptors = cache_descriptors[spec.root.name]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-fy-bin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - dr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-05 00:00:00.000000000 Z
11
+ date: 2022-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parallel