Skip to content

Commit

Permalink
Merge branch 'master' into truffle-head
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisseaton committed Dec 12, 2014
2 parents 4cc6aff + 4bd351c commit 9f0253b
Show file tree
Hide file tree
Showing 77 changed files with 765 additions and 746 deletions.
35 changes: 9 additions & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@ before_script:
- "export JAVA_OPTS='-XX:+TieredCompilation -XX:TieredStopAtLevel=1'"
- echo $HOME

jdk:
- openjdk7
- oraclejdk8
jdk: openjdk7

os:
- linux
- osx

env:
global:
Expand All @@ -32,30 +29,16 @@ env:
- PHASE='-Prake -Dtask=spec:profiler'
- PHASE='-Ptruffle-specs-language'
- PHASE='-Ptruffle-specs-core'
- PHASE='-Pmain'
- PHASE='-Pcomplete'
- PHASE='-Posgi'
- PHASE='-Pj2ee'
- PHASE='-Pjruby-jars,test -Dinvoker.test=extended'
- PHASE='-Pmain,test -Dinvoker.test=extended'
- PHASE='-Pjruby_complete_jar_extended -Dinvoker.skip=true'
- COMMAND=test/check_versions.sh

matrix:
include:
# these profile do no need to run for all JDKs
- env: PHASE='-Pdist'
jdk: oraclejdk8
- env: PHASE='-Pjruby-jars'
jdk: openjdk7
- env: PHASE='-Pmain'
jdk: oraclejdk7
- env: PHASE='-Pcomplete'
jdk: oraclejdk8
- env: PHASE='-Posgi'
jdk: openjdk7
- env: PHASE='-Pj2ee'
jdk: oraclejdk7
- env: PHASE='-Pjruby-jars,test -Dinvoker.test=extended'
jdk: oraclejdk7
- env: PHASE='-Pmain,test -Dinvoker.test=extended'
jdk: openjdk7
- env: PHASE='-Pjruby_complete_jar_extended -Dinvoker.skip=true'
jdk: oraclejdk8
- env: COMMAND=test/check_versions.sh
jdk: oraclejdk8
fast_finish: true
allow_failures:
- env: PHASE='-Pcomplete'
Expand Down
10 changes: 5 additions & 5 deletions antlib/extra.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ build jruby-complete.jar
<env key='GEM_PATH' value='lib/ruby/gems/shared'/>
<arg value='-Djruby.home=uri:classloader://META-INF/jruby.home'/>
<arg value='-cp'/>
<arg value='core/target/test-classes:test/target/test-classes:lib/jruby.jar:maven/jruby-stdlib/target/jruby-stdlib-1.7.17-SNAPSHOT.jar'/>
<arg value='core/target/test-classes:test/target/test-classes:lib/jruby.jar:maven/jruby-stdlib/target/jruby-stdlib-1.7.18-SNAPSHOT.jar'/>
<arg value='org.jruby.Main'/>
<arg value='-I.:test/externals/ruby1.9:test/externals/ruby1.9/ruby'/>
<arg value='-r./test/ruby19_env.rb'/>
Expand Down Expand Up @@ -136,7 +136,7 @@ build jruby-complete.jar
<env key='GEM_PATH' value='lib/ruby/gems/shared'/>
<arg value='-Djruby.home=uri:classloader://META-INF/jruby.home'/>
<arg value='-cp'/>
<arg value='core/target/test-classes:test/target/test-classes:maven/jruby-complete/target/jruby-complete-1.7.17-SNAPSHOT.jar'/>
<arg value='core/target/test-classes:test/target/test-classes:maven/jruby-complete/target/jruby-complete-1.7.18-SNAPSHOT.jar'/>
<arg value='org.jruby.Main'/>
<arg value='-I.:test/externals/ruby1.9:test/externals/ruby1.9/ruby'/>
<arg value='-r./test/ruby19_env.rb'/>
Expand All @@ -152,7 +152,7 @@ build jruby-complete.jar
<env key='GEM_PATH' value='lib/ruby/gems/shared'/>
<arg value='-Djruby.home=uri:classloader://META-INF/jruby.home'/>
<arg value='-cp'/>
<arg value='core/target/test-classes:test/target/test-classes:lib/jruby.jar:maven/jruby-stdlib/target/jruby-stdlib-1.7.17-SNAPSHOT.jar'/>
<arg value='core/target/test-classes:test/target/test-classes:lib/jruby.jar:maven/jruby-stdlib/target/jruby-stdlib-1.7.18-SNAPSHOT.jar'/>
<arg value='org.jruby.Main'/>
<arg value='-I.:test/externals/ruby1.9:test/externals/ruby1.9/ruby'/>
<arg value='-r./test/ruby19_env.rb'/>
Expand All @@ -168,7 +168,7 @@ build jruby-complete.jar
<env key='GEM_PATH' value='lib/ruby/gems/shared'/>
<arg value='-Djruby.home=uri:classloader://META-INF/jruby.home'/>
<arg value='-cp'/>
<arg value='core/target/test-classes:test/target/test-classes:lib/jruby.jar:maven/jruby-stdlib/target/jruby-stdlib-1.7.17-SNAPSHOT.jar'/>
<arg value='core/target/test-classes:test/target/test-classes:lib/jruby.jar:maven/jruby-stdlib/target/jruby-stdlib-1.7.18-SNAPSHOT.jar'/>
<arg value='org.jruby.Main'/>
<arg value='-I.:test/externals/ruby1.9:test/externals/ruby1.9/ruby'/>
<arg value='-r./test/ruby19_env.rb'/>
Expand Down Expand Up @@ -460,7 +460,7 @@ build jruby-complete.jar
<env key='GEM_PATH' value='lib/ruby/gems/shared'/>
<arg value='-Djruby.home=uri:classloader://META-INF/jruby.home'/>
<arg value='-cp'/>
<arg value='core/target/test-classes:test/target/test-classes:maven/jruby-complete/target/jruby-complete-1.7.17-SNAPSHOT.jar'/>
<arg value='core/target/test-classes:test/target/test-classes:maven/jruby-complete/target/jruby-complete-1.7.18-SNAPSHOT.jar'/>
<arg value='org.jruby.Main'/>
<arg value='-I.:test/externals/ruby1.9:test/externals/ruby1.9/ruby'/>
<arg value='-r./test/ruby19_env.rb'/>
Expand Down
12 changes: 6 additions & 6 deletions core/pom.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
jar 'org.ow2.asm:asm-analysis:${asm.version}'
jar 'org.ow2.asm:asm-util:${asm.version}'

