rjb 1.3.1-universal-darwin-10 → 1.3.3-universal-darwin-10

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,21 @@
1
+ Wed Nov 17 arton
2
+ *ext/rjb.c
3
+ RJV_VERSION -> 1.3.3
4
+ *ext/load.c
5
+ Check JAVA_HOME before load JVM (OS X specific)
6
+ change int -> size_t for 64bit OS
7
+ *test/test_osxjvm.rb
8
+ add new test for OS X specific JVM detection.
9
+ Sat Oct 30 arton
10
+ *ext/rjb.c
11
+ RJB_VERSION -> 1.3.2
12
+ *extconf.rb
13
+ Change OSX's include path detecting
14
+ Tue Oct 26 arton
15
+ *ext/rjb.c
16
+ RJB_VERSION -> 1.3.1
17
+ *rjb.rake
18
+ make universal-darwin gem for Mac bundled ruby.
1
19
  Sun Oct 24 arton
2
20
  *sample/filechooser.rb
3
21
  omit Thread use (cause JVM crush with 1.9 and StackOverflow with 1.8)
data/ext/load.c CHANGED
@@ -12,7 +12,7 @@
12
12
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
13
  * Lesser General Public License for more details.
14
14
  *
15
- * $Id: load.c 148 2010-10-23 08:38:44Z arton $
15
+ * $Id: load.c 159 2010-11-16 16:35:49Z arton $
16
16
  */
17
17
 
18
18
  #include <stdlib.h>
@@ -131,10 +131,21 @@ static int open_jvm(char* libpath)
131
131
  #endif
132
132
  return 1;
133
133
  }
134
+
135
+ #if defined(__APPLE__) && defined(__MACH__)
136
+ static int file_exist(const char* dir, const char* file)
137
+ {
138
+ VALUE path = rb_funcall(rb_cFile, rb_intern("join"), 2,
139
+ rb_str_new2(dir), rb_str_new2(file));
140
+ VALUE ret = rb_funcall(rb_cFile, rb_intern("exist?"), 1, path);
141
+ return RTEST(ret);
142
+ }
143
+ #endif
144
+
134
145
  /*
135
146
  * not completed, only valid under some circumstances.
136
147
  */
137
- static int load_jvm(char* jvmtype)
148
+ static int load_jvm(const char* jvmtype)
138
149
  {
139
150
  char* libpath;
140
151
  char* java_home;
@@ -150,7 +161,7 @@ static int load_jvm(char* jvmtype)
150
161
  {
151
162
  if (strlen(jh) > HOME_NAME_LEN)
152
163
  {
153
- int len = strlen(jh);
164
+ size_t len = strlen(jh);
154
165
  char* p = ALLOCA_N(char, len + 8);
155
166
  jh = strcpy(p, jh);
156
167
  if (*(jh + len - 1) == '/')
@@ -163,6 +174,10 @@ static int load_jvm(char* jvmtype)
163
174
  strcpy(p + len, "/..");
164
175
  }
165
176
  }
177
+ if (!jvmtype && !file_exist(jh, "JavaVM"))
178
+ {
179
+ jh = DEFAULT_HOME;
180
+ }
166
181
  }
167
182
  #endif
168
183
  if (!jh)
@@ -208,7 +223,7 @@ static int load_bridge(JNIEnv* jenv)
208
223
  JNINativeMethod nmethod[1];
209
224
  jbyte buff[8192];
210
225
  char* bridge;
211
- int len;
226
+ size_t len;
212
227
  FILE* f;
213
228
  #if defined(RUBINIUS)
214
229
  VALUE v = rb_const_get(rb_cObject, rb_intern("RjbConf"));
@@ -268,12 +283,12 @@ int rjb_create_jvm(JNIEnv** pjenv, JavaVMInitArgs* vm_args, char* userpath, VALU
268
283
  { "DUMMY", NULL }, /* for classpath count */
269
284
  };
270
285
  char* newpath;
271
- int len;
286
+ size_t len;
272
287
  int result;
273
288
  GETDEFAULTJAVAVMINITARGS initargs;
274
289
  CREATEJAVAVM createjavavm;
275
290
  JavaVMOption* options;
276
- int optlen;
291
+ size_t optlen;
277
292
  int i;
278
293
  VALUE optval;
279
294
 
@@ -292,7 +307,7 @@ int rjb_create_jvm(JNIEnv** pjenv, JavaVMInitArgs* vm_args, char* userpath, VALU
292
307
  if (libjvm == NULL || !open_jvm(libjvm))
293
308
  {
294
309
  #if defined(__APPLE__) && defined(__MACH__)
295
- if (!(load_jvm(JVM_TYPE) || load_jvm(ALT_JVM_TYPE)))
310
+ if (!(load_jvm(NULL)))
296
311
  {
297
312
  JVMDLL = "%s/Libraries/libjvm.dylib";
298
313
  CREATEJVM = "JNI_CreateJavaVM_Impl";
@@ -359,7 +374,7 @@ int rjb_create_jvm(JNIEnv** pjenv, JavaVMInitArgs* vm_args, char* userpath, VALU
359
374
  (options + i)->optionString = StringValueCStr(optval);
360
375
  (options + i)->extraInfo = NULL;
361
376
  }
362
- vm_args->nOptions = optlen;
377
+ vm_args->nOptions = (int)optlen;
363
378
  vm_args->options = options;
364
379
  vm_args->ignoreUnrecognized = JNI_TRUE;
365
380
  if (NIL_P(createjavavmfunc))
data/ext/rjb.c CHANGED
@@ -12,10 +12,10 @@
12
12
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
13
  * Lesser General Public License for more details.
14
14
  *
15
- * $Id: rjb.c 147 2010-10-23 05:10:33Z arton $
15
+ * $Id: rjb.c 159 2010-11-16 16:35:49Z arton $
16
16
  */
17
17
 
18
- #define RJB_VERSION "1.3.1"
18
+ #define RJB_VERSION "1.3.3"
19
19
 
20
20
  #include "ruby.h"
21
21
  #include "extconf.h"
Binary file
@@ -0,0 +1,23 @@
1
+ #!/usr/local/env ruby -Ku
2
+ # encoding: utf-8
3
+ # $Id:$
4
+
5
+ begin
6
+ require 'rjb'
7
+ rescue LoadError
8
+ require 'rubygems'
9
+ require 'rjb'
10
+ end
11
+ require 'test/unit'
12
+
13
+ if RUBY_PLATFORM =~ /darwin/
14
+ class TestOsxJvm < Test::Unit::TestCase
15
+ def test_with_javahome
16
+ ENV['JAVA_HOME'] = `/usr/libexec/java_home`
17
+ assert_nothing_raised do
18
+ Rjb::load
19
+ end
20
+ end
21
+ end
22
+ end
23
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rjb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.3
5
5
  platform: universal-darwin-10
6
6
  authors:
7
7
  - arton
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-10-26 00:00:00 +09:00
12
+ date: 2010-11-17 00:00:00 +09:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -42,6 +42,7 @@ files:
42
42
  - test/exttest.rb
43
43
  - test/gctest.rb
44
44
  - test/test.rb
45
+ - test/test_osxjvm.rb
45
46
  - test/jp/co/infoseek/hp/arton/rjb/IBase.class
46
47
  - test/jp/co/infoseek/hp/arton/rjb/Test$TestTypes.class
47
48
  - test/jp/co/infoseek/hp/arton/rjb/Test.class