Skip to content

Commit 9776ebc

Browse files
committed
Update Main.java
fixed some dependency detection
1 parent 8ca43db commit 9776ebc

File tree

1 file changed

+13
-7
lines changed
  • src/main/java/io/github/intisy/gradle/github

1 file changed

+13
-7
lines changed

src/main/java/io/github/intisy/gradle/github/Main.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public void apply(Project project) {
3030
task.setGroup("github");
3131
task.setDescription("Implement an github dependency");
3232
task.doLast(t -> {
33-
for (Dependency dependency : githubImplementation.getAllDependencies()) {
33+
for (Dependency dependency : getDependencies(project)) {
3434
String group = dependency.getGroup();
3535
String name = dependency.getName();
3636
String version = dependency.getVersion();
@@ -44,12 +44,7 @@ public void apply(Project project) {
4444
task.setDescription("Updates all GitHub dependencies");
4545
task.doLast(t -> {
4646
boolean refresh = false;
47-
Set<Dependency> dependencyList = new HashSet<>();
48-
project.getAllprojects().forEach(p -> {
49-
if (!p.equals(project.getRootProject())) {
50-
dependencyList.addAll(p.getConfigurations().getByName("githubImplementation").getAllDependencies());
51-
}
52-
});
47+
Set<Dependency> dependencyList = getDependencies(project);
5348
logger.debug("Updating GitHub dependencies: " + dependencyList);
5449
for (Dependency dependency : dependencyList) {
5550
String group = dependency.getGroup();
@@ -71,6 +66,17 @@ public void apply(Project project) {
7166
});
7267
}
7368

69+
public Set<Dependency> getDependencies(Project project) {
70+
Set<Dependency> dependencyList = new HashSet<>();
71+
project.getAllprojects().forEach(p -> {
72+
if (!p.equals(project.getRootProject())) {
73+
dependencyList.addAll(p.getConfigurations().getByName("githubImplementation").getAllDependencies());
74+
}
75+
});
76+
dependencyList.addAll(project.getConfigurations().getByName("githubImplementation").getAllDependencies());
77+
return dependencyList;
78+
}
79+
7480
public static org.kohsuke.github.GitHub getGitHub(Logger logger, GithubExtension extension) {
7581
org.kohsuke.github.GitHub github;
7682
try {

0 commit comments

Comments
 (0)