-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved handling of cached dependencies and added cache also for Cla…
…ssLoaders.
- Loading branch information
1 parent
044fd4a
commit d92c749
Showing
11 changed files
with
157 additions
and
80 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
jgrab-runner/src/main/java/com/athaydes/jgrab/Classpath.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package com.athaydes.jgrab; | ||
|
||
import java.io.File; | ||
import java.util.List; | ||
import java.util.SortedSet; | ||
import java.util.TreeSet; | ||
|
||
import static java.util.Collections.unmodifiableList; | ||
import static java.util.Collections.unmodifiableSortedSet; | ||
|
||
public final class Classpath { | ||
private static final Classpath EMPTY = new Classpath( new TreeSet<>(), List.of() ); | ||
|
||
public final SortedSet<Dependency> dependencies; | ||
public final List<File> resolvedArtifacts; | ||
public final String hash; | ||
|
||
public Classpath( SortedSet<Dependency> dependencies, List<File> resolvedArtifacts ) { | ||
this( dependencies, resolvedArtifacts, Dependency.hashOf( dependencies ) ); | ||
} | ||
|
||
public Classpath( SortedSet<Dependency> dependencies, | ||
List<File> resolvedArtifacts, | ||
String hash ) { | ||
this.dependencies = unmodifiableSortedSet( dependencies ); | ||
this.resolvedArtifacts = unmodifiableList( resolvedArtifacts ); | ||
this.hash = hash; | ||
} | ||
|
||
public static Classpath empty() { | ||
return EMPTY; | ||
} | ||
|
||
public boolean isEmpty() { | ||
return resolvedArtifacts.isEmpty(); | ||
} | ||
|
||
@Override | ||
public boolean equals( Object o ) { | ||
if ( this == o ) return true; | ||
if ( o == null || getClass() != o.getClass() ) return false; | ||
|
||
Classpath classpath = ( Classpath ) o; | ||
|
||
return hash.equals( classpath.hash ); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return hash.hashCode(); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Classpath{" + | ||
"dependencies=" + dependencies + | ||
", resolvedArtifacts=" + resolvedArtifacts + | ||
'}'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.