pass environment mode and version number to the runtime, minor refactoring

This commit is contained in:
Laurent Sansonetti
2014-09-11 15:55:59 +02:00
parent 510aee6a4d
commit bcf2883943
3 changed files with 11 additions and 9 deletions

View File

@@ -313,5 +313,13 @@ EOS
path
end
end
def rubymotion_env_value
if spec_mode
'test'
else
development? ? 'development' : 'release'
end
end
end
end; end

View File

@@ -77,7 +77,7 @@ EOS
end
payload_c_txt << <<EOS
void rb_vm_register_native_methods(void);
bool rb_vm_init(const char *app_package, JNIEnv *env);
bool rb_vm_init(const char *app_package, const char *rm_env, const char *rm_version, JNIEnv *env);
jint
JNI_OnLoad(JavaVM *vm, void *reserved)
{
@@ -87,7 +87,7 @@ JNI_OnLoad(JavaVM *vm, void *reserved)
return -1;
}
assert(env != NULL);
rb_vm_init("#{App.config.package_path}", env);
rb_vm_init("#{App.config.package_path}", "#{App.config.rubymotion_env_value}", "#{Motion::Version}", env);
EOS
ruby_objs.each do |_, init_func|
payload_c_txt << " (*env)->PushLocalFrame(env, 32);\n"

View File

@@ -411,13 +411,7 @@ EOS
end
def define_global_env_txt
rubymotion_env =
if spec_mode
'test'
else
development? ? 'development' : 'release'
end
"rb_define_global_const(\"RUBYMOTION_ENV\", @\"#{rubymotion_env}\");\nrb_define_global_const(\"RUBYMOTION_VERSION\", @\"#{Motion::Version}\");\n"
"rb_define_global_const(\"RUBYMOTION_ENV\", @\"#{rubymotion_env_value}\");\nrb_define_global_const(\"RUBYMOTION_VERSION\", @\"#{Motion::Version}\");\n"
end
def spritekit_texture_atlas_compiler