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