Skip to content

Commit 39ff33a

Browse files
authored
Merge pull request #128 from nebula-plugins/applyRecommendationToDependency-disable-deprecation
applyRecommendationToDependency: disable deprecation logging for now
2 parents d09693d + b1552b0 commit 39ff33a

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ gradlePlugin {
5454
*/
5555
tasks.withType(Test).configureEach {
5656
Provider<String> jdkVersionForTestsEnvVariable = providers.environmentVariable("JDK_VERSION_FOR_TESTS")
57-
Integer jdkVersionForTests = jdkVersionForTestsEnvVariable.isPresent() ? jdkVersionForTestsEnvVariable.get().toInteger() : 8
57+
Integer jdkVersionForTests = jdkVersionForTestsEnvVariable.isPresent() ? jdkVersionForTestsEnvVariable.get().toInteger() : 17
5858
if(jdkVersionForTests >= 17) {
5959
jvmArgs = [
6060
'--add-opens=java.base/java.lang=ALL-UNNAMED',

src/main/groovy/netflix/nebula/dependency/recommender/DependencyRecommendationsPlugin.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import org.gradle.api.logging.Logger;
3939
import org.gradle.api.logging.Logging;
4040
import org.gradle.api.plugins.ExtraPropertiesExtension;
41+
import org.gradle.internal.deprecation.DeprecationLogger;
4142

4243
import java.lang.reflect.Method;
4344
import java.util.*;
@@ -166,20 +167,23 @@ private void applyRecommendationToDependency(final RecommendationStrategyFactory
166167
ProjectDependency projectDependency = (ProjectDependency) dependency;
167168
if (!visited.contains(projectDependency)) {
168169
visited.add(projectDependency);
169-
Configuration configuration;
170+
final Configuration[] configuration = new Configuration[1];
170171
try {
171172
ProjectDependency.class.getMethod("getTargetConfiguration");
172173
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+
});
174178
} catch (NoSuchMethodException ignore) {
175179
try {
176180
Method method = ProjectDependency.class.getMethod("getProjectConfiguration");
177-
configuration = (Configuration) method.invoke(dependency);
181+
configuration[0] = (Configuration) method.invoke(dependency);
178182
} catch (Exception e) {
179183
throw new RuntimeException("Unable to retrieve configuration for project dependency", e);
180184
}
181185
}
182-
DependencySet dependencies = configuration.getAllDependencies();
186+
DependencySet dependencies = configuration[0].getAllDependencies();
183187
for (Dependency dep : dependencies) {
184188
applyRecommendationToDependency(factory, dep, visited);
185189
}

0 commit comments

Comments
 (0)