|
38 | 38 | import org.gradle.api.logging.Logger; |
39 | 39 | import org.gradle.api.logging.Logging; |
40 | 40 | import org.gradle.api.plugins.ExtraPropertiesExtension; |
| 41 | +import org.gradle.internal.deprecation.DeprecationLogger; |
41 | 42 |
|
42 | 43 | import java.lang.reflect.Method; |
43 | 44 | import java.util.*; |
@@ -166,20 +167,23 @@ private void applyRecommendationToDependency(final RecommendationStrategyFactory |
166 | 167 | ProjectDependency projectDependency = (ProjectDependency) dependency; |
167 | 168 | if (!visited.contains(projectDependency)) { |
168 | 169 | visited.add(projectDependency); |
169 | | - Configuration configuration; |
| 170 | + final Configuration[] configuration = new Configuration[1]; |
170 | 171 | try { |
171 | 172 | ProjectDependency.class.getMethod("getTargetConfiguration"); |
172 | 173 | String targetConfiguration = projectDependency.getTargetConfiguration() == null ? Dependency.DEFAULT_CONFIGURATION : projectDependency.getTargetConfiguration(); |
173 | | - configuration = projectDependency.getDependencyProject().getConfigurations().getByName(targetConfiguration); |
| 174 | + |
| 175 | + DeprecationLogger.whileDisabled(() -> { |
| 176 | + configuration[0] = projectDependency.getDependencyProject().getConfigurations().getByName(targetConfiguration); |
| 177 | + }); |
174 | 178 | } catch (NoSuchMethodException ignore) { |
175 | 179 | try { |
176 | 180 | Method method = ProjectDependency.class.getMethod("getProjectConfiguration"); |
177 | | - configuration = (Configuration) method.invoke(dependency); |
| 181 | + configuration[0] = (Configuration) method.invoke(dependency); |
178 | 182 | } catch (Exception e) { |
179 | 183 | throw new RuntimeException("Unable to retrieve configuration for project dependency", e); |
180 | 184 | } |
181 | 185 | } |
182 | | - DependencySet dependencies = configuration.getAllDependencies(); |
| 186 | + DependencySet dependencies = configuration[0].getAllDependencies(); |
183 | 187 | for (Dependency dep : dependencies) { |
184 | 188 | applyRecommendationToDependency(factory, dep, visited); |
185 | 189 | } |
|
0 commit comments