Class: Pod::Prebuild

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

Defined Under Namespace

Classes: Passer

Class Method Summary collapse

Class Method Details

.build(sandbox_root_path, target, output_path, bitcode_enabled = false) ⇒ Object

Build the frameworks with sandbox and targets

Parameters:

  • The sandbox root path where the targets project place

    PodTarget

    target

    The pod targets to build

    Pathname

    output_path

    output path for generated frameworks

Raises:



97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/cocoapods-binary/rome/build_framework.rb', line 97

def self.build(sandbox_root_path, target, output_path, bitcode_enabled = false)

  return unless not 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 then build_for_iosish_platform(sandbox, build_dir, output_path, target, 'iphoneos', 'iphonesimulator', bitcode_enabled)
  when :osx then xcodebuild(sandbox, target.label)
  # when :tvos then build_for_iosish_platform(sandbox, build_dir, target, 'appletvos', 'appletvsimulator')
  # when :watchos then build_for_iosish_platform(sandbox, build_dir, target, 'watchos', 'watchsimulator')
  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?

  # # --- copy the vendored libraries and framework
  # frameworks = build_dir.children.select{ |path| File.extname(path) == ".framework" }
  # Pod::UI.puts "Built #{frameworks.count} #{'frameworks'.pluralize(frameworks.count)}"

  # pod_target = target
  # consumer = pod_target.root_spec.consumer(pod_target.platform.name)
  # file_accessor = Pod::Sandbox::FileAccessor.new(sandbox.pod_dir(pod_target.pod_name), consumer)
  # frameworks += file_accessor.vendored_libraries
  # frameworks += file_accessor.vendored_frameworks

  # frameworks.uniq!

  # frameworks.each do |framework|
  #   FileUtils.mkdir_p destination
  #   FileUtils.cp_r framework, destination, :remove_destination => true
  # end
  # build_dir.rmtree if build_dir.directory?
end

.build_dir(sandbox_root) ⇒ Object



141
142
143
144
# File 'lib/cocoapods-binary/rome/build_framework.rb', line 141

def self.build_dir(sandbox_root)
  # don't know why xcode chose this folder
  sandbox_root.parent + 'build' 
end

.keywordObject



4
5
6
# File 'lib/cocoapods-binary/helper/podfile_options.rb', line 4

def self.keyword
    :binary
end

.remove_build_dir(sandbox_root) ⇒ Object



134
135
136
137
# File 'lib/cocoapods-binary/rome/build_framework.rb', line 134

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