aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryangbill <yangbill@google.com>2024-03-18 10:22:28 +0000
committeryangbill <yangbill@google.com>2024-03-27 05:46:51 +0000
commit379eda1b281a9f61ad38a815120869077612bbb7 (patch)
treef8a6754ce67abf8cc982f64cabf4ef77e303bb05
parent3cb4fdb3221c7fbada565fe2aa31cdb5bf6455fa (diff)
downloadvogar-379eda1b281a9f61ad38a815120869077612bbb7.tar.gz
Convert run-vogar-tests and vogar script to Android.bpHEADmastermain
This CL converts vogar to Soong, and use phony_rule module which allow users to build vogar script and host jar file without changing user experience. (running `m vogar`) Bug: 329011980 Test: m run-vogar-tests Test: m vogar Change-Id: I915aaee9474738163ddad5977e524402f9eef499
-rw-r--r--Android.bp44
-rw-r--r--Android.mk35
2 files changed, 42 insertions, 37 deletions
diff --git a/Android.bp b/Android.bp
index 8e22d91..c7c981f 100644
--- a/Android.bp
+++ b/Android.bp
@@ -57,8 +57,11 @@ java_import_host {
// build vogar jar
java_library_host {
- name: "vogar",
+ name: "vogar-host-jar",
srcs: ["src/**/*.java"],
+ // Make the host jar file name to be vogar.jar due to in vogar-script it
+ // expect the jar to be vogar.jar.
+ stem: "vogar",
java_resource_dirs: ["resources"],
static_libs: [
"caliper",
@@ -75,6 +78,26 @@ java_library_host {
],
}
+// copy vogar script
+sh_binary_host {
+ // Set filename to the same name as the stem of vogar-host-jar to align with
+ // original make behavior.
+ name: "vogar-script",
+ src: "bin/vogar-android",
+ filename: "vogar",
+}
+
+// User can build both vogar-host-jar and vogar-script just use vogar as target
+// name. This could be replace after soong has implemented the wrapper function
+// for java_library_host.
+phony_rule {
+ name: "vogar",
+ phony_deps: [
+ "vogar-host-jar",
+ "vogar-script",
+ ],
+}
+
// build vogar tests jar
java_library_host {
name: "vogar-tests",
@@ -83,6 +106,23 @@ java_library_host {
"junit",
"mockito",
"objenesis",
- "vogar",
+ "vogar-host-jar",
+ ],
+}
+
+// Run the tests using using run-vogar-tests.
+java_genrule_host {
+ name: "vogar-tests-result",
+ srcs: [
+ ":vogar-tests",
+ ],
+ cmd: "ANDROID_BUILD_TOP=$$(pwd) java -cp $(in) org.junit.runner.JUnitCore vogar.AllTests 2>&1 | tee $(out)",
+ out: ["vogar-tests-result.txt"],
+}
+
+phony_rule {
+ name: "run-vogar-tests",
+ phony_deps: [
+ "vogar-tests-result",
],
}
diff --git a/Android.mk b/Android.mk
deleted file mode 100644
index d4398c9..0000000
--- a/Android.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright (C) 2014 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-LOCAL_PATH := $(call my-dir)
-
-# Run the tests using using the following target.
-# ============================================================
-.PHONY: run-vogar-tests
-run-vogar-tests: vogar-tests
- ANDROID_BUILD_TOP=$$(pwd) \
- java -cp ./out/host/linux-x86/framework/vogar-tests.jar \
- org.junit.runner.JUnitCore vogar.AllTests
-
-# copy vogar script
-# ============================================================
-include $(CLEAR_VARS)
-LOCAL_IS_HOST_MODULE := true
-LOCAL_MODULE_CLASS := EXECUTABLES
-LOCAL_MODULE := vogar
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_NOTICE_FILE := $(LOCAL_PATH)/LICENSE
-LOCAL_SRC_FILES := bin/vogar-android
-include $(BUILD_PREBUILT)