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.java-test-conventions' 19} 20 21// Use JDK 21 for this module, via a toolchain 22// We must null out sourceCompatibility and targetCompatibility to use toolchains. 23java.sourceCompatibility = null 24java.targetCompatibility = null 25java.toolchain.languageVersion.set JavaLanguageVersion.of(21) 26 27configurations { 28 // We use this configuration to expose a module path that can be 29 // used to test analysis of module-info.java files. 30 // See com.uber.nullaway.jdk17.NullAwayModuleInfoTests 31 testModulePath 32} 33 34dependencies { 35 testImplementation project(":nullaway") 36 testImplementation deps.test.junit4 37 testImplementation deps.test.junit5Jupiter 38 testImplementation deps.test.assertJ 39 testImplementation(deps.build.errorProneTestHelpers) { 40 exclude group: "junit", module: "junit" 41 } 42 testImplementation deps.build.jsr305Annotations 43 testModulePath deps.test.cfQual 44} 45 46test { 47 jvmArgs += [ 48 // Expose a module path for tests as a JVM property. 49 // Used by com.uber.nullaway.jdk17.NullAwayModuleInfoTests 50 "-Dtest.module.path=${configurations.testModulePath.asPath}" 51 ] 52} 53 54tasks.getByName('testJdk21').configure { 55 // We don't need this task since we already run the tests on JDK 21 56 onlyIf { false } 57} 58