File: build.gradle

package info (click to toggle)
checker-framework-java 3.0.1%2Bds2-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 22,736 kB
  • sloc: java: 145,286; xml: 785; sh: 456; makefile: 401; perl: 26
file content (39 lines) | stat: -rw-r--r-- 1,297 bytes parent folder | download | duplicates (3)
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
evaluationDependsOn(":checker-qual")

task copySources(type: Copy, dependsOn: ':checker-qual:copySources') {
    description 'Copy checker-qual source to checker-qual-android'

    includeEmptyDirs = false
    doFirst {
        // Delete the directory in case a previously copied file should no longer be in checker-qual
        delete file('src')
    }
    from files('../checker-qual/src/main')
    include "**/*.java"
    into file('src/main')

    // Not read only because "replaceAnnotations" tasks writes to the files.
    fileMode(0666)
    dirMode(0777)
}

/**
* Types annotated with runtime annotations are always kept in the main dex by the default Android Gradle plugin.
* Using the standard Checker Framework annotations can lead to main dex overflows;
* users of the Checker framework may find themselves unable to build their Android apps.
* By contrast, class-retention annotations are stripped out before packaging by all build systems as a convention.
*/
task replaceAnnotations {
    doLast {
        fileTree(dir: 'src', include: "**/*.java").each {
            it.text = it.text.replaceAll("RetentionPolicy.RUNTIME", "RetentionPolicy.CLASS")
        }
    }
}
replaceAnnotations.dependsOn copySources

compileJava.dependsOn replaceAnnotations

clean {
    delete file('src')
}