aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Walbran <qwandor@google.com>2021-08-16 16:25:23 +0000
committerAndrew Walbran <qwandor@google.com>2021-08-17 12:38:00 +0000
commitc32d1ae9479b633edc400673da3caf4996150886 (patch)
treec23f2968ae4aa0c306c41bd2e757312928f4d8d3
parentbba25447d73a91556f5c8f6fb774a722d86ee397 (diff)
downloadcrosvm-c32d1ae9479b633edc400673da3caf4996150886.tar.gz
Generate Android.bp files for common crates.
Test: atest VirtualizationTestCases MicrodroidHostTestCases Change-Id: I29491eea27fd66be8aa282411633bc66811d7c22
-rwxr-xr-xall2android.sh5
-rw-r--r--common/cros-fuzz/Cargo.toml2
-rw-r--r--common/cros-fuzz/cargo2android.json1
-rw-r--r--common/p9/Android.bp46
-rw-r--r--common/p9/fuzz/cargo2android.json1
-rw-r--r--common/p9/wire_format_derive/Android.bp17
-rw-r--r--common/p9/wire_format_derive/cargo2android.json7
7 files changed, 76 insertions, 3 deletions
diff --git a/all2android.sh b/all2android.sh
index e0123b32a..f724ef271 100755
--- a/all2android.sh
+++ b/all2android.sh
@@ -19,7 +19,8 @@ cargo2android() {
# Run in the main crosvm directory.
cargo2android --no-subdir
-for dir in */src
+initial_dir=`pwd`
+for dir in */src common/*/src
do
base=`dirname $dir`
echo "$base"
@@ -42,5 +43,5 @@ do
cargo2android --global_defaults=crosvm_defaults --add_workspace
fi
- cd ..
+ cd "$initial_dir"
done
diff --git a/common/cros-fuzz/Cargo.toml b/common/cros-fuzz/Cargo.toml
index d2facca0a..e91baf2e4 100644
--- a/common/cros-fuzz/Cargo.toml
+++ b/common/cros-fuzz/Cargo.toml
@@ -8,4 +8,4 @@ include = ["Cargo.toml", "src/*.rs"]
[dependencies]
rand_core = "0.4"
-[workspace] \ No newline at end of file
+[workspace]
diff --git a/common/cros-fuzz/cargo2android.json b/common/cros-fuzz/cargo2android.json
new file mode 100644
index 000000000..9e26dfeeb
--- /dev/null
+++ b/common/cros-fuzz/cargo2android.json
@@ -0,0 +1 @@
+{} \ No newline at end of file
diff --git a/common/p9/Android.bp b/common/p9/Android.bp
new file mode 100644
index 000000000..ef4ef6c93
--- /dev/null
+++ b/common/p9/Android.bp
@@ -0,0 +1,46 @@
+// This file is generated by cargo2android.py --run --device --tests --global_defaults=crosvm_defaults --add_workspace --no-subdir.
+// Do not modify this file as changes will be overridden on upgrade.
+
+
+
+rust_library {
+ name: "libp9",
+ defaults: ["crosvm_defaults"],
+ host_supported: true,
+ crate_name: "p9",
+ srcs: ["src/lib.rs"],
+ edition: "2018",
+ rustlibs: [
+ "liblibc",
+ "libsys_util",
+ ],
+ proc_macros: ["libwire_format_derive"],
+}
+
+rust_defaults {
+ name: "p9_test_defaults",
+ defaults: ["crosvm_defaults"],
+ crate_name: "p9",
+ srcs: ["src/lib.rs"],
+ test_suites: ["general-tests"],
+ auto_gen_config: true,
+ edition: "2018",
+ rustlibs: [
+ "liblibc",
+ "libsys_util",
+ ],
+ proc_macros: ["libwire_format_derive"],
+}
+
+rust_test_host {
+ name: "p9_host_test_src_lib",
+ defaults: ["p9_test_defaults"],
+ test_options: {
+ unit_test: true,
+ },
+}
+
+rust_test {
+ name: "p9_device_test_src_lib",
+ defaults: ["p9_test_defaults"],
+}
diff --git a/common/p9/fuzz/cargo2android.json b/common/p9/fuzz/cargo2android.json
new file mode 100644
index 000000000..9e26dfeeb
--- /dev/null
+++ b/common/p9/fuzz/cargo2android.json
@@ -0,0 +1 @@
+{} \ No newline at end of file
diff --git a/common/p9/wire_format_derive/Android.bp b/common/p9/wire_format_derive/Android.bp
new file mode 100644
index 000000000..410174441
--- /dev/null
+++ b/common/p9/wire_format_derive/Android.bp
@@ -0,0 +1,17 @@
+// This file is generated by cargo2android.py --config cargo2android.json.
+// Do not modify this file as changes will be overridden on upgrade.
+
+
+
+rust_proc_macro {
+ name: "libwire_format_derive",
+ defaults: ["crosvm_defaults"],
+ crate_name: "wire_format_derive",
+ srcs: ["wire_format_derive.rs"],
+ edition: "2015",
+ rustlibs: [
+ "libproc_macro2",
+ "libquote",
+ "libsyn",
+ ],
+}
diff --git a/common/p9/wire_format_derive/cargo2android.json b/common/p9/wire_format_derive/cargo2android.json
new file mode 100644
index 000000000..9a6eee39c
--- /dev/null
+++ b/common/p9/wire_format_derive/cargo2android.json
@@ -0,0 +1,7 @@
+{
+ "add_workspace": true,
+ "device": true,
+ "global_defaults": "crosvm_defaults",
+ "run": true,
+ "tests": false
+} \ No newline at end of file