Debian Codegraph @

checker-qual-android/build.gradle

raw
1 evaluationDependsOn(":checker-qual")
2
3 task copySources(type: Copy, dependsOn: ':checker-qual:copySources') {
4 description 'Copy checker-qual source to checker-qual-android'
5
6 includeEmptyDirs = false
7 doFirst {
8 // Delete the directory in case a previously copied file should no longer be in checker-qual
9 delete file('src')
10 }
11 from files('../checker-qual/src/main')
12 include "**/*.java"
13 into file('src/main')
14
15 // Not read only because "replaceAnnotations" tasks writes to the files.
16 fileMode(0666)
17 dirMode(0777)
18 }
19
20 /**
21 * Types annotated with runtime annotations are always kept in the main dex by the default Android Gradle plugin.
22 * Using the standard Checker Framework annotations can lead to main dex overflows;
23 * users of the Checker framework may find themselves unable to build their Android apps.
24 * By contrast, class-retention annotations are stripped out before packaging by all build systems as a convention.
25 */
26 task replaceAnnotations {
27 doLast {
28 fileTree(dir: 'src', include: "**/*.java").each {
29 it.text = it.text.replaceAll("RetentionPolicy.RUNTIME", "RetentionPolicy.CLASS")
30 }
31 }
32 }
33 replaceAnnotations.dependsOn copySources
34
35 compileJava.dependsOn replaceAnnotations
36
37 clean {
38 delete file('src')
39 }