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