Skip to content

Commit

Permalink
Merge pull request #260 from nebula-plugins/configuration-cache-tests…
Browse files Browse the repository at this point in the history
…-locking

Configuration cache tests locking
  • Loading branch information
rpalcolea authored Nov 11, 2023
2 parents 2f3c2cc + 60fba75 commit f224afb
Show file tree
Hide file tree
Showing 7 changed files with 153 additions and 133 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,7 @@ class DependencyLockTaskConfigurer {
private TaskProvider<GenerateLockTask> configureGlobalLockTask(TaskProvider<GenerateGlobalLockTask> globalLockTask, String lockFilename,
DependencyLockExtension extension, Map<String, String> overridesMap) {
globalLockTask.configure { globalGenerateTask ->
globalGenerateTask.doFirst {
project.subprojects.each { sub -> sub.repositories.each { repo -> project.repositories.add(repo) } }
}
project.subprojects.each { sub -> sub.repositories.each { repo -> project.repositories.add(repo) } }
includeTransitives.set(
project.hasProperty('dependencyLock.includeTransitives') ? Boolean.parseBoolean(project['dependencyLock.includeTransitives'] as String) : extension.includeTransitives.get()
)
Expand Down
10 changes: 10 additions & 0 deletions src/test/groovy/nebula/plugin/BaseIntegrationTestKitSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ import nebula.test.IntegrationTestKitSpec

abstract class BaseIntegrationTestKitSpec extends IntegrationTestKitSpec {
def setup() {
// Enable configuration cache :)
new File(projectDir, 'gradle.properties') << '''org.gradle.configuration-cache=true'''.stripIndent()
}

void disableConfigurationCache() {
def propertiesFile = new File(projectDir, 'gradle.properties')
if(propertiesFile.exists()) {
propertiesFile.delete()
}
propertiesFile.createNewFile()
propertiesFile << '''org.gradle.configuration-cache=false'''.stripIndent()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class DependencyLockAlignmentLauncherSpec extends BaseIntegrationTestKitSpec {
def setup() {
definePluginOutsideOfPluginBlock = true
keepFiles = true

//TODO make task listener changes for config cache
disableConfigurationCache()
}

@Unroll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
*/
package nebula.plugin.dependencylock

import nebula.plugin.BaseIntegrationTestKitSpec
import nebula.plugin.dependencylock.dependencyfixture.Fixture
import nebula.test.IntegrationTestKitSpec
import org.ajoberstar.grgit.Grgit

import java.nio.file.Files

class DependencyLockCommitLauncherSpec extends BaseIntegrationTestKitSpec {
class DependencyLockCommitLauncherSpec extends IntegrationTestKitSpec {

protected Grgit git
protected Grgit originGit
Expand Down Expand Up @@ -53,7 +53,6 @@ class DependencyLockCommitLauncherSpec extends BaseIntegrationTestKitSpec {
build/
gradle.properties'''.stripIndent()
def gradleProperties = new File(projectDir, "gradle.properties")
gradleProperties.createNewFile()
gradleProperties << "systemProp.nebula.features.coreLockingSupport=false"
// Enable configuration cache :)
gradleProperties << '''org.gradle.configuration-cache=true'''.stripIndent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import nebula.plugin.BaseIntegrationTestKitSpec
import nebula.plugin.dependencylock.dependencyfixture.Fixture
import nebula.plugin.dependencylock.util.LockGenerator
import nebula.plugin.dependencylock.utils.GradleVersionUtils
import nebula.test.IntegrationTestKitSpec
import nebula.test.dependencies.DependencyGraphBuilder
import nebula.test.dependencies.GradleDependencyGenerator
import nebula.test.dependencies.ModuleBuilder
Expand Down Expand Up @@ -446,6 +445,9 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec {
dependenciesLock << PRE_DIFF_FOO_LOCK
buildFile << BUILD_GRADLE

//TODO make diff lock config cache compatible
disableConfigurationCache()

when:
runTasks('generateLock', 'diffLock')

Expand Down Expand Up @@ -1056,6 +1058,8 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec {
}
'''.stripIndent())

//TODO make diff lock config cache compatible
disableConfigurationCache()
when:
runTasks('generateLock', 'diffLock')

Expand All @@ -1071,6 +1075,8 @@ class DependencyLockLauncherSpec extends BaseIntegrationTestKitSpec {
}

def 'diffLock in multiproject with no locks'() {
//TODO make diff lock config cache compatible
disableConfigurationCache()
setupCommonMultiproject()

when:
Expand Down
Loading

0 comments on commit f224afb

Please sign in to comment.