Class: Pod::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-packager/builder.rb

Instance Method Summary collapse

Constructor Details

#initialize(source_dir, static_sandbox_root, dynamic_sandbox_root, public_headers_root, spec, embedded, mangle, dynamic, config, bundle_identifier, exclude_deps) ⇒ Builder

Returns a new instance of Builder.



3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/cocoapods-packager/builder.rb', line 3

def initialize(source_dir, static_sandbox_root, dynamic_sandbox_root, public_headers_root, spec, embedded, mangle, dynamic, config, bundle_identifier, exclude_deps)
  @source_dir = source_dir
  @static_sandbox_root = static_sandbox_root
  @dynamic_sandbox_root = dynamic_sandbox_root
  @public_headers_root = public_headers_root
  @spec = spec
  @embedded = embedded
  @mangle = mangle
  @dynamic = dynamic
  @config = config
  @bundle_identifier = bundle_identifier
  @exclude_deps = exclude_deps
end

Instance Method Details

#build(platform, library) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/cocoapods-packager/builder.rb', line 17

def build(platform, library)
  if library
    build_static_library(platform)
  else
    build_framework(platform)
  end
end

#build_framework(platform) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/cocoapods-packager/builder.rb', line 36

def build_framework(platform)
  UI.puts("Building framework #{@spec} with configuration #{@config}")

  defines = compile(platform)
  build_sim_libraries(platform, defines)

  if @dynamic
    build_dynamic_framework(platform, defines, "#{@dynamic_sandbox_root}/build/#{@spec.name}.framework/#{@spec.name}")
  else
    create_framework(platform.name.to_s)
    build_library(platform, defines, @fwk.versions_path + Pathname.new(@spec.name))
    copy_headers
    copy_license
  end

  copy_resources(platform)
end

#build_static_library(platform) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/cocoapods-packager/builder.rb', line 25

def build_static_library(platform)
  UI.puts("Building static library #{@spec} with configuration #{@config}")

  defines = compile(platform)
  build_sim_libraries(platform, defines)

  platform_path = Pathname.new(platform.name.to_s)
  platform_path.mkdir unless platform_path.exist?
  build_library(platform, defines, platform_path + Pathname.new("lib#{@spec.name}.a"))
end


54
55
56
57
58
59
60
61
62
# File 'lib/cocoapods-packager/builder.rb', line 54

def link_embedded_resources
  target_path = @fwk.root_path + Pathname.new('Resources')
  target_path.mkdir unless target_path.exist?

  Dir.glob(@fwk.resources_path.to_s + '/*').each do |resource|
    resource = Pathname.new(resource).relative_path_from(target_path)
    `ln -sf #{resource} #{target_path}`
  end
end