Skip to content

Commit

Permalink
fix: Repository#collectDependency includes the processing project.
Browse files Browse the repository at this point in the history
  • Loading branch information
teletha committed Dec 9, 2021
1 parent eb8377a commit 0ebc7fc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
9 changes: 9 additions & 0 deletions src/main/java/bee/api/Project.java
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,15 @@ protected final void versionControlSystem(String uri) {
}
}

/**
* Convert this project to {@link Library}.
*
* @return
*/
public final Library asLibrary() {
return new Library(getGroup(), getProduct(), getVersion());
}

/**
* {@inheritDoc}
*/
Expand Down
8 changes: 1 addition & 7 deletions src/main/java/bee/api/Repository.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,7 @@ private Set<Library> collectDependency(Project project, Scope[] scopes, Set<Libr
}));

for (ArtifactResult dependency : result.getArtifactResults()) {
Artifact artifact = dependency.getArtifact();

// exclude itself
if (!artifact.getGroupId().equalsIgnoreCase(project.getGroup()) || !artifact.getArtifactId()
.equalsIgnoreCase(project.getProduct())) {
set.add(new Library(artifact));
}
set.add(new Library(dependency.getArtifact()));
}
} catch (Exception e) {
throw I.quiet(e);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/bee/task/Eclipse.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,13 @@ private void createClasspath(File file) {
});

// library
List<Library> libraries = I.signal(project.getDependency(Scope.Compile))
.concat(I.signal(project.getDependency(Scope.Annotation)))
.toList();
List<Library> libraries = I.signal(project.getDependency(Scope.Compile, Scope.Annotation)).toList();
libraries.remove(project.asLibrary());

// test library
Set<Library> tests = project.getDependency(Scope.Test);
tests.removeAll(libraries);
tests.remove(project.asLibrary());

for (Library library : tests) {
File jar = library.getLocalJar();
Expand Down

0 comments on commit 0ebc7fc

Please sign in to comment.