1/* 2 * Copyright (C) 2021. Uber Technologies 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16plugins { 17 id 'java-library' 18 id 'nullaway.jacoco-conventions' 19} 20 21// Use JDK 17 for this module, via a toolchain 22java.toolchain.languageVersion.set JavaLanguageVersion.of(17) 23 24configurations { 25 // We use this configuration to expose a module path that can be 26 // used to test analysis of module-info.java files. 27 // See com.uber.nullaway.jdk17.NullAwayModuleInfoTests 28 testModulePath 29} 30 31dependencies { 32 testImplementation project(":nullaway") 33 testImplementation deps.test.junit4 34 testImplementation(deps.build.errorProneTestHelpers) { 35 exclude group: "junit", module: "junit" 36 } 37 testImplementation deps.build.jsr305Annotations 38 testModulePath deps.test.cfQual 39} 40 41test { 42 maxHeapSize = "1024m" 43 // to expose necessary JDK types on JDK 16+; see https://errorprone.info/docs/installation#java-9-and-newer 44 jvmArgs += [ 45 "--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED", 46 "--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED", 47 "--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED", 48 "--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED", 49 "--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED", 50 "--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED", 51 "--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED", 52 "--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED", 53 "--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED", 54 "--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED", 55 // Expose a module path for tests as a JVM property. 56 // Used by com.uber.nullaway.jdk17.NullAwayModuleInfoTests 57 "-Dtest.module.path=${configurations.testModulePath.asPath}" 58 ] 59} 60 61