Commit 3f4ed2ad authored by Eloy Duran's avatar Eloy Duran

Generate BridgeSupport if Specification#generate_bridge_support is used.

parent 252e6104
......@@ -16,6 +16,7 @@
51657584144AFA12002A4EFA /* AppDelegate.rb in Resources */ = {isa = PBXBuildFile; fileRef = 51657583144AFA12002A4EFA /* AppDelegate.rb */; };
51657598144B2608002A4EFA /* Pods.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 51657597144B2608002A4EFA /* Pods.xcconfig */; };
5165759B144B265B002A4EFA /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5165759A144B265B002A4EFA /* libPods.a */; };
516575F1144B498E002A4EFA /* Pods.bridgesupport in Resources */ = {isa = PBXBuildFile; fileRef = 516575F0144B498E002A4EFA /* Pods.bridgesupport */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
......@@ -30,7 +31,8 @@
51657581144AFA12002A4EFA /* rb_main.rb */ = {isa = PBXFileReference; lastKnownFileType = text.script.ruby; path = rb_main.rb; sourceTree = "<group>"; };
51657583144AFA12002A4EFA /* AppDelegate.rb */ = {isa = PBXFileReference; lastKnownFileType = text.script.ruby; path = AppDelegate.rb; sourceTree = "<group>"; };
51657597144B2608002A4EFA /* Pods.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Pods.xcconfig; path = Pods/Pods.xcconfig; sourceTree = "<group>"; };
5165759A144B265B002A4EFA /* libPods.a */ = {isa = PBXFileReference; lastKnownFileType = file; name = libPods.a; path = Pods/build/Release/libPods.a; sourceTree = "<group>"; };
5165759A144B265B002A4EFA /* libPods.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libPods.a; path = Pods/build/Release/libPods.a; sourceTree = "<group>"; };
516575F0144B498E002A4EFA /* Pods.bridgesupport */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = Pods.bridgesupport; path = Pods/Pods.bridgesupport; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -100,6 +102,7 @@
5165757C144AFA12002A4EFA /* Resources */ = {
isa = PBXGroup;
children = (
516575F0144B498E002A4EFA /* Pods.bridgesupport */,
5165757D144AFA12002A4EFA /* MainMenu.xib */,
);
name = Resources;
......@@ -168,6 +171,7 @@
51657582144AFA12002A4EFA /* rb_main.rb in Resources */,
51657584144AFA12002A4EFA /* AppDelegate.rb in Resources */,
51657598144B2608002A4EFA /* Pods.xcconfig in Resources */,
516575F1144B498E002A4EFA /* Pods.bridgesupport in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
Pod::File.new do |f|
f.platform = :osx
f.generate_bridge_support = true
f.dependency 'ASIHTTPRequest'
f.dependency 'AFNetworking'
f.dependency 'CocoaLumberjack'
end
......@@ -4,24 +4,25 @@ module Pod
class Informative < StandardError
end
autoload :Command, 'cocoapods/command'
autoload :Config, 'cocoapods/config'
autoload :Dependency, 'cocoapods/dependency'
autoload :Downloader, 'cocoapods/downloader'
autoload :Executable, 'cocoapods/executable'
autoload :Installer, 'cocoapods/installer'
autoload :Resolver, 'cocoapods/resolver'
autoload :Source, 'cocoapods/source'
autoload :Spec, 'cocoapods/specification'
autoload :Specification, 'cocoapods/specification'
autoload :Version, 'cocoapods/version'
autoload :BridgeSupportGenerator, 'cocoapods/bridge_support_generator'
autoload :Command, 'cocoapods/command'
autoload :Config, 'cocoapods/config'
autoload :Dependency, 'cocoapods/dependency'
autoload :Downloader, 'cocoapods/downloader'
autoload :Executable, 'cocoapods/executable'
autoload :Installer, 'cocoapods/installer'
autoload :Resolver, 'cocoapods/resolver'
autoload :Source, 'cocoapods/source'
autoload :Spec, 'cocoapods/specification'
autoload :Specification, 'cocoapods/specification'
autoload :Version, 'cocoapods/version'
module Xcode
autoload :Config, 'cocoapods/xcode/config'
autoload :Project, 'cocoapods/xcode/project'
autoload :Config, 'cocoapods/xcode/config'
autoload :Project, 'cocoapods/xcode/project'
end
autoload :Pathname, 'pathname'
autoload :Pathname, 'pathname'
end
class Pathname
......
module Pod
class BridgeSupportGenerator
include Config::Mixin
extend Executable
executable :gen_bridge_metadata
attr_reader :headers
def initialize(headers)
@headers = headers
end
def expanded_headers
headers.map { |header| config.project_pods_root + header }
end
def search_paths
expanded_headers.map { |header| "-I#{header.dirname}" }.uniq
end
def create_in(root)
puts "==> Generating BridgeSupport metadata file" unless config.silent?
cflags = "-c '#{search_paths.join(' ')}'"
output = "-o '#{root + 'Pods.bridgesupport'}'"
gen_bridge_metadata "#{cflags} #{output} #{expanded_headers.join(' ')}"
end
end
end
......@@ -3,11 +3,13 @@ module Pod
def executable(name)
define_method(name) do |command|
if Config.instance.verbose?
puts "#{name} #{command}"
`#{name} #{command} 1>&2`
else
`#{name} #{command} 2> /dev/null`
end
end
private name
end
end
end
......@@ -45,7 +45,7 @@ module Pod
# Add header files to a `copy header build phase` for each destination
# directory in the pod's header directory.
set.specification.copy_header_mappings.each do |header_dir, files|
spec.copy_header_mappings.each do |header_dir, files|
copy_phase = xcodeproj.add_copy_header_build_phase(spec.name, header_dir)
files.each do |file|
group.add_source_file(file, copy_phase)
......@@ -58,6 +58,12 @@ module Pod
xcconfig.merge!('USER_HEADER_SEARCH_PATHS' => user_header_search_paths.sort.uniq.join(" "))
end
def bridge_support_generator
BridgeSupportGenerator.new(build_specification_sets.map do |set|
set.specification.header_files
end.flatten)
end
# TODO we need a spec that tests that all dependencies are first downloaded/installed
# before #generate_project is called!
def install!
......@@ -66,8 +72,10 @@ module Pod
set.specification.install!
end
generate_project
xcodeproj.create_in(config.project_pods_root)
xcconfig.create_in(config.project_pods_root)
root = config.project_pods_root
xcodeproj.create_in(root)
xcconfig.create_in(root)
bridge_support_generator.create_in(root) if @specification.generate_bridge_support
end
end
end
......@@ -116,6 +116,8 @@ module Pod
attr_accessor :platform
attr_accessor :generate_bridge_support
# Not attributes
include Config::Mixin
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment