summaryrefslogtreecommitdiff
path: root/gradle/integTest.gradle
blob: 07b07437b551b10ba42c96ed11d533d2324cd1b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
sourceSets {
    integTest {
        compileClasspath += main.output + test.output
        runtimeClasspath += main.output + test.output
    }
}

configurations {
    integTestCompile.extendsFrom testCompile
    integTestRuntime.extendsFrom testRuntime
}

task integTest(type: Test) {
    shouldRunAfter 'test'
    testClassesDir = sourceSets.integTest.output.classesDir
    classpath = sourceSets.integTest.runtimeClasspath

}
check.dependsOn(integTest)

plugins.withType(org.gradle.plugins.ide.idea.IdeaPlugin) {
    idea {
        module {
            testSourceDirs += sourceSets.integTest.groovy.srcDirs
            testSourceDirs += sourceSets.integTest.resources.srcDirs
            scopes.TEST.plus.add(configurations.integTestCompile)
            scopes.TEST.plus.add(configurations.integTestRuntime)
        }
    }
}


// START SNIPPET test-logic-classpath
// Write the plugin's classpath to a file to share with the tests
task createClasspathManifest {
    def outputDir = file("$buildDir/$name")

    inputs.files sourceSets.main.runtimeClasspath
    outputs.dir outputDir

    doLast {
        outputDir.mkdirs()
        file("$outputDir/plugin-classpath.txt").text = sourceSets.main.runtimeClasspath.join("\n")
    }
}

// Add the classpath file to the test runtime classpath
dependencies {
    integTestRuntime files(createClasspathManifest)
}