Class: Pod::NEBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-nepackager/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, includ_dependencies) ⇒ NEBuilder

Returns a new instance of NEBuilder.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/cocoapods-nepackager/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, includ_dependencies)
  @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
  @includ_dependencies = includ_dependencies
end

Instance Method Details

#build(platform, library) ⇒ Object



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

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

#build_framework(platform) ⇒ Object



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

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



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

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


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

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