Skip to content

Commit

Permalink
Merge pull request jruby#3073 from jruby/test-dir-globs-on-uri-classl…
Browse files Browse the repository at this point in the history
…oader

dir globs on uri classloader without the need of .jrubydir
  • Loading branch information
mkristian committed Jul 6, 2015
2 parents 026b0d9 + 8106cc4 commit 5b411a2
Show file tree
Hide file tree
Showing 14 changed files with 135 additions and 389 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,18 @@ public OSGiLoadService(Ruby runtime) {
super(runtime);
// super.searchers.add(new OSGiBundlesSearcher());
}


protected Library findLibraryBySearchState(SearchState state) {
Library library = super.findLibraryBySearchState(state);
if (library == null){
library = findLibraryWithClassloaders(state, state.searchFile, state.suffixType);
if (library != null) {
state.library = library;
}
}
return library;
}

/**
* Support for 'bundle:/' to look for libraries in osgi bundles
* or classes or ruby files.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,10 @@ public void load(Ruby runtime, boolean wrap) {
try {
URL url;
if (location.startsWith(URLResource.URI)) {
url = null;
runtime.getJRubyClassLoader().addURLNoIndex(URLResource.getResourceURL(runtime, location));
url = URLResource.getResourceURL(runtime, location);
} else {
// convert file urls with !/ into jar urls so the classloader
// can handle them via protocol handler
File f = new File(location);
if (f.exists() || location.contains( "!")){
url = f.toURI().toURL();
Expand All @@ -305,9 +306,7 @@ public void load(Ruby runtime, boolean wrap) {
url = new URL(location);
}
}
if (url != null) {
runtime.getJRubyClassLoader().addURL(url);
}
runtime.getJRubyClassLoader().addURL(url);
} catch (MalformedURLException badUrl) {
runtime.newIOErrorFromException(badUrl);
}
Expand Down
10 changes: 2 additions & 8 deletions core/src/main/java/org/jruby/runtime/load/LoadService.java
Original file line number Diff line number Diff line change
Expand Up @@ -966,18 +966,12 @@ protected void debugLogFound( LoadServiceResource resource ) {
}
}

private Library findLibraryBySearchState(SearchState state) {
protected Library findLibraryBySearchState(SearchState state) {
if (librarySearcher.findBySearchState(state) != null) {
// findBySearchState should fill the state already
return state.library;
}

// TODO(ratnikov): Remove the special classpath case by introducing a classpath file resource
Library library = findLibraryWithClassloaders(state, state.searchFile, state.suffixType);
if (library != null) {
state.library = library;
}
return library;
return null;
}

@Deprecated
Expand Down
182 changes: 0 additions & 182 deletions core/src/main/java/org/jruby/util/CompoundJarURLStreamHandler.java

This file was deleted.

Loading

0 comments on commit 5b411a2

Please sign in to comment.