Rakefile in rhodes-5.5.18 vs Rakefile in rhodes-6.0.11

- old
+ new

@@ -46,10 +46,11 @@ require 'pathname' require 'rexml/document' require 'securerandom' require 'uri' require 'logger' +require 'rake' # It does not work on Mac OS X. rake -T prints nothing. So I comment this hack out. # NB: server build scripts depend on proper rake -T functioning. =begin #Look, another big fat hack. Make it so we can remove tasks from rake -T by setting comment to nil @@ -78,55 +79,111 @@ $startdir = File.dirname(__FILE__) $startdir.gsub!('\\', '/') chdir File.dirname(__FILE__), :verbose => Rake.application.options.trace + require File.join(pwd, 'lib/build/jake.rb') require File.join(pwd, 'lib/build/GeneratorTimeChecker.rb') +require File.join(pwd, 'lib/build/GeneralTimeChecker.rb') require File.join(pwd, 'lib/build/CheckSumCalculator.rb') require File.join(pwd, 'lib/build/SiteChecker.rb') require File.join(pwd, 'lib/build/ExtendedString.rb') require File.join(pwd, 'lib/build/rhohub.rb') require File.join(pwd, 'lib/build/BuildOutput.rb') require File.join(pwd, 'lib/build/BuildConfig.rb') require File.join(pwd, 'lib/build/RhoHubAccount.rb') require File.join(pwd, 'lib/build/rhoDevelopment.rb') -load File.join(pwd, 'lib/commonAPI/printing_zebra/ext/platform/wm/PrintingService/PrintingService/installer/Rakefile') -#load File.join(pwd, 'platform/bb/build/bb.rake') -load File.join(pwd, 'platform/android/build/android.rake') -load File.join(pwd, 'platform/iphone/rbuild/iphone.rake') -load File.join(pwd, 'platform/wm/build/wm.rake') -load File.join(pwd, 'platform/linux/tasks/linux.rake') -load File.join(pwd, 'platform/wp8/build/wp.rake') -load File.join(pwd, 'platform/osx/build/osx.rake') $timestamp_start_milliseconds = 0 + +module Rake + class Application + attr_accessor :current_task + end + class Task + alias :old_execute :execute + def execute(args=nil) + Rake.application.current_task = @name + old_execute(args) + end + end #class Task +end #module Rake + +class Logger + alias :original_add :add + + def add(severity, message = nil, progname = nil) + if (self.level == Logger::DEBUG) + begin + #try to get rake task name + taskName = Rake.application.current_task + rescue Exception => e + end + + if message + message = "#{taskName}|\t#{message}" + else + progname = "#{taskName}|\t#{progname}" + end + end + original_add( severity, message, progname ) + end +end + +def puts( s ) + if $logger + $logger.info(s) + else + Kernel::puts( s ) + end +end + $logger = Logger.new(STDOUT) if Rake.application.options.trace $logger.level = Logger::DEBUG else $logger.level = Logger::INFO end +Rake::FileUtilsExt.verbose(Rake.application.options.trace) + + $logger.formatter = proc do |severity,datetime,progname,msg| "[#{severity}]\t#{msg}\n" end +Jake.set_logger( $logger ) -def print_timestamp(msg = 'just for info') + +def print_timestamp(msg = 'just for info') if $timestamp_start_milliseconds == 0 $timestamp_start_milliseconds = (Time.now.to_f*1000.0).to_i end curmillis = (Time.now.to_f*1000.0).to_i - $timestamp_start_milliseconds - puts '-$TIME$- message [ '+msg+' ] time is { '+Time.now.utc.iso8601+' } milliseconds from start ('+curmillis.to_s+')' + $logger.debug '-$TIME$- message [ '+msg+' ] time is { '+Time.now.utc.iso8601+' } milliseconds from start ('+curmillis.to_s+')' end + + + +load File.join(pwd, 'lib/commonAPI/printing_zebra/ext/platform/wm/PrintingService/PrintingService/installer/Rakefile') +#load File.join(pwd, 'platform/bb/build/bb.rake') +load File.join(pwd, 'platform/android/build/android.rake') +load File.join(pwd, 'platform/iphone/rbuild/iphone.rake') +load File.join(pwd, 'platform/wm/build/wm.rake') +load File.join(pwd, 'platform/linux/tasks/linux.rake') +load File.join(pwd, 'platform/wp8/build/wp.rake') +load File.join(pwd, 'platform/uwp/build/uwp.rake') +load File.join(pwd, 'platform/osx/build/osx.rake') + + #------------------------------------------------------------------------ def get_dir_hash(dir, init = nil) hash = init hash = Digest::SHA2.new if hash.nil? @@ -155,11 +212,11 @@ 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 = ['nodejs_application', 'security_token', 'encrypt_database', 'android_title', 'iphone_db_in_approot', 'iphone_set_approot', 'iphone_userpath_in_approot', "iphone_use_new_ios7_status_bar_style", "iphone_full_screen", "webkit_outprocess", "webengine", "iphone_enable_startup_logging"] +$application_build_configs_keys = ['encrypt_files_key', 'nodejs_application', 'security_token', 'encrypt_database', 'android_title', 'iphone_db_in_approot', 'iphone_set_approot', 'iphone_userpath_in_approot', "iphone_use_new_ios7_status_bar_style", "iphone_full_screen", "webkit_outprocess", "webengine", "iphone_enable_startup_logging"] $winxpe_build = false def make_application_build_config_header_file f = StringIO.new("", "w+") @@ -220,11 +277,11 @@ Jake.modify_file_if_content_changed(File.join($startdir, "platform", "shared", "common", "app_build_configs.c"), f) end def make_application_build_capabilities_header_file - puts "%%% Prepare capability header file %%%" + $logger.debug "%%% Prepare capability header file %%%" f = StringIO.new("", "w+") f.puts "// WARNING! THIS FILE IS GENERATED AUTOMATICALLY! DO NOT EDIT IT MANUALLY!" #f.puts "// Generated #{Time.now.to_s}" f.puts "" @@ -244,15 +301,15 @@ end f.puts '' if $js_application || $nodejs_application - puts '#define RHO_NO_RUBY' + puts '#define RHO_NO_RUBY' if USE_TRACES f.puts '#define RHO_NO_RUBY' f.puts '#define RHO_NO_RUBY_API' else - puts '//#define RHO_NO_RUBY' + $logger.debug '//#define RHO_NO_RUBY' end Jake.modify_file_if_content_changed(File.join($startdir, "platform", "shared", "common", "app_build_capabilities.h"), f) end @@ -551,10 +608,11 @@ rm_rf File.join(extpath, "ext", "platform", "android", "generated") rm_rf File.join(extpath, "ext", "platform", "iphone", "generated") rm_rf File.join(extpath, "ext", "platform", "osx", "generated") rm_rf File.join(extpath, "ext", "platform", "wm", "generated") rm_rf File.join(extpath, "ext", "platform", "wp8", "generated") + rm_rf File.join(extpath, "ext", "platform", "uwp", "generated") rm_rf File.join(extpath, "ext", "public", "api", "generated") end end end end @@ -1831,27 +1889,37 @@ RhoPackages.set_root(args[:rho_dir]) end task :load do + require 'deep_merge' + print_timestamp('First timestamp') buildyml = 'rhobuild.yml' # read shared config $rhodes_home = create_rhodes_home() + conf_file = File.join($rhodes_home,buildyml) $shared_conf = {} if File.exists?(conf_file) + $logger.info "Shared config is available at #{File.join($rhodes_home,buildyml)}" $shared_conf = Jake.config(File.open(File.join($rhodes_home,buildyml))) end $current_platform_bridge = $current_platform unless $current_platform_bridge + $logger.info( "Using Rhodes configuration from path: #{buildyml}" ) + # read gem folder build config buildyml = ENV["RHOBUILD"] unless ENV["RHOBUILD"].nil? - $config = Jake.config(File.open(buildyml)) + $config = {} + $config = Jake.config(File.open(buildyml)) if File.file?(buildyml) + + $config = $config.deep_merge($shared_conf) if $shared_conf + $config["platform"] = $current_platform if $current_platform $config["env"]["app"] = "spec/framework_spec" if $rhosimulator_build $app_path = ENV["RHO_APP_PATH"] if ENV["RHO_APP_PATH"] && $app_path.nil? @@ -1934,11 +2002,11 @@ Jake.set_bbver($app_config["bbver"].to_s) end task :common => [:initialize] do - puts "Starting rhodes build system using ruby version: #{RUBY_VERSION}" + $logger.info "Starting rhodes build system using ruby version: #{RUBY_VERSION}" print_timestamp('config:common') if $app_config && !$app_config["sdk"].nil? BuildOutput.note('To use latest Rhodes gem, run migrate-rhodes-app in application folder or comment sdk in build.yml.','You use sdk parameter in build.yml') end @@ -1991,10 +2059,15 @@ end # gather main extensions extensions = [] extensions << "coreapi" #unless $app_config['re_buildstub'] + if ($current_platform == "iphone") || ($current_platform == "android") + extensions << "decryptstub" + else + puts "do not checking for encrypt/decrypt because not iOS/Android 1" + end extensions << "zlib" if $current_platform == "win32" # required by coreapi on win32 for gzip support in Network extensions += get_extensions extensions << "rhoconnect-client" if $rhosimulator_build extensions << "json" @@ -2103,10 +2176,14 @@ end if $current_platform == "wp8" $app_config['extensions'] = $app_config['extensions'] | ['barcode'] end + + if $current_platform == "uwp" + $app_config['extensions'] = $app_config['extensions'] | ['barcode'] + end end if $current_platform == "android" if $app_config['extensions'].index('rhoelementsext') $app_config['extensions'].delete('rhoelementsext') @@ -2189,25 +2266,42 @@ $use_shared_runtime = Jake.getBuildBoolProp("use_shared_runtime") $js_application = Jake.getBuildBoolProp("javascript_application") $nodejs_application = Jake.getBuildBoolProp("nodejs_application") - puts '%%%_%%% $js_application = '+$js_application.to_s - puts '%%%_%%% $nodejs_application = '+$nodejs_application.to_s + $logger.debug '%%%_%%% $js_application = '+$js_application.to_s + $logger.debug '%%%_%%% $nodejs_application = '+$nodejs_application.to_s if !$js_application && !$nodejs_application && !Dir.exists?(File.join($app_path, "app")) BuildOutput.error([ "Add javascript_application:true to build.yml, since application does not contain app folder.", "See: http://docs.rhomobile.com/guide/api_js#javascript-rhomobile-application-structure" ]); exit(1) end $shared_rt_js_appliction = ($js_application and $current_platform == "wm" and $app_config["capabilities"].index('shared_runtime')) - puts "%%%_%%% $shared_rt_js_application = #{$shared_rt_js_appliction}" + $logger.debug "%%%_%%% $shared_rt_js_application = #{$shared_rt_js_appliction}" $app_config['extensions'] = $app_config['extensions'] | ['rubyvm_stub'] if $shared_rt_js_appliction + # check for encrypting + if ($current_platform == "iphone") || ($current_platform == "android") + $encrypt_aes_key = nil + encrypt_file_extensions = $app_config["encrypt_file_extensions"] + encrypt_files_key = $app_config["encrypt_files_key"] + if (encrypt_file_extensions != nil) && (encrypt_files_key != nil) + if encrypt_file_extensions.is_a?(Array) && encrypt_files_key.is_a?(String) + $encrypt_aes_key = encrypt_files_key + $app_config['extensions'] = $app_config['extensions'] | ['openssl.so'] + $app_config['extensions'] = $app_config['extensions'] | ['decrypt'] + $app_config["extensions"].delete("decryptstub") + end + end + else + puts "do not checking for encrypt/decrypt because not iOS/Android" + end + if $current_platform == "bb" make_application_build_config_java_file() update_rhoprofiler_java_file() elsif $current_platform == "wp" else @@ -2227,12 +2321,12 @@ # it`s should be in the end of common:config task platform_task = "config:#{$current_platform}:app_config" Rake::Task[platform_task].invoke if Rake::Task.task_defined? platform_task - puts "$app_config['extensions'] : #{$app_config['extensions'].inspect}" - puts "$app_config['capabilities'] : #{$app_config['capabilities'].inspect}" + $logger.debug "$app_config['extensions'] : #{$app_config['extensions'].inspect}" + $logger.debug "$app_config['capabilities'] : #{$app_config['capabilities'].inspect}" end # end of config:common task :qt do $qtdir = ENV['QTDIR'] @@ -2497,13 +2591,16 @@ rhoapi_nodejs_folder = File.join( $app_path, "nodejs/rhoapi" ) end do_separate_js_modules = Jake.getBuildBoolProp("separate_js_modules", $app_config, false) - puts "rhoapi_js_folder: #{rhoapi_js_folder}" - puts 'init extensions' + $logger.debug "rhoapi_js_folder: #{rhoapi_js_folder}" + $logger.info 'Init extensions' + + $logger.debug "Extensions list: #{$app_config['extensions'].to_s}" + # TODO: checker init gen_checker = GeneratorTimeChecker.new gen_checker.init($startdir, $app_path) $app_config["extensions"].each do |extname| @@ -2555,11 +2652,16 @@ entry = extconf["entry"] nlib = extconf["nativelibs"] type = Jake.getBuildProp( "exttype", extconf ) xml_api_paths = extconf["xml_api_paths"] extconf_wp8 = $config["platform"] == "wp8" && (!extconf['wp8'].nil?) ? extconf['wp8'] : Hash.new - csharp_impl_all = (!extconf_wp8['csharp_impl'].nil?) ? true : false + extconf_uwp = $config["platform"] == "uwp" && (!extconf['uwp'].nil?) ? extconf['uwp'] : Hash.new + if ($config["platform"] == "wp8") + csharp_impl_all = (!extconf_wp8['csharp_impl'].nil?) ? true : false + else + csharp_impl_all = (!extconf_uwp['csharp_impl'].nil?) ? true : false + end if nlib != nil nlib.each do |libname| nativelib << libname end @@ -2605,24 +2707,24 @@ if (!extconf[$config["platform"]].nil?) && (!extconf[$config["platform"]]["libraries"].nil?) && (extconf[$config["platform"]]["libraries"].is_a? Array) libs = libs + extconf[$config["platform"]]["libraries"] end - if $config["platform"] == "wm" || $config["platform"] == "win32" || $config["platform"] == "wp8" + if $config["platform"] == "wm" || $config["platform"] == "win32" || $config["platform"] == "uwp" libs.each do |lib| - extconf_wp8_lib = !extconf_wp8[lib.downcase].nil? ? extconf_wp8[lib.downcase] : Hash.new - csharp_impl = csharp_impl_all || (!extconf_wp8_lib['csharp_impl'].nil?) - if extconf_wp8_lib['libname'].nil? + extconf_uwp_lib = !extconf_uwp[lib.downcase].nil? ? extconf_uwp[lib.downcase] : Hash.new + csharp_impl = csharp_impl_all || (!extconf_uwp_lib['csharp_impl'].nil?) + if extconf_uwp_lib['libname'].nil? extlibs << lib + (csharp_impl ? "Lib" : "") + ".lib" end if csharp_impl - wp8_root_namespace = !extconf_wp8_lib['root_namespace'].nil? ? extconf_wp8_lib['root_namespace'] : (!extconf_wp8['root_namespace'].nil? ? extconf_wp8['root_namespace'] : 'rho'); - extcsharplibs << (extconf_wp8_lib['libname'].nil? ? (lib + "Lib.lib") : (extconf_wp8_lib['libname'] + ".lib")) - extcsharppaths << "<#{lib.upcase}_ROOT>" + File.join(extpath, 'ext') + "</#{lib.upcase}_ROOT>" - extcsharpprojects << '<Import Project="$(' + lib.upcase + '_ROOT)\\platform\\wp8\\' + lib + 'Impl.targets" />' - extcsharpentries << "#{lib}FactoryComponent.setImpl(new #{wp8_root_namespace}.#{lib}Impl.#{lib}Factory())" + uwp_root_namespace = !extconf_uwp_lib['root_namespace'].nil? ? extconf_uwp_lib['root_namespace'] : 'rho' + extcsharplibs << (extconf_uwp_lib['libname'].nil? ? (lib + "Lib.lib") : (extconf_uwp_lib['libname'] + ".lib")) + extcsharppaths << "<#{lib.upcase}_ROOT>" + File.join(extpath, 'ext') + "</#{lib.upcase}_ROOT>" + extcsharpprojects << '<Import Project="$(' + lib.upcase + '_ROOT)\\platform\\uwp\\' + lib + 'Impl.targets" />' + extcsharpentries << "#{lib}FactoryComponent.setImpl(new #{uwp_root_namespace}.#{lib}Impl.#{lib}Factory())" end end else libs.map! { |lib| "lib" + lib + ".a" } extlibs += libs @@ -2691,14 +2793,14 @@ end end Dir.glob(extpath + "/public/api/generated/*.js").each do |f| if /(rho\.orm)|(rho\.ruby\.runtime)|(rho\.rhosim\.fix)/i.match(f.downcase()) - puts "add #{f} to extjsmodulefiles_opt.." + puts "add #{f} to extjsmodulefiles_opt.." if USE_TRACES extjsmodulefiles_opt << f else - puts "add #{f} to extjsmodulefiles.." + puts "add #{f} to extjsmodulefiles.." if USE_TRACES extjsmodulefiles << f end end end #end @@ -2741,14 +2843,14 @@ #TODO: checker update gen_checker.update exts = File.join($startdir, "platform", "shared", "ruby", "ext", "rho", "extensions.c") - if $config["platform"] == "wp8" - extscsharp = File.join($startdir, "platform", "wp8", "rhodes", "CSharpExtensions.cs") - extscsharptargets = File.join($startdir, "platform", "wp8", "rhodes", "CSharpExtensions.targets") - extscsharpcpp = File.join($startdir, "platform", "wp8", "rhoruntime", "CSharpExtensions.cpp") + if $config["platform"] == "uwp" + extscsharp = File.join($startdir, "platform", "uwp", "rhodes", "CSharpExtensions.cs") + extscsharptargets = File.join($startdir, "platform", "uwp", "rhodes", "CSharpExtensions.targets") + extscsharpcpp = File.join($startdir, "platform", "uwp", "rhoruntime", "CSharpExtensions.cpp") end puts "exts " + exts # deploy Common API JS implementation @@ -2767,11 +2869,11 @@ mkdir_p rhoapi_nodejs_folder end # if !$skip_build_js_api_files if extjsmodulefiles.count > 0 - puts 'extjsmodulefiles=' + extjsmodulefiles.to_s + puts 'extjsmodulefiles=' + extjsmodulefiles.to_s if USE_TRACES write_modules_js(rhoapi_js_folder, "rhoapi-modules.js", extjsmodulefiles, do_separate_js_modules) $ebfiles_shared_rt_js_appliction = ($js_application and ($current_platform == "wm" or $current_platform == "android") and $app_config["capabilities"].index('shared_runtime')) if $use_shared_runtime || $ebfiles_shared_rt_js_appliction start_path = Dir.pwd @@ -2791,11 +2893,11 @@ write_modules_js(rhoapi_nodejs_folder, "rhoapi.js", extnodejsmodulefiles, false) end # make rhoapi-modules-ORM.js only if not shared-runtime (for WM) build if !$shared_rt_js_appliction if extjsmodulefiles_opt.count > 0 - puts 'extjsmodulefiles_opt=' + extjsmodulefiles_opt.to_s + puts 'extjsmodulefiles_opt=' + extjsmodulefiles_opt.to_s if USE_TRACES #write_modules_js(rhoapi_js_folder, "rhoapi-modules-ORM.js", extjsmodulefiles_opt, do_separate_js_modules) write_orm_modules_js(rhoapi_js_folder, extjsmodulefiles_opt) end end end @@ -2810,11 +2912,11 @@ if $config["platform"] != "bb" f = StringIO.new("", "w+") f.puts "// WARNING! THIS FILE IS GENERATED AUTOMATICALLY! DO NOT EDIT IT MANUALLY!" f.puts "int rho_ruby_is_started();" - if $config["platform"] == "wm" || $config["platform"] == "win32" || $config["platform"] == "wp8" + if $config["platform"] == "wm" || $config["platform"] == "win32" || $config["platform"] == "wp8" || $config["platform"] == "uwp" # Add libraries through pragma extlibs.each do |lib| f.puts "#pragma comment(lib, \"#{lib}\")" end @@ -3038,10 +3140,11 @@ Dir.glob("**/*.wm.*").each { |f| rm f } Dir.glob("**/*.win32.*").each { |f| rm f } Dir.glob("**/*.wp.*").each { |f| rm f } Dir.glob("**/*.wp8.*").each { |f| rm f } + Dir.glob("**/*.uwp.*").each { |f| rm f } Dir.glob("**/*.sym.*").each { |f| rm f } Dir.glob("**/*.iphone.*").each { |f| rm f } Dir.glob("**/*.bb.*").each { |f| rm f } Dir.glob("**/*.bb6.*").each { |f| rm f } Dir.glob("**/*.android.*").each { |f| rm f } @@ -3115,10 +3218,17 @@ File.open(File.join(rhodes_dir, 'version'), 'wb') { |f| f.write(version) } end namespace "bundle" do + + desc "Generate AES key for bundle encryption" + task :generate_AES_key do + generated_key = Jake.generate_AES_key + puts 'Generated AES key is : "'+generated_key+'"' + end + task :prepare_native_generated_files do currentdir = Dir.pwd() chdir $startdir @@ -3304,28 +3414,29 @@ if !$js_application && !$nodejs_application create_manifest cp compileERB, $srcdir puts "Running default.rb" - cmd_str = "#{$rubypath} -I#{rhodeslib} #{$srcdir}/default.rb" + cmd_str = "#{$rubypath} -E UTF-8 -I#{rhodeslib} #{$srcdir}/default.rb" + puts cmd_str if defined?(Bundler) Bundler.with_clean_env do puts `#{cmd_str}` end else puts `#{cmd_str}` - end + end unless $? == 0 puts "Error interpreting erb code" exit 1 end rm "#{$srcdir}/default.rb" cp compileRB, $srcdir puts "Running compileRB" - cmd_str = "#{$rubypath} -I#{rhodeslib} #{$srcdir}/compileRB.rb" + cmd_str = "#{$rubypath} -E UTF-8 -I#{rhodeslib} #{$srcdir}/compileRB.rb" if defined?(Bundler) Bundler.with_clean_env do puts `#{cmd_str}` end else @@ -3364,10 +3475,16 @@ if not $minify_types.empty? minify_js_and_css($srcdir,$minify_types) end end + #encrypt files + if $encrypt_aes_key != nil + Jake.encrypt_files_by_AES($srcdir, $encrypt_aes_key, $app_config["encrypt_file_extensions"]) + end + + chdir startdir cp_r "platform/shared/db/res/db", File.join($srcdir, "db") # create bundle map file with the final information Jake.build_file_map($srcdir, $file_map_name) @@ -3406,11 +3523,11 @@ minify_inplace_batch(files_to_minify) if files_to_minify.length>0 end def minify_inplace_batch(files_to_minify) - puts "minifying file list: #{files_to_minify}" + puts "minifying file list: #{files_to_minify}" if USE_TRACES cmd = "java -jar #{$minifier} -o \"x$:x\"" files_to_minify.each { |f| cmd += " #{f}" } @@ -3428,21 +3545,21 @@ rescue Exception => e puts "Minify error: #{e.inspect}" error = e.inspect end - puts "Minification done: #{status}" + puts "Minification done: #{status}" if USE_TRACES if !status || !status.exitstatus.zero? - puts "WARNING: Minification error!" + puts "WARNING: Minification error!" if USE_TRACES error = output if error.nil? BuildOutput.warning(["Minification errors occured. Minificator stderr output: \n" + error], 'Minification error') end end def minify_inplace(filename,type) - puts "minify file: #{filename}" + puts "minify file: #{filename}" if USE_TRACES f = StringIO.new("", "w+") f.write(File.read(filename)) f.rewind() @@ -3475,11 +3592,11 @@ error = e.inspect #raise e end if !status || !status.exitstatus.zero? - puts "WARNING: Minification error!" + puts "WARNING: Minification error!" if USE_TRACES error = output if error.nil? BuildOutput.warning(['Failed to minify ' + filename, 'Output: ' + error], 'Minification error') @@ -3576,11 +3693,11 @@ end end end task :get_ext_xml_paths, [:platform] do |t,args| - throw "You must pass in platform(win32, wm, android, iphone, wp8)" if args.platform.nil? + throw "You must pass in platform(win32, wm, android, iphone, wp8, uwp)" if args.platform.nil? $current_platform = args.platform $current_platform_bridge = args.platform Rake::Task["config:common"].invoke @@ -3590,11 +3707,11 @@ puts res_xmls end desc "Generate rhoapi-modules.js file with coreapi and javascript parts of extensions" task :update_rho_modules_js, [:platform] do |t,args| - throw "You must pass in platform(win32, wm, android, iphone, wp8, all)" if args.platform.nil? + throw "You must pass in platform(win32, wm, android, iphone, wp8, uwp, all)" if args.platform.nil? $current_platform = args.platform $current_platform = 'wm' if args.platform == 'all' $current_platform_bridge = args.platform @@ -3817,10 +3934,11 @@ task :tasks do Rake::Task.tasks.each {|t| puts t.to_s.ljust(27) + "# " + t.comment.to_s} end task :switch_app do + puts "Preparing rhobuild.yml" rhobuildyml = File.dirname(__FILE__) + "/rhobuild.yml" if File.exists? rhobuildyml config = YAML::load_file(rhobuildyml) else puts "Cant find rhobuild.yml" @@ -3949,11 +4067,11 @@ startJSModules = [] startJSModules_opt = [] endJSModules = [] rhoapi_js_folder = File.join( $app_path, "public/api" ) - puts "rhoapi_js_folder: #{rhoapi_js_folder}" + puts "rhoapi_js_folder: #{rhoapi_js_folder}" if USE_TRACES do_separate_js_modules = Jake.getBuildBoolProp("separate_js_modules", $app_config, false) # TODO: checker init gen_checker = GeneratorTimeChecker.new @@ -4044,10 +4162,12 @@ if f.downcase().end_with?("jquery-2.0.2-rho-custom.min.js") startJSModules.unshift(f) elsif f.downcase().end_with?("rhoapi.js") startJSModules << f + elsif f.downcase().end_with?("rhonodejsapi.js") + puts "ignore honodejsapi.js" elsif f.downcase().end_with?("rho.application.js") endJSModules << f elsif f.downcase().end_with?("rho.database.js") endJSModules << f elsif f.downcase().end_with?("rho.newormhelper.js") @@ -4059,14 +4179,14 @@ extjsmodulefiles << f end end Dir.glob(extpath + "/public/api/generated/*.js").each do |f| if /(rho\.orm)|(rho\.ruby\.runtime)|(rho\.rhosim\.fix)/i.match(f.downcase()) - puts "add #{f} to extjsmodulefiles_opt.." + puts "add #{f} to extjsmodulefiles_opt.." if USE_TRACES extjsmodulefiles_opt << f else - puts "add #{f} to extjsmodulefiles.." + puts "add #{f} to extjsmodulefiles.." if USE_TRACES extjsmodulefiles << f end end end @@ -4086,16 +4206,16 @@ rm_rf rhoapi_js_folder if Dir.exist?(rhoapi_js_folder) mkdir_p rhoapi_js_folder end # if extjsmodulefiles.count > 0 - puts "extjsmodulefiles: #{extjsmodulefiles}" + puts "extjsmodulefiles: #{extjsmodulefiles}" if USE_TRACES write_modules_js(rhoapi_js_folder, "rhoapi-modules.js", extjsmodulefiles, do_separate_js_modules) end # if extjsmodulefiles_opt.count > 0 - puts "extjsmodulefiles_opt: #{extjsmodulefiles_opt}" + puts "extjsmodulefiles_opt: #{extjsmodulefiles_opt}" if USE_TRACES #write_modules_js(rhoapi_js_folder, "rhoapi-modules-ORM.js", extjsmodulefiles_opt, do_separate_js_modules) write_orm_modules_js(rhoapi_js_folder, extjsmodulefiles_opt) end sim_conf += "ext_path=#{config_ext_paths}\r\n" if config_ext_paths && config_ext_paths.length() > 0 @@ -4112,10 +4232,12 @@ next end sim_conf += "#{key}=#{value}\r\n" end + sim_conf += "platform=#{RUBY_PLATFORM}\r\n" + fname = File.join(fdir, 'rhosimconfig.txt') File.open(fname, "wb") do |fconf| fconf.write( sim_conf ) end end @@ -4139,11 +4261,27 @@ if $config['env']['paths']['rhosimulator'] and $config['env']['paths']['rhosimulator'].length() > 0 path = File.join( $config['env']['paths']['rhosimulator'], "rhosimulator.exe" ) else path = File.join( $startdir, "platform/win32/RhoSimulator/rhosimulator.exe" ) end - cmd = path + + oldDir = File.join( $startdir, "platform/win32/RhoSimulator" ) + newDir = oldDir + #newDir = File.join( $startdir, "platform/win32/RhoSimulatorRunnable" ) + + #rm_rf newDir if Dir.exist?(newDir) + #FileUtils.mkpath newDir + + #cp_r File.join(oldDir, "."), newDir + + qtdir = ENV['QTDIR'] + if !qtdir.nil? + cp File.join(qtdir, "bin/Qt5Core.dll"), newDir + args << "-remote-debugging-port=9090" + end + + cmd = File.join(newDir, 'rhosimulator.exe') elsif RUBY_PLATFORM =~ /darwin/ if $config['env']['paths']['rhosimulator'] and $config['env']['paths']['rhosimulator'].length() > 0 path = File.join( $config['env']['paths']['rhosimulator'], "RhoSimulator.app" ) else path = File.join( $startdir, "platform/osx/bin/RhoSimulator/RhoSimulator.app" ) @@ -4261,11 +4399,13 @@ task :rhosimulator do if RUBY_PLATFORM =~ /(win|w)32$/ Rake::Task["build:win32:rhosimulator"].invoke elsif RUBY_PLATFORM =~ /darwin/ Rake::Task["build:osx:rhosimulator"].invoke + elsif RUBY_PLATFORM =~ /linux/ + Rake::Task["build:linux:rhosimulator"].invoke else - puts "Sorry, at this time RhoSimulator can be built for Windows and Mac OS X only" + puts "Sorry, at this time RhoSimulator can be built for Windows, Mac OS X or Linux only" exit 1 end end task :rhosimulator_version do