Skip to content

Instantly share code, notes, and snippets.

@zdennis
Created March 17, 2014 20:50
Show Gist options
  • Save zdennis/9608082 to your computer and use it in GitHub Desktop.
Save zdennis/9608082 to your computer and use it in GitHub Desktop.
Add a Rakefile for generating a bridgesupport file whenever the project is built in XCode. This is for RubyMotion when building out a third-party library.
DIR = File.dirname(__FILE__)
BRIDGESUPPORT_FILE = "BridgeSupport.bridgesupport"
namespace :gen do
desc "Generates the bridgesupport file for RubyMotion"
task :bridgesupport do
Dir.chdir(DIR) do
SHELL_COMMAND=<<-EOS.gsub(/^\s*/, '')
#!/bin/sh
BRIDGESUPPORT_INCLUDES=`find . -type d | ruby -e "puts '-I' + STDIN.read.split(/\n/).join(' -I')"`
BRIDGESUPPORT_FILES=`find . -name "*.h" | ruby -e "puts STDIN.read.split(/\n/).join(' ')"`
echo gen_bridge_metadata -F complete --no-64-bit -c \\\"$BRIDGESUPPORT_INCLUDES\\\" $BRIDGESUPPORT_FILES -o #{BRIDGESUPPORT_FILE}
EOS
command = `#{SHELL_COMMAND}`
system command
end
end
end
# Inside of Motion::Project::App.setup do/end blocks add
app.bridgesupport_files << File.dirname(File.dirname(__FILE__)) + "/YOUR_TARGET_NAME/BridgeSupport.bridgesupport"
cd $SRCROOT && cd $TARGET_NAME && rake gen:bridgesupport
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment