diff --git a/build.gradle b/build.gradle index 050cca8..b2b1823 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ import org.gradle.util.GradleVersion plugins { id 'com.netflix.nebula.plugin-plugin' version '21.2.1' id 'com.netflix.nebula.optional-base' version '9.0.0' - id "org.jetbrains.kotlin.jvm" version "1.9.0" + id "org.jetbrains.kotlin.jvm" version "2.1.0" id 'java-gradle-plugin' id "org.gradle.test-retry" version "1.5.0" } diff --git a/gradle.lockfile b/gradle.lockfile index 7020a4b..9bcfa68 100644 --- a/gradle.lockfile +++ b/gradle.lockfile @@ -14,40 +14,29 @@ com.github.tomakehurst:wiremock:2.17.0=integTestCompileClasspath,integTestRuntim com.google.guava:guava:20.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath com.googlecode.javaewah:JavaEWAH:1.1.12=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath com.jayway.jsonpath:json-path:2.4.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath -com.jcraft:jsch.agentproxy.connector-factory:0.0.7=integTestRuntimeClasspath,testRuntimeClasspath -com.jcraft:jsch.agentproxy.core:0.0.7=integTestRuntimeClasspath,testRuntimeClasspath -com.jcraft:jsch.agentproxy.pageant:0.0.7=integTestRuntimeClasspath,testRuntimeClasspath -com.jcraft:jsch.agentproxy.sshagent:0.0.7=integTestRuntimeClasspath,testRuntimeClasspath -com.jcraft:jsch.agentproxy.svnkit-trilead-ssh2:0.0.7=integTestRuntimeClasspath,testRuntimeClasspath -com.jcraft:jsch.agentproxy.usocket-jna:0.0.7=integTestRuntimeClasspath,testRuntimeClasspath -com.jcraft:jsch.agentproxy.usocket-nc:0.0.7=integTestRuntimeClasspath,testRuntimeClasspath com.jcraft:jzlib:1.1.2=integTestRuntimeClasspath,testRuntimeClasspath com.netflix.nebula:gradle-contacts-plugin:7.0.1=integTestRuntimeClasspath,testRuntimeClasspath -com.netflix.nebula:gradle-info-plugin:12.1.4=integTestRuntimeClasspath,testRuntimeClasspath +com.netflix.nebula:gradle-info-plugin:13.1.0=integTestRuntimeClasspath,testRuntimeClasspath com.netflix.nebula:nebula-dependencies-comparison:0.2.1=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -com.netflix.nebula:nebula-gradle-interop:2.1.1=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -com.netflix.nebula:nebula-project-plugin:10.1.5=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath -com.netflix.nebula:nebula-publishing-plugin:20.3.0=integTestRuntimeClasspath,testRuntimeClasspath -com.netflix.nebula:nebula-test:10.5.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +com.netflix.nebula:nebula-gradle-interop:2.3.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +com.netflix.nebula:nebula-project-plugin:11.0.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath +com.netflix.nebula:nebula-publishing-plugin:21.0.0=integTestRuntimeClasspath,testRuntimeClasspath +com.netflix.nebula:nebula-test:10.6.2=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath com.perforce:p4java:2015.2.1365273=integTestRuntimeClasspath,testRuntimeClasspath com.squareup.moshi:moshi:1.12.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath com.squareup.okio:okio:2.10.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -com.trilead:trilead-ssh2:1.0.0-build220=integTestRuntimeClasspath,testRuntimeClasspath commons-codec:commons-codec:1.10=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath commons-logging:commons-logging:1.2=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath -de.regnis.q.sequence:sequence-library:1.0.3=integTestRuntimeClasspath,testRuntimeClasspath javax.servlet:javax.servlet-api:3.1.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath joda-time:joda-time:2.10=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath junit:junit-dep:4.11=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath junit:junit:4.13.2=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath net.java.dev.jna:jna-platform:5.7.0=integTestRuntimeClasspath,testRuntimeClasspath net.java.dev.jna:jna:5.7.0=integTestRuntimeClasspath,testRuntimeClasspath -net.java.dev.jna:platform:3.4.0=integTestRuntimeClasspath,testRuntimeClasspath net.minidev:accessors-smart:1.2=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath net.minidev:json-smart:2.3=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath net.sf.jopt-simple:jopt-simple:5.0.3=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath org.ajoberstar.grgit:grgit-core:4.1.1=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath -org.antlr:antlr-runtime:3.4=integTestRuntimeClasspath,testRuntimeClasspath org.antlr:antlr4-runtime:4.5.1-1=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath org.apache.commons:commons-lang3:3.12.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.apache.httpcomponents:httpclient:4.5.5=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath @@ -67,10 +56,8 @@ org.eclipse.jetty:jetty-xml:9.2.24.v20180105=integTestCompileClasspath,integTest org.eclipse.jgit:org.eclipse.jgit:5.13.0.202109080827-r=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath org.hamcrest:hamcrest-core:1.3=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath org.hamcrest:hamcrest:2.2=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-common:1.9.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.9.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath -org.jetbrains.kotlin:kotlin-stdlib:1.9.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.jetbrains.kotlin:kotlin-stdlib-common:1.4.20=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath +org.jetbrains.kotlin:kotlin-stdlib:2.1.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.jetbrains:annotations:13.0=compileClasspath,integTestCompileClasspath,integTestRuntimeClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath org.junit.platform:junit-platform-commons:1.9.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath org.junit.platform:junit-platform-engine:1.9.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath @@ -81,8 +68,6 @@ org.ow2.asm:asm:5.0.4=integTestCompileClasspath,integTestRuntimeClasspath,testCo org.slf4j:slf4j-api:1.7.30=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath org.spockframework:spock-core:2.3-groovy-3.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath org.spockframework:spock-junit4:2.3-groovy-3.0=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath -org.tmatesoft.sqljet:sqljet:1.1.10=integTestRuntimeClasspath,testRuntimeClasspath -org.tmatesoft.svnkit:svnkit:1.8.12=integTestRuntimeClasspath,testRuntimeClasspath org.xmlunit:xmlunit-core:2.5.1=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath org.xmlunit:xmlunit-legacy:2.5.1=integTestCompileClasspath,integTestRuntimeClasspath,testCompileClasspath,testRuntimeClasspath empty=annotationProcessor,integTestAnnotationProcessor,testAnnotationProcessor diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e2847c8..41c00d0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip +distributionUrl=https://services.gradle.org/distributions-snapshots/gradle-8.12-20241210012659+0000-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/groovy/nebula/plugin/dependencylock/DependencyLockTaskConfigurer.groovy b/src/main/groovy/nebula/plugin/dependencylock/DependencyLockTaskConfigurer.groovy index a2aaf59..02484e6 100644 --- a/src/main/groovy/nebula/plugin/dependencylock/DependencyLockTaskConfigurer.groovy +++ b/src/main/groovy/nebula/plugin/dependencylock/DependencyLockTaskConfigurer.groovy @@ -31,6 +31,7 @@ import org.gradle.api.logging.Logger import org.gradle.api.logging.Logging import org.gradle.api.tasks.Delete import org.gradle.api.tasks.TaskProvider +import org.gradle.internal.deprecation.DeprecationLogger import static nebula.plugin.dependencylock.tasks.GenerateLockTask.filterNonLockableConfigurationsAndProvideWarningsForGlobalLockSubproject import static nebula.plugin.dependencylock.tasks.GenerateLockTask.lockableConfigurations @@ -154,9 +155,12 @@ class DependencyLockTaskConfigurer { saveLockTask.configure { saveTask -> saveTask.doFirst { - SaveLockTask globalSave = project.rootProject.tasks.findByName(SAVE_GLOBAL_LOCK_TASK_NAME) as SaveLockTask - if (globalSave?.outputLock?.exists()) { - throw new GradleException('Cannot save individual locks when global lock is in place, run deleteGlobalLock task') + //TODO: address Invocation of Task.project at execution time has been deprecated. + DeprecationLogger.whileDisabled { + SaveLockTask globalSave = project.rootProject.tasks.findByName(SAVE_GLOBAL_LOCK_TASK_NAME) as SaveLockTask + if (globalSave?.outputLock?.exists()) { + throw new GradleException('Cannot save individual locks when global lock is in place, run deleteGlobalLock task') + } } } saveTask.conventionMapping.with { @@ -190,10 +194,13 @@ class DependencyLockTaskConfigurer { globalSaveLockTask.configure { globalSaveTask -> globalSaveTask.doFirst { - project.subprojects.each { Project sub -> - SaveLockTask save = sub.tasks.findByName(SAVE_LOCK_TASK_NAME) as SaveLockTask - if (save && save.outputLock?.exists()) { - throw new GradleException('Cannot save global lock, one or more individual locks are in place, run deleteLock task') + //TODO: address Invocation of Task.project at execution time has been deprecated. + DeprecationLogger.whileDisabled { + project.subprojects.each { Project sub -> + SaveLockTask save = sub.tasks.findByName(SAVE_LOCK_TASK_NAME) as SaveLockTask + if (save && save.outputLock?.exists()) { + throw new GradleException('Cannot save global lock, one or more individual locks are in place, run deleteLock task') + } } } } @@ -240,7 +247,10 @@ class DependencyLockTaskConfigurer { globalLockTask.configure { globalGenerateTask -> globalGenerateTask.notCompatibleWithConfigurationCache("Dependency locking plugin tasks require project access. Please consider using Gradle's dependency locking mechanism") globalGenerateTask.doFirst { - project.subprojects.each { sub -> sub.repositories.each { repo -> project.repositories.add(repo) } } + //TODO: address Invocation of Task.project at execution time has been deprecated. + DeprecationLogger.whileDisabled { + project.subprojects.each { sub -> sub.repositories.each { repo -> project.repositories.add(repo) } } + } } globalGenerateTask.conventionMapping.with { dependenciesLock = { getBuildDirGlobalLockFile(lockFilename, extension) } diff --git a/src/main/groovy/nebula/plugin/dependencylock/tasks/DiffLockTask.groovy b/src/main/groovy/nebula/plugin/dependencylock/tasks/DiffLockTask.groovy index 96d426c..efece89 100644 --- a/src/main/groovy/nebula/plugin/dependencylock/tasks/DiffLockTask.groovy +++ b/src/main/groovy/nebula/plugin/dependencylock/tasks/DiffLockTask.groovy @@ -13,6 +13,7 @@ import org.gradle.api.tasks.OutputFile import org.gradle.api.tasks.PathSensitive import org.gradle.api.tasks.PathSensitivity import org.gradle.api.tasks.TaskAction +import org.gradle.internal.deprecation.DeprecationLogger import org.gradle.work.DisableCachingByDefault import java.nio.charset.StandardCharsets @@ -42,23 +43,26 @@ class DiffLockTask extends AbstractLockTask { @TaskAction def diffLocks() { - ConfigurationsSet existingLock = readLocks(existingLockFile) - ConfigurationsSet newLock = readLocks(updatedLockFile) - if (DependencyLockingFeatureFlags.isPathAwareDependencyDiffEnabled()) { - Map> diffByConfiguration = new DependenciesComparison().performDiffByConfiguration(existingLock, newLock) - DiffReportGenerator generator = Class.forName("nebula.plugin.dependencylock.diff.PathAwareDiffReportGenerator").newInstance() as DiffReportGenerator - def lockDiff = generator.generateDiffReport(project, diffByConfiguration) - outputDir.mkdirs() - diffFile.text = JsonOutput.prettyPrint(JsonOutput.toJson(lockDiff)) - } else { - if (newLock.isEmpty()) { + //TODO: address Invocation of Task.project at execution time has been deprecated. + DeprecationLogger.whileDisabled { + ConfigurationsSet existingLock = readLocks(existingLockFile) + ConfigurationsSet newLock = readLocks(updatedLockFile) + if (DependencyLockingFeatureFlags.isPathAwareDependencyDiffEnabled()) { + Map> diffByConfiguration = new DependenciesComparison().performDiffByConfiguration(existingLock, newLock) + DiffReportGenerator generator = Class.forName("nebula.plugin.dependencylock.diff.PathAwareDiffReportGenerator").newInstance() as DiffReportGenerator + def lockDiff = generator.generateDiffReport(project, diffByConfiguration) outputDir.mkdirs() - diffFile.withPrintWriter(StandardCharsets.UTF_8.displayName()) { writer -> - writer.println('--no updated locks to diff--') - } + diffFile.text = JsonOutput.prettyPrint(JsonOutput.toJson(lockDiff)) } else { - List diff = new DependenciesComparison().performDiff(existingLock, newLock) - writeDiff(diff) + if (newLock.isEmpty()) { + outputDir.mkdirs() + diffFile.withPrintWriter(StandardCharsets.UTF_8.displayName()) { writer -> + writer.println('--no updated locks to diff--') + } + } else { + List diff = new DependenciesComparison().performDiff(existingLock, newLock) + writeDiff(diff) + } } } } diff --git a/src/main/groovy/nebula/plugin/dependencylock/tasks/GenerateLockTask.groovy b/src/main/groovy/nebula/plugin/dependencylock/tasks/GenerateLockTask.groovy index 5dc699c..df27711 100644 --- a/src/main/groovy/nebula/plugin/dependencylock/tasks/GenerateLockTask.groovy +++ b/src/main/groovy/nebula/plugin/dependencylock/tasks/GenerateLockTask.groovy @@ -33,12 +33,11 @@ import org.gradle.api.tasks.Input import org.gradle.api.tasks.Internal import org.gradle.api.tasks.Optional import org.gradle.api.tasks.TaskAction +import org.gradle.internal.deprecation.DeprecationLogger import org.gradle.work.DisableCachingByDefault @DisableCachingByDefault class GenerateLockTask extends AbstractLockTask { - private String WRITE_CORE_LOCK_TASK_TO_RUN = "`./gradlew dependencies --write-locks`" - private String MIGRATE_TO_CORE_LOCK_TASK_NAME = "migrateToCoreLocks" private static final Logger LOGGER = Logging.getLogger(GenerateLockTask) @Internal @@ -72,25 +71,31 @@ class GenerateLockTask extends AbstractLockTask { @TaskAction void lock() { - if (DependencyLockingFeatureFlags.isCoreLockingEnabled()) { - def dependencyLockExtension = project.extensions.findByType(DependencyLockExtension) - def globalLockFile = new File(project.projectDir, dependencyLockExtension.globalLockFile) - if (globalLockFile.exists()) { - throw new BuildCancelledException("Legacy global locks are not supported with core locking.\n" + - "Please remove global locks.\n" + - " - Global locks: ${globalLockFile.absolutePath}") - } + //TODO: address Invocation of Task.project at execution time has been deprecated. + DeprecationLogger.whileDisabled { + final String WRITE_CORE_LOCK_TASK_TO_RUN = "`./gradlew dependencies --write-locks`" + final String MIGRATE_TO_CORE_LOCK_TASK_NAME = "migrateToCoreLocks" + if (DependencyLockingFeatureFlags.isCoreLockingEnabled()) { + def dependencyLockExtension = project.extensions.findByType(DependencyLockExtension) + def globalLockFile = new File(project.projectDir, dependencyLockExtension.globalLockFile) + if (globalLockFile.exists()) { + throw new BuildCancelledException("Legacy global locks are not supported with core locking.\n" + + "Please remove global locks.\n" + + " - Global locks: ${globalLockFile.absolutePath}") + } - throw new BuildCancelledException("generateLock is not supported with core locking.\n" + - "Please use $WRITE_CORE_LOCK_TASK_TO_RUN\n" + - "or do a one-time migration with `./gradlew $MIGRATE_TO_CORE_LOCK_TASK_NAME` to preserve the current lock state") - } - if (DependencyLockTaskConfigurer.shouldIgnoreDependencyLock(project)) { - throw new DependencyLockException("Dependency locks cannot be generated. The plugin is disabled for this project (dependencyLock.ignore is set to true)") + throw new BuildCancelledException("generateLock is not supported with core locking.\n" + + "Please use $WRITE_CORE_LOCK_TASK_TO_RUN\n" + + "or do a one-time migration with `./gradlew $MIGRATE_TO_CORE_LOCK_TASK_NAME` to preserve the current lock state") + } + if (DependencyLockTaskConfigurer.shouldIgnoreDependencyLock(project)) { + throw new DependencyLockException("Dependency locks cannot be generated. The plugin is disabled for this project (dependencyLock.ignore is set to true)") + } + Collection confs = getConfigurations() ?: lockableConfigurations(project, project, getConfigurationNames(), getSkippedConfigurationNames()) + Map dependencyMap = new GenerateLockFromConfigurations().lock(confs) + new DependencyLockWriter(getDependenciesLock(), getSkippedDependencies()).writeLock(dependencyMap) } - Collection confs = getConfigurations() ?: lockableConfigurations(project, project, getConfigurationNames(), getSkippedConfigurationNames()) - Map dependencyMap = new GenerateLockFromConfigurations().lock(confs) - new DependencyLockWriter(getDependenciesLock(), getSkippedDependencies()).writeLock(dependencyMap) + } static Collection lockableConfigurations(Project taskProject, Project project, Set configurationNames, Set skippedConfigurationNamesPrefixes = []) { diff --git a/src/main/groovy/nebula/plugin/dependencylock/tasks/MigrateLockedDepsToCoreLocksTask.groovy b/src/main/groovy/nebula/plugin/dependencylock/tasks/MigrateLockedDepsToCoreLocksTask.groovy index 96f8b28..8496e1d 100644 --- a/src/main/groovy/nebula/plugin/dependencylock/tasks/MigrateLockedDepsToCoreLocksTask.groovy +++ b/src/main/groovy/nebula/plugin/dependencylock/tasks/MigrateLockedDepsToCoreLocksTask.groovy @@ -26,6 +26,7 @@ import org.gradle.api.logging.Logger import org.gradle.api.logging.Logging import org.gradle.api.tasks.Internal import org.gradle.api.tasks.TaskAction +import org.gradle.internal.deprecation.DeprecationLogger import org.gradle.work.DisableCachingByDefault @DisableCachingByDefault @@ -41,79 +42,78 @@ class MigrateLockedDepsToCoreLocksTask extends AbstractMigrateToCoreLocksTask { @TaskAction void migrateLockedDependencies() { - if (DependencyLockingFeatureFlags.isCoreLockingEnabled()) { - def coreLockingHelper = new CoreLockingHelper(project) - coreLockingHelper.lockSelectedConfigurations(getConfigurationNames()) - - if (getInputLockFile().exists()) { - LOGGER.warn("Migrating legacy locks to core Gradle locking. This will remove legacy locks.\n" + - " - Legacy lock: ${getInputLockFile().absolutePath}\n" + - " - Core Gradle locks: ${project.projectDir.absoluteFile}/gradle.lockfile") - - def lockReader = new DependencyLockReader(project) - - Map> dependenciesInConfigs = new HashMap<>() - List emptyLockedConfigs = new ArrayList<>() - - def migrateConfigurationClosure = { - def locks = lockReader.readLocks(it, getInputLockFile(), new HashMap<>()) - - if (locks != null) { - for (Map.Entry> entry : locks.entrySet()) { - def groupAndName = entry.key as String - def entryLockedValue = (entry.value as Map)["locked"] - if (entryLockedValue != null) { - def lockedVersion = entryLockedValue as String - def lockedDependency = "$groupAndName:$lockedVersion".toString() - if (dependenciesInConfigs.containsKey(lockedDependency)) { - if (!dependenciesInConfigs[lockedDependency].contains(it.name)) { - dependenciesInConfigs[lockedDependency].add(it.name) + //TODO: address Invocation of Task.project at execution time has been deprecated. + DeprecationLogger.whileDisabled { + if (DependencyLockingFeatureFlags.isCoreLockingEnabled()) { + def coreLockingHelper = new CoreLockingHelper(project) + coreLockingHelper.lockSelectedConfigurations(getConfigurationNames()) + + if (getInputLockFile().exists()) { + LOGGER.warn("Migrating legacy locks to core Gradle locking. This will remove legacy locks.\n" + + " - Legacy lock: ${getInputLockFile().absolutePath}\n" + + " - Core Gradle locks: ${project.projectDir.absoluteFile}/gradle.lockfile") + + def lockReader = new DependencyLockReader(project) + + Map> dependenciesInConfigs = new HashMap<>() + List emptyLockedConfigs = new ArrayList<>() + + def migrateConfigurationClosure = { + def locks = lockReader.readLocks(it, getInputLockFile(), new HashMap<>()) + + if (locks != null) { + for (Map.Entry> entry : locks.entrySet()) { + def groupAndName = entry.key as String + def entryLockedValue = (entry.value as Map)["locked"] + if (entryLockedValue != null) { + def lockedVersion = entryLockedValue as String + def lockedDependency = "$groupAndName:$lockedVersion".toString() + if (dependenciesInConfigs.containsKey(lockedDependency)) { + if (!dependenciesInConfigs[lockedDependency].contains(it.name)) { + dependenciesInConfigs[lockedDependency].add(it.name) + } + } else { + dependenciesInConfigs.put(lockedDependency, [it.name]) } } else { - dependenciesInConfigs.put(lockedDependency, [it.name]) + LOGGER.info("No locked version for '$groupAndName' to migrate in $it") } - } else { - LOGGER.info("No locked version for '$groupAndName' to migrate in $it") } + } else { + if (!emptyLockedConfigs.contains(it.name)) + emptyLockedConfigs.add(it.name) } - } else { - if (!emptyLockedConfigs.contains(it.name)) - emptyLockedConfigs.add(it.name) } - } - coreLockingHelper.migrateLockedConfigurations(getConfigurationNames(), migrateConfigurationClosure) + coreLockingHelper.migrateLockedConfigurations(getConfigurationNames(), migrateConfigurationClosure) - def configLockFile = outputLock - if (!configLockFile.exists()) { - configLockFile.createNewFile() - configLockFile.write("# This is a file for dependency locking, migrated from Nebula locks.\n" + - "# Manual edits can break the build and are not advised.\n" + - "# This file is expected to be part of source control.\n") + def configLockFile = outputLock + if (!configLockFile.exists()) { + configLockFile.createNewFile() + configLockFile.write("# This is a file for dependency locking, migrated from Nebula locks.\n" + + "# Manual edits can break the build and are not advised.\n" + + "# This file is expected to be part of source control.\n") - dependenciesInConfigs.sort { it.key }.each { - configLockFile.append("${it.key}=${it.value.sort().join(",")}\n") + dependenciesInConfigs.sort { it.key }.each { + configLockFile.append("${it.key}=${it.value.sort().join(",")}\n") + } + configLockFile.append("empty=${emptyLockedConfigs.join(',')}") } - configLockFile.append("empty=${emptyLockedConfigs.join(',')}") - } - deleteInputLockFile() - } else { - throw new BuildCancelledException("Stopping migration. There is no lockfile at expected location:\n" + - "${getInputLockFile().path}") - } - } - } - - private void deleteInputLockFile() { - def failureToDeleteInputLockFileMessage = "Failed to delete legacy locks.\n" + - "Please remove the legacy lockfile manually.\n" + - " - Legacy lock: ${getInputLockFile().absolutePath}" - try { - if (!getInputLockFile().delete()) { - throw new BuildCancelledException(failureToDeleteInputLockFileMessage) + def failureToDeleteInputLockFileMessage = "Failed to delete legacy locks.\n" + + "Please remove the legacy lockfile manually.\n" + + " - Legacy lock: ${getInputLockFile().absolutePath}" + try { + if (!getInputLockFile().delete()) { + throw new BuildCancelledException(failureToDeleteInputLockFileMessage) + } + } catch (Exception e) { + throw new BuildCancelledException(failureToDeleteInputLockFileMessage, e) + } + } else { + throw new BuildCancelledException("Stopping migration. There is no lockfile at expected location:\n" + + "${getInputLockFile().path}") + } } - } catch (Exception e) { - throw new BuildCancelledException(failureToDeleteInputLockFileMessage, e) } } } diff --git a/src/main/groovy/nebula/plugin/dependencylock/tasks/MigrateToCoreLocksTask.groovy b/src/main/groovy/nebula/plugin/dependencylock/tasks/MigrateToCoreLocksTask.groovy index ff6d13a..84b695a 100644 --- a/src/main/groovy/nebula/plugin/dependencylock/tasks/MigrateToCoreLocksTask.groovy +++ b/src/main/groovy/nebula/plugin/dependencylock/tasks/MigrateToCoreLocksTask.groovy @@ -26,6 +26,7 @@ import org.gradle.api.artifacts.Configuration import org.gradle.api.artifacts.ResolveException import org.gradle.api.tasks.Internal import org.gradle.api.tasks.TaskAction +import org.gradle.internal.deprecation.DeprecationLogger import org.gradle.work.DisableCachingByDefault @DisableCachingByDefault @@ -35,30 +36,33 @@ class MigrateToCoreLocksTask extends AbstractMigrateToCoreLocksTask { @TaskAction void migrateUnlockedDependencies() { - if (DependencyLockingFeatureFlags.isCoreLockingEnabled()) { - def coreLockingHelper = new CoreLockingHelper(project) - coreLockingHelper.lockSelectedConfigurations(getConfigurationNames()) - - Map> dependenciesInConfigs = new HashMap<>() - - def migratingUnlockedDependenciesClosure = { - HashSet unlockedDependencies = MigrateToCoreLocksTask.findUnlockedDependencies(it) - - if (unlockedDependencies.size() > 0) { - - unlockedDependencies.toList().each { lockedDependency -> - if (dependenciesInConfigs.containsKey(lockedDependency)) { - if (!dependenciesInConfigs[lockedDependency].contains(it.name)) - dependenciesInConfigs[lockedDependency].add(it.name) - } else { - dependenciesInConfigs.put(lockedDependency, [it.name]) + //TODO: address Invocation of Task.project at execution time has been deprecated. + DeprecationLogger.whileDisabled { + if (DependencyLockingFeatureFlags.isCoreLockingEnabled()) { + def coreLockingHelper = new CoreLockingHelper(project) + coreLockingHelper.lockSelectedConfigurations(getConfigurationNames()) + + Map> dependenciesInConfigs = new HashMap<>() + + def migratingUnlockedDependenciesClosure = { + HashSet unlockedDependencies = MigrateToCoreLocksTask.findUnlockedDependencies(it) + + if (unlockedDependencies.size() > 0) { + + unlockedDependencies.toList().each { lockedDependency -> + if (dependenciesInConfigs.containsKey(lockedDependency)) { + if (!dependenciesInConfigs[lockedDependency].contains(it.name)) + dependenciesInConfigs[lockedDependency].add(it.name) + } else { + dependenciesInConfigs.put(lockedDependency, [it.name]) + } } } } - } - coreLockingHelper.migrateUnlockedDependenciesClosure(getConfigurationNames(), migratingUnlockedDependenciesClosure) + coreLockingHelper.migrateUnlockedDependenciesClosure(getConfigurationNames(), migratingUnlockedDependenciesClosure) - writeDependenciesIntoLockFile(dependenciesInConfigs, outputLock) + writeDependenciesIntoLockFile(dependenciesInConfigs, outputLock) + } } } diff --git a/src/main/groovy/nebula/plugin/dependencylock/tasks/UpdateLockTask.groovy b/src/main/groovy/nebula/plugin/dependencylock/tasks/UpdateLockTask.groovy index 70326a3..b207ca0 100644 --- a/src/main/groovy/nebula/plugin/dependencylock/tasks/UpdateLockTask.groovy +++ b/src/main/groovy/nebula/plugin/dependencylock/tasks/UpdateLockTask.groovy @@ -19,6 +19,7 @@ import nebula.plugin.dependencylock.DependencyLockExtension import nebula.plugin.dependencylock.utils.DependencyLockingFeatureFlags import org.gradle.api.BuildCancelledException import org.gradle.api.tasks.TaskAction +import org.gradle.internal.deprecation.DeprecationLogger import org.gradle.work.DisableCachingByDefault /** @@ -32,18 +33,22 @@ class UpdateLockTask extends GenerateLockTask { @TaskAction @Override void lock() { - if (DependencyLockingFeatureFlags.isCoreLockingEnabled()) { - def dependencyLockExtension = project.extensions.findByType(DependencyLockExtension) - def globalLockFile = new File(project.projectDir, dependencyLockExtension.globalLockFile) - if (globalLockFile.exists()) { - throw new BuildCancelledException("Legacy global locks are not supported with core locking.\n" + - "Please remove global locks.\n" + - " - Global locks: ${globalLockFile.absolutePath}") - } + //TODO: address Invocation of Task.project at execution time has been deprecated. + DeprecationLogger.whileDisabled { + if (DependencyLockingFeatureFlags.isCoreLockingEnabled()) { + def dependencyLockExtension = project.extensions.findByType(DependencyLockExtension) + def globalLockFile = new File(project.projectDir, dependencyLockExtension.globalLockFile) + if (globalLockFile.exists()) { + throw new BuildCancelledException("Legacy global locks are not supported with core locking.\n" + + "Please remove global locks.\n" + + " - Global locks: ${globalLockFile.absolutePath}") + } - throw new BuildCancelledException("updateLock is not supported with core locking.\n" + - "Please use `./gradlew dependencies --update-locks group1:module1,group2:module2`") + throw new BuildCancelledException("updateLock is not supported with core locking.\n" + + "Please use `./gradlew dependencies --update-locks group1:module1,group2:module2`") + } + super.lock() } - super.lock() + } } diff --git a/src/test/groovy/nebula/plugin/dependencylock/DependencyLockAlignmentLauncherSpec.groovy b/src/test/groovy/nebula/plugin/dependencylock/DependencyLockAlignmentLauncherSpec.groovy index bc3ea1a..2ad8765 100644 --- a/src/test/groovy/nebula/plugin/dependencylock/DependencyLockAlignmentLauncherSpec.groovy +++ b/src/test/groovy/nebula/plugin/dependencylock/DependencyLockAlignmentLauncherSpec.groovy @@ -53,7 +53,7 @@ class DependencyLockAlignmentLauncherSpec extends BaseIntegrationTestKitSpec { repositories { ${mavenrepo.mavenRepositoryBlock} - maven { url '${mavenForRules.absolutePath}' } + maven { url = '${mavenForRules.absolutePath}' } } dependencies { @@ -118,7 +118,7 @@ class DependencyLockAlignmentLauncherSpec extends BaseIntegrationTestKitSpec { repositories { ${mavenrepo.mavenRepositoryBlock} - maven { url '${mavenForRules.absolutePath}' } + maven { url = '${mavenForRules.absolutePath}' } } dependencies { diff --git a/src/test/groovy/nebula/plugin/dependencylock/DependencyLockCommitLauncherSpec.groovy b/src/test/groovy/nebula/plugin/dependencylock/DependencyLockCommitLauncherSpec.groovy index 0ef43fa..39ad86c 100644 --- a/src/test/groovy/nebula/plugin/dependencylock/DependencyLockCommitLauncherSpec.groovy +++ b/src/test/groovy/nebula/plugin/dependencylock/DependencyLockCommitLauncherSpec.groovy @@ -92,7 +92,7 @@ gradle.properties'''.stripIndent() subprojects { apply plugin: 'java' apply plugin: 'com.netflix.nebula.dependency-lock' - repositories { maven { url '${Fixture.repo}' } } + repositories { maven { url = '${Fixture.repo}' } } } """.stripIndent() @@ -133,7 +133,7 @@ gradle.properties'''.stripIndent() subprojects { apply plugin: 'java' apply plugin: 'com.netflix.nebula.dependency-lock' - repositories { maven { url '${Fixture.repo}' } } + repositories { maven { url = '${Fixture.repo}' } } } """.stripIndent() diff --git a/src/test/groovy/nebula/plugin/dependencylock/DependencyLockLauncherSpec.groovy b/src/test/groovy/nebula/plugin/dependencylock/DependencyLockLauncherSpec.groovy index d276290..823ecd7 100644 --- a/src/test/groovy/nebula/plugin/dependencylock/DependencyLockLauncherSpec.groovy +++ b/src/test/groovy/nebula/plugin/dependencylock/DependencyLockLauncherSpec.groovy @@ -45,7 +45,7 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec { static final String SPECIFIC_BUILD_GRADLE = """\ apply plugin: 'java' apply plugin: 'com.netflix.nebula.dependency-lock' - repositories { maven { url '${Fixture.repo}' } } + repositories { maven { url = '${Fixture.repo}' } } dependencies { implementation 'test.example:foo:1.0.1' implementation 'test.example:baz:1.0.0' @@ -55,7 +55,7 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec { static final String BUILD_GRADLE = """\ apply plugin: 'java' apply plugin: 'com.netflix.nebula.dependency-lock' - repositories { maven { url '${Fixture.repo}' } } + repositories { maven { url = '${Fixture.repo}' } } dependencies { implementation 'test.example:foo:1.+' } @@ -64,7 +64,7 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec { static final String NEW_BUILD_GRADLE = """\ apply plugin: 'java' apply plugin: 'com.netflix.nebula.dependency-lock' - repositories { maven { url '${Fixture.repo}' } } + repositories { maven { url = '${Fixture.repo}' } } dependencies { implementation 'test.example:foo:2.+' } @@ -304,7 +304,7 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec { group = 'test' } subprojects { - repositories { maven { url '${Fixture.repo}' } } + repositories { maven { url = '${Fixture.repo}' } } } """.stripIndent() @@ -389,7 +389,7 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec { buildFile << """\ apply plugin: 'java' apply plugin: 'com.netflix.nebula.dependency-lock' - repositories { maven { url '${Fixture.repo}' } } + repositories { maven { url = '${Fixture.repo}' } } dependencyLock { skippedDependencies = [ 'test.example:foo' ] } @@ -612,7 +612,7 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec { subprojects { apply plugin: 'java' apply plugin: 'com.netflix.nebula.dependency-lock' - repositories { maven { url '${Fixture.repo}' } } + repositories { maven { url = '${Fixture.repo}' } } } """.stripIndent() @@ -708,7 +708,7 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec { } subprojects { apply plugin: 'java' - repositories { maven { url '${Fixture.repo}' } } + repositories { maven { url = '${Fixture.repo}' } } } dependencyLock { includeTransitives = true @@ -797,7 +797,7 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec { } subprojects { apply plugin: 'java' - repositories { maven { url '${Fixture.repo}' } } + repositories { maven { url = '${Fixture.repo}' } } } dependencyLock { includeTransitives = true @@ -874,7 +874,7 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec { } subprojects { apply plugin: 'java' - repositories { maven { url '${Fixture.repo}' } } + repositories { maven { url = '${Fixture.repo}' } } } dependencyLock { @@ -923,7 +923,7 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec { } subprojects { apply plugin: 'java' - repositories { maven { url '${Fixture.repo}' } } + repositories { maven { url = '${Fixture.repo}' } } } dependencyLock { includeTransitives = true @@ -1155,7 +1155,7 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec { buildFile << """\ apply plugin: 'java' apply plugin: 'com.netflix.nebula.dependency-lock' - repositories { maven { url '${Fixture.repo}' } } + repositories { maven { url = '${Fixture.repo}' } } dependencyLock { includeTransitives = true } @@ -1212,7 +1212,7 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec { buildFile << """\ apply plugin: 'java' apply plugin: 'com.netflix.nebula.dependency-lock' - repositories { maven { url '${Fixture.repo}' } } + repositories { maven { url = '${Fixture.repo}' } } dependencyLock { includeTransitives = true } @@ -1436,7 +1436,7 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec { buildFile << """ apply plugin: 'java' apply plugin: 'com.netflix.nebula.dependency-lock' - repositories { maven { url '${Fixture.repo}' } } + repositories { maven { url = '${Fixture.repo}' } } dependencies { implementation 'test.example:foo:1.+' } @@ -1470,7 +1470,7 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec { buildFile << """ apply plugin: 'java' apply plugin: 'com.netflix.nebula.dependency-lock' - repositories { maven { url '${Fixture.repo}' } } + repositories { maven { url = '${Fixture.repo}' } } dependencies { implementation 'test.example:foo:1.+' } @@ -1492,7 +1492,7 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec { buildFile << """ apply plugin: 'java' apply plugin: 'com.netflix.nebula.dependency-lock' - repositories { maven { url '${Fixture.repo}' } } + repositories { maven { url = '${Fixture.repo}' } } dependencies { implementation 'test.example:foo:1.+' } @@ -1899,7 +1899,7 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec { } subprojects { apply plugin: 'java' - repositories { maven { url '${Fixture.repo}' } } + repositories { maven { url = '${Fixture.repo}' } } } """.stripIndent() } @@ -1920,7 +1920,7 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec { buildscript { repositories { maven { - url "https://plugins.gradle.org/m2/" + url = "https://plugins.gradle.org/m2/" } } dependencies { @@ -1940,7 +1940,7 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec { apply plugin: 'scala' apply plugin: "com.github.spotbugs" repositories { - maven { url '${Fixture.repo}' } + maven { url = '${Fixture.repo}' } mavenCentral() } } @@ -1970,7 +1970,7 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec { } subprojects { apply plugin: 'java-library' - repositories { maven { url '${Fixture.repo}' } } + repositories { maven { url = '${Fixture.repo}' } } } """.stripIndent() } @@ -2126,7 +2126,7 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec { buildFile << """\ apply plugin: 'java' apply plugin: 'com.netflix.nebula.dependency-lock' - repositories { maven { url '${repo.absolutePath}' } } + repositories { maven { url = '${repo.absolutePath}' } } dependencies { implementation($platformType('sample:recommender:1.1')) } @@ -2154,7 +2154,7 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec { buildFile << """\ apply plugin: 'java' apply plugin: 'com.netflix.nebula.dependency-lock' - repositories { maven { url '${Fixture.repo}' } } + repositories { maven { url = '${Fixture.repo}' } } repositories { flatDir { dirs 'libs' } } dependencies { implementation 'test.example:foo:1.0.1' diff --git a/src/test/groovy/nebula/plugin/dependencylock/DependencyLockPluginIntegrationSpec.groovy b/src/test/groovy/nebula/plugin/dependencylock/DependencyLockPluginIntegrationSpec.groovy index c36fb03..4cd8d7c 100644 --- a/src/test/groovy/nebula/plugin/dependencylock/DependencyLockPluginIntegrationSpec.groovy +++ b/src/test/groovy/nebula/plugin/dependencylock/DependencyLockPluginIntegrationSpec.groovy @@ -14,7 +14,7 @@ class DependencyLockPluginIntegrationSpec extends BaseIntegrationTestKitSpec { id 'java' } - repositories { maven { url '${Fixture.repo}' } } + repositories { maven { url = '${Fixture.repo}' } } dependencies { implementation 'test.example:foo:latest.release' @@ -45,7 +45,7 @@ class DependencyLockPluginIntegrationSpec extends BaseIntegrationTestKitSpec { id 'java' } - repositories { maven { url '${Fixture.repo}' } } + repositories { maven { url = '${Fixture.repo}' } } configurations.all { configuration -> incoming.beforeResolve { diff --git a/src/test/groovy/nebula/plugin/dependencylock/DependencyLockPluginWithCoreSpec.groovy b/src/test/groovy/nebula/plugin/dependencylock/DependencyLockPluginWithCoreSpec.groovy index 2481cf4..16e21ce 100644 --- a/src/test/groovy/nebula/plugin/dependencylock/DependencyLockPluginWithCoreSpec.groovy +++ b/src/test/groovy/nebula/plugin/dependencylock/DependencyLockPluginWithCoreSpec.groovy @@ -483,8 +483,8 @@ class DependencyLockPluginWithCoreSpec extends AbstractDependencyLockPluginSpec buildFile << """\ buildscript { repositories { - maven { url "https://plugins.gradle.org/m2/" } - maven { url 'https://clojars.org/repo' } + maven { url = "https://plugins.gradle.org/m2/" } + maven { url = 'https://clojars.org/repo' } } } plugins { @@ -495,7 +495,7 @@ buildscript { repositories { ${mavenrepo.mavenRepositoryBlock} mavenCentral() - maven { url 'https://clojars.org/repo' } + maven { url = 'https://clojars.org/repo' } } dependencies { $configuration 'org.clojure:clojure:1.8.0' @@ -568,8 +568,8 @@ buildscript { buildFile << """\ buildscript { repositories { - maven { url "https://plugins.gradle.org/m2/" } - maven { url 'https://clojars.org/repo' } + maven { url = "https://plugins.gradle.org/m2/" } + maven { url = 'https://clojars.org/repo' } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0" @@ -580,7 +580,7 @@ buildscript { repositories { ${mavenrepo.mavenRepositoryBlock} mavenCentral() - maven { url 'https://clojars.org/repo' } + maven { url = 'https://clojars.org/repo' } } dependencies { implementation 'test.nebula:a:1.+' @@ -696,9 +696,9 @@ buildscript { buildscript { repositories { maven { - url "https://plugins.gradle.org/m2/" + url = "https://plugins.gradle.org/m2/" } - maven { url 'https://clojars.org/repo' } + maven { url = 'https://clojars.org/repo' } } dependencies { classpath "com.github.spotbugs.snom:spotbugs-gradle-plugin:5.0.14" @@ -896,9 +896,9 @@ buildscript { buildscript { repositories { maven { - url "https://plugins.gradle.org/m2/" + url = "https://plugins.gradle.org/m2/" } - maven { url 'https://clojars.org/repo' } + maven { url = 'https://clojars.org/repo' } } dependencies { classpath "com.netflix.nebula:nebula-project-plugin:10.1.4" @@ -912,7 +912,7 @@ buildscript { repositories { ${mavenrepo.mavenRepositoryBlock} mavenCentral() - maven { url 'https://clojars.org/repo' } + maven { url = 'https://clojars.org/repo' } } dependencies { implementation 'test.nebula:a:1.+' diff --git a/src/test/groovy/nebula/plugin/dependencylock/DependencyLockPluginWithCoreVerifierSpec.groovy b/src/test/groovy/nebula/plugin/dependencylock/DependencyLockPluginWithCoreVerifierSpec.groovy index 315433d..ac9a2a4 100644 --- a/src/test/groovy/nebula/plugin/dependencylock/DependencyLockPluginWithCoreVerifierSpec.groovy +++ b/src/test/groovy/nebula/plugin/dependencylock/DependencyLockPluginWithCoreVerifierSpec.groovy @@ -550,7 +550,7 @@ empty=annotationProcessor,testAnnotationProcessor buildFile << """\ buildscript { - repositories { maven { url "https://plugins.gradle.org/m2/" } } + repositories { maven { url = "https://plugins.gradle.org/m2/" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22" } @@ -608,8 +608,8 @@ empty=annotationProcessor,testAnnotationProcessor buildFile << """\ buildscript { repositories { - maven { url "https://plugins.gradle.org/m2/" } - maven { url 'https://clojars.org/repo' } + maven { url = "https://plugins.gradle.org/m2/" } + maven { url = 'https://clojars.org/repo' } } dependencies { classpath "com.netflix.nebula:nebula-clojure-plugin:13.0.1" @@ -622,7 +622,7 @@ empty=annotationProcessor,testAnnotationProcessor repositories { ${mavenrepo.mavenRepositoryBlock} mavenCentral() - maven { url 'https://clojars.org/repo' } + maven { url = 'https://clojars.org/repo' } } dependencies { implementation 'org.clojure:clojure:1.8.0' diff --git a/src/test/groovy/nebula/plugin/dependencylock/PathAwareDependencyDiffSpec.groovy b/src/test/groovy/nebula/plugin/dependencylock/PathAwareDependencyDiffSpec.groovy index f3f3dcd..f508828 100644 --- a/src/test/groovy/nebula/plugin/dependencylock/PathAwareDependencyDiffSpec.groovy +++ b/src/test/groovy/nebula/plugin/dependencylock/PathAwareDependencyDiffSpec.groovy @@ -146,7 +146,7 @@ class PathAwareDependencyDiffSpec extends BaseIntegrationTestKitSpec { } apply plugin: 'java' - repositories { maven { url '${repoDir.absolutePath}' } } + repositories { maven { url = '${repoDir.absolutePath}' } } dependencyLock { includeTransitives = true @@ -263,8 +263,8 @@ class PathAwareDependencyDiffSpec extends BaseIntegrationTestKitSpec { apply plugin: 'java' repositories { - maven { url '${repo.root.absoluteFile.toURI()}' } - maven { url '${repoDir.absolutePath}' } + maven { url = '${repo.root.absoluteFile.toURI()}' } + maven { url = '${repoDir.absolutePath}' } } dependencyLock { @@ -336,12 +336,12 @@ class PathAwareDependencyDiffSpec extends BaseIntegrationTestKitSpec { buildFile << """\ plugins { id 'com.netflix.nebula.dependency-lock' - id "nebula.resolution-rules" version "9.0.0" + id "com.netflix.nebula.resolution-rules" version "11.4.1" } apply plugin: 'java' repositories { - maven { url '${repoDir.absolutePath}' } + maven { url = '${repoDir.absolutePath}' } } dependencyLock { @@ -444,12 +444,12 @@ class PathAwareDependencyDiffSpec extends BaseIntegrationTestKitSpec { buildFile << """\ plugins { id 'com.netflix.nebula.dependency-lock' - id "nebula.resolution-rules" version "9.0.0" + id "com.netflix.nebula.resolution-rules" version "11.4.1" } apply plugin: 'java' repositories { - maven { url '${repoDir.absolutePath}' } + maven { url = '${repoDir.absolutePath}' } } dependencyLock { @@ -557,12 +557,12 @@ class PathAwareDependencyDiffSpec extends BaseIntegrationTestKitSpec { buildFile << """\ plugins { id 'com.netflix.nebula.dependency-lock' - id "nebula.resolution-rules" version "9.0.0" + id "com.netflix.nebula.resolution-rules" version "11.4.1" } apply plugin: 'java' repositories { - maven { url '${repoDir.absolutePath}' } + maven { url = '${repoDir.absolutePath}' } } dependencyLock { @@ -631,12 +631,12 @@ class PathAwareDependencyDiffSpec extends BaseIntegrationTestKitSpec { buildFile << """\ plugins { id 'com.netflix.nebula.dependency-lock' - id "nebula.resolution-rules" version "9.0.0" + id "com.netflix.nebula.resolution-rules" version "11.4.1" } apply plugin: 'java' repositories { - maven { url '${repoDir.absolutePath}' } + maven { url = '${repoDir.absolutePath}' } } dependencyLock { @@ -703,12 +703,12 @@ class PathAwareDependencyDiffSpec extends BaseIntegrationTestKitSpec { buildFile << """\ plugins { id 'com.netflix.nebula.dependency-lock' - id "nebula.resolution-rules" version "9.0.0" + id "com.netflix.nebula.resolution-rules" version "11.4.1" } apply plugin: 'java' repositories { - maven { url '${repoDir.absolutePath}' } + maven { url = '${repoDir.absolutePath}' } } dependencyLock { @@ -780,12 +780,12 @@ class PathAwareDependencyDiffSpec extends BaseIntegrationTestKitSpec { buildFile << """\ plugins { id 'com.netflix.nebula.dependency-lock' - id "nebula.resolution-rules" version "9.0.0" + id "com.netflix.nebula.resolution-rules" version "11.4.1" } apply plugin: 'java' repositories { - maven { url '${repoDir.absolutePath}' } + maven { url = '${repoDir.absolutePath}' } } dependencyLock { @@ -818,7 +818,7 @@ class PathAwareDependencyDiffSpec extends BaseIntegrationTestKitSpec { allprojects { apply plugin: 'java-library' apply plugin: 'com.netflix.nebula.dependency-lock' - repositories { maven { url '${repoDir.absolutePath}' } } + repositories { maven { url = '${repoDir.absolutePath}' } } group = 'test' @@ -949,7 +949,7 @@ class PathAwareDependencyDiffSpec extends BaseIntegrationTestKitSpec { allprojects { apply plugin: 'java-library' apply plugin: 'com.netflix.nebula.dependency-lock' - repositories { maven { url '${repoDir.absolutePath}' } } + repositories { maven { url = '${repoDir.absolutePath}' } } group = 'test' @@ -992,7 +992,7 @@ class PathAwareDependencyDiffSpec extends BaseIntegrationTestKitSpec { apply plugin: 'java' repositories { - maven { url '${repoDir.absolutePath}' } + maven { url = '${repoDir.absolutePath}' } } dependencyLock { @@ -1035,12 +1035,12 @@ class PathAwareDependencyDiffSpec extends BaseIntegrationTestKitSpec { buildFile << """\ plugins { id 'com.netflix.nebula.dependency-lock' - id "nebula.resolution-rules" version "9.0.0" + id "com.netflix.nebula.resolution-rules" version "11.4.1" } apply plugin: 'java' repositories { - maven { url '${repoDir.absolutePath}' } + maven { url = '${repoDir.absolutePath}' } } dependencyLock { @@ -1155,7 +1155,7 @@ class PathAwareDependencyDiffSpec extends BaseIntegrationTestKitSpec { apply plugin: 'java' repositories { - maven { url '${repoDir.absolutePath}' } + maven { url = '${repoDir.absolutePath}' } } dependencyLock { diff --git a/src/test/groovy/nebula/plugin/dependencylock/ResolutionRulesLockabilitySpec.groovy b/src/test/groovy/nebula/plugin/dependencylock/ResolutionRulesLockabilitySpec.groovy index 01c9e96..893d97e 100644 --- a/src/test/groovy/nebula/plugin/dependencylock/ResolutionRulesLockabilitySpec.groovy +++ b/src/test/groovy/nebula/plugin/dependencylock/ResolutionRulesLockabilitySpec.groovy @@ -50,7 +50,7 @@ class ResolutionRulesLockabilitySpec extends BaseIntegrationTestKitSpec { allprojects { repositories { mavenCentral() - maven { url '${mavenForRules.absolutePath}' } + maven { url = '${mavenForRules.absolutePath}' } } } dependencies { diff --git a/src/test/groovy/nebula/plugin/dependencylock/caching/AbstractCachingAndDependencyLockingFeatureFlagsSpec.groovy b/src/test/groovy/nebula/plugin/dependencylock/caching/AbstractCachingAndDependencyLockingFeatureFlagsSpec.groovy index a7c4874..37a2914 100644 --- a/src/test/groovy/nebula/plugin/dependencylock/caching/AbstractCachingAndDependencyLockingFeatureFlagsSpec.groovy +++ b/src/test/groovy/nebula/plugin/dependencylock/caching/AbstractCachingAndDependencyLockingFeatureFlagsSpec.groovy @@ -84,7 +84,7 @@ class AbstractCachingAndDependencyLockingFeatureFlagsSpec extends BaseIntegratio } repositories { maven { - url "$serverUrl" + url = "$serverUrl" allowInsecureProtocol = true metadataSources { mavenPom() diff --git a/src/test/groovy/nebula/plugin/dependencylock/tasks/MigrateToCoreLocksTaskSpec.groovy b/src/test/groovy/nebula/plugin/dependencylock/tasks/MigrateToCoreLocksTaskSpec.groovy index 91a0142..cc736b1 100644 --- a/src/test/groovy/nebula/plugin/dependencylock/tasks/MigrateToCoreLocksTaskSpec.groovy +++ b/src/test/groovy/nebula/plugin/dependencylock/tasks/MigrateToCoreLocksTaskSpec.groovy @@ -562,7 +562,7 @@ class MigrateToCoreLocksTaskSpec extends AbstractDependencyLockPluginSpec { buildscript { repositories { maven { - url "https://plugins.gradle.org/m2/" + url = "https://plugins.gradle.org/m2/" } } dependencies { @@ -653,7 +653,7 @@ class MigrateToCoreLocksTaskSpec extends AbstractDependencyLockPluginSpec { buildscript { repositories { maven { - url "https://plugins.gradle.org/m2/" + url = "https://plugins.gradle.org/m2/" } } dependencies { diff --git a/src/test/groovy/nebula/plugin/dependencyverifier/DependencyResolutionVerifierTest.groovy b/src/test/groovy/nebula/plugin/dependencyverifier/DependencyResolutionVerifierTest.groovy index 465a602..5806f39 100644 --- a/src/test/groovy/nebula/plugin/dependencyverifier/DependencyResolutionVerifierTest.groovy +++ b/src/test/groovy/nebula/plugin/dependencyverifier/DependencyResolutionVerifierTest.groovy @@ -214,7 +214,7 @@ class DependencyResolutionVerifierTest extends BaseIntegrationTestKitSpec { given: buildFile << """ buildscript { - repositories { maven { url "https://plugins.gradle.org/m2/" } } + repositories { maven { url = "https://plugins.gradle.org/m2/" } } dependencies { classpath "com.github.spotbugs.snom:spotbugs-gradle-plugin:5.0.14" }