Skip to content

Commit

Permalink
DependencyLockExtension: skippedConfigurationNamesPrefixes not lazy a…
Browse files Browse the repository at this point in the history
…pi for backwrads compatibility
  • Loading branch information
rpalcolea committed Nov 15, 2023
1 parent eb2fd35 commit 07a7fe1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ abstract class DependencyLockExtension {
lockFile.convention('dependencies.lock')
globalLockFile.convention('global.lock')
configurationNames.convention([])
skippedConfigurationNamesPrefixes.convention([])
updateDependencies.convention([])
skippedDependencies.convention([])
includeTransitives.convention(false)
Expand All @@ -37,7 +36,6 @@ abstract class DependencyLockExtension {
abstract Property<String> getLockFile()
abstract Property<String> getGlobalLockFile()
abstract SetProperty<String> getConfigurationNames()
abstract SetProperty<String> getSkippedConfigurationNamesPrefixes()
abstract SetProperty<String> getUpdateDependencies()
abstract SetProperty<String> getSkippedDependencies()
abstract Property<Boolean> getIncludeTransitives()
Expand All @@ -47,5 +45,7 @@ abstract class DependencyLockExtension {
abstract Property<Boolean> getUpdateDependenciesFailOnNonSpecifiedDependenciesToUpdate()
abstract SetProperty<String> getAdditionalConfigurationsToLock()

Set<String> skippedConfigurationNamesPrefixes = [] as Set

Closure dependencyFilter = { String group, String name, String version -> true }
}
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class DependencyLockTaskConfigurer {
peers.set(getProjectPeers())
generateLockTask.conventionMapping.with {
configurationResolutionData = {
lockableConfigurations(project, extension.configurationNames.get(), extension.skippedConfigurationNamesPrefixes.get()).findAll { it.isCanBeResolved() }.collect {
lockableConfigurations(project, extension.configurationNames.get(), extension.skippedConfigurationNamesPrefixes).findAll { it.isCanBeResolved() }.collect {
new ConfigurationResolutionData(
it.name,
it.incoming.resolutionResult.getAllDependencies(),
Expand Down Expand Up @@ -237,15 +237,15 @@ class DependencyLockTaskConfigurer {
def subprojects = project.subprojects.collect { subproject ->
def ext = subproject.getExtensions().findByType(DependencyLockExtension)
if (ext != null) {
Collection<Configuration> lockableConfigurations = lockableConfigurations(subproject, ext.configurationNames.get(), extension.skippedConfigurationNamesPrefixes.get())
Collection<Configuration> lockableConfigurations = lockableConfigurations(subproject, ext.configurationNames.get(), extension.skippedConfigurationNamesPrefixes)
Collection<Configuration> configurations = filterNonLockableConfigurationsAndProvideWarningsForGlobalLockSubproject(subproject, ext.configurationNames.get(), lockableConfigurations)
Configuration aggregate = subproject.configurations.create("aggregateConfiguration")
aggregate.setCanBeConsumed(true)
aggregate.setCanBeResolved(true)
configurations
.findAll { configuration ->
!configurationsToSkipForGlobalLockPrefixes.any { String prefix -> configuration.name.startsWith(prefix) }
&& !extension.skippedConfigurationNamesPrefixes.get().any { String prefix -> configuration.name.startsWith(prefix) }
&& !extension.skippedConfigurationNamesPrefixes.any { String prefix -> configuration.name.startsWith(prefix) }
}
.each { configuration ->
aggregate.extendsFrom(configuration)
Expand All @@ -259,7 +259,7 @@ class DependencyLockTaskConfigurer {
def conf = project.configurations.detachedConfiguration(subprojectsArray)
project.allprojects.each { it.configurations.add(conf) }

def configs = [conf] + ConfigurationUtils.lockableConfigurations(project, extension.configurationNames.get(), extension.skippedConfigurationNamesPrefixes.get())
def configs = [conf] + ConfigurationUtils.lockableConfigurations(project, extension.configurationNames.get(), extension.skippedConfigurationNamesPrefixes)
configs.findAll { it.isCanBeResolved() }.collect {
new ConfigurationResolutionData(
it.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class DependencyLockPlugin : Plugin<Project> {
}

private fun maybeApplyLock(conf: Configuration, extension: DependencyLockExtension, overrides: Map<*, *>, globalLockFileName: String?, lockFilename: String?) {
val shouldIgnoreLock = (extension.skippedConfigurationNamesPrefixes.get() + DependencyLockTaskConfigurer.configurationsToSkipForGlobalLockPrefixes).any {
val shouldIgnoreLock = (extension.skippedConfigurationNamesPrefixes + DependencyLockTaskConfigurer.configurationsToSkipForGlobalLockPrefixes).any {
prefix -> conf.name.startsWith(prefix) && !conf.name.contains("resolutionRules")
}
if(shouldIgnoreLock) {
Expand Down

0 comments on commit 07a7fe1

Please sign in to comment.