cocoapods-fy-bin 0.0.7 → 0.1.0

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: 486802350d9a84b0d3e24a78e3aa80c5046f28d4aca673a4d402ddcd828b42c3
4
- data.tar.gz: 1a7ef09d02e6c82592df52c5348f26ffaf750f19c93a11087e22251137f3a86b
3
+ metadata.gz: c74b770ea4b7bbe73552a6e712806ecfeb15f5577f5af3ceaf9e32b2c7ca572c
4
+ data.tar.gz: c0214a11e1d99cd967c761435a97b8fff1b10279bdba3bdb0030295c76ebb8e0
5
5
  SHA512:
6
- metadata.gz: f5da4926687ef53e65acb03ddc25eed9faed5d79f7c6de454e4472f788560839b1f8af036a3e637ea055daec67d202315b1599ccf02ddc0517af3cf2a40363d7
7
- data.tar.gz: b93bc714e77c576957813ad31c34e35d0f12933a929b64bdea959b02e54ac906af80f37011337f5acb8d177c44da2609a4ee44741e210430e75679bcd5e3f74b
6
+ metadata.gz: 9b24eea4630d9d98291eb273fe40f0063d9c22a703461f88e05507d81de51211c41ba642a72872e850cc6c39bac8872b28b9a1bea23fbab2e727e5af4e4f3a21
7
+ data.tar.gz: d19f8b103b16f37de2a8fb3c0e2fefed7bf7fccd3118d05fec05ad7679c6d0d46b75ede01bcddb6de190e6498690ab3e7a6cba68936ca26c6fe03a430279faba
@@ -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.7'
3
+ VERSION = '0.1.0'
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,26 @@ module CBin
199
202
  end
200
203
  end
201
204
 
205
+ # 编译前需执行的的shell脚本
206
+ def pre_build_shell
207
+ @pre_build_commands.each do |command_arg|
208
+ command = "sh #{command_arg}"
209
+ puts command
210
+ UI.message "command = #{command}"
211
+ output = `#{command}`.lines.to_a
212
+
213
+ if $CHILD_STATUS.exitstatus != 0
214
+ raise <<~EOF
215
+ Shell command failed: #{command}
216
+ Output:
217
+ #{output.map { |line| " #{line}" }.join}
218
+ EOF
219
+
220
+ Process.exit
221
+ end
222
+ end
223
+ end
224
+
202
225
  def xcodebuild(defines = '', args = '', build_dir = 'build', build_model = 'Debug')
203
226
 
204
227
  unless File.exist?("Pods.xcodeproj") #cocoapods-generate v2.0.0
@@ -206,6 +229,7 @@ module CBin
206
229
  puts command
207
230
  else
208
231
  command = "xcodebuild #{defines} #{args} CONFIGURATION_BUILD_DIR=#{build_dir} clean build -configuration #{build_model} -target #{target_name} -project ./Pods.xcodeproj 2>&1"
232
+ puts command
209
233
  end
210
234
 
211
235
  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
@@ -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.7
4
+ version: 0.1.0
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