rjb 1.6.1 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +7 -0
- data/ext/extconf.h +1 -1
- data/ext/load.c +38 -14
- data/ext/rjb.c +1 -1
- data/lib/rjb.rb +1 -1
- data/test/test.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb67ad89857525ce2a6443cb151d5f48dc05a5338ad09e28714b1706cecaa5d6
|
4
|
+
data.tar.gz: 42ab7af0fab4e999d025bc4c7957771a9372699dcd0e15664a741eb0b008aea5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce14080ae984eaa12dafd0433fd5a902fa9dcb5d731f34e674a78d20ae9e04634512c7f40086283fcad7db1064f3a750c1b8c35802c8f1fd75add365cbcf3c0a
|
7
|
+
data.tar.gz: ea0a88e9752dfd8407bd9130b1548589b0fdca90d7a962bef175e504183775817e2818abcb833bae7ab65cfb88e4dcda04c666388b3f2c40235f4b93db396a56
|
data/ChangeLog
CHANGED
data/ext/extconf.h
CHANGED
data/ext/load.c
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/*
|
2
2
|
* Rjb - Ruby <-> Java Bridge
|
3
|
-
* Copyright(c) 2004,2005,2006,2009,2010,2011 arton
|
3
|
+
* Copyright(c) 2004,2005,2006,2009,2010,2011,2020 arton
|
4
4
|
*
|
5
5
|
* This library is free software; you can redistribute it and/or
|
6
6
|
* modify it under the terms of the GNU Lesser General Public
|
@@ -38,9 +38,11 @@
|
|
38
38
|
#if defined(_WIN32) || defined(__CYGWIN__)
|
39
39
|
#if defined(__CYGWIN__)
|
40
40
|
#define JVMDLL "%s/jre/bin/%s/jvm.dll"
|
41
|
+
#define OPENJDK_JVMDLL "%s/bin/%s/jvm.dll"
|
41
42
|
#define DIRSEPARATOR '/'
|
42
43
|
#else
|
43
44
|
#define JVMDLL "%s\\jre\\bin\\%s\\jvm.dll"
|
45
|
+
#define OPENJDK_JVMDLL "%s\\bin\\%s\\jvm.dll"
|
44
46
|
#define DIRSEPARATOR '\\'
|
45
47
|
#if defined(_WIN64)
|
46
48
|
#undef JVM_TYPE
|
@@ -61,6 +63,7 @@
|
|
61
63
|
#define JVM_TYPE "j9vm"
|
62
64
|
#elif defined(__hpux)
|
63
65
|
#define JVMDLL "%s/jre/lib/%s/%s/libjvm.sl"
|
66
|
+
#define OPENJDK_JVMDLL "%s/lib/%s/libjvm.sl"
|
64
67
|
#define ARCH "PA_RISC"
|
65
68
|
#undef JVM_TYPE
|
66
69
|
#define JVM_TYPE "server"
|
@@ -88,6 +91,7 @@
|
|
88
91
|
#include <sys/systeminfo.h>
|
89
92
|
#endif
|
90
93
|
#define JVMDLL "%s/jre/lib/%s/%s/libjvm.so"
|
94
|
+
#define OPENJDK_JVMDLL "%s/lib/%s/libjvm.so"
|
91
95
|
#define DIRSEPARATOR '/'
|
92
96
|
#define CLASSPATH_SEP ':'
|
93
97
|
#endif
|
@@ -123,12 +127,20 @@ static int open_jvm(char* libpath)
|
|
123
127
|
size_t i;
|
124
128
|
int state;
|
125
129
|
|
130
|
+
if (rb_funcall(rb_cFile, rb_intern("exist?"), 1, rb_str_new2(libpath)) == RUBY_Qfalse)
|
131
|
+
{
|
132
|
+
if (RTEST(ruby_verbose))
|
133
|
+
{
|
134
|
+
fprintf(stderr, "Rjb::load try to find but not exist %s\n", libpath);
|
135
|
+
}
|
136
|
+
return 0;
|
137
|
+
}
|
126
138
|
#if defined(RUBINIUS)
|
127
139
|
i = 1;
|
128
140
|
#else
|
129
141
|
i = 0;
|
130
142
|
#endif
|
131
|
-
for (; i < COUNTOF(DLLibs); i++)
|
143
|
+
for (; i < COUNTOF(DLLibs); i++)
|
132
144
|
{
|
133
145
|
state = 0;
|
134
146
|
rb_protect(safe_require, rb_str_new2(DLLibs[i]), &state);
|
@@ -137,7 +149,7 @@ static int open_jvm(char* libpath)
|
|
137
149
|
{
|
138
150
|
if (i > 0)
|
139
151
|
{
|
140
|
-
rb_raise(rb_eRuntimeError, "Constants DL
|
152
|
+
rb_raise(rb_eRuntimeError, "Constants DL or Fiddle is not defined.");
|
141
153
|
return 0;
|
142
154
|
}
|
143
155
|
}
|
@@ -163,8 +175,8 @@ static int open_jvm(char* libpath)
|
|
163
175
|
}
|
164
176
|
/* get function pointers of JNI */
|
165
177
|
#if RJB_RUBY_VERSION_CODE < 190
|
166
|
-
getdefaultjavavminitargsfunc = rb_funcall(rb_funcall(rb_funcall(jvmdll, rb_intern("[]"), 2, rb_str_new2(GETDEFAULTJVMINITARGS), rb_str_new2("IP")), rb_intern("to_ptr"), 0), rb_intern("to_i"), 0);
|
167
|
-
createjavavmfunc = rb_funcall(rb_funcall(rb_funcall(jvmdll, rb_intern("[]"), 2, rb_str_new2(CREATEJVM), rb_str_new2("IPPP")), rb_intern("to_ptr"), 0), rb_intern("to_i"), 0);
|
178
|
+
getdefaultjavavminitargsfunc = rb_funcall(rb_funcall(rb_funcall(jvmdll, rb_intern("[]"), 2, rb_str_new2(GETDEFAULTJVMINITARGS), rb_str_new2("IP")), rb_intern("to_ptr"), 0), rb_intern("to_i"), 0);
|
179
|
+
createjavavmfunc = rb_funcall(rb_funcall(rb_funcall(jvmdll, rb_intern("[]"), 2, rb_str_new2(CREATEJVM), rb_str_new2("IPPP")), rb_intern("to_ptr"), 0), rb_intern("to_i"), 0);
|
168
180
|
#else
|
169
181
|
getdefaultjavavminitargsfunc = rb_funcall(jvmdll, rb_intern("[]"), 1, rb_str_new2(GETDEFAULTJVMINITARGS));
|
170
182
|
createjavavmfunc = rb_funcall(jvmdll, rb_intern("[]"), 1, rb_str_new2(CREATEJVM));
|
@@ -184,6 +196,7 @@ static int file_exist(const char* dir, const char* file)
|
|
184
196
|
|
185
197
|
/*
|
186
198
|
* not completed, only valid under some circumstances.
|
199
|
+
* load priority: OpenJDK -> SunJDK
|
187
200
|
*/
|
188
201
|
static int load_jvm(const char* jvmtype)
|
189
202
|
{
|
@@ -236,26 +249,37 @@ static int load_jvm(const char* jvmtype)
|
|
236
249
|
*(p + strlen(p) - 1) = '\0';
|
237
250
|
jh = p;
|
238
251
|
}
|
239
|
-
#endif
|
252
|
+
#endif
|
240
253
|
java_home = ALLOCA_N(char, strlen(jh) + 1);
|
241
254
|
strcpy(java_home, jh);
|
242
255
|
if (*(java_home + strlen(jh) - 1) == DIRSEPARATOR)
|
243
256
|
{
|
244
257
|
*(java_home + strlen(jh) - 1) = '\0';
|
245
258
|
}
|
259
|
+
#if defined(__APPLE__) && defined(__MACH__)
|
260
|
+
libpath = ALLOCA_N(char, sizeof(JVMDLL) + strlen(java_home) + 1);
|
261
|
+
sprintf(libpath, JVMDLL, java_home);
|
262
|
+
return open_jvm(libpath);
|
263
|
+
#else
|
246
264
|
#if defined(_WIN32) || defined(__CYGWIN__)
|
247
265
|
libpath = ALLOCA_N(char, sizeof(JVMDLL) + strlen(java_home)
|
248
266
|
+ strlen(jvmtype) + 1);
|
249
|
-
sprintf(libpath, JVMDLL, java_home, jvmtype);
|
250
|
-
#elif defined(__APPLE__) && defined(__MACH__)
|
251
|
-
libpath = ALLOCA_N(char, sizeof(JVMDLL) + strlen(java_home) + 1);
|
252
|
-
sprintf(libpath, JVMDLL, java_home);
|
253
267
|
#else /* not Windows / MAC OS-X */
|
254
268
|
libpath = ALLOCA_N(char, sizeof(JVMDLL) + strlen(java_home)
|
255
|
-
|
269
|
+
+ strlen(ARCH) + strlen(jvmtype) + 1);
|
270
|
+
#endif
|
271
|
+
sprintf(libpath, OPENJDK_JVMDLL, java_home, jvmtype);
|
272
|
+
if (open_jvm(libpath))
|
273
|
+
{
|
274
|
+
return 1;
|
275
|
+
}
|
276
|
+
#if defined(_WIN32) || defined(__CYGWIN__)
|
277
|
+
return 0;
|
278
|
+
#else /* not Windows / MAC OS-X */
|
256
279
|
sprintf(libpath, JVMDLL, java_home, ARCH, jvmtype);
|
257
280
|
#endif
|
258
281
|
return open_jvm(libpath);
|
282
|
+
#endif /* __APPLE__ and __MACH */
|
259
283
|
}
|
260
284
|
|
261
285
|
static int load_bridge(JNIEnv* jenv)
|
@@ -269,7 +293,7 @@ static int load_bridge(JNIEnv* jenv)
|
|
269
293
|
VALUE v = rb_const_get(rb_cObject, rb_intern("RjbConf"));
|
270
294
|
v = rb_const_get(v, rb_intern("BRIDGE_FILE"));
|
271
295
|
#else
|
272
|
-
VALUE v = rb_const_get_at(rb_const_get(rb_cObject, rb_intern("RjbConf")),
|
296
|
+
VALUE v = rb_const_get_at(rb_const_get(rb_cObject, rb_intern("RjbConf")),
|
273
297
|
rb_intern("BRIDGE_FILE"));
|
274
298
|
#endif
|
275
299
|
bridge = StringValuePtr(v);
|
@@ -352,7 +376,7 @@ int rjb_create_jvm(JNIEnv** pjenv, JavaVMInitArgs* vm_args, char* userpath, VALU
|
|
352
376
|
*(p + strlen(p) - 1) = '\0';
|
353
377
|
libjvm = p;
|
354
378
|
}
|
355
|
-
#endif
|
379
|
+
#endif
|
356
380
|
if (libjvm == NULL || !open_jvm(libjvm))
|
357
381
|
{
|
358
382
|
#if defined(__APPLE__) && defined(__MACH__)
|
@@ -370,7 +394,7 @@ int rjb_create_jvm(JNIEnv** pjenv, JavaVMInitArgs* vm_args, char* userpath, VALU
|
|
370
394
|
}
|
371
395
|
#endif
|
372
396
|
}
|
373
|
-
|
397
|
+
|
374
398
|
#if RJB_RUBY_VERSION_CODE < 190 && !defined(RUBINIUS)
|
375
399
|
ruby_errinfo = Qnil;
|
376
400
|
#else
|
data/ext/rjb.c
CHANGED
data/lib/rjb.rb
CHANGED
data/test/test.rb
CHANGED
@@ -973,7 +973,7 @@ class TestRjb < Test::Unit::TestCase
|
|
973
973
|
rescue => e
|
974
974
|
assert e.respond_to? :print_stack_trace
|
975
975
|
assert e.respond_to? :printStackTrace
|
976
|
-
|
976
|
+
assert_false e.respond_to? :unknown_method
|
977
977
|
end
|
978
978
|
end
|
979
979
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rjb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- arton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: 'RJB is a bridge program that connect between Ruby and Java with Java
|
14
14
|
Native Interface.
|
@@ -74,7 +74,7 @@ files:
|
|
74
74
|
- test/x.rb
|
75
75
|
homepage: https://www.artonx.org/collabo/backyard/?RubyJavaBridge
|
76
76
|
licenses:
|
77
|
-
- LGPL
|
77
|
+
- LGPL-2.1-or-later
|
78
78
|
metadata: {}
|
79
79
|
post_install_message:
|
80
80
|
rdoc_options: []
|
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
93
|
requirements:
|
94
94
|
- none
|
95
95
|
- JDK 5.0
|
96
|
-
rubygems_version: 3.
|
96
|
+
rubygems_version: 3.1.2
|
97
97
|
signing_key:
|
98
98
|
specification_version: 4
|
99
99
|
summary: Ruby Java bridge
|