Skip to content

Commit 22f5f41

Browse files
committed
Use Provider API and configureEach instead of all when iterating configurations
1 parent a01af61 commit 22f5f41

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/main/kotlin/nebula/plugin/resolutionrules/extensions.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ inline fun <T, R> Collection<T>.mapToSet(transform: (T) -> R): Set<R> {
66
return mapTo(LinkedHashSet<R>(size), transform)
77
}
88

9-
fun Project.findStringProperty(name: String): String? = if (hasProperty(name)) property(name) as String? else null
9+
/**
10+
* Finds a Gradle property by name using the modern Provider API.
11+
* Returns the property value as a String, or null if not present.
12+
*/
13+
fun Project.findStringProperty(name: String): String? =
14+
providers.gradleProperty(name).orNull
1015

1116
fun parseRuleNames(ruleNames: String): Set<String> =
1217
ruleNames.split(",").map { it.trim() }.filter { it.isNotEmpty()} .toSet()

src/main/kotlin/nebula/plugin/resolutionrules/plugin.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ class ResolutionRulesPlugin : Plugin<Project> {
9898
)
9999
}
100100

101-
project.configurations.all { config ->
101+
project.configurations.configureEach { config ->
102102
if (ignoredConfigurationPrefixes.any { config.name.startsWith(it) }) {
103-
return@all
103+
return@configureEach
104104
}
105105

106106
if (ignoredConfigurationSuffixes.any { config.name.endsWith(it) }) {
107-
return@all
107+
return@configureEach
108108
}
109109

110110
var dependencyRulesApplied = false

0 commit comments

Comments
 (0)