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 @@ ...@@ -16,6 +16,7 @@
51657584144AFA12002A4EFA /* AppDelegate.rb in Resources */ = {isa = PBXBuildFile; fileRef = 51657583144AFA12002A4EFA /* AppDelegate.rb */; }; 51657584144AFA12002A4EFA /* AppDelegate.rb in Resources */ = {isa = PBXBuildFile; fileRef = 51657583144AFA12002A4EFA /* AppDelegate.rb */; };
51657598144B2608002A4EFA /* Pods.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 51657597144B2608002A4EFA /* Pods.xcconfig */; }; 51657598144B2608002A4EFA /* Pods.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 51657597144B2608002A4EFA /* Pods.xcconfig */; };
5165759B144B265B002A4EFA /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5165759A144B265B002A4EFA /* libPods.a */; }; 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 */ /* End PBXBuildFile section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
...@@ -30,7 +31,8 @@ ...@@ -30,7 +31,8 @@
51657581144AFA12002A4EFA /* rb_main.rb */ = {isa = PBXFileReference; lastKnownFileType = text.script.ruby; path = rb_main.rb; sourceTree = "<group>"; }; 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>"; }; 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>"; }; 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 */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
...@@ -100,6 +102,7 @@ ...@@ -100,6 +102,7 @@
5165757C144AFA12002A4EFA /* Resources */ = { 5165757C144AFA12002A4EFA /* Resources */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
516575F0144B498E002A4EFA /* Pods.bridgesupport */,
5165757D144AFA12002A4EFA /* MainMenu.xib */, 5165757D144AFA12002A4EFA /* MainMenu.xib */,
); );
name = Resources; name = Resources;
...@@ -168,6 +171,7 @@ ...@@ -168,6 +171,7 @@
51657582144AFA12002A4EFA /* rb_main.rb in Resources */, 51657582144AFA12002A4EFA /* rb_main.rb in Resources */,
51657584144AFA12002A4EFA /* AppDelegate.rb in Resources */, 51657584144AFA12002A4EFA /* AppDelegate.rb in Resources */,
51657598144B2608002A4EFA /* Pods.xcconfig in Resources */, 51657598144B2608002A4EFA /* Pods.xcconfig in Resources */,
516575F1144B498E002A4EFA /* Pods.bridgesupport in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
......
Pod::File.new do |f| Pod::File.new do |f|
f.platform = :osx f.platform = :osx
f.generate_bridge_support = true
f.dependency 'ASIHTTPRequest' f.dependency 'ASIHTTPRequest'
f.dependency 'AFNetworking'
f.dependency 'CocoaLumberjack'
end end
...@@ -4,24 +4,25 @@ module Pod ...@@ -4,24 +4,25 @@ module Pod
class Informative < StandardError class Informative < StandardError
end end
autoload :Command, 'cocoapods/command' autoload :BridgeSupportGenerator, 'cocoapods/bridge_support_generator'
autoload :Config, 'cocoapods/config' autoload :Command, 'cocoapods/command'
autoload :Dependency, 'cocoapods/dependency' autoload :Config, 'cocoapods/config'
autoload :Downloader, 'cocoapods/downloader' autoload :Dependency, 'cocoapods/dependency'
autoload :Executable, 'cocoapods/executable' autoload :Downloader, 'cocoapods/downloader'
autoload :Installer, 'cocoapods/installer' autoload :Executable, 'cocoapods/executable'
autoload :Resolver, 'cocoapods/resolver' autoload :Installer, 'cocoapods/installer'
autoload :Source, 'cocoapods/source' autoload :Resolver, 'cocoapods/resolver'
autoload :Spec, 'cocoapods/specification' autoload :Source, 'cocoapods/source'
autoload :Specification, 'cocoapods/specification' autoload :Spec, 'cocoapods/specification'
autoload :Version, 'cocoapods/version' autoload :Specification, 'cocoapods/specification'
autoload :Version, 'cocoapods/version'
module Xcode module Xcode
autoload :Config, 'cocoapods/xcode/config' autoload :Config, 'cocoapods/xcode/config'
autoload :Project, 'cocoapods/xcode/project' autoload :Project, 'cocoapods/xcode/project'
end end
autoload :Pathname, 'pathname' autoload :Pathname, 'pathname'
end end
class Pathname 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 ...@@ -3,11 +3,13 @@ module Pod
def executable(name) def executable(name)
define_method(name) do |command| define_method(name) do |command|
if Config.instance.verbose? if Config.instance.verbose?
puts "#{name} #{command}"
`#{name} #{command} 1>&2` `#{name} #{command} 1>&2`
else else
`#{name} #{command} 2> /dev/null` `#{name} #{command} 2> /dev/null`
end end
end end
private name
end end
end end
end end
...@@ -45,7 +45,7 @@ module Pod ...@@ -45,7 +45,7 @@ module Pod
# Add header files to a `copy header build phase` for each destination # Add header files to a `copy header build phase` for each destination
# directory in the pod's header directory. # 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) copy_phase = xcodeproj.add_copy_header_build_phase(spec.name, header_dir)
files.each do |file| files.each do |file|
group.add_source_file(file, copy_phase) group.add_source_file(file, copy_phase)
...@@ -58,6 +58,12 @@ module Pod ...@@ -58,6 +58,12 @@ module Pod
xcconfig.merge!('USER_HEADER_SEARCH_PATHS' => user_header_search_paths.sort.uniq.join(" ")) xcconfig.merge!('USER_HEADER_SEARCH_PATHS' => user_header_search_paths.sort.uniq.join(" "))
end 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 # TODO we need a spec that tests that all dependencies are first downloaded/installed
# before #generate_project is called! # before #generate_project is called!
def install! def install!
...@@ -66,8 +72,10 @@ module Pod ...@@ -66,8 +72,10 @@ module Pod
set.specification.install! set.specification.install!
end end
generate_project generate_project
xcodeproj.create_in(config.project_pods_root) root = config.project_pods_root
xcconfig.create_in(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 end
end end
...@@ -116,6 +116,8 @@ module Pod ...@@ -116,6 +116,8 @@ module Pod
attr_accessor :platform attr_accessor :platform
attr_accessor :generate_bridge_support
# Not attributes # Not attributes
include Config::Mixin 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