-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fix updating of libraries. (dependency loader) * Update eternalcore-plugin/src/main/java/com/eternalcode/core/loader/dependency/Dependency.java Co-authored-by: Jakubk15 <[email protected]> * Update eternalcore-plugin/src/main/java/com/eternalcode/core/loader/dependency/Dependency.java Co-authored-by: Jakubk15 <[email protected]> --------- Co-authored-by: Martin Sulikowski <[email protected]> Co-authored-by: Jakubk15 <[email protected]>
- Loading branch information
1 parent
44823f0
commit 300ed25
Showing
4 changed files
with
95 additions
and
19 deletions.
There are no files selected for viewing
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
26 changes: 19 additions & 7 deletions
26
...core-plugin/src/main/java/com/eternalcode/core/loader/dependency/DependencyCollector.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 |
---|---|---|
@@ -1,26 +1,38 @@ | ||
package com.eternalcode.core.loader.dependency; | ||
|
||
import java.util.Collection; | ||
import java.util.LinkedHashSet; | ||
import java.util.Collections; | ||
import java.util.LinkedHashMap; | ||
|
||
public class DependencyCollector { | ||
|
||
private final LinkedHashSet<Dependency> fullScannedDependencies = new LinkedHashSet<>(); | ||
private final LinkedHashMap<String, Dependency> fullScannedDependencies = new LinkedHashMap<>(); | ||
|
||
public boolean hasScannedDependency(Dependency dependency) { | ||
return this.fullScannedDependencies.contains(dependency); | ||
return this.fullScannedDependencies.containsKey(dependency.getGroupArtifactId()); | ||
} | ||
|
||
public void scannedDependency(Dependency dependency) { | ||
this.fullScannedDependencies.add(dependency); | ||
Dependency current = this.fullScannedDependencies.get(dependency.getGroupArtifactId()); | ||
|
||
if (current == null) { | ||
this.fullScannedDependencies.put(dependency.getGroupArtifactId(), dependency); | ||
return; | ||
} | ||
|
||
if (dependency.isNewerThan(current)) { | ||
this.fullScannedDependencies.put(dependency.getGroupArtifactId(), dependency); | ||
} | ||
} | ||
|
||
public void scannedDependencies(Collection<Dependency> dependencies) { | ||
this.fullScannedDependencies.addAll(dependencies); | ||
for (Dependency dependency : dependencies) { | ||
this.scannedDependency(dependency); | ||
} | ||
} | ||
|
||
public LinkedHashSet<Dependency> scannedDependencies() { | ||
return this.fullScannedDependencies; | ||
public Collection<Dependency> scannedDependencies() { | ||
return Collections.unmodifiableCollection(this.fullScannedDependencies.values()); | ||
} | ||
|
||
} |
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