xref: /aosp_15_r20/external/vogar/Android.bp (revision e17b455832b152077f3f109e08c3a59761ae9ee5)
1// Copyright (C) 2014 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// Build dependencies.
16// ============================================================
17
18package {
19    default_applicable_licenses: ["external_vogar_license"],
20}
21
22// Added automatically by a large-scale-change that took the approach of
23// 'apply every license found to every target'. While this makes sure we respect
24// every license restriction, it may not be entirely correct.
25//
26// e.g. GPL in an MIT project might only apply to the contrib/ directory.
27//
28// Please consider splitting the single license below into multiple licenses,
29// taking care not to lose any license_kind information, and overriding the
30// default license using the 'licenses: [...]' property on targets as needed.
31//
32// For unused files, consider creating a 'fileGroup' with "//visibility:private"
33// to attach the license to, and including a comment whether the files may be
34// used in the current project.
35// See: http://go/android-license-faq
36license {
37    name: "external_vogar_license",
38    visibility: [":__subpackages__"],
39    license_kinds: [
40        "SPDX-license-identifier-Apache-2.0",
41        "SPDX-license-identifier-BSD",
42    ],
43    license_text: [
44        "LICENSE",
45    ],
46}
47
48java_import_host {
49    name: "vogar-jsr305",
50    jars: ["lib/jsr305.jar"],
51}
52
53java_import_host {
54    name: "vogar-kxml-libcore-20110123",
55    jars: ["lib/kxml-libcore-20110123.jar"],
56}
57
58// build vogar jar
59java_library_host {
60    name: "vogar-host-jar",
61    srcs: ["src/**/*.java"],
62    // Make the host jar file name to be vogar.jar due to in vogar-script it
63    // expect the jar to be vogar.jar.
64    stem: "vogar",
65    java_resource_dirs: ["resources"],
66    static_libs: [
67        "caliper",
68        "gson",
69        "guava",
70        "junit",
71        "testng",
72        "vogar-jsr305",
73        "vogar-kxml-libcore-20110123",
74    ],
75    // Vogar uses android.jar.
76    libs: [
77        "android_current",
78    ],
79}
80
81// copy vogar script
82sh_binary_host {
83    // Set filename to the same name as the stem of vogar-host-jar to align with
84    // original make behavior.
85    name: "vogar-script",
86    src: "bin/vogar-android",
87    filename: "vogar",
88}
89
90// User can build both vogar-host-jar and vogar-script just use vogar as target
91// name. This could be replace after soong has implemented the wrapper function
92// for java_library_host.
93phony_rule {
94    name: "vogar",
95    phony_deps: [
96        "vogar-host-jar",
97        "vogar-script",
98    ],
99}
100
101// build vogar tests jar
102java_library_host {
103    name: "vogar-tests",
104    srcs: ["test/**/*.java"],
105    static_libs: [
106        "junit",
107        "mockito",
108        "objenesis",
109        "vogar-host-jar",
110    ],
111}
112
113// Run the tests using using run-vogar-tests.
114java_genrule_host {
115    name: "vogar-tests-result",
116    srcs: [
117        ":vogar-tests",
118    ],
119    cmd: "ANDROID_BUILD_TOP=$$(pwd) java -cp $(in) org.junit.runner.JUnitCore vogar.AllTests 2>&1 | tee $(out)",
120    out: ["vogar-tests-result.txt"],
121}
122
123phony_rule {
124    name: "run-vogar-tests",
125    phony_deps: [
126        "vogar-tests-result",
127    ],
128}
129