File: integTest.gradle

package info (click to toggle)
gradle 1.5-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 36,408 kB
  • ctags: 34,655
  • sloc: java: 148,313; xml: 23,958; sh: 291; makefile: 53; cpp: 30; jsp: 11
file content (89 lines) | stat: -rw-r--r-- 3,374 bytes parent folder | download
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
apply plugin: 'java'

sourceSets {
    integTest {
        compileClasspath += main.output + test.output
        runtimeClasspath += main.output + test.output
    }
}

configurations {
    integTestCompile.extendsFrom testCompile
    integTestRuntime.extendsFrom testRuntime
}

dependencies {
    integTestCompile project(":internalIntegTesting")

    //so that implicit help tasks are available:
    integTestRuntime project(':diagnostics')
    //above can be removed when we implement the auto-apply plugins
}

ext.integTestTasks = tasks.withType(Test).matching { it.name.toLowerCase().endsWith('integtest') }

integTestTasks.all { Test task ->
    dependsOn ':intTestImage'
    testClassesDir = sourceSets.integTest.output.classesDir
    classpath = sourceSets.integTest.runtimeClasspath
    testSrcDirs = []
    jvmArgs '-Xmx512m', '-XX:MaxPermSize=256m', '-XX:+HeapDumpOnOutOfMemoryError'

    testResultsDir = file("${project.testResultsDir}/$name")

    systemProperties['org.gradle.integtest.versions'] = project.hasProperty("testAllVersions") ? 'all' : 'latest'
    if (project.hasProperty('crossVersionTestsOnly')) {
        include '**/*CrossVersion*'
        forkEvery = 1
    }

    dependsOn project.task("configure${task.name.capitalize()}") << {
        configure(task) {
            testReportDir = file("${project.reporting.baseDir}/$name")
            systemProperties['integTest.gradleHomeDir'] = rootProject.intTestImage.destinationDir.absolutePath
            systemProperties['integTest.gradleUserHomeDir'] = rootProject.file('intTestHomeDir').absolutePath
            systemProperties['integTest.libsRepo'] = rootProject.file('build/repo')
            
            // If the projects int test need the distributions, they should add:
            // inputs.files rootProject.buildDists
            systemProperties['integTest.distsDir'] = rootProject.distsDir.absolutePath

            // The user home dir is not wiped out by clean
            // Move the daemon working space underneath the build dir so they don't pile up on CI
            systemProperties['org.gradle.integtest.daemon.registry'] = file("$rootProject.buildDir/daemon").absolutePath
        }
    }
}

task integTest(type: Test) {
    def defaultExecuter = project.hasProperty("defaultIntegTestExecuter") ? project.defaultIntegTestExecuter : "embedded"
    systemProperties['org.gradle.integtest.executer'] = defaultExecuter
}
check.dependsOn(integTest)

['embedded', 'forking', 'daemon', 'embeddedDaemon', 'parallel'].each { mode ->
    def taskName = "${mode}IntegTest"
    tasks.add(taskName, Test).configure {
        systemProperties['org.gradle.integtest.executer'] = mode
    }
}

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

plugins.withType(org.gradle.plugins.ide.eclipse.EclipsePlugin) { // lazy as plugin not applied yet
    eclipse {
        classpath {
            plusConfigurations.add(configurations.integTestCompile)
            plusConfigurations.add(configurations.integTestRuntime)
        }
    }
}