1/* 2 * Copyright (C) 2017. 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 */ 16 17import com.android.build.gradle.api.BaseVariant 18import net.ltgt.gradle.errorprone.CheckSeverity 19 20plugins { 21 id('com.android.application') 22} 23 24android { 25 compileSdkVersion deps.build.compileSdkVersion 26 27 defaultConfig { 28 applicationId "com.uber.myapplication" 29 minSdkVersion deps.build.minSdkVersion 30 targetSdkVersion deps.build.targetSdkVersion 31 versionCode 1 32 versionName "1.0" 33 } 34 compileOptions { 35 sourceCompatibility JavaVersion.VERSION_11 36 targetCompatibility JavaVersion.VERSION_11 37 } 38 39 lintOptions { 40 abortOnError false 41 } 42 43 DomainObjectSet<BaseVariant> variants = getApplicationVariants() // or getLibraryVariants() in libraries 44 variants.addAll(getTestVariants()) 45 variants.addAll(getUnitTestVariants()) 46 variants.configureEach { variant -> 47 variant.getJavaCompileProvider().configure { 48 options.compilerArgs += [ 49 "-XDcompilePolicy=simple", 50 "-Xplugin:ErrorProne -XepOpt:NullAway:AnnotatedPackages=com.uber", 51 ] 52 options.fork = true 53 options.forkOptions.jvmArgs = [ 54 "--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED", 55 "--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED", 56 "--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED", 57 "--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED", 58 "--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED", 59 "--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED", 60 "--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED", 61 "--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED", 62 "--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED", 63 "--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED" 64 ] 65 } 66 } 67} 68 69dependencies { 70 implementation deps.support.appcompat 71 annotationProcessor deps.build.errorProneCore 72 annotationProcessor project(":nullaway") 73 annotationProcessor project(path: ":sample-library-model") 74 75 testImplementation deps.test.junit4 76} 77 78spotless { 79 java { 80 target 'src/*/java/**/*.java' 81 } 82} 83