Class: Pod::Prebuild

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-binary-cache/pod-binary/helper/passer.rb,
lib/cocoapods-binary-cache/pod-rome/build_framework.rb,
lib/cocoapods-binary-cache/pod-binary/helper/target_checker.rb

Defined Under Namespace

Classes: Passer

Class Method Summary collapse

Class Method Details

.build(options) ⇒ Object

Raises:



178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/cocoapods-binary-cache/pod-rome/build_framework.rb', line 178

def self.build(options)
  sandbox_root_path = options[:sandbox_root_path]
  target = options[:target]
  configuration = options[:configuration]
  output_path = options[:output_path]
  bitcode_enabled = options[:bitcode_enabled] || false
  device_build_enabled = options[:device_build_enabled] || false
  custom_build_options = options[:custom_build_options] || []
  custom_build_options_simulator = options[:custom_build_options_simulator] || []

  return if target.nil?

  sandbox_root = Pathname(sandbox_root_path)
  sandbox = Pod::Sandbox.new(sandbox_root)
  build_dir = self.build_dir(sandbox_root)

  # -- build the framework
  case target.platform.name
  when :ios
    build_for_iosish_platform(
      sandbox,
      build_dir,
      output_path,
      target,
      configuration,
      "iphoneos",
      "iphonesimulator",
      bitcode_enabled,
      custom_build_options,
      custom_build_options_simulator,
      device_build_enabled
    )
  when :osx
    xcodebuild(
      sandbox,
      target.label,
      configuration,
      "macosx",
      nil,
      custom_build_options
    )
  # when :tvos then build_for_iosish_platform(sandbox, build_dir, target, 'appletvos', 'appletvsimulator')
  when :watchos
    build_for_iosish_platform(
      sandbox,
      build_dir,
      output_path,
      target,
      configuration,
      "watchos",
      "watchsimulator",
      true,
      custom_build_options,
      custom_build_options_simulator,
      device_build_enabled
    )
  else raise "Unsupported platform for '#{target.name}': '#{target.platform.name}'" end

  raise Pod::Informative, "The build directory was not found in the expected location" unless build_dir.directory?
end

.build_dir(sandbox_root) ⇒ Object



244
245
246
# File 'lib/cocoapods-binary-cache/pod-rome/build_framework.rb', line 244

def self.build_dir(sandbox_root)
  sandbox_root.parent + "build"
end

.check_one_pod_should_have_only_one_target(prebuilt_targets) ⇒ Object

Check the targets, for the current limitation of the plugin

Parameters:



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/cocoapods-binary-cache/pod-binary/helper/target_checker.rb', line 7

def self.check_one_pod_should_have_only_one_target(prebuilt_targets)
  targets_have_different_platforms = prebuilt_targets.select { |t| t.pod_name != t.name }

  if targets_have_different_platforms.count > 0
    names = targets_have_different_platforms.map(&:pod_name)
    raw_names = targets_have_different_platforms.map(&:name)
    message = "Oops, you came across a limitation of cocoapods-binary.

The plugin requires that one pod should have ONLY ONE target in the 'Pod.xcodeproj'. There are mainly 2 situations \
causing this problem:

1. One pod integrates in 2 or more different platforms' targets. e.g.
```
target 'iphoneApp' do
  pod 'A', :binary => true
end
target 'watchApp' do
  pod 'A'
end
```

2. Use different subspecs in multiple targets. e.g.
```
target 'iphoneApp' do
  pod 'A/core'
  pod 'A/network'
end
target 'iphoneAppTest' do
  pod 'A/core'
end
```

Related pods: #{names}, target names: #{raw_names}
    "
    raise Informative, message
  end
end

.remove_build_dir(sandbox_root) ⇒ Object



239
240
241
242
# File 'lib/cocoapods-binary-cache/pod-rome/build_framework.rb', line 239

def self.remove_build_dir(sandbox_root)
  path = build_dir(sandbox_root)
  path.rmtree if path.exist?
end