aboutsummaryrefslogtreecommitdiff
path: root/busytown.gradle
blob: 1b9a7119fbeac58a4f00d783f853fdd4530564a0 (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
def destDir = (System.getenv("DIST_DIR") == null) ? file("dist") : file(System.getenv("DIST_DIR"))

def hostTestDir = new File(destDir, "host-test-reports")

allprojects { project ->
    project.tasks.withType(Test) { task ->
        def report = task.reports.junitXml
        if (report.isEnabled()) {
            def zipTask = project.tasks.create("zipResultsOf${project.name}", Zip) {
                destinationDir = hostTestDir
                archiveName = "${project.name}.zip"
            }
            task.finalizedBy(zipTask)
            task.doFirst {
                zipTask.from(report.destination)
            }
        }
        task.ignoreFailures = true
    }
    if (project.rootProject == project) {
        def zipMaven = project.tasks.create("zipMaven", Zip) {
            from file("${project.buildDir}/dist-maven")
            destinationDir destDir
            archiveName = "maven.zip"
        }

        def copyRepository = project.tasks.create("copyRepository", Copy) {
            from file("${project.buildDir}/dist-maven")
            into "${destDir}/repository"
        }

        [copyRepository, zipMaven].forEach {
            it.dependsOn(":runners:android-gradle-plugin:publishToDistMaven")
            it.dependsOn(":runners:gradle-plugin:publishToDistMaven")
            it.dependsOn(":runners:fatjar:publishToDistMaven")
        }
    }
}