jar 'com.github.jnr:jnr-netdb:1.1.2'
jar 'com.github.jnr:jnr-enxio:0.4'
jar 'com.github.jnr:jnr-netdb:1.1.3'
jar 'com.github.jnr:jnr-enxio:0.5'
jar 'com.github.jnr:jnr-x86asm:1.0.2'
jar 'com.github.jnr:jnr-unixsocket:0.3'
jar 'com.github.jnr:jnr-posix:3.0.7'
jar 'com.github.jnr:jnr-constants:0.8.6-SNAPSHOT'
jar 'com.github.jnr:jnr-unixsocket:0.4'
jar 'com.github.jnr:jnr-posix:3.0.8'
jar 'com.github.jnr:jnr-constants:0.8.6'
jar 'com.github.jnr:jnr-ffi:2.0.0'
jar 'com.github.jnr:jffi:${jffi.version}'
jar 'com.github.jnr:jffi:${jffi.version}:native'
Expand All @@ -45,7 +45,7 @@
jar 'org.jruby.extras:bytelist:1.0.12'
jar 'org.jruby.jcodings:jcodings:1.0.12'

jar 'com.headius:invokebinder:1.5-SNAPSHOT'
jar 'com.headius:invokebinder:1.5'
jar 'com.headius:options:1.1'
jar 'com.headius:coro-mock:1.0', :scope => 'provided'
jar 'com.headius:unsafe-mock', '${unsafe.version}', :scope => 'provided'
Expand Down
12 changes: 6 additions & 6 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-netdb</artifactId>
<version>1.1.2</version>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-enxio</artifactId>
<version>0.4</version>
<version>0.5</version>
</dependency>
<dependency>
<groupId>com.github.jnr</groupId>
Expand All @@ -66,17 +66,17 @@
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-unixsocket</artifactId>
<version>0.3</version>
<version>0.4</version>
</dependency>
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-posix</artifactId>
<version>3.0.7</version>
<version>3.0.8</version>
</dependency>
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-constants</artifactId>
<version>0.8.6-SNAPSHOT</version>
<version>0.8.6</version>
</dependency>
<dependency>
<groupId>com.github.jnr</groupId>
Expand Down Expand Up @@ -112,7 +112,7 @@
<dependency>
<groupId>com.headius</groupId>
<artifactId>invokebinder</artifactId>
<version>1.5-SNAPSHOT</version>
<version>1.5</version>
</dependency>
<dependency>
<groupId>com.headius</groupId>
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/org/jruby/Ruby.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
import java.security.AccessControlException;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.HashMap;
Expand Down Expand Up @@ -3037,7 +3038,7 @@ public synchronized void addEventHook(EventHook hook) {
}

