diff --git a/.ci/check_cache_and_install_gems.sh b/.ci/check_cache_and_install_gems.sh index f2187d38436..23d9bc6aa77 100755 --- a/.ci/check_cache_and_install_gems.sh +++ b/.ci/check_cache_and_install_gems.sh @@ -7,23 +7,23 @@ if [[ -z $GEMS_INSTALLED ]]; then rvm gemset list gem list -gem install rest-client -v 2.0.2 --no-document -gem install listen -v 3.0.6 --no-document -gem install zip --no-document -gem install templater -v 1.0.0 --no-document -gem install rake -v 12.0.0 --no-document -gem install uuid -v 2.3.7 --no-document -gem install systemu -v 2.6.4 --no-document -gem install json -v 1.8.6 --no-document -gem install CFPropertyList -v 2.2.8 --no-document -gem install naturally -v 1.3.2 --no-document -gem install simctl -v 1.5.6 --no-document -gem install listen -v 3.0.6 --no-document -gem install rubyzip -v 1.2.2 --no-document -gem install ffi -v 1.9.24 --no-document -gem install rdoc -v 4.2.2 --no-document -gem install deep_merge -v 1.1.1 --no-document -gem install nokogiri -v 1.10.4 --no-document -gem install net-scp -v 1.2.1 --no-document -gem install net-ssh -v 4.2.0 --no-document +# gem install rest-client -v 2.0.2 --no-document +# gem install listen -v 3.0.6 --no-document +# gem install zip --no-document +# gem install templater -v 1.0.0 --no-document +# gem install rake -v 12.0.0 --no-document +# gem install uuid -v 2.3.7 --no-document +# gem install systemu -v 2.6.4 --no-document +# gem install json -v 1.8.6 --no-document +# gem install CFPropertyList -v 2.2.8 --no-document +# gem install naturally -v 1.3.2 --no-document +# gem install simctl -v 1.5.6 --no-document +# gem install listen -v 3.0.6 --no-document +# gem install rubyzip -v 1.2.2 --no-document +# gem install ffi -v 1.9.24 --no-document +# gem install rdoc -v 4.2.2 --no-document +# gem install deep_merge -v 1.1.1 --no-document +# gem install nokogiri -v 1.10.4 --no-document +# gem install net-scp -v 1.2.1 --no-document +# gem install net-ssh -v 4.2.0 --no-document fi diff --git a/.ci/check_cache_and_install_ruby.sh b/.ci/check_cache_and_install_ruby.sh index 510df71603c..d2472f624c2 100755 --- a/.ci/check_cache_and_install_ruby.sh +++ b/.ci/check_cache_and_install_ruby.sh @@ -1,15 +1,10 @@ #!/usr/bin/env bash set -x -RUBY_INSTALLED=$(rvm list | grep ruby-2.5.1) +RUBY_INSTALLED=$(rvm list | grep ruby-$RHO_RUBY) echo $RUBY_INSTALLED if [[ -z $RUBY_INSTALLED ]]; then export HOMEBREW_NO_INSTALL_CLEANUP=1 #brew install openssl -rvm install --autolibs=disable 2.5.1 +rvm install --autolibs=disable $RHO_RUBY fi - - - - - diff --git a/.ci/hosts/linux/before_install.sh b/.ci/hosts/linux/before_install.sh new file mode 100755 index 00000000000..ff294d6d949 --- /dev/null +++ b/.ci/hosts/linux/before_install.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -x + +#sudo adduser $USER libvirt +#sudo adduser $USER kvm diff --git a/.ci/modify_target_abi.rb b/.ci/modify_target_abi.rb new file mode 100755 index 00000000000..3ec139ac9a2 --- /dev/null +++ b/.ci/modify_target_abi.rb @@ -0,0 +1,12 @@ +#!/usr/bin/env ruby + +require 'yaml' + +file = ARGV[0] +abis = ARGV[1].split(',') + +cfg = YAML::load_file(file) + +cfg['android']['abis'] = abis + +File.write( file, cfg.to_yaml ) diff --git a/.ci/targets/android/build_artefact_for_deploy.sh b/.ci/targets/android/build_artefact_for_deploy.sh index 52a90154671..842e32f83c7 100755 --- a/.ci/targets/android/build_artefact_for_deploy.sh +++ b/.ci/targets/android/build_artefact_for_deploy.sh @@ -2,4 +2,5 @@ set -x +$TRAVIS_BUILD_DIR/.ci/modify_target_abi.rb ./build.yml $ANDROID_ABIS rake device:android:debug diff --git a/.ci/targets/android/run_app_on_simulator.sh b/.ci/targets/android/run_app_on_simulator.sh index 833f3b82f10..8a76c7fa6d4 100755 --- a/.ci/targets/android/run_app_on_simulator.sh +++ b/.ci/targets/android/run_app_on_simulator.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash set -x +$TRAVIS_BUILD_DIR/.ci/modify_target_abi.rb build.yml $ANDROID_ABIS rake run:android diff --git a/.ci/targets/iphone/rho_setup.sh b/.ci/targets/iphone/rho_setup.sh new file mode 100755 index 00000000000..7167b30e589 --- /dev/null +++ b/.ci/targets/iphone/rho_setup.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +set -x +printf "\n\n\n\n\n\n\n\n\n" | rhodes-setup diff --git a/.ci/targets/rhosimulator_osx/install.sh b/.ci/targets/rhosimulator_osx/install.sh index a439061a4dc..c5e4bbaaa01 100755 --- a/.ci/targets/rhosimulator_osx/install.sh +++ b/.ci/targets/rhosimulator_osx/install.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +#gem install rest-client --no-document #gem install deep_merge --no-document #gem install templater --no-document #gem install uuid --no-document +#gem install listen --no-document diff --git a/.ci/targets/rhosimulator_osx/post_gem.sh b/.ci/targets/rhosimulator_osx/post_gem.sh new file mode 100755 index 00000000000..4e5a09b3603 --- /dev/null +++ b/.ci/targets/rhosimulator_osx/post_gem.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +set -x + +#echo "Building rhosim" +#cd $TRAVIS_BUILD_DIR +#rm $TRAVIS_BUILD_DIR/platform/osx/bin/RhoSimulator/RhoSimulator.app.zip +#rm -rf $TRAVIS_BUILD_DIR/platform/osx/bin/RhoSimulator/* +#rake build:osx:rhosimulator +#cd $TRAVIS_BUILD_DIR/platform/osx/bin/RhoSimulator/ +#zip -r -y RhoSimulator.app.zip RhoSimulator.app +#rm -rf $TRAVIS_BUILD_DIR/platform/osx/bin/RhoSimulator/RhoSimulator.app +#cd $TRAVIS_BUILD_DIR +# > build.log + +#OUT=$? + +#if [ $OUT -eq 0 ];then +# echo "RhoSimulator built successfully" +#else +# echo "Error building RhoSimulator" +# cat build.log +#fi + +#exit $OUT diff --git a/.ci/targets/rhosimulator_osx/pre_gem.sh b/.ci/targets/rhosimulator_osx/pre_gem.sh index 0bed11d82d0..1d6c51e58bb 100755 --- a/.ci/targets/rhosimulator_osx/pre_gem.sh +++ b/.ci/targets/rhosimulator_osx/pre_gem.sh @@ -25,7 +25,7 @@ rm -rf $TRAVIS_BUILD_DIR/platform/osx/bin/RhoSimulator/* rake build:osx:rhosimulator cd $TRAVIS_BUILD_DIR/platform/osx/bin/RhoSimulator/ zip -r -y RhoSimulator.app.zip RhoSimulator.app -rm -rf $TRAVIS_BUILD_DIR/platform/osx/bin/RhoSimulator/RhoSimulator.app +# rm -rf $TRAVIS_BUILD_DIR/platform/osx/bin/RhoSimulator/RhoSimulator.app cd $TRAVIS_BUILD_DIR # > build.log @@ -38,4 +38,4 @@ else cat build.log fi -exit $OUT \ No newline at end of file +exit $OUT diff --git a/.gitignore b/.gitignore index 6b548ed1e24..baea276f28e 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,8 @@ rhobuild.yml rhobuild.*.yml lastbuildoptions.yml +Gemfile.lock + #platform/iphone/Info.plist lib/commonAPI/*/*/*/generated/ lib/commonAPI/*/*/*/*/generated/ diff --git a/.travis.yml b/.travis.yml index 888ef9d2936..9dd45d07335 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,39 +1,43 @@ before_install: + - $TRAVIS_BUILD_DIR/.ci/safe_run.sh $TRAVIS_BUILD_DIR/.ci/hosts/$TRAVIS_OS_NAME/before_install.sh - $TRAVIS_BUILD_DIR/.ci/safe_run.sh $TRAVIS_BUILD_DIR/.ci/targets/$RHO_TARGET/before_install.sh install: - ANDROID_NDK_HOME="${HOME}/android-ndk-r${NDK_NUMBER}" - $TRAVIS_BUILD_DIR/.ci/safe_run.sh $TRAVIS_BUILD_DIR/.ci/check_cache_and_install_ruby.sh -- rvm use 2.5.1 +- rvm use $RHO_RUBY - | if [[ -z $(rvm gemset list | grep rhodes) ]]; then rvm gemset create rhodes; fi - rvm gemset use rhodes -- $TRAVIS_BUILD_DIR/.ci/safe_run.sh $TRAVIS_BUILD_DIR/.ci/check_cache_and_install_gems.sh +#- $TRAVIS_BUILD_DIR/.ci/safe_run.sh $TRAVIS_BUILD_DIR/.ci/check_cache_and_install_gems.sh +- bundle install - $TRAVIS_BUILD_DIR/.ci/safe_run.sh $TRAVIS_BUILD_DIR/.ci/hosts/$TRAVIS_OS_NAME/install.sh - $TRAVIS_BUILD_DIR/.ci/safe_run.sh $TRAVIS_BUILD_DIR/.ci/targets/$RHO_TARGET/install.sh script: - ANDROID_NDK_HOME="${HOME}/android-ndk-r${NDK_NUMBER}" - rvm list -- rvm use 2.5.1 +- rvm use $RHO_RUBY - rvm gemset list - rvm gemset use rhodes +- gem install bundler - gem list - cd $TRAVIS_BUILD_DIR #- .ci/hosts/$TRAVIS_OS_NAME/build_rhoruby.sh #TODO - $TRAVIS_BUILD_DIR/.ci/safe_run.sh $TRAVIS_BUILD_DIR/.ci/targets/$RHO_TARGET/pre_gem.sh -- rake gem -- travis_wait 30 gem install ./rhodes-$(cat ./version).gem --no-document --ignore-dependencies -f +- $TRAVIS_BUILD_DIR/lib/build/buildgem.rb +- travis_wait 30 gem install ./rhodes-$(cat ./version).gem - $TRAVIS_BUILD_DIR/.ci/safe_run.sh $TRAVIS_BUILD_DIR/.ci/targets/$RHO_TARGET/rho_setup.sh - .ci/install_rhoconnect-client.sh - | if [[ -n $RHO_TAU_EXTENSIONS ]]; then .ci/install_rho-tau-extensions.sh; fi +- $TRAVIS_BUILD_DIR/.ci/safe_run.sh $TRAVIS_BUILD_DIR/.ci/targets/$RHO_TARGET/post_gem.sh - cd $HOME - rhodes app vanilla_rhodes_app @@ -94,33 +98,74 @@ android: - android-26 - android-${RHO_ANDROID_LEVEL:-19} - addon-google_apis-google-${RHO_ANDROID_LEVEL:-19} +# - sys-img-x86-android-${RHO_ANDROID_LEVEL:-19} - sys-img-armeabi-v7a-android-${RHO_ANDROID_LEVEL:-19} + env: global: - BUILD_ARTEFACTS_DIR=$HOME/build_artefacts - S3_JOB_DIR="$TRAVIS_COMMIT"/"$TRAVIS_OS_NAME" - S3_DEPLOY_DIR="$TRAVIS_REPO_SLUG"/"$TRAVIS_BRANCH" - QTDIR="$HOME/Qt5.13.2/5.13.2/clang_64" + - RHO_RUBY="${RHO_RUBY:=2.7.0}" + - ANDROID_ABIS="${ANDROID_ABIS:=arm,aarch64}" #osx_image: xcode9.1 +#addons: +# apt: +# packages: +# - bridge-utils +# - libpulse0 +# - libvirt-bin +# - qemu-kvm +# - virtinst +# - ubuntu-vm-builder + +#addons: +# apt: +# packages: +# - bridge-utils +# - libpulse0 +# - libvirt-bin +# - qemu-kvm +# - virtinst +# - ubuntu-vm-builder + matrix: include: +#ios targets - language: objective-c os: osx #osx_image: xcode11.4 - env: RHO_TARGET="rhosimulator_osx" CACHE_NAME="RVM_OSX" RHO_RUNNER_SCRIPT="run_app_on_simulator.sh" + env: RHO_TARGET="rhosimulator_osx" CACHE_NAME="RVM_OSX" RHO_RUNNER_SCRIPT="run_app_on_simulator.sh" RHO_RUBY="2.7.0" - language: objective-c os: osx #osx_image: xcode11.4 - env: RHO_TARGET="iphone" RHO_APP="auto_common_spec" CACHE_NAME="RVM_OSX" RHO_RUNNER_SCRIPT="run_test_on_simulator.sh" + env: RHO_TARGET="iphone" RHO_APP="auto_common_spec" CACHE_NAME="RVM_OSX" RHO_RUNNER_SCRIPT="run_test_on_simulator.sh" RHO_RUBY="2.6.5" - language: objective-c os: osx #osx_image: xcode11.4 - env: RHO_TARGET="iphone" RHO_APP="framework_spec" CACHE_NAME="RVM_OSX" RHO_RUNNER_SCRIPT="run_test_on_simulator.sh" + env: RHO_TARGET="iphone" RHO_APP="framework_spec" CACHE_NAME="RVM_OSX" RHO_RUNNER_SCRIPT="run_test_on_simulator.sh" RHO_RUBY="2.7.0" + + - language: objective-c + os: osx + osx_image: xcode11.4 + env: RHO_TARGET="iphone" RHO_APP="sas" CACHE_NAME="RVM_OSX" RHO_RUNNER_SCRIPT="run_app_on_simulator.sh" + + - language: objective-c + os: osx + osx_image: xcode11.4 + env: RHO_TARGET="iphone" RHO_APP="universal_push_example" CACHE_NAME="RVM_OSX" RHO_RUNNER_SCRIPT="run_app_on_simulator.sh" + + - language: objective-c + os: osx + osx_image: xcode11.4 + env: RHO_TARGET="iphone" RHO_APP="rhodes_fcm_test" CACHE_NAME="RVM_OSX" RHO_RUNNER_SCRIPT="run_app_on_simulator.sh" + - language: objective-c os: osx @@ -147,9 +192,15 @@ matrix: osx_image: xcode11.4 env: RHO_TARGET="iphone_native_lib" RHO_APP="rhodes_lib_examples" CACHE_NAME="RVM_OSX2" RHO_RUNNER_SCRIPT="run_app_on_simulator.sh" + - language: objective-c + os: osx + osx_image: xcode11.4 + env: RHO_TARGET="iphone_native_lib" RHO_APP="rhodes_lib_examples" CACHE_NAME="RVM_OSX2" RHO_RUNNER_SCRIPT="run_app_on_simulator.sh" + +#linux targets - language: c++ os: linux - env: RHO_TARGET="linux" RHO_APP="auto_common_spec" CACHE_NAME="RVM_LINUX" MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" RHO_RUNNER_SCRIPT="run_app_on_simulator.sh" + env: RHO_TARGET="linux" RHO_APP="auto_common_spec" CACHE_NAME="RVM_LINUX" MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" RHO_RUNNER_SCRIPT="run_app_on_simulator.sh" RHO_RUBY="2.5.7" dist: bionic addons: apt: @@ -167,17 +218,18 @@ matrix: - debhelper - fakeroot +#android targets - language: android os: linux - env: RHO_TARGET="android" RHO_APP="framework_spec" CACHE_NAME="RVM_LINUX" RHO_ANDROID_LEVEL="21" NDK_NUMBER="17c" RHO_RUNNER_SCRIPT="run_test_on_simulator.sh" + env: RHO_TARGET="android" RHO_APP="framework_spec" CACHE_NAME="RVM_LINUX" RHO_ANDROID_LEVEL="21" NDK_NUMBER="20" RHO_RUNNER_SCRIPT="run_test_on_simulator.sh" RHO_RUBY="2.5.7" ANDROID_ABIS="arm,x86" - language: android os: linux - env: RHO_TARGET="android" RHO_APP="auto_common_spec" CACHE_NAME="RVM_LINUX" RHO_ANDROID_LEVEL="21" NDK_NUMBER="17c" RHO_RUNNER_SCRIPT="run_test_on_simulator.sh" + env: RHO_TARGET="android" RHO_APP="auto_common_spec" CACHE_NAME="RVM_LINUX" RHO_ANDROID_LEVEL="21" NDK_NUMBER="20" RHO_RUNNER_SCRIPT="run_test_on_simulator.sh" RHO_RUBY="2.6.5" - language: android os: linux - env: RHO_TARGET="android" RHO_APP="auto_common_spec" CACHE_NAME="RVM_LINUX" RHO_ANDROID_LEVEL="21" NDK_NUMBER="20" RHO_RUNNER_SCRIPT="run_test_on_simulator.sh" + env: RHO_TARGET="android" RHO_APP="auto_common_spec" CACHE_NAME="RVM_LINUX" RHO_ANDROID_LEVEL="21" NDK_NUMBER="20" RHO_RUNNER_SCRIPT="run_test_on_simulator.sh" RUBY_VERSION="2.7.0" - language: android os: linux diff --git a/Gemfile b/Gemfile new file mode 100644 index 00000000000..4a01a4522d9 --- /dev/null +++ b/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' do + gemspec :name => 'rhodes' +end \ No newline at end of file diff --git a/Rakefile b/Rakefile index 6e935e3ee15..d799860372d 100644 --- a/Rakefile +++ b/Rakefile @@ -24,6 +24,10 @@ # http://rhomobile.com #------------------------------------------------------------------------ +task :gem do + load 'lib/build/buildgem.rb' +end + require_relative 'lib/build/rho_packages.rb' require File.join(File.dirname(__FILE__), 'lib/build/required_time.rb') @@ -47,8 +51,8 @@ require 'pathname' require 'rexml/document' require 'securerandom' require 'uri' -require 'logger' require 'rake' +require 'logger' # 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. @@ -82,7 +86,6 @@ $push_type = -1 chdir File.dirname(__FILE__), :verbose => (Rake.application.options.trace == true) - require File.join(pwd, 'lib/build/jake.rb') require File.join(pwd, 'lib/build/RhoLogger.rb') require File.join(pwd, 'lib/build/GeneratorTimeChecker.rb') @@ -97,6 +100,23 @@ require File.join(pwd, 'lib/build/RhoHubAccount.rb') require File.join(pwd, 'lib/build/rhoDevelopment.rb') +$logger = Logger.new(STDOUT) +if Rake.application.options.trace + ENV["RHODES_BUILD_LOGGER_LEVEL"]= "DEBUG" + $logger.level = Logger::DEBUG +else + ENV["RHODES_BUILD_LOGGER_LEVEL"]= "INFO" + $logger.level = Logger::INFO +end + + +$logger.formatter = proc do |severity,datetime,progname,msg| + "[#{severity}]\t#{msg}\n" +end + +Jake.set_logger( $logger ) + + $timestamp_start_milliseconds = 0 @@ -116,28 +136,9 @@ module Rake end #module Rake - - -$logger = Logger.new(STDOUT) -if Rake.application.options.trace - ENV["RHODES_BUILD_LOGGER_LEVEL"]= "DEBUG" - $logger.level = Logger::DEBUG -else - ENV["RHODES_BUILD_LOGGER_LEVEL"]= "INFO" - $logger.level = Logger::INFO -end - - Rake::FileUtilsExt.verbose(Rake.application.options.trace == true) -$logger.formatter = proc do |severity,datetime,progname,msg| - "[#{severity}]\t#{msg}\n" -end - -Jake.set_logger( $logger ) - - def print_timestamp(msg = 'just for info') if $timestamp_start_milliseconds == 0 $timestamp_start_milliseconds = (Time.now.to_f*1000.0).to_i @@ -287,7 +288,7 @@ def make_application_build_capabilities_header_file f.puts '' if $js_application || $nodejs_application - puts '#define RHO_NO_RUBY' if USE_TRACES + $logger.debug '#define RHO_NO_RUBY' f.puts '#define RHO_NO_RUBY' f.puts '#define RHO_NO_RUBY_API' else @@ -2340,7 +2341,7 @@ def copy_assets(asset, file_map) dest = File.join($srcdir,'apps/public') - cp_r asset + "/.", dest, :preserve => true, :remove_destination => true, :verbose => USE_TRACES + cp_r asset + "/.", dest, :preserve => true, :remove_destination => true, :verbose => Rake.application.options.trace end def clear_linker_settings @@ -2789,11 +2790,11 @@ def init_extensions(dest, mode = "") 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.." if USE_TRACES + if /(rho\.orm)|(rho\.ruby\.runtime)|(rho\.rhosim\.fix)/i.match(f.downcase()) + $logger.debug "add #{f} to extjsmodulefiles_opt.." extjsmodulefiles_opt << f else - puts "add #{f} to extjsmodulefiles.." if USE_TRACES + $logger.debug "add #{f} to extjsmodulefiles.." extjsmodulefiles << f end end @@ -2866,7 +2867,7 @@ def init_extensions(dest, mode = "") # if !$skip_build_js_api_files if extjsmodulefiles.count > 0 - puts 'extjsmodulefiles=' + extjsmodulefiles.to_s if USE_TRACES + $logger.debug "extjsmodulefiles=#{extjsmodulefiles.to_s}" 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')) @@ -2890,7 +2891,7 @@ def init_extensions(dest, mode = "") # 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 if USE_TRACES + $logger.debug 'extjsmodulefiles_opt=' + extjsmodulefiles_opt.to_s #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 @@ -3001,7 +3002,7 @@ def public_folder_cp_r(src_dir, dst_dir, level, file_map, start_path) return if src_dir == dst_dir - mkdir_p dst_dir, :verbose => USE_TRACES if not File.exists? dst_dir + mkdir_p dst_dir, :verbose => Rake.application.options.trace if not File.exists? dst_dir Dir.foreach(src_dir) do |filename| next if filename.eql?('.') || filename.eql?('..') @@ -3032,7 +3033,7 @@ def public_folder_cp_r(src_dir, dst_dir, level, file_map, start_path) puts "old_time=" + old_time.to_s if Rake.application.options.trace end - cp filepath, dst_path, :preserve => true, :verbose => USE_TRACES + cp filepath, dst_path, :preserve => true, :verbose => Rake.application.options.trace end end end @@ -3522,7 +3523,7 @@ namespace "build" do end def minify_inplace_batch(files_to_minify) - puts "minifying file list: #{files_to_minify}" if USE_TRACES + $logger.debug "minifying file list: #{files_to_minify}" cmd = "java -jar #{$minifier} -o \"x$:x\"" @@ -3536,21 +3537,21 @@ namespace "build" do begin output, error, status = Open3.capture3(cmd) rescue Exception => e - puts "Minify error: #{e.inspect}" + $logger.debug "Minify error: #{e.inspect}" error = e.inspect end - puts "Minification done: #{status}" if USE_TRACES + $logger.debug "Minification done: #{status}" if !status || !status.exitstatus.zero? - puts "WARNING: Minification error!" if USE_TRACES + $logger.debug "WARNING: Minification error!" 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}" if USE_TRACES + $logger.debug "minify file: #{filename}" f = StringIO.new("", "w+") f.write(File.read(filename)) @@ -3587,7 +3588,7 @@ namespace "build" do end if !status || !status.exitstatus.zero? - puts "WARNING: Minification error!" if USE_TRACES + $logger.debug "WARNING: Minification error!" error = output if error.nil? @@ -3871,29 +3872,6 @@ namespace "buildall" do end end -task :gem do - puts "Removing old gem" - rm_rf Dir.glob("rhodes*.gem") - puts "Copying Rakefile" - cp "Rakefile", "rakefile.rb" - - puts "Building manifest" - out = "" - Dir.glob("**/*") do |fname| - # TODO: create exclusion list - next unless File.file? fname - next if fname =~ /rhoconnect-client/ - next if fname =~ /^spec\/api_generator_spec/ - next if fname =~ /ruby-standalone/ - - out << fname + "\n" - end - File.open("Manifest.txt",'w') {|f| f.write(out)} - - puts "Building gem" - Jake.run3('gem build rhodes.gemspec') -end - namespace "rhomobile-debug" do task :gem do puts "Removing old gem" @@ -3929,13 +3907,12 @@ task :tasks do end task :switch_app do - puts "Preparing rhobuild.yml" + $logger.info "Preparing rhobuild.yml" rhobuildyml = File.dirname(__FILE__) + "/rhobuild.yml" if File.exists? rhobuildyml config = YAML::load_file(rhobuildyml) else - puts "Cant find rhobuild.yml" - exit 1 + $logger.warn "Cant find rhobuild.yml" end config["env"]["app"] = $app_path.gsub(/\\/,"/") File.open( rhobuildyml, 'w' ) do |out| @@ -4080,7 +4057,7 @@ namespace "run" do endJSModules = [] rhoapi_js_folder = File.join( $app_path, "public/api" ) - puts "rhoapi_js_folder: #{rhoapi_js_folder}" if USE_TRACES + $logger.debug "rhoapi_js_folder: #{rhoapi_js_folder}" do_separate_js_modules = Jake.getBuildBoolProp("separate_js_modules", $app_config, false) @@ -4192,10 +4169,10 @@ namespace "run" do 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.." if USE_TRACES + $logger.debug "add #{f} to extjsmodulefiles_opt.." extjsmodulefiles_opt << f else - puts "add #{f} to extjsmodulefiles.." if USE_TRACES + $logger.debug "add #{f} to extjsmodulefiles.." extjsmodulefiles << f end end @@ -4219,12 +4196,12 @@ namespace "run" do end # if extjsmodulefiles.count > 0 - puts "extjsmodulefiles: #{extjsmodulefiles}" if USE_TRACES + $logger.debug "extjsmodulefiles: #{extjsmodulefiles}" 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}" if USE_TRACES + $logger.debug "extjsmodulefiles_opt: #{extjsmodulefiles_opt}" #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 diff --git a/appveyor.yml b/appveyor.yml index 4305c8a6337..803679a8d4f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,10 +9,10 @@ environment: testable_application_repository: https://github.com/rhomobile/RMS-Testing.git test_app_folder: C:\TAU\RMS-Testing\ test_app_subfolder: auto\feature_def\auto_common_spec\ - build_command: "build:rhosimulator" + build_command: build:win32:rhosimulator_to C:/TAU/rhosim/RhoSimulator.zip app_name: RhoSimulator target_os: win32 - target_artefact_path: C:\Ruby23\lib\ruby\gems\2.3.0\gems\rhodes-7.3.0\platform\win32\RhoSimulator\ + target_artefact_path: C:\TAU\rhosim\ target_artefact_file_name: RhoSimulator.zip - win32_auto_common_spec: @@ -109,10 +109,10 @@ build: off install: - set PATH=C:\Ruby23\bin;%PATH% - set RAKEOPT=-rdevkit - - gem install rest-client --no-document -f - - gem install listen --no-document -f - - gem install zip --no-document -f - - gem install net-scp --no-document -f +# - gem install rest-client --no-document -f +# - gem install listen --no-document -f +# - gem install zip --no-document -f +# - gem install net-scp --no-document -f # - gem install bundler --quiet --no-ri --no-rdoc -f # - bundler --version @@ -121,7 +121,7 @@ before_test: - gem -v - bundle -v - cp rhobuild.yml.example rhobuild.yml - - rake gem + - ruby C:\TAU\rhodes\lib\build\buildgem.rb - set /P BUILD_VERSION= "config:android" do - print_timestamp('build:android:libsqlite START') + class BuildContext + attr_accessor :libname + attr_accessor :sourcelist + attr_accessor :extra_copmiler_args + end - srcdir = File.join($shareddir, "sqlite") - objdir = $objdir["sqlite"] - libname = $libname["sqlite"] - sourcelist = File.join($builddir, 'libsqlite_build.files') + class LibBuilder - libdir = File.dirname(libname) - mkdir_p libdir unless File.directory? libdir + attr_accessor :context - args = ["-I\"#{srcdir}\"", "-I\"#{$shareddir}\""] + @@results = {} - ENV['SOURCEPATH'] = File.join($androidpath,'..','..') - ENV['SOURCELIST'] = File.join($builddir, 'libsqlite_build.files') - ENV["ANDROID_NDK"] = $androidndkpath - ENV["ANDROID_API_LEVEL"] = $min_sdk_level.to_s - ENV["RHO_ROOT"] = $startdir - ENV["RHO_INC"] = $appincdir - ENV["TARGETPATH"] = File.dirname($libname["sqlite"]) - ENV['TARGETLIB'] = File.basename($libname["sqlite"]) - ENV['TEMP_FILES_DIR'] = $objdir["sqlite"] - ENV['BUILDARGS'] = args.join(' ') + def self.results + @@results + end - $abis.each do |abi| - args = ['-f', "\"#{File.join($builddir,'Rakefile')}\"", "arch:#{abi}"] - args << '-m' - args << '--trace' if USE_TRACES - cc_run('rake', args, nil, false, nil, USE_TRACES) or raise "Build failed: sqlite" + def self.results=v + @@results = v + end + + def initialize + @context = BuildContext.new + @context.extra_copmiler_args = [] + end + + def build + objdir = File.join($tmpdir, @context.libname) + libdir = File.join($app_builddir, @context.libname) + mkdir_p libdir unless File.directory? libdir + + args = [] + + args.concat @context.extra_copmiler_args + + ENV['SOURCEPATH'] = File.join($androidpath,'..','..') + ENV['SOURCELIST'] = @context.sourcelist + ENV["ANDROID_NDK"] = $androidndkpath + ENV["ANDROID_API_LEVEL"] = $min_sdk_level.to_s + ENV["RHO_ROOT"] = $startdir + ENV["RHO_INC"] = $appincdir + ENV["TARGETPATH"] = libdir + ENV['TARGETLIB'] = "lib#{@context.libname}.a" + ENV['TEMP_FILES_DIR'] = objdir + ENV['BUILDARGS'] = args.join(' ') + + $abis.each { |abi| + args = ['-f', "\"#{File.join( $builddir,'Rakefile')}\"", "arch:#{abi}"] + args << '-m' + args << '--trace' if Rake.application.options.trace + cc_run('rake', args, nil, false, nil, Rake.application.options.trace) or raise "Build failed: #{@context.libname}" + } + + LibBuilder.results[@context.libname] = libdir end + end + + task :libsqlite => "config:android" do + print_timestamp('build:android:libsqlite START') + + b = LibBuilder.new + b.context.libname = 'sqlite' + b.context.sourcelist = File.join($builddir, 'libsqlite_build.files') + + srcdir = File.join($shareddir, "sqlite") + b.context.extra_copmiler_args = [ + "-I\"#{srcdir}\"", + "-I\"#{$shareddir}\"" + ] + b.build + print_timestamp('build:android:libsqlite FINISH') end + #not real build, just copy existing .so to build dir task :libopenssl => "config:android" do - if($openssl_skip) - next - end + + skip = ($app_config['extensions'].index('openssl.so') || $app_config['extensions'].index('openssl')) + next if skip + print_timestamp('build:android:libopenssl START') - objdir = $objdir["openssl"] - libname = $libname["openssl"] - libdir = File.dirname(libname) + libdir = File.join($app_builddir, 'openssl') mkdir_p libdir unless File.directory? libdir src_dir = "#{$shareddir}/../../lib/extensions/openssl.so/ext/android" @@ -1524,6 +1547,8 @@ namespace "build" do mkdir_p File.join(libdir, realabi) unless File.directory? File.join(libdir, realabi) cp_r File.join(src_dir, realabi, "libopenssl.so.a"), File.join(libdir, realabi, "libopenssl.a") end + + LibBuilder.results['openssl'] = libdir end task :libcurl => "config:android" do @@ -1536,293 +1561,163 @@ namespace "build" do #export CPPFLAGS="--sysroot /build/platforms/android-3/arch-arm -fPIC -mandroid -DANDROID -DOS_ANDROID" #./configure --without-ssl --without-ca-bundle --without-ca-path --without-libssh2 --without-libidn --disable-ldap --disable-ldaps --host=arm-eabi - srcdir = File.join $shareddir, "curl", "lib" - objdir = $objdir["curl"] - libname = $libname["curl"] - sourcelist = File.join($builddir, 'libcurl_build.files') - - libdir = File.dirname(libname) - mkdir_p libdir unless File.directory? libdir - - args = [] - args << "-DHAVE_CONFIG_H" - args << "-I\"#{srcdir}/../include\"" - args << "-I\"#{srcdir}\"" - args << "-I\"#{$shareddir}\"" + b = LibBuilder.new + b.context.libname = 'curl' + b.context.sourcelist = File.join($builddir, 'libcurl_build.files') - ENV['SOURCEPATH'] = File.join($androidpath,'..','..') - ENV['SOURCELIST'] = File.join($builddir, 'libcurl_build.files') - ENV["ANDROID_NDK"] = $androidndkpath - ENV["ANDROID_API_LEVEL"] = $min_sdk_level.to_s - ENV["RHO_ROOT"] = $startdir - ENV["RHO_INC"] = $appincdir - ENV["TARGETPATH"] = File.dirname($libname["curl"]) - ENV['TARGETLIB'] = File.basename($libname["curl"]) - ENV['TEMP_FILES_DIR'] = $objdir["curl"] - ENV['BUILDARGS'] = args.join(' ') + srcdir = File.join $shareddir, "curl", "lib" + b.context.extra_copmiler_args = [ + "-DHAVE_CONFIG_H", + "-I\"#{srcdir}/../include\"", + "-I\"#{srcdir}\"", + "-I\"#{$shareddir}\"" + ] + b.build - $abis.each do |abi| - args = ['-f', "\"#{File.join($builddir,'Rakefile')}\"", "arch:#{abi}"] - args << '-m' - args << '--trace' if USE_TRACES - cc_run('rake', args, nil, false, nil, USE_TRACES) or raise "Build failed: curl" - end print_timestamp('build:android:libcurl FINISH') end task :libruby => "config:android" do print_timestamp('build:android:libruby START') - srcdir = File.join $shareddir, "ruby" - objdir = $objdir["ruby"] - libname = $libname["ruby"] - sourcelist = File.join($builddir, 'libruby_build.files') - libdir = File.dirname(libname) - mkdir_p libdir unless File.directory? libdir - - args = [] - args << "-DRUBY_EXPORT" - args << "-Wno-uninitialized" - args << "-Wno-missing-field-initializers" - args << '-Wno-shadow' - args << "-I\"#{srcdir}/include\"" - args << "-I\"#{srcdir}/android\"" - args << "-I\"#{srcdir}/generated\"" - args << "-I\"#{srcdir}\"" - args << "-I\"#{srcdir}/..\"" - args << "-I\"#{srcdir}/../sqlite\"" - #args << "-I\"#{$startdir}/platform/android/Rhodes/jni/include\"" - - ENV['SOURCEPATH'] = File.join($androidpath,'..','..') - ENV['SOURCELIST'] = File.join($builddir, 'libruby_build.files') - ENV["ANDROID_NDK"] = $androidndkpath - ENV["ANDROID_API_LEVEL"] = $min_sdk_level.to_s - ENV["RHO_ROOT"] = $startdir - ENV["RHO_INC"] = $appincdir - ENV["TARGETPATH"] = File.dirname($libname["ruby"]) - ENV['TARGETLIB'] = File.basename($libname["ruby"]) - ENV['TEMP_FILES_DIR'] = $objdir["ruby"] - ENV['BUILDARGS'] = args.join(' ') + b = LibBuilder.new + b.context.libname = 'ruby' + b.context.sourcelist = File.join($builddir, 'libruby_build.files') + + srcdir = File.join($shareddir, "ruby") + b.context.extra_copmiler_args = [ + "-DRUBY_EXPORT", + "-Wno-uninitialized", + "-Wno-missing-field-initializers", + '-Wno-shadow', + "-I\"#{srcdir}/include\"", + "-I\"#{srcdir}/android\"", + "-I\"#{srcdir}/generated\"", + "-I\"#{srcdir}\"", + "-I\"#{srcdir}/..\"" +# "-I\"#{b.context.srcdir}/../sqlite\"" + ] + b.build - $abis.each do |abi| - args = ['-f', "\"#{File.join($builddir,'Rakefile')}\"", "arch:#{abi}"] - args << '-m' - args << '--trace' if USE_TRACES - cc_run('rake', args, nil, false, nil, USE_TRACES) or raise "Build failed: ruby" - end print_timestamp('build:android:libruby FINISH') end task :libjson => "config:android" do print_timestamp('build:android:libjson START') - srcdir = File.join $shareddir, "json" - objdir = $objdir["json"] - libname = $libname["json"] - sourcelist = File.join($builddir, 'libjson_build.files') - - libdir = File.dirname(libname) - mkdir_p libdir unless File.directory? libdir - args = [] - args << "-I\"#{srcdir}\"" - args << "-I\"#{srcdir}/..\"" + b = LibBuilder.new + b.context.libname = 'json' + b.context.sourcelist = File.join($builddir, 'libjson_build.files') - ENV['SOURCEPATH'] = File.join($androidpath,'..','..') - ENV['SOURCELIST'] = File.join($builddir, 'libjson_build.files') - ENV["ANDROID_NDK"] = $androidndkpath - ENV["ANDROID_API_LEVEL"] = $min_sdk_level.to_s - ENV["RHO_ROOT"] = $startdir - ENV["RHO_INC"] = $appincdir - ENV["TARGETPATH"] = File.dirname($libname["json"]) - ENV['TARGETLIB'] = File.basename($libname["json"]) - ENV['TEMP_FILES_DIR'] = $objdir["json"] - ENV['BUILDARGS'] = args.join(' ') + srcdir = File.join($shareddir, "json") + b.context.extra_copmiler_args = [ + "-I\"#{srcdir}\"", + "-I\"#{srcdir}/..\"" + ] + b.build - $abis.each do |abi| - args = ['-f', "\"#{File.join($builddir,'Rakefile')}\"", "arch:#{abi}"] - args << '-m' - args << '--trace' if USE_TRACES - cc_run('rake', args, nil, false, nil, USE_TRACES) or raise "Build failed: json" - end print_timestamp('build:android:libjson FINISH') end task :librholog => "config:android" do print_timestamp('build:android:librholog START') - srcdir = File.join $shareddir, "logging" - objdir = $objdir["rholog"] - libname = $libname["rholog"] - sourcelist = File.join($builddir, 'librholog_build.files') - libdir = File.dirname(libname) - mkdir_p libdir unless File.directory? libdir + b = LibBuilder.new + b.context.libname = 'rholog' + b.context.sourcelist = File.join($builddir, 'librholog_build.files') - args = [] - args << "-I\"#{srcdir}/..\"" + srcdir = File.join($shareddir, "logging") + b.context.extra_copmiler_args = [ + "-I\"#{srcdir}/..\"" + ] + b.build - ENV['SOURCEPATH'] = File.join($androidpath,'..','..') - ENV['SOURCELIST'] = File.join($builddir, 'librholog_build.files') - ENV["ANDROID_NDK"] = $androidndkpath - ENV["ANDROID_API_LEVEL"] = $min_sdk_level.to_s - ENV["RHO_ROOT"] = $startdir - ENV["RHO_INC"] = $appincdir - ENV["TARGETPATH"] = File.dirname($libname['rholog']) - ENV['TARGETLIB'] = File.basename($libname['rholog']) - ENV['TEMP_FILES_DIR'] = $objdir['rholog'] - ENV['BUILDARGS'] = args.join(' ') - - $abis.each do |abi| - args = ['-f', "\"#{File.join($builddir,'Rakefile')}\"", "arch:#{abi}"] - args << '-m' - args << '--trace' if USE_TRACES - cc_run('rake', args, nil, false, nil, USE_TRACES) or raise "Build failed: rholog" - end print_timestamp('build:android:librholog FINISH') end task :librhomain => "config:android" do print_timestamp('build:android:librhomain START') - srcdir = $shareddir - objdir = $objdir["rhomain"] - libname = $libname["rhomain"] - sourcelist = File.join($builddir, 'librhomain_build.files') - - libdir = File.dirname(libname) - mkdir_p libdir unless File.directory? libdir - - args = [] - args << "-I\"#{srcdir}\"" - args << "-I\"#{$commonapidir}\"" - ENV['SOURCEPATH'] = File.join($androidpath,'..','..') - ENV['SOURCELIST'] = File.join($builddir, 'librhomain_build.files') - ENV["ANDROID_NDK"] = $androidndkpath - ENV["ANDROID_API_LEVEL"] = $min_sdk_level.to_s - ENV["RHO_ROOT"] = $startdir - ENV["RHO_INC"] = $appincdir - ENV["TARGETPATH"] = File.dirname($libname['rhomain']) - ENV['TARGETLIB'] = File.basename($libname['rhomain']) - ENV['TEMP_FILES_DIR'] = $objdir['rhomain'] - ENV['BUILDARGS'] = args.join(' ') + b = LibBuilder.new + b.context.libname = 'rhomain' + b.context.sourcelist = File.join($builddir, 'librhomain_build.files') + b.context.extra_copmiler_args = [ + "-I\"#{$shareddir}\"", + "-I\"#{$commonapidir}\"" + ] + b.build - $abis.each do |abi| - args = ['-f', "\"#{File.join($builddir,'Rakefile')}\"", "arch:#{abi}"] - args << '-m' - args << '--trace' if USE_TRACES - cc_run('rake', args, nil, false, nil, USE_TRACES) or raise "Build failed: rhomain" - end print_timestamp('build:android:librhomain FINISH') end task :librhocommon => "config:android" do print_timestamp('build:android:librhocommon START') - objdir = $objdir["rhocommon"] - libname = $libname["rhocommon"] - sourcelist = File.join($builddir, 'librhocommon_build.files') - libdir = File.dirname(libname) - mkdir_p libdir unless File.directory? libdir + b = LibBuilder.new + b.context.libname = 'rhocommon' + b.context.sourcelist = File.join($builddir, 'librhocommon_build.files') + b.context.extra_copmiler_args = [ + "-I\"#{$shareddir}\"", + "-I\"#{$shareddir}/curl/include\"", + "-I\"#{$shareddir}/ruby/include\"", + "-I\"#{$shareddir}/ruby/android\"", + "-I\"#{$shareddir}/../../lib/extensions/openssl.so/ext/sources/include\"" + ] + b.build - args = [] - args << "-I\"#{$shareddir}\"" - args << "-I\"#{$shareddir}/curl/include\"" - args << "-I\"#{$shareddir}/ruby/include\"" - args << "-I\"#{$shareddir}/ruby/android\"" - args << "-I\"#{$shareddir}/../../lib/extensions/openssl.so/ext/sources/include\"" - - ENV['SOURCEPATH'] = File.join($androidpath,'..','..') - ENV['SOURCELIST'] = File.join($builddir, 'librhocommon_build.files') - ENV["ANDROID_NDK"] = $androidndkpath - ENV["ANDROID_API_LEVEL"] = $min_sdk_level.to_s - ENV["RHO_ROOT"] = $startdir - ENV["RHO_INC"] = $appincdir - ENV["TARGETPATH"] = File.dirname($libname['rhocommon']) - ENV['TARGETLIB'] = File.basename($libname['rhocommon']) - ENV['TEMP_FILES_DIR'] = $objdir['rhocommon'] - ENV['BUILDARGS'] = args.join(' ') - - $abis.each do |abi| - args = ['-f', "\"#{File.join($builddir,'Rakefile')}\"", "arch:#{abi}"] - args << '-m' - args << '--trace' if USE_TRACES - cc_run('rake', args, nil, false, nil, USE_TRACES) or raise "Build failed: rhocommon" - end print_timestamp('build:android:librhocommon FINISH') end task :librhodb => "config:android" do print_timestamp('build:android:librhodb START') - srcdir = File.join $shareddir, "db" - objdir = $objdir["rhodb"] - libname = $libname["rhodb"] - sourcelist = File.join($builddir, 'librhodb_build.files') - libdir = File.dirname(libname) - mkdir_p libdir unless File.directory? libdir + b = LibBuilder.new + b.context.libname = 'rhodb' + b.context.sourcelist = File.join($builddir, 'librhodb_build.files') - args = [] - args << "-I\"#{srcdir}\"" - args << "-I\"#{srcdir}/..\"" - args << "-I\"#{srcdir}/../sqlite\"" - args << "-I\"#{$shareddir}/ruby/include\"" - args << "-I\"#{$shareddir}/ruby/android\"" - - ENV['SOURCEPATH'] = File.join($androidpath,'..','..') - ENV['SOURCELIST'] = File.join($builddir, 'librhodb_build.files') - ENV["ANDROID_NDK"] = $androidndkpath - ENV["ANDROID_API_LEVEL"] = $min_sdk_level.to_s - ENV["RHO_ROOT"] = $startdir - ENV["RHO_INC"] = $appincdir - ENV["TARGETPATH"] = File.dirname($libname['rhodb']) - ENV['TARGETLIB'] = File.basename($libname['rhodb']) - ENV['TEMP_FILES_DIR'] = $objdir['rhodb'] - ENV['BUILDARGS'] = args.join(' ') + srcdir = File.join($shareddir, "db") + b.context.extra_copmiler_args = [ + "-I\"#{srcdir}\"", + "-I\"#{srcdir}/..\"", + "-I\"#{srcdir}/../sqlite\"", + "-I\"#{$shareddir}/ruby/include\"", + "-I\"#{$shareddir}/ruby/android\"" + ] + b.build - $abis.each do |abi| - args = ['-f', "\"#{File.join($builddir,'Rakefile')}\"", "arch:#{abi}"] - args << '-m' - args << '--trace' if USE_TRACES - cc_run('rake', args, nil, false, nil, USE_TRACES) or raise "Build failed: rhodb" - end print_timestamp('build:android:librhodb FINISH') end task :librhosync => "config:android" do print_timestamp('build:android:librhosync START') - srcdir = File.join $shareddir, "sync" - objdir = $objdir["rhosync"] - libname = $libname["rhosync"] - sourcelist = File.join($builddir, 'librhosync_build.files') - - libdir = File.dirname(libname) - mkdir_p libdir unless File.directory? libdir - args = [] - args << "-I\"#{srcdir}\"" - args << "-I\"#{srcdir}/..\"" - args << "-I\"#{srcdir}/../sqlite\"" + b = LibBuilder.new + b.context.libname = 'rhosync' + b.context.sourcelist = File.join($builddir, 'librhosync_build.files') - ENV['SOURCEPATH'] = File.join($androidpath,'..','..') - ENV['SOURCELIST'] = File.join($builddir, 'librhosync_build.files') - ENV["ANDROID_NDK"] = $androidndkpath - ENV["ANDROID_API_LEVEL"] = $min_sdk_level.to_s - ENV["RHO_ROOT"] = $startdir - ENV["RHO_INC"] = $appincdir - ENV["TARGETPATH"] = File.dirname($libname['rhosync']) - ENV['TARGETLIB'] = File.basename($libname['rhosync']) - ENV['TEMP_FILES_DIR'] = $objdir['rhosync'] - ENV['BUILDARGS'] = args.join(' ') + srcdir = File.join($shareddir, "sync") + b.context.extra_copmiler_args = [ + "-I\"#{srcdir}\"", + "-I\"#{srcdir}/..\"", + "-I\"#{srcdir}/../sqlite\"" + ] + b.build - $abis.each do |abi| - args = ['-f', "\"#{File.join($builddir,'Rakefile')}\"", "arch:#{abi}"] - args << '-m' - args << '--trace' if USE_TRACES - cc_run('rake', args, nil, false, nil, USE_TRACES) or raise "Build failed: rhosync" - end print_timestamp('build:android:librhosync FINISH') end - task :libs => [:libsqlite, :libcurl, :libruby, :libjson, :librhodb, :librhocommon, :librhomain, :librhosync, :librholog, :libopenssl] + task :libs => [ + :libsqlite, + :libcurl, + :libruby, + :libjson, + :librhodb, + :librhocommon, + :librhomain, + :librhosync, + :librholog, + :libopenssl + ] task :genconfig => "config:android" do print_timestamp('build:android:genconfig START') @@ -1960,10 +1855,10 @@ namespace "build" do deps = [] libs = [] - $libname.each do |name, lib| - deps << File.join( File.dirname(lib), realabi, File.basename(lib) ) + LibBuilder.results.each do |name, libdir| + deps << File.join( libdir, realabi, "lib#{name}.a" ) libs << name - args << "-L\"#{File.dirname(lib)}/#{realabi}\"" + args << "-L\"#{libdir}/#{realabi}\"" end libs.map! { |x| "-l#{x}" } @@ -2001,7 +1896,7 @@ namespace "build" do ENV['LINKDEPS'] = (deps+extlibs).join(' ') args = ['-f', "\"#{File.join($builddir,'Rakefile')}\"", "link:#{abi}"] - args << '--trace' #if USE_TRACES + args << '--trace' cc_run('rake', args, nil, false, nil, true) or raise "Build failed: rhodes" #Jake.run3("rake #{args.join(' ')}") end @@ -2341,7 +2236,7 @@ namespace "build" do Dir.glob(File.join($appres,'**','*.*')) do |filepath| args = ["compile", PathToWindowsWay(filepath), "-o", PathToWindowsWay($appres_flats)] - args << '-v' if USE_TRACES + args << '-v' if Rake.application.options.trace Jake.run($aapt2, args) end @@ -2349,7 +2244,7 @@ namespace "build" do res_dirs.each do |dir| Dir.glob(File.join(dir,'**','*.*')) do |filepath| args = ["compile", PathToWindowsWay(filepath), "-o", PathToWindowsWay($appres_flats)] - args << '-v' if USE_TRACES + args << '-v' if Rake.application.options.trace Jake.run($aapt2, args) end end @@ -2381,7 +2276,7 @@ namespace "build" do args += AndroidTools::MavenDepsExtractor.instance.aapt_args end - args << '-v' if USE_TRACES + args << '-v' if Rake.application.options.trace if ($rhodes_as_lib) require 'nokogiri' @@ -2953,7 +2848,7 @@ namespace "package" do end # Workaround: manually add files starting with '_' because aapt silently ignore such files when creating package - args = [ USE_TRACES ? "uvf" : "uf", resourcepkg] + args = [ Rake.application.options.trace ? "uvf" : "uf", resourcepkg] skip_underscores = true @@ -3015,7 +2910,7 @@ namespace "package" do end end - args = [ USE_TRACES ? "uvf" : "uf", resourcepkg] + args = [ Rake.application.options.trace ? "uvf" : "uf", resourcepkg] Dir.glob(File.join(respath,"**/*")).each do |f| next if not File.file?(f) diff --git a/platform/android/build/android_tools.rb b/platform/android/build/android_tools.rb index e9eba067558..8e8fd6750bd 100644 --- a/platform/android/build/android_tools.rb +++ b/platform/android/build/android_tools.rb @@ -29,8 +29,6 @@ # uses following globals # $adb, $applog_path -#USE_TRACES = Rake.application.options.trace - require 'pp' require 'open3' @@ -59,7 +57,7 @@ def fill_api_levels(sdkpath) end end - puts "+++ API LEVEL of #{platform}: #{apilevel}" if USE_TRACES + puts "+++ API LEVEL of #{platform}: #{apilevel}" if Rake.application.options.trace if apilevel != 0 $api_levels[marketversion] = apilevel @@ -105,7 +103,7 @@ def get_addon_classpath(addon_pattern, apilevel = nil) #libnames - if USE_TRACES + if Rake.application.options.trace puts "Looking for name pattern: #{addon_pattern}" puts "Looking for API level: #{apilevel}" if apilevel end @@ -136,7 +134,7 @@ def get_addon_classpath(addon_pattern, apilevel = nil) line.strip! if namepattern =~ line - puts "Parsing add-on: #{$1}" if USE_TRACES + puts "Parsing add-on: #{$1}" if Rake.application.options.trace cur_name = $1 break unless addonnamepattern =~ $1 next @@ -147,7 +145,7 @@ def get_addon_classpath(addon_pattern, apilevel = nil) if line =~ /^api=([0-9]+)$/ cur_apilevel = $1.to_i - puts "API level of #{dir}: #{cur_apilevel}" if USE_TRACES + puts "API level of #{dir}: #{cur_apilevel}" if Rake.application.options.trace break if apilevel and apilevel != cur_apilevel break if found_apilevel and found_apilevel > cur_apilevel @@ -169,7 +167,7 @@ def get_addon_classpath(addon_pattern, apilevel = nil) found_libpatterns << Regexp.new("^(#{name})=(.+);.*$") end - puts "Library patterns: #{found_libpatterns.inspect}" if USE_TRACES + puts "Library patterns: #{found_libpatterns.inspect}" if Rake.application.options.trace end next @@ -201,7 +199,7 @@ def get_addon_classpath(addon_pattern, apilevel = nil) next unless classpath found_classpath = classpath - puts "classpath: #{found_classpath}, API level: #{found_apilevel}" if USE_TRACES + puts "classpath: #{found_classpath}, API level: #{found_apilevel}" if Rake.application.options.trace end @@ -212,7 +210,7 @@ def get_addon_classpath(addon_pattern, apilevel = nil) @@logger.warn msg end - if USE_TRACES + if Rake.application.options.trace puts "Add-on name: #{found_name}" puts "Add-on API level: #{found_apilevel}" puts "Add-on classpath: #{found_classpath}" @@ -425,7 +423,7 @@ def run_emulator(options = {}) system("\"#{$adb}\" start-server") unless is_emulator_running - puts "Need to start emulator" if USE_TRACES + puts "Need to start emulator" if Rake.application.options.trace avdname = prepare_avd( $appavdname, $emuversion, $abis, $use_google_addon_api ) @@ -802,7 +800,7 @@ def signApk( inputApk, outputApk, keystore, keypass, storepass, storealias ) args << inputApk args << storealias if storealias - Jake.run2(@@jarsigner, args, :hide_output => !USE_TRACES ) + Jake.run2(@@jarsigner, args, :hide_output => !Rake.application.options.trace ) unless $?.success? @@logger.error "Error running jarsigner" exit 1 @@ -832,8 +830,8 @@ def alignApk( inputApk, outputApk ) args << "4" args << inputApk args << outputApk - out = Jake.run2(@@zipalign, args, :hide_output => !USE_TRACES ) - puts out if USE_TRACES + out = Jake.run2(@@zipalign, args, :hide_output => !Rake.application.options.trace ) + puts out if Rake.application.options.trace unless $?.success? @@logger.error "Error running zipalign" exit 1 diff --git a/platform/android/build/androidcommon.rb b/platform/android/build/androidcommon.rb index 9331e427e06..8ff0ec91f08 100644 --- a/platform/android/build/androidcommon.rb +++ b/platform/android/build/androidcommon.rb @@ -38,8 +38,6 @@ # $libname[] list of paths to compiled library # $debug set to true to enable debug binaries -USE_TRACES = Rake.application.options.trace - $output_lock = Mutex.new def num_cpus @@ -55,7 +53,7 @@ def get_objects(sources, objdir) end def setup_ndk(ndkpath,apilevel,abi) - puts "setup_ndk(#{ndkpath}, #{apilevel}, #{abi})" if USE_TRACES + puts "setup_ndk(#{ndkpath}, #{apilevel}, #{abi})" if Rake.application.options.trace apilevel = 21 if apilevel.to_i < 21 && abi == 'aarch64' $apilevel = apilevel ndk = NDKWrapper.new( ndkpath ) @@ -99,7 +97,7 @@ def setup_ndk(ndkpath,apilevel,abi) end end - puts "setup success!" if USE_TRACES + puts "setup success!" if Rake.application.options.trace end def cc_def_args @@ -275,7 +273,7 @@ def cc_run(command, args, chdir = nil, coloring = true, env = nil, verbose = tru puts '-' * 80 puts "PWD: " + FileUtils.pwd puts cmdstr - puts out.string if verbose + puts out.string if verbose || ( ret && (!(ret.success?)) ) } out.close end @@ -527,7 +525,7 @@ def java_build(jarpath, buildpath, classpath, srclists) args = [] - if USE_TRACES + if Rake.application.options.trace args << "cfv" else args << "cf" diff --git a/platform/android/build/maven_deps_extractor.rb b/platform/android/build/maven_deps_extractor.rb index 5499d786ee0..47edd12b278 100644 --- a/platform/android/build/maven_deps_extractor.rb +++ b/platform/android/build/maven_deps_extractor.rb @@ -191,8 +191,8 @@ def dep_copy_cmd argv << 'dependency:copy-dependencies' # argv << '-o' #work offline argv << "-Dmaven.repo.local=#{File.join(@m2home,'m2')}" - argv << '-e' if USE_TRACES - argv << '-X' if USE_TRACES + argv << '-e' if Rake.application.options.trace + argv << '-X' if Rake.application.options.trace argv.join(' ') end @@ -232,8 +232,8 @@ def dep_get_cmd(grp_id, art_id, ver, repos) argv << "-Ddest=./" argv << "-Dtransitive=false" - argv << '-e' if USE_TRACES - argv << '-X' if USE_TRACES + argv << '-e' if Rake.application.options.trace + argv << '-X' if Rake.application.options.trace argv.join(' ') end diff --git a/platform/android/build/ndkwrapper.rb b/platform/android/build/ndkwrapper.rb index 4314ec60b7e..fdb1a1978ac 100644 --- a/platform/android/build/ndkwrapper.rb +++ b/platform/android/build/ndkwrapper.rb @@ -1,7 +1,5 @@ require_relative 'hostplatform' -USE_TRACES = Rake.application.options.trace - class NDKWrapper @root_path = nil @@ -116,15 +114,15 @@ def sysroot_pre_16( api, abi ) max_ndk_api_level = 19 #we use some functions missing from API 20 and forth variants.each do |variant| - puts "Check NDK folder: #{variant}" if USE_TRACES + puts "Check NDK folder: #{variant}" if Rake.application.options.trace Dir.glob(File.join(@root_path, variant, "*")).each do |platform| sys_root = File.join platform, "arch-arm" - puts "Checking #{sys_root} for NDK nsysroot" if USE_TRACES + puts "Checking #{sys_root} for NDK nsysroot" if Rake.application.options.trace next unless File.directory? sys_root next unless platform =~ /android-([0-9]+)$/ api_level = $1.to_i api_levels.push api_level if (api_level<=max_ndk_api_level) - puts "NDK API level: #{api_level}" if USE_TRACES + puts "NDK API level: #{api_level}" if Rake.application.options.trace end end @@ -132,7 +130,7 @@ def sysroot_pre_16( api, abi ) last_api_level = 0 api_levels.each do |cur_api_level| - puts "Checking is API level enough: #{cur_api_level}" if USE_TRACES + puts "Checking is API level enough: #{cur_api_level}" if Rake.application.options.trace break if cur_api_level > max_ndk_api_level last_api_level = cur_api_level end @@ -207,7 +205,7 @@ def detect_toolchain( abi ) end ndkhostvariants.each do |ndkhost| - puts "Checking toolchain for host: #{ndkhost}" if USE_TRACES + puts "Checking toolchain for host: #{ndkhost}" if Rake.application.options.trace toolchainversions.each do |version| variants = [] @@ -221,7 +219,7 @@ def detect_toolchain( abi ) variants.each do |variant| - puts "Check toolchain path: #{variant}" if USE_TRACES + puts "Check toolchain path: #{variant}" if Rake.application.options.trace next unless File.directory? variant ndktools = variant @@ -231,7 +229,7 @@ def detect_toolchain( abi ) ndkabi = 'i686-linux-android' if ndkabi == 'x86' ndkabi = 'x86_64-linux-android' if ndkabi == 'x86_64' - puts "Toolchain is detected: #{ndktools}, abi: #{ndkabi}, version: #{@gccver}" if USE_TRACES + puts "Toolchain is detected: #{ndktools}, abi: #{ndkabi}, version: #{@gccver}" if Rake.application.options.trace tools = {} @@ -272,7 +270,7 @@ def check_tool( tool, ndktoolsdir, abi ) toolpath = File.join(ndktoolsdir,'bin',"clang++#{HostPlatform.exe_ext}") end end - puts "Checking tool path #{toolpath} for tool #{tool}" if USE_TRACES + puts "Checking tool path #{toolpath} for tool #{tool}" if Rake.application.options.trace if File.file? toolpath return toolpath diff --git a/platform/iphone/rbuild/iphone.rake b/platform/iphone/rbuild/iphone.rake index d2fe9925719..c0544e5e333 100755 --- a/platform/iphone/rbuild/iphone.rake +++ b/platform/iphone/rbuild/iphone.rake @@ -38,8 +38,8 @@ APPLE_PUSH = 0 FCM_PUSH = 1 UNKNOWN_PUSH = -1 -puts 'iphone.rake execute' if USE_TRACES -puts 'ENV["RHO_BUNDLE_BUILD_LOG_FILE"] = '+ENV["RHO_BUNDLE_BUILD_LOG_FILE"].to_s if USE_TRACES +puts 'iphone.rake execute' if Rake.application.options.trace +puts 'ENV["RHO_BUNDLE_BUILD_LOG_FILE"] = '+ENV["RHO_BUNDLE_BUILD_LOG_FILE"].to_s if Rake.application.options.trace if (ENV["RHO_BUNDLE_BUILD_LOG_FILE"] != nil) $out_file_buf_path = ENV["RHO_BUNDLE_BUILD_LOG_FILE"] $out_file_buf_enable = true diff --git a/platform/wm/build/wm.rake b/platform/wm/build/wm.rake index 38dcd3a769e..b708a85d591 100755 --- a/platform/wm/build/wm.rake +++ b/platform/wm/build/wm.rake @@ -1716,15 +1716,28 @@ PRE_TARGETDEPS += #{pre_targetdeps} directory = $target_path - zipfile_name = File.join($target_path, "RhoSimulator.zip") + $zipfile_name = File.join($target_path, "RhoSimulator.zip") args = [] args << "a" args << "-tzip" - args << zipfile_name + args << $zipfile_name args << directory + "/*" puts Jake.run($zippath, args) end + + task :rhosimulator_to => ["build:win32:rhosimulator"] do + ARGV.each { |a| task a.to_sym do ; end } + targetfileName = ARGV[1] + + dir = File.dirname(targetfileName) + if not File.directory?(dir) + FileUtils.mkdir_p(dir) + end + cp $zipfile_name, targetfileName + + end + end #desc "Build rhodes for win32" diff --git a/rhodes-core.gemspec b/rhodes-core.gemspec index ac2cea8b2d3..1e7d7dcb3a4 100644 --- a/rhodes-core.gemspec +++ b/rhodes-core.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |s| - require 'FileUtils' + require 'fileutils' FileUtils.cp "Rakefile", "rakefile.rb" s.name = %q{rhodes-core} @@ -23,7 +23,6 @@ Gem::Specification.new do |s| "./platform/android/build", "./platform/iphone/rbuild", "./platform/wm/build", - "./platform/wp7/build", "./platform/wp8/build", "./platform/uwp/build", "./platform/linux/tasks/linux.rake", diff --git a/rhodes.gemspec b/rhodes.gemspec index 1e8f6138025..b4b3b8834a7 100644 --- a/rhodes.gemspec +++ b/rhodes.gemspec @@ -1,26 +1,29 @@ # -*- encoding: utf-8 -*- -#require "lib/rhodes.rb" Gem::Specification.new do |s| s.name = %q{rhodes} s.version = File.read('version').chomp s.licenses = ['MIT'] - s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + #s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ['TAU Technologies'] s.date = Time.now s.platform = Gem::Platform::RUBY s.description = 'Rhodes mobile framework' s.email = 'info@tau-technologies.com' s.extra_rdoc_files = ["README.md", "LICENSE"] - files = Array.new - IO.read("Manifest.txt").each_line {|x| files << x.chomp} - s.files = files + + if File.file?("Manifest.txt") # manifest may be missing when running bundle install + files = Array.new + IO .read("Manifest.txt").each_line {|x| files << x.chomp} + s.files = files + end + s.homepage = 'http://tau-technologies.com/' s.rdoc_options = ["--inline-source", "--charset=UTF-8", '--exclude=bin', '--exclude=doc', '--exclude=ext', '--exclude=installer', '--exclude=lib/build', '--exclude=lib/commonAPI', '--exclude=lib/extensions', '--exclude=lib/rhodes', '--exclude=lib/test', '--exclude=lib/rhodes.rb', '--exclude=platform', '--exclude=res', '--exclude=spec'] s.require_paths = ["lib"] - s.required_ruby_version = '>= 1.9.1' + s.required_ruby_version = '>= 2.5' s.add_dependency('templater', '1.0.0') - s.add_dependency('rake', '12.0.0') + s.add_dependency('rake', '12.3.3') s.add_dependency('uuid', '2.3.7') s.add_dependency('systemu', '2.6.5') s.add_dependency('json', '1.8.6') @@ -31,11 +34,11 @@ Gem::Specification.new do |s| s.add_dependency('naturally', '1.3.2') s.add_dependency('simctl', '1.5.6') s.add_dependency('listen', '3.0.6') - s.add_dependency('rubyzip', '1.2.2') - s.add_dependency('ffi', '1.9.24') + s.add_dependency('rubyzip', '1.3.0') + s.add_dependency('ffi', '1.12.2') s.add_dependency('rdoc', '4.2.2') s.add_dependency('deep_merge','1.1.1') - s.add_dependency('nokogiri', '1.10.4') + s.add_dependency('nokogiri', '1.11.0.rc2') s.post_install_message = "Thanks for installing Rhodes ! Please visit our website: http://tau-technologies.com" if s.respond_to? :post_install_message= s.executables << 'rhogen' @@ -48,16 +51,6 @@ Gem::Specification.new do |s| #this is a hack, we dont have an extension, but we want to run postinstall code. It's done via the 'building' of an extension s.extensions << 'ext/extconf.rb' s.summary = %q{The Rhodes framework is the easiest way to develop NATIVE apps with full device capabilities (GPS, PIM, camera, etc.) for any smartphone.} - if s.respond_to? :specification_version then - current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION - s.specification_version = 2 - if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then - s.add_runtime_dependency(%q, ["~> 1.1", ">= 1.1.2"]) - else - s.add_dependency(%q, [">= 1.1.2"]) - end - else - s.add_dependency(%q, [">= 1.1.2"]) - end + s.add_dependency(%q, "1.1.2") end diff --git a/rhomobile-debug.gemspec b/rhomobile-debug.gemspec index 9349031e241..2360c58fd5e 100644 --- a/rhomobile-debug.gemspec +++ b/rhomobile-debug.gemspec @@ -10,7 +10,6 @@ Gem::Specification.new do |s| s.homepage = %q{http://rhomobile.com} s.summary = %q{Rhomobile debugger extension for RhoStudio} - s.rubyforge_project = nil s.rubygems_version = %q{1.5.0} s.require_paths = ["lib"]