|
1 | 1 | /* |
2 | | - * Copyright 2014-2018 the original author or authors. |
| 2 | + * Copyright 2014-2021 the original author or authors. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
@@ -45,6 +45,8 @@ class VersionConfiguringAction implements Action<DependencyResolveDetails> { |
45 | 45 |
|
46 | 46 | private Set<String> directDependencies; |
47 | 47 |
|
| 48 | + private Set<String> localProjectNames; |
| 49 | + |
48 | 50 | VersionConfiguringAction(Project project, |
49 | 51 | DependencyManagementContainer dependencyManagementContainer, |
50 | 52 | Configuration configuration) { |
@@ -97,16 +99,15 @@ private boolean isDirectDependency(DependencyResolveDetails details) { |
97 | 99 |
|
98 | 100 | private boolean isDependencyOnLocalProject(Project project, |
99 | 101 | DependencyResolveDetails details) { |
100 | | - return getAllLocalProjectNames(project.getRootProject()).contains(details.getRequested() |
101 | | - .getGroup() + ":" + details.getRequested().getName()); |
102 | | - } |
103 | | - |
104 | | - private Set<String> getAllLocalProjectNames(Project rootProject) { |
105 | | - Set<String> names = new HashSet<String>(); |
106 | | - for (Project localProject: rootProject.getAllprojects()) { |
107 | | - names.add(localProject.getGroup() + ":" + localProject.getName()); |
| 102 | + if (this.localProjectNames == null) { |
| 103 | + Set<String> names = new HashSet<String>(); |
| 104 | + for (Project localProject : project.getRootProject().getAllprojects()) { |
| 105 | + names.add(localProject.getGroup() + ":" + localProject.getName()); |
| 106 | + } |
| 107 | + this.localProjectNames = names; |
108 | 108 | } |
109 | | - return names; |
110 | | - } |
111 | 109 |
|
| 110 | + return localProjectNames |
| 111 | + .contains(details.getRequested().getGroup() + ":" + details.getRequested().getName()); |
| 112 | + } |
112 | 113 | } |
0 commit comments