Skip to content
Permalink
Browse files
Merge branch 'master' into truffle-head
  • Loading branch information
chrisseaton committed Dec 12, 2014
2 parents 4cc6aff + 4bd351c commit 9f0253be7086860dec93fe4ed9734e7fca257c6f
Showing with 765 additions and 746 deletions.
  1. +9 −26 .travis.yml
  2. +5 −5 antlib/extra.xml
  3. +6 −6 core/pom.rb
  4. +6 −6 core/pom.xml
  5. +2 −1 core/src/main/java/org/jruby/Ruby.java
  6. +1 −1 core/src/main/java/org/jruby/RubyClass.java
  7. +25 −4 core/src/main/java/org/jruby/RubyFile.java
  8. +1 −1 core/src/main/java/org/jruby/RubyFileStat.java
  9. +8 −5 core/src/main/java/org/jruby/RubyFileTest.java
  10. +137 −135 core/src/main/java/org/jruby/RubyString.java
  11. +37 −8 core/src/main/java/org/jruby/ast/SymbolNode.java
  12. +11 −11 core/src/main/java/org/jruby/ast/executable/AbstractScript.java
  13. +7 −2 core/src/main/java/org/jruby/ast/executable/RuntimeCache.java
  14. +5 −10 core/src/main/java/org/jruby/common/RubyWarnings.java
  15. +20 −40 core/src/main/java/org/jruby/embed/IsolatedScriptingContainer.java
  16. +15 −1 core/src/main/java/org/jruby/embed/internal/EmbedRubyRuntimeAdapterImpl.java
  17. +1 −1 core/src/main/java/org/jruby/ext/tempfile/Tempfile.java
  18. +0 −1 core/src/main/java/org/jruby/ir/instructions/ArgScopeDepthInstr.java
  19. +12 −5 core/src/main/java/org/jruby/runtime/invokedynamic/InvokeDynamicSupport.java
  20. +9 −1 core/src/main/java/org/jruby/runtime/load/JarredScript.java
  21. +9 −5 core/src/main/java/org/jruby/runtime/load/LibrarySearcher.java
  22. +30 −17 core/src/main/java/org/jruby/runtime/load/LoadService.java
  23. +11 −0 core/src/main/java/org/jruby/truffle/nodes/RubyCallNode.java
  24. +19 −6 core/src/main/java/org/jruby/truffle/nodes/core/BasicObjectNodes.java
  25. +2 −1 core/src/main/java/org/jruby/truffle/nodes/core/InteroplatedRegexpNode.java
  26. +32 −9 core/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
  27. +11 −11 core/src/main/java/org/jruby/truffle/nodes/methods/arguments/CheckArityNode.java
  28. +12 −1 core/src/main/java/org/jruby/truffle/runtime/core/CoreLibrary.java
  29. +4 −1 core/src/main/java/org/jruby/truffle/runtime/core/RubyRegexp.java
  30. +6 −6 core/src/main/java/org/jruby/truffle/translator/BodyTranslator.java
  31. +36 −0 core/src/main/java/org/jruby/util/AbstractFileResource.java
  32. +3 −7 core/src/main/java/org/jruby/util/ClasspathResource.java
  33. +12 −2 core/src/main/java/org/jruby/util/EmptyFileResource.java
  34. +14 −5 core/src/main/java/org/jruby/util/FileResource.java
  35. +6 −2 core/src/main/java/org/jruby/util/JRubyFile.java
  36. +3 −2 core/src/main/java/org/jruby/util/JarDirectoryResource.java
  37. +3 −2 core/src/main/java/org/jruby/util/JarFileResource.java
  38. +1 −2 core/src/main/java/org/jruby/util/JarResource.java
  39. +12 −7 core/src/main/java/org/jruby/util/RegularFileResource.java
  40. +8 −0 core/src/main/java/org/jruby/util/ShellLauncher.java
  41. +39 −45 core/src/main/java/org/jruby/util/URLResource.java
  42. +0 −235 core/src/main/java/org/jruby/util/string/JavaCrypt.java
  43. +0 −18 core/src/main/resources/org/jruby/runtime/Constants.java
  44. +7 −0 core/src/test/java/org/jruby/embed/ScriptingContainerTest.java
  45. +52 −8 core/src/test/java/org/jruby/util/URLResourceTest.java
  46. +1 −0 core/src/test/ruby/__FILE__.rb
  47. +0 −10 default.build.properties
  48. +1 −1 ivy/ivy.xml
  49. +1 −5 lib/ruby/stdlib/rubygems/dependency_list.rb
  50. +1 −1 lib/ruby/stdlib/rubygems/indexer.rb
  51. +9 −3 lib/ruby/stdlib/rubygems/package/tar_writer.rb
  52. +5 −7 ...y_bundles_with_embedded_gems/test/src/test/java/org/jruby/embed/osgi/test/JRubyOsgiEmbedTest.java
  53. +0 −10 maven/jruby-complete/src/templates/osgi_many_bundles_with_embedded_gems/verify.bsh
  54. +1 −1 maven/jruby-dist/pom.xml
  55. +1 −1 maven/jruby-jars/.gitignore
  56. +2 −3 maven/jruby-jars/jruby-jars.gemspec
  57. +0 −4 maven/jruby-jars/lib/jruby-jars/version.rb
  58. +22 −0 maven/jruby/src/it/many_jars_with_embedded_gems_ng/app/src/test/java/org/example/SimpleTest.java
  59. +6 −7 .../src/templates/osgi_all_inclusive/src/test/java/org/jruby/embed/osgi/test/JRubyOsgiEmbedTest.java
  60. +3 −3 maven/pom.rb
  61. +1 −0 maven/pom.xml
  62. +1 −0 rakelib/commands.rake
  63. +1 −1 rakelib/maven.rake
  64. +21 −0 spec/regression/GH-1941_loaded_features_does_not_expand_symlinks_spec.rb
  65. +7 −0 spec/regression/GH-2259_file_basename_must_preserve_encoding_spec.rb
  66. +10 −0 spec/regression/GH-2298_capture3_accepts_trailing_options_spec.rb
  67. +2 −0 spec/tags/1.8/ruby/core/string/crypt_tags.txt
  68. +1 −0 spec/tags/1.9/ruby/core/string/crypt_tags.txt
  69. +1 −0 spec/tags/ruby/core/string/crypt_tags.txt
  70. +0 −1 spec/tags/ruby/core/symbol/length_tags.txt
  71. +0 −1 spec/tags/ruby/core/symbol/size_tags.txt
  72. +0 −2 spec/tags/ruby/core/symbol/versions/encoding_1.9_tags.txt
  73. +0 −2 spec/truffle/tags/language/regexp/interpolation_tags.txt
  74. +0 −1 spec/truffle/tags/language/versions/def_2.0_tags.txt
  75. +17 −1 test/jruby/test_file.rb
  76. +1 −0 test/mri/excludes/TestM17N.rb
  77. +0 −19 test/test_adding_pem_to_x509store.rb
@@ -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:
@@ -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'
@@ -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'/>
@@ -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'/>
@@ -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'/>
@@ -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'/>
@@ -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'/>
@@ -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'
@@ -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'
@@ -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>
@@ -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>
@@ -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>
@@ -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;
@@ -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;
@@ -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) {
@@ -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;
@@ -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 '/':
@@ -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)
@@ -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) {
@@ -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) {

0 comments on commit 9f0253b

Please sign in to comment.