xref: /aosp_15_r20/external/nullaway/jar-infer/test-java-lib-jarinfer/build.gradle (revision f50c306653bc89b8210ce6c9e0b0b44fc134bc03)
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 Workerplugins {
18*f50c3066SAndroid Build Coastguard Worker    id "java-library"
19*f50c3066SAndroid Build Coastguard Worker}
20*f50c3066SAndroid Build Coastguard Worker
21*f50c3066SAndroid Build Coastguard WorkerevaluationDependsOn(":jar-infer:jar-infer-cli")
22*f50c3066SAndroid Build Coastguard Worker
23*f50c3066SAndroid Build Coastguard Workerdef astubxPath = "com/uber/nullaway/jarinfer/provider/jarinfer.astubx"
24*f50c3066SAndroid Build Coastguard Worker
25*f50c3066SAndroid Build Coastguard Workerjar {
26*f50c3066SAndroid Build Coastguard Worker    manifest {
27*f50c3066SAndroid Build Coastguard Worker        attributes(
28*f50c3066SAndroid Build Coastguard Worker                'Created-By'     : "Gradle ${gradle.gradleVersion}",
29*f50c3066SAndroid Build Coastguard Worker                'Build-Jdk'      : "${System.properties['java.version']} (${System.properties['java.vendor']} ${System.properties['java.vm.version']})",
30*f50c3066SAndroid Build Coastguard Worker                'Build-OS'       : "${System.properties['os.name']} ${System.properties['os.arch']} ${System.properties['os.version']}"
31*f50c3066SAndroid Build Coastguard Worker                )
32*f50c3066SAndroid Build Coastguard Worker    }
33*f50c3066SAndroid Build Coastguard Worker}
34*f50c3066SAndroid Build Coastguard Worker
35*f50c3066SAndroid Build Coastguard Workerjar.doLast {
36*f50c3066SAndroid Build Coastguard Worker    javaexec {
37*f50c3066SAndroid Build Coastguard Worker        classpath = files("${rootProject.projectDir}/jar-infer/jar-infer-cli/build/libs/jar-infer-cli.jar")
38*f50c3066SAndroid Build Coastguard Worker        main = "com.uber.nullaway.jarinfer.JarInfer"
39*f50c3066SAndroid Build Coastguard Worker        args = [
40*f50c3066SAndroid Build Coastguard Worker            "-i",
41*f50c3066SAndroid Build Coastguard Worker            jar.archiveFile.get(),
42*f50c3066SAndroid Build Coastguard Worker            "-o",
43*f50c3066SAndroid Build Coastguard Worker            "${jar.destinationDirectory.get()}/${astubxPath}"
44*f50c3066SAndroid Build Coastguard Worker        ]
45*f50c3066SAndroid Build Coastguard Worker    }
46*f50c3066SAndroid Build Coastguard Worker    exec {
47*f50c3066SAndroid Build Coastguard Worker        workingDir "./build/libs"
48*f50c3066SAndroid Build Coastguard Worker        commandLine "jar", "uf", "test-java-lib-jarinfer.jar", astubxPath
49*f50c3066SAndroid Build Coastguard Worker    }
50*f50c3066SAndroid Build Coastguard Worker}
51*f50c3066SAndroid Build Coastguard Worker
52*f50c3066SAndroid Build Coastguard Workerdependencies {
53*f50c3066SAndroid Build Coastguard Worker    compileOnly deps.apt.autoService
54*f50c3066SAndroid Build Coastguard Worker    annotationProcessor deps.apt.autoService
55*f50c3066SAndroid Build Coastguard Worker    compileOnly project(":nullaway")
56*f50c3066SAndroid Build Coastguard Worker    implementation deps.build.jsr305Annotations
57*f50c3066SAndroid Build Coastguard Worker}
58*f50c3066SAndroid Build Coastguard Worker
59*f50c3066SAndroid Build Coastguard Workerjar.dependsOn ":jar-infer:jar-infer-cli:assemble"
60