Files
cappuccino/Objective-J/Runtime/rakefile
T
2009-03-15 02:25:23 -07:00

66 lines
1.6 KiB
Ruby

#!/usr/bin/env ruby
require 'rake'
require '../../common'
require 'objective-j'
$PRODUCT = File.join($PRODUCT_DIR, 'Objective-J')
$ENVIRONMENT_PRODUCT = File.join($ENVIRONMENT_FRAMEWORKS_DIR, 'Objective-J')
$LICENSE_FILE = File.join($PRODUCT, 'LICENSE')
$BROWSER_FILE = File.join($PRODUCT, 'Objective-J.js')
$RHINO_FILE = File.join($PRODUCT, 'Rhino.platform', 'Objective-J.js')
task :Products => [$BROWSER_FILE, $RHINO_FILE]
task :build => [:Products, $ENVIRONMENT_PRODUCT]
=begin
task :environment => [$PRODUCT_FILE, $LICENSE_FILE, ENVIRONMENT_FRAMEWORKS_DIR] do
cp_r($BUILD_PRODUCT_DIR, ENVIRONMENT_FRAMEWORKS_DIR)
end
=end
Files = [ 'LICENSE.txt',
'constants.js',
'utilities.js',
'runtime.js',
'dictionary.js',
'plist.js',
'file.js',
'exception.js',
'preprocess.js',
'evaluate.js',
'debug.js',
'bootstrap.js'];
file_d $BROWSER_FILE => Files do |t|
build_product(t.name)
end
file_d $RHINO_FILE => Files do |t|
build_product(t.name)
end
#Framework in environment directory
file_d $ENVIRONMENT_PRODUCT => [:Products] do
cp_r($PRODUCT, $ENVIRONMENT_PRODUCT)
end
def build_product(path, *flags)
IO.popen("gcc -E -x c -P -", "w+") do |preprocessor|
Files.select { |name| name.match(/\.js$/) }.each do |fileName|
preprocessor.puts IO.read(fileName)
end
preprocessor.close_write
File.open(path, "w") do |file|
file.write(IO.read("LICENSE.txt") + preprocessor.read)
end
end
end