Sagar2018

checker.gradle

May 9th, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 2.77 KB | None | 0 0
  1. ///////////////////////////////////////////////////////////////////////////
  2. /// Checker Framework pluggable type-checking
  3. ///
  4.  
  5. apply plugin: 'java'
  6.  
  7. repositories {
  8.   mavenCentral()
  9. }
  10.  
  11. configurations {
  12.   checkerFrameworkCheckerJar {
  13.     description = 'the Checker Framework, including the Type Annotations compiler'
  14.   }
  15.  
  16.   checkerFrameworkAnnotatedJDK {
  17.     description = 'a copy of JDK classes with Checker Framework type qualifers inserted'
  18.   }
  19. }
  20.  
  21. // Checker Framework from Maven Central
  22. dependencies {
  23.   ext.checkerFrameworkVersion = '2.5.0'
  24.   checkerFrameworkAnnotatedJDK "org.checkerframework:jdk8:${checkerFrameworkVersion}"
  25.   checkerFrameworkCheckerJar "org.checkerframework:checker:${checkerFrameworkVersion}"
  26.   implementation "org.checkerframework:checker-qual:${checkerFrameworkVersion}"
  27. }
  28.  
  29. // Checker Framework from local build
  30. // dependencies {
  31. //   ext.checkerframeworkdist = "$System.env.CHECKERFRAMEWORK/checker/dist"
  32. //   checkerFrameworkAnnotatedJDK fileTree(dir: "${ext.checkerframeworkdist}", include: "jdk8.jar")
  33. //   checkerFrameworkCheckerJar fileTree(dir: "${ext.checkerframeworkdist}", include: 'checker.jar')
  34. //   compile fileTree(dir: "${ext.checkerframeworkdist}", include: 'checker-qual.jar')
  35. // }
  36.  
  37. // // To type-check all projects.
  38. allprojects {
  39.   tasks.withType(JavaCompile).all { JavaCompile compile ->
  40.     compile.doFirst {
  41.       compile.options.compilerArgs = [
  42.         '-processorpath', "${configurations.checkerFrameworkCheckerJar.asPath}",
  43.         '-processor', 'org.checkerframework.checker.formatter.FormatterChecker,org.checkerframework.checker.index.IndexChecker,org.checkerframework.checker.lock.LockChecker,org.checkerframework.checker.nullness.NullnessChecker,org.checkerframework.checker.signature.SignatureChecker',
  44.         '-Xmaxerrs', '10000',
  45.         '-Awarns',    // turn Checker Framework errors into warnings
  46.         '-AcheckPurityAnnotations',
  47.         "-Xbootclasspath/p:${configurations.checkerFrameworkAnnotatedJDK.asPath}",
  48.         "-Astubs=$System.env.CHECKERFRAMEWORK/checker/resources/javadoc.astub" // TODO: does not work when downloading from Maven Central
  49.       ]
  50.     }
  51.   }
  52. }
  53.  
  54. // To typecheck only the current project's main source set (in a multi-project
  55. // build), use this instead:
  56. // compileJava {
  57. //   doFirst {
  58. //     options.compilerArgs = [
  59. //         '-processorpath', "${configurations.checkerFrameworkCheckerJar.asPath}",
  60. //         '-processor', 'org.checkerframework.checker.nullness.NullnessChecker',
  61. //         '-Xmaxerrs', '10000',
  62. //         '-Xmaxwarns', '10000',
  63. //         // '-Awarns',      // turn Checker Framework errors into warnings
  64. //         '-AcheckPurityAnnotations',
  65. //         "-Xbootclasspath/p:${configurations.checkerFrameworkAnnotatedJDK.asPath}"
  66. //     ]
  67. //   }
  68. // }
Add Comment
Please, Sign In to add comment