mirror of
https://github.com/zhigang1992/RubyMotion.git
synced 2026-03-29 17:18:57 +08:00
pass environment mode and version number to the runtime, minor refactoring
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user