pod-builder 3.5.0 → 4.0.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: cf1ba531fbdf9edef61d09e7c1c0fe2c7822ba0823a64203895cc850d43f0288
4
- data.tar.gz: 6d0101ec9a99a23b660cce491dffea35a66b9eb26820bb123bf704af5a67d196
3
+ metadata.gz: f4eb5820c597538d2cdca26385c8d307d1ec1136d8c393594167fae25d1de240
4
+ data.tar.gz: 8a489a9710bc41a6c96ec3603227cb06e0a9d376835f05976c5e595bd45d902e
5
5
  SHA512:
6
- metadata.gz: 94d82628002ce8f8debb7aadfd6f8ad8a928ee93bfe201a0ccd40fc21a063c912be4753890f5c13d9de765eed259634125caa425e9b804d894bac463bee2eb6e
7
- data.tar.gz: af202cee868e1e52b30b2b4549a56f1dbcb568af028f2dd1ea026523168a50e0c11f72fb0d5a7b5daec524d8f6e91ca972562b9eb962bac63a329b1106c02e5b
6
+ metadata.gz: 3ed8a52ba842937a2a24626c55bd67932c9a2a2af80b8b3891dd00109597e42251e4eea694b4c4f5901218de22ec6b21ae95a87f5e9f034e4467c4d9e9c8c0b3
7
+ data.tar.gz: 00ac3c4c7c07716d84011dab03b5524e4154172bae3ecac9cce228b2b78047738c5037f057e0d14fb0e0779b29090f83b0b8df0c3e7f9f77a59369cf954db99c
data/README.md CHANGED
@@ -324,6 +324,24 @@ PodBuilder writes a plist and markdown license files of pods specified in the Po
324
324
 
325
325
  If you use bundler to pin the version of CocoaPods in your project set this to true. Default false.
326
326
 
327
+ #### `pre_actions`
328
+
329
+ Pre actions allow to execute custom scripts before a given command (`switch`, `build`) has been performed.
330
+
331
+ You need to specify a `path` to the executable script which is relative to the _PodBuilder_ folder. Optionally you can also specify whether the command should or should not print the output to stdout/stderr by passing a bool to the `quiet` key (default: false).
332
+
333
+ ```json
334
+ {
335
+ "pre_actions": {
336
+ "switch" : { "path": "pre_switch_action.rb", "quiet": true },
337
+ "build" : { "path": "pre_build_action.rb", "quiet": false }
338
+ }
339
+ }
340
+ ```
341
+
342
+ **Note:** The build action might be invoked more than once depending on the build strategy that PodBuilder needs to perform.
343
+
344
+
327
345
  #### `post_actions`
328
346
 
329
347
  Post actions allow to execute custom scripts after a given command (`switch`, `build`) has been performed.
@@ -339,6 +357,7 @@ You need to specify a `path` to the executable script which is relative to the _
339
357
  }
