rakefile.rb in rhodes-2.2.4.beta.1 vs rakefile.rb in rhodes-2.2.5.beta.1

- old
+ new

@@ -49,10 +49,98 @@ puts `#{rhoruby} -I#{File.expand_path('spec/framework_spec/app/')} -I#{File.expand_path('lib/framework')} -I#{File.expand_path('lib/test')} -Clib/test framework_test.rb` end end +$application_build_configs_keys = ['security_token'] + +def make_application_build_config_header_file + inc_file = File.join($startdir, "platform", "shared", "common", "app_build_configs.c") + File.open(inc_file, "w") do |f| + f.puts "// WARNING! THIS FILE IS GENERATED AUTOMATICALLY! DO NOT EDIT IT MANUALLY!" + f.puts "// Generated #{Time.now.to_s}" + f.puts "" + f.puts "#include <string.h>" + f.puts "" + f.puts '#include "app_build_configs.h"' + f.puts "" + + f.puts 'static const char* keys[] = { ""' + $application_build_configs.keys.each do |key| + f.puts ',"'+key+'"' + end + f.puts '};' + f.puts '' + + count = 1 + + f.puts 'static const char* values[] = { ""' + $application_build_configs.keys.each do |key| + f.puts ',"'+$application_build_configs[key]+'"' + count = count + 1 + end + f.puts '};' + f.puts '' + + f.puts '#define APP_BUILD_CONFIG_COUNT '+count.to_s + f.puts '' + f.puts 'const char* get_app_build_config_item(const char* key) {' + f.puts ' int i;' + f.puts ' for (i = 1; i < APP_BUILD_CONFIG_COUNT; i++) {' + f.puts ' if (strcmp(key, keys[i]) == 0) {' + f.puts ' return values[i];' + f.puts ' }' + f.puts ' }' + f.puts ' return 0;' + f.puts '}' + f.puts '' + + end +end + +def make_application_build_config_java_file + file_name = $startdir + "/platform/bb/RubyVM/src/com/rho/AppBuildConfig.java" + + File.open(file_name, "w") do |f| + f.puts "// WARNING! THIS FILE IS GENERATED AUTOMATICALLY! DO NOT EDIT IT MANUALLY!" + f.puts "// Generated #{Time.now.to_s}" + + f.puts "package com.rho;" + f.puts "" + f.puts "public class AppBuildConfig {" + + f.puts 'static final String keys[] = { ""' + $application_build_configs.keys.each do |key| + f.puts ',"'+key+'"' + end + f.puts '};' + f.puts '' + + count = 1 + + f.puts 'static final String values[] = { ""' + $application_build_configs.keys.each do |key| + f.puts ',"'+$application_build_configs[key]+'"' + count = count + 1 + end + f.puts '};' + f.puts '' + + f.puts 'static final int APP_BUILD_CONFIG_COUNT = '+count.to_s + ';' + f.puts '' + f.puts 'public static String getItem(String key){' + f.puts ' for (int i = 1; i < APP_BUILD_CONFIG_COUNT; i++) {' + f.puts ' if ( key.compareTo( keys[i]) == 0) {' + f.puts ' return values[i];' + f.puts ' }' + f.puts ' }' + f.puts ' return null;' + f.puts '}' + f.puts "}" + end +end + namespace "config" do task :common do $startdir = File.dirname(__FILE__) $binextensions = [] buildyml = 'rhobuild.yml' @@ -104,10 +192,36 @@ extensions += $app_config["extensions"] if $app_config["extensions"] and $app_config["extensions"].is_a? Array extensions += $app_config[$config["platform"]]["extensions"] if $app_config[$config["platform"]] and $app_config[$config["platform"]]["extensions"] and $app_config[$config["platform"]]["extensions"].is_a? Array $app_config["extensions"] = extensions + + $hidden_app = $app_config["hidden_app"].nil?() ? "0" : $app_config["hidden_app"] + + + #application build configs + application_build_configs = {} + + $application_build_configs_keys.each do |key| + value = $app_config[key] + if $app_config[$config["platform"]] != nil + if $app_config[$config["platform"]][key] != nil + value = $app_config[$config["platform"]][key] + end + end + if value != nil + application_build_configs[key] = value + end + end + $application_build_configs = application_build_configs + + if $current_platform == "bb" + make_application_build_config_java_file + else + make_application_build_config_header_file + end + end out = `javac -version 2>&1` puts "\n\nYour java bin folder does not appear to be on your path.\nThis is required to use rhodes.\n\n" unless $? == 0 end @@ -309,11 +423,11 @@ chdir start clear_linker_settings init_extensions(startdir, dest) - + chdir startdir #throw "ME" cp_r app + '/app',File.join($srcdir,'apps'), :preserve => true cp_r app + '/public', File.join($srcdir,'apps'), :preserve => true if File.exists? app + '/public' cp app + '/rhoconfig.txt', File.join($srcdir,'apps'), :preserve => true @@ -417,10 +531,11 @@ namespace "build" do namespace "bundle" do task :xruby do #needs $config, $srcdir, $excludelib, $bindir app = $app_path + jpath = $config["env"]["paths"]["java"] startdir = pwd dest = $srcdir xruby = File.dirname(__FILE__) + '/res/build-tools/xruby-0.3.3.jar' compileERB = "lib/build/compileERB/bb.rb" rhodeslib = File.dirname(__FILE__) + "/lib/framework" @@ -480,11 +595,12 @@ chdir $tmpdir puts `jar cf #{$bindir}/RhoBundle.jar #{$all_files_mask}` rm_rf $tmpdir mkdir_p $tmpdir chdir $srcdir -=end - puts `jar uf ../RhoBundle.jar apps/#{$all_files_mask}` +=end + + puts `"#{File.join(jpath,'jar')}" uf ../RhoBundle.jar apps/#{$all_files_mask}` unless $? == 0 puts "Error creating Rhobundle.jar" exit 1 end chdir startdir \ No newline at end of file