EventHook[] hooks = eventHooks;
EventHook[] newHooks = new EventHook[hooks.length + 1];
EventHook[] newHooks = Arrays.copyOf(hooks, hooks.length + 1);
newHooks[hooks.length] = hook;
eventHooks = newHooks;
hasEventHooks = true;
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ public static boolean checkFuncallCallable(ThreadContext context, DynamicMethod
// MRI: rb_method_call_status
// FIXME: Partial impl because we don't have these "NOEX" flags
public static boolean rbMethodCallStatus(ThreadContext context, DynamicMethod method, CallType callType, IRubyObject self) {
return !method.isUndefined() && method.isCallableFrom(self, callType);
return method != null && !method.isUndefined() && method.isCallableFrom(self, callType);
}

private static IRubyObject checkFuncallMissing(ThreadContext context, RubyClass klass, IRubyObject self, String method, IRubyObject... args) {
Expand Down
29 changes: 25 additions & 4 deletions core/src/main/java/org/jruby/RubyFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URL;
import java.nio.channels.Channels;
Expand Down Expand Up @@ -502,16 +503,28 @@ public IRubyObject inspect() {

@JRubyMethod(required = 1, optional = 1, meta = true)
public static IRubyObject basename(ThreadContext context, IRubyObject recv, IRubyObject[] args) {
String name = get_path(context,args[0]).getUnicodeValue();
Ruby runtime = context.runtime;

RubyString origString = get_path(context,args[0]);
Encoding origEncoding = origString.getEncoding();
String name = origString.toString();

// MRI-compatible basename handling for windows drive letter paths
if (Platform.IS_WINDOWS) {
if (name.length() > 1 && name.charAt(1) == ':' && Character.isLetter(name.charAt(0))) {
switch (name.length()) {
case 2:
return RubyString.newEmptyString(context.runtime).infectBy(args[0]);
return RubyString.newEmptyString(runtime, origString.getEncoding()).infectBy(args[0]);
case 3:
return context.runtime.newString(name.substring(2)).infectBy(args[0]);
if (origEncoding.getCharset() != null) {
try {
return RubyString.newString(runtime, new ByteList(name.substring(2).getBytes(origEncoding.getCharsetName()), origString.getEncoding())).infectBy(args[0]);
} catch (UnsupportedEncodingException uee) {
// fall through to UTF-8 logic
}
}

return RubyString.newString(runtime, name.substring(2)).infectBy(args[0]);
default:
switch (name.charAt(2)) {
case '/':
Expand Down Expand Up @@ -566,7 +579,15 @@ public static IRubyObject basename(ThreadContext context, IRubyObject recv, IRub
name = name.substring(0, name.length() - ext.length());
}
}
return context.runtime.newString(name).infectBy(args[0]);
if (origEncoding.getCharset() != null) {
try {
return RubyString.newString(runtime, new ByteList(name.getBytes(origEncoding.getCharsetName()), origString.getEncoding())).infectBy(args[0]);
} catch (UnsupportedEncodingException uee) {
// fall through to UTF-8 logic
}
}

return RubyString.newString(runtime, name).infectBy(args[0]);
}

@JRubyMethod(required = 2, rest = true, meta = true)
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/org/jruby/RubyFileStat.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private void setup(String filename, boolean lstat) {
file = JRubyFile.createResource(runtime.getPosix(), runtime.getCurrentDirectory(), filename);
stat = lstat ? file.lstat() : file.stat();

if (stat == null) throw runtime.newErrnoFromInt(runtime.getPosix().errno(), filename);
if (stat == null) throw runtime.newErrnoFromInt(file.errno(), filename);
}

public IRubyObject initialize(IRubyObject fname, Block unusedBlock) {
Expand Down
13 changes: 8 additions & 5 deletions core/src/main/java/org/jruby/RubyFileTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,19 @@ public static IRubyObject directory_p(ThreadContext context, IRubyObject filenam

@JRubyMethod(name = "executable?", required = 1, module = true)
public static IRubyObject executable_p(IRubyObject recv, IRubyObject filename) {
FileStat stat = fileResource(filename).stat();

return recv.getRuntime().newBoolean(stat != null && stat.isExecutable());
return recv.getRuntime().newBoolean(fileResource(filename).canExecute());
}

@JRubyMethod(name = "executable_real?", required = 1, module = true)
public static IRubyObject executable_real_p(IRubyObject recv, IRubyObject filename) {
FileStat stat = fileResource(filename).stat();
if (recv.getRuntime().getPosix().isNative()) {
FileStat stat = fileResource(filename).stat();

return recv.getRuntime().newBoolean(stat != null && stat.isExecutableReal());
return recv.getRuntime().newBoolean(stat != null && stat.isExecutableReal());
}
else {
return executable_p(recv, filename);
}
}

public static IRubyObject exist_p(IRubyObject recv, IRubyObject filename) {
Expand Down

0 comments on commit 9f0253b

Please sign in to comment.