340
358
  ```
341
359
 
360
+ **Note:** The build action might be invoked more than once depending on the build strategy that PodBuilder needs to perform.
342
361
 
343
362
 
344
363
  # Behind the scenes
@@ -2,7 +2,7 @@ require 'pod_builder/core'
2
2
  require 'json'
3
3
 
4
4
  module PodBuilder
5
- module PostActions
5
+ module Actions
6
6
  def self.load(hash)
7
7
  actions = {}
8
8
  if json = hash["switch"]
@@ -114,10 +114,19 @@ module PodBuilder
114
114
  podfile_items = podfile_items.map { |t| t.recursive_dependencies(all_buildable_items) }.flatten.uniq
115
115
 
116
116
  podfile_content = Podfile.from_podfile_items(podfile_items, analyzer, build_configuration, install_using_frameworks, build_catalyst, podfile_items.first.build_xcframework)
117
+
118
+ PodBuilder::safe_rm_rf(Configuration.build_path)
119
+ FileUtils.mkdir_p(Configuration.build_path)
120
+
121
+ init_git(Configuration.build_path) # this is needed to be able to call safe_rm_rf
122
+
123
+ Configuration.pre_actions[:build]&.execute()
117
124
 
118
125
  install_result += Install.podfile(podfile_content, podfile_items, argument_pods, podfile_items.first.build_configuration)
119
126
 
120
127
  FileUtils.rm_f(PodBuilder::basepath("Podfile.lock"))
128
+
129
+ Configuration.post_actions[:build]&.execute()
121
130
  end
122
131
 
123
132
  install_result.write_prebuilt_info_files
@@ -145,9 +154,7 @@ module PodBuilder
145
154
 
146
155
  if (restore_file_error = restore_file_error) && Configuration.restore_enabled
147
156
  puts "\n\n⚠️ Podfile.restore was found invalid and was overwritten. Error:\n #{restore_file_error}".red
148
- end
149
-
150
- Configuration.post_actions[:build]&.execute()
157
+ end
151
158
 
152
159
  puts "\n\n🎉 done!\n".green
153
160
  return 0
@@ -155,6 +162,12 @@ module PodBuilder
155
162
 
156
163
  private
157
164
 
165
+ def self.init_git(path)
166
+ Dir.chdir(path) do
167
+ system("git init")
168
+ end
169
+ end
170
+
158
171
  def self.should_build_catalyst(installer)
159
172
  integrate_targets = installer.podfile.installation_options.integrate_targets
160
173
 
@@ -13,6 +13,8 @@ module PodBuilder
13
13
  return -1
14
14
  end
15
15
 
16
+ Configuration.pre_actions[:switch]&.execute()
17
+
16
18
  pods_not_found = []
17
19
  pod_names_to_switch = []
18
20
  argument_pods.each do |pod|
@@ -75,6 +75,7 @@ module PodBuilder
75
75
  attr_accessor :build_xcframeworks_all
76
76
  attr_accessor :build_xcframeworks_include
77
77
  attr_accessor :build_xcframeworks_exclude
78
+ attr_accessor :pre_actions
78
79
  attr_accessor :post_actions
79
80
  end
80
81
 
@@ -113,6 +114,7 @@ module PodBuilder
113
114
  @build_xcframeworks_include = []
114
115
  @build_xcframeworks_exclude = []
115
116
 
117
+ @pre_actions = {}
116
118
  @post_actions = {}
117
119
 
118
120
  def self.check_inited
@@ -232,9 +234,14 @@ module PodBuilder
232
234
  Configuration.build_xcframeworks_exclude = value
233
235
  end
234
236
  end
237
+ if value = json["pre_actions"]
238
+ if value.is_a?(Hash)
239
+ Configuration.pre_actions = PodBuilder::Actions.load(value)
240
+ end
241
+ end
235
242
  if value = json["post_actions"]
236
243
  if value.is_a?(Hash)
237
- Configuration.post_actions = PodBuilder::PostActions.load(value)
244
+ Configuration.post_actions = PodBuilder::Actions.load(value)
238
245
  end
239
246
  end
240
247
 
@@ -12,7 +12,7 @@ require 'pod_builder/info'
12
12
  require 'pod_builder/configuration'
13
13
  require 'pod_builder/podspec'
14
14
  require 'pod_builder/licenses'
15
- require 'pod_builder/post_actions'
15
+ require 'pod_builder/actions'
16
16
 
17
17
  require 'core_ext/string'
18
18
 
@@ -140,12 +140,7 @@ module PodBuilder
140
140
  class Install
141
141
  # This method will generate prebuilt data by building from "/tmp/pod_builder/Podfile"
142
142
  def self.podfile(podfile_content, podfile_items, argument_pods, build_configuration)
143
- puts "Preparing build Podfile".yellow
144
-
145
- PodBuilder::safe_rm_rf(Configuration.build_path)
146
- FileUtils.mkdir_p(Configuration.build_path)
147
-
148
- init_git(Configuration.build_path) # this is needed to be able to call safe_rm_rf
143
+ puts "Preparing build Podfile".yellow
149
144
 
150
145
  podfile_content = copy_development_pods_source_code(podfile_content, podfile_items)
151
146
 
@@ -452,13 +447,7 @@ module PodBuilder
452
447
  File.write(gitattributes_path, expected_attributes, mode: 'a')
453
448
  end
454
449
  end
455
-
456
- def self.init_git(path)
457
- Dir.chdir(path) do
458
- system("git init")
459
- end
460
- end
461
-
450
+
462
451
  def self.build_folder_hash_in_prebuilt_info_file(podfile_item)
463
452
  prebuilt_info_path = PodBuilder::prebuiltpath(File.join(podfile_item.root_name, Configuration.prebuilt_info_filename))
464
453
 
@@ -591,8 +591,10 @@ module PodBuilder
591
591
  if matches&.size == 4 && !stripped_line.start_with?("#")
592
592
  path = matches[2]
593
593
 
594
+ file_exists = File.exist?(File.expand_path(path))
595
+
594
596
  is_absolute = ["~", "/"].include?(path[0])
595
- unless !is_absolute
597
+ if is_absolute || !file_exists
596
598
  podfile_lines.push(line)
597
599
  next
598
600
  end
@@ -1,4 +1,3 @@
1
1
  module PodBuilder
2
- VERSION = "3.5.0"
2
+ VERSION = "4.0.0"
3
3
  end
4
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pod-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.0
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Camin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-27 00:00:00.000000000 Z
11
+ date: 2021-07-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -181,6 +181,7 @@ files:
181
181
  - bin/setup
182
182
  - exe/pod_builder
183
183
  - lib/core_ext/string.rb
184
+ - lib/pod_builder/actions.rb
184
185
  - lib/pod_builder/analyze.rb
185
186
  - lib/pod_builder/analyzer.rb
186
187
  - lib/pod_builder/command.rb
@@ -208,7 +209,6 @@ files:
208
209
  - lib/pod_builder/podfile_cp.rb
209
210
  - lib/pod_builder/podfile_item.rb
210
211
  - lib/pod_builder/podspec.rb
211
- - lib/pod_builder/post_actions.rb
212
212
  - lib/pod_builder/rome/post_install.rb
213
213
  - lib/pod_builder/rome/pre_install.rb
214
214
  - lib/pod_builder/templates/build_podfile.template