1*f50c3066SAndroid Build Coastguard Worker/* 2*f50c3066SAndroid Build Coastguard Worker * Copyright (C) 2017. Uber Technologies 3*f50c3066SAndroid Build Coastguard Worker * 4*f50c3066SAndroid Build Coastguard Worker * Licensed under the Apache License, Version 2.0 (the "License"); 5*f50c3066SAndroid Build Coastguard Worker * you may not use this file except in compliance with the License. 6*f50c3066SAndroid Build Coastguard Worker * You may obtain a copy of the License at 7*f50c3066SAndroid Build Coastguard Worker * 8*f50c3066SAndroid Build Coastguard Worker * http://www.apache.org/licenses/LICENSE-2.0 9*f50c3066SAndroid Build Coastguard Worker * 10*f50c3066SAndroid Build Coastguard Worker * Unless required by applicable law or agreed to in writing, software 11*f50c3066SAndroid Build Coastguard Worker * distributed under the License is distributed on an "AS IS" BASIS, 12*f50c3066SAndroid Build Coastguard Worker * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*f50c3066SAndroid Build Coastguard Worker * See the License for the specific language governing permissions and 14*f50c3066SAndroid Build Coastguard Worker * limitations under the License. 15*f50c3066SAndroid Build Coastguard Worker */ 16*f50c3066SAndroid Build Coastguard Worker 17*f50c3066SAndroid Build Coastguard Workerimport com.android.build.gradle.api.BaseVariant 18*f50c3066SAndroid Build Coastguard Workerimport net.ltgt.gradle.errorprone.CheckSeverity 19*f50c3066SAndroid Build Coastguard Worker 20*f50c3066SAndroid Build Coastguard Workerplugins { 21*f50c3066SAndroid Build Coastguard Worker id('com.android.application') 22*f50c3066SAndroid Build Coastguard Worker} 23*f50c3066SAndroid Build Coastguard Worker 24*f50c3066SAndroid Build Coastguard Workerandroid { 25*f50c3066SAndroid Build Coastguard Worker compileSdkVersion deps.build.compileSdkVersion 26*f50c3066SAndroid Build Coastguard Worker 27*f50c3066SAndroid Build Coastguard Worker defaultConfig { 28*f50c3066SAndroid Build Coastguard Worker applicationId "com.uber.myapplication" 29*f50c3066SAndroid Build Coastguard Worker minSdkVersion deps.build.minSdkVersion 30*f50c3066SAndroid Build Coastguard Worker targetSdkVersion deps.build.targetSdkVersion 31*f50c3066SAndroid Build Coastguard Worker versionCode 1 32*f50c3066SAndroid Build Coastguard Worker versionName "1.0" 33*f50c3066SAndroid Build Coastguard Worker } 34*f50c3066SAndroid Build Coastguard Worker compileOptions { 35*f50c3066SAndroid Build Coastguard Worker sourceCompatibility JavaVersion.VERSION_11 36*f50c3066SAndroid Build Coastguard Worker targetCompatibility JavaVersion.VERSION_11 37*f50c3066SAndroid Build Coastguard Worker } 38*f50c3066SAndroid Build Coastguard Worker 39*f50c3066SAndroid Build Coastguard Worker lintOptions { 40*f50c3066SAndroid Build Coastguard Worker abortOnError false 41*f50c3066SAndroid Build Coastguard Worker } 42*f50c3066SAndroid Build Coastguard Worker 43*f50c3066SAndroid Build Coastguard Worker DomainObjectSet<BaseVariant> variants = getApplicationVariants() // or getLibraryVariants() in libraries 44*f50c3066SAndroid Build Coastguard Worker variants.addAll(getTestVariants()) 45*f50c3066SAndroid Build Coastguard Worker variants.addAll(getUnitTestVariants()) 46*f50c3066SAndroid Build Coastguard Worker variants.configureEach { variant -> 47*f50c3066SAndroid Build Coastguard Worker variant.getJavaCompileProvider().configure { 48*f50c3066SAndroid Build Coastguard Worker options.compilerArgs += [ 49*f50c3066SAndroid Build Coastguard Worker "-XDcompilePolicy=simple", 50*f50c3066SAndroid Build Coastguard Worker "-Xplugin:ErrorProne -XepOpt:NullAway:AnnotatedPackages=com.uber", 51*f50c3066SAndroid Build Coastguard Worker ] 52*f50c3066SAndroid Build Coastguard Worker options.fork = true 53*f50c3066SAndroid Build Coastguard Worker options.forkOptions.jvmArgs = [ 54*f50c3066SAndroid Build Coastguard Worker "--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED", 55*f50c3066SAndroid Build Coastguard Worker "--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED", 56*f50c3066SAndroid Build Coastguard Worker "--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED", 57*f50c3066SAndroid Build Coastguard Worker "--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED", 58*f50c3066SAndroid Build Coastguard Worker "--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED", 59*f50c3066SAndroid Build Coastguard Worker "--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED", 60*f50c3066SAndroid Build Coastguard Worker "--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED", 61*f50c3066SAndroid Build Coastguard Worker "--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED", 62*f50c3066SAndroid Build Coastguard Worker "--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED", 63*f50c3066SAndroid Build Coastguard Worker "--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED" 64*f50c3066SAndroid Build Coastguard Worker ] 65*f50c3066SAndroid Build Coastguard Worker } 66*f50c3066SAndroid Build Coastguard Worker } 67*f50c3066SAndroid Build Coastguard Worker} 68*f50c3066SAndroid Build Coastguard Worker 69*f50c3066SAndroid Build Coastguard Workerdependencies { 70*f50c3066SAndroid Build Coastguard Worker implementation deps.support.appcompat 71*f50c3066SAndroid Build Coastguard Worker annotationProcessor deps.build.errorProneCore 72*f50c3066SAndroid Build Coastguard Worker annotationProcessor project(":nullaway") 73*f50c3066SAndroid Build Coastguard Worker annotationProcessor project(path: ":sample-library-model") 74*f50c3066SAndroid Build Coastguard Worker 75*f50c3066SAndroid Build Coastguard Worker testImplementation deps.test.junit4 76*f50c3066SAndroid Build Coastguard Worker} 77*f50c3066SAndroid Build Coastguard Worker 78*f50c3066SAndroid Build Coastguard Workerspotless { 79*f50c3066SAndroid Build Coastguard Worker java { 80*f50c3066SAndroid Build Coastguard Worker target 'src/*/java/**/*.java' 81*f50c3066SAndroid Build Coastguard Worker } 82*f50c3066SAndroid Build Coastguard Worker} 83