generated from typetools/templatefora-checker
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
309 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: gradle | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
open-pull-requests-limit: 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Java CI with Gradle | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
java: [ '11', '17', '21' ] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
show-progress: false | ||
- name: Set up JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: ${{ matrix.java }} | ||
- name: ./gradlew build javadoc | ||
run: ./gradlew build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
name: "Validate Gradle Wrapper" | ||
on: [push, pull_request] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
validation: | ||
name: "Validation" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
show-progress: false | ||
- uses: gradle/wrapper-validation-action@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
# Generated files | ||
# Gradle | ||
.gradle | ||
build | ||
|
||
# IntelliJ | ||
.idea | ||
*.iml | ||
|
||
# Emacs backups | ||
# Emacs | ||
*~ | ||
|
||
# checker-qual | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,97 +1,116 @@ | ||
plugins { | ||
id 'java' | ||
id 'maven-publish' | ||
id 'java' | ||
id 'maven-publish' | ||
} | ||
|
||
repositories { | ||
// Use jcenter for resolving your dependencies. | ||
// You can declare any Maven/Ivy/file repository here. | ||
mavenCentral() | ||
// Use Maven Central for resolving your dependencies. | ||
// You can declare any Maven/Ivy/file repository here. | ||
mavenCentral() | ||
} | ||
|
||
configurations { | ||
// for putting Error Prone javac in bootclasspath for running tests | ||
errorproneJavac | ||
// for putting Error Prone javac in bootclasspath for running tests | ||
errorproneJavac | ||
} | ||
|
||
ext.versions = [ | ||
checkerFramework: "3.21.3", | ||
checkerFramework: "3.43.0", | ||
] | ||
|
||
|
||
sourceCompatibility = 1.8 | ||
def checkerframework_local = false // Set this variable to [true] while using local version of checker framework. | ||
|
||
dependencies { | ||
// This dependency is found on compile classpath of this component and consumers. | ||
if (checkerframework_local) { | ||
implementation files('${CHECKERFRAMEWORK}/checker/dist/checker-qual.jar') | ||
implementation files('${CHECKERFRAMEWORK}/checker/dist/checker.jar') | ||
} | ||
else { | ||
implementation "org.checkerframework:checker:${versions.checkerFramework}" | ||
implementation "org.checkerframework:checker-qual:${versions.checkerFramework}" | ||
} | ||
// This dependency is found on compile classpath of this component and consumers. | ||
if (checkerframework_local) { | ||
implementation files('${CHECKERFRAMEWORK}/checker/dist/checker-qual.jar') | ||
implementation files('${CHECKERFRAMEWORK}/checker/dist/checker.jar') | ||
} | ||
else { | ||
implementation "org.checkerframework:checker:${versions.checkerFramework}" | ||
implementation "org.checkerframework:checker-qual:${versions.checkerFramework}" | ||
} | ||
|
||
compileOnly "com.google.errorprone:javac:9+181-r4173-1" | ||
compileOnly "com.google.errorprone:javac:9+181-r4173-1" | ||
|
||
// Testing | ||
testImplementation 'junit:junit:4.13.2' | ||
testImplementation "org.checkerframework:framework-test:${versions.checkerFramework}" | ||
// Testing | ||
testImplementation 'junit:junit:4.13.2' | ||
testImplementation "org.checkerframework:framework-test:${versions.checkerFramework}" | ||
|
||
errorproneJavac "com.google.errorprone:javac:9+181-r4173-1" | ||
errorproneJavac "com.google.errorprone:javac:9+181-r4173-1" | ||
} | ||
|
||
tasks.withType(JavaCompile).all { | ||
options.compilerArgs.add("-Xlint:all") | ||
options.compilerArgs.add("-Xlint:all") | ||
} | ||
|
||
// Add `mavenLocal()` in `repositories`, then run `./gradlew publishToMavenLocal` | ||
// to publish your checker to your local Maven repository. | ||
publishing { | ||
publications { | ||
maven(MavenPublication) { | ||
groupId = 'org.checkerframework' | ||
artifactId = 'dividebyzero-checker' | ||
version = '0.1-SNAPSHOT' | ||
|
||
from components.java | ||
} | ||
publications { | ||
maven(MavenPublication) { | ||
groupId = 'org.checkerframework' | ||
artifactId = 'dividebyzero-checker' | ||
version = '0.1-SNAPSHOT' | ||
|
||
from components.java | ||
} | ||
} | ||
} | ||
|
||
test { | ||
inputs.files("tests/dividebyzero") | ||
if (!JavaVersion.current().java9Compatible) { | ||
jvmArgs "-Xbootclasspath/p:${configurations.errorproneJavac.asPath}" | ||
} else { | ||
// A list of add-export and add-open arguments to be used when running the Checker Framework. | ||
// Keep this list in sync with the list in the Checker Framework manual. | ||
var compilerArgsForRunningCF = [ | ||
// These are required in Java 16+ because the --illegal-access option is set to deny | ||
// by default. None of these packages are accessed via reflection, so the module | ||
// only needs to be exported, but not opened. | ||
"--add-exports", "jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED", | ||
"--add-exports", "jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED", | ||
"--add-exports", "jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED", | ||
"--add-exports", "jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED", | ||
"--add-exports", "jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED", | ||
"--add-exports", "jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED", | ||
"--add-exports", "jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED", | ||
"--add-exports", "jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED", | ||
// Required because the Checker Framework reflectively accesses private members in com.sun.tools.javac.comp. | ||
"--add-opens", "jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED", | ||
] | ||
jvmArgs += compilerArgsForRunningCF | ||
} | ||
testLogging { | ||
showStandardStreams = true | ||
// Show the found unexpected diagnostics and expected diagnostics not found. | ||
exceptionFormat "full" | ||
events "failed" | ||
} | ||
inputs.files("tests/dividebyzero") | ||
if (!JavaVersion.current().java9Compatible) { | ||
jvmArgs "-Xbootclasspath/p:${configurations.errorproneJavac.asPath}" | ||
} else { | ||
// A list of add-export and add-open arguments to be used when running the Checker Framework. | ||
// Keep this list in sync with the list in the Checker Framework manual. | ||
var compilerArgsForRunningCF = [ | ||
// These are required in Java 16+ because the --illegal-access option is set to deny | ||
// by default. None of these packages are accessed via reflection, so the module | ||
// only needs to be exported, but not opened. | ||
"--add-exports", "jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED", | ||
"--add-exports", "jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED", | ||
"--add-exports", "jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED", | ||
"--add-exports", "jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED", | ||
"--add-exports", "jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED", | ||
"--add-exports", "jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED", | ||
"--add-exports", "jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED", | ||
"--add-exports", "jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED", | ||
// Required because the Checker Framework reflectively accesses private members in com.sun.tools.javac.comp. | ||
"--add-opens", "jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED", | ||
] | ||
jvmArgs += compilerArgsForRunningCF | ||
} | ||
testLogging { | ||
showStandardStreams = true | ||
// Show the found unexpected diagnostics and expected diagnostics not found. | ||
exceptionFormat "full" | ||
events "failed" | ||
} | ||
} | ||
|
||
clean.doFirst { | ||
delete "${rootDir}/tests/build/" | ||
delete "${rootDir}/tests/build/" | ||
} | ||
|
||
task printClasspath { | ||
description 'Prints the runtime classpath of the checker. ' + | ||
'When typechecking, put the output of this task on either the ' + | ||
'processor path or the classpath of the project being type-checed.' | ||
doLast { | ||
println sourceSets.main.runtimeClasspath.asPath | ||
} | ||
} | ||
|
||
sourceSets { | ||
main { | ||
resources { | ||
// ensures that any .stub files present in the same directory as | ||
// the checker source code are copied into the distributed jar | ||
srcDirs += ['src/main/java'] | ||
} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.