aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Walbran <qwandor@google.com>2021-09-23 17:47:05 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-09-23 17:47:05 +0000
commit4c20cc2e2bdac38f8b06a6c93998d006d84f4c65 (patch)
tree10df7cb4c98da3fff0689c8f08fab0d5bccfbded
parent214107143d59380315b15421745a2ba6a7a22f17 (diff)
parente3f5c33ad6f98434eb73b1791186396a75b64cde (diff)
downloadcrosvm-4c20cc2e2bdac38f8b06a6c93998d006d84f4c65.tar.gz
Merge "Generate top-level Android.bp with cargo2android." am: e3f5c33ad6
Original change: https://android-review.googlesource.com/c/platform/external/crosvm/+/1815096 Change-Id: I7be76a216707685f522d6270614141e663aaed01
-rw-r--r--Android.bp338
-rw-r--r--Cargo.toml1
-rw-r--r--cargo2android.json15
-rw-r--r--cargo2android_defaults.bp24
-rw-r--r--cargo2android_module.bp25
-rw-r--r--gpu_display/src/display_wl.c4
-rw-r--r--patches/Android.bp.patch27
7 files changed, 282 insertions, 152 deletions
diff --git a/Android.bp b/Android.bp
index 1480656f0..20be12171 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,16 +1,5 @@
-// This file is generated by cargo2android.py --run --device --tests --dependencies --no-subdir.
-// Most modules in this file are edited manually:
-// * global defaults defined in crosvm_defaults, enabled for linux_glibc_x86_64
-// * all modules use crosvm_defaults or other defaults derived from it
-// * root host binary is crosvm
-// * crosvm and libcrosvm have extra features:
-// * audio, gfxstream, gpu
-// * crosvm has extra flags and ld_flags
-// * crosvm_host_test_tests_boot and crosvm_host_test_tests_plugins
-// are not ready yet
-// We use cargo2android.py only to discover new changes.
-// * Use --no-subdir to suppress output of subdirectory Android.bp files.
-// * Run cargo2android.py in each subdirectory to generate .bp files.
+// This file is generated by cargo2android.py --config cargo2android.json.
+// Do not modify this file as changes will be overridden on upgrade.
package {
default_applicable_licenses: ["external_crosvm_license"],
@@ -43,93 +32,22 @@ license {
],
}
-rust_defaults {
- name: "crosvm_defaults",
- edition: "2018",
- enabled: false,
- target: {
- linux_glibc_x86_64: {
- enabled: true,
- },
- android64: {
- compile_multilib: "64",
- enabled: true,
- },
- linux_bionic_arm64: {
- enabled: true,
- },
- darwin: {
- enabled: false,
- },
- },
- apex_available: [
- "//apex_available:platform",
- "com.android.virt",
- ],
-}
-
-rust_defaults {
- name: "crosvm_proc_macro_defaults",
- defaults: ["crosvm_defaults"],
- target: {
- darwin: {
- enabled: true,
- },
- },
-}
-
rust_binary {
name: "crosvm",
defaults: ["crosvm_defaults"],
host_supported: true,
prefer_rlib: true,
crate_name: "crosvm",
+ cargo_env_compat: true,
+ cargo_pkg_version: "",
srcs: ["src/main.rs"],
-
- target: {
- linux_bionic_arm64: {
- relative_install_path: "aarch64-linux-bionic",
- },
- linux_glibc_x86_64: {
- features: [
- "gdb",
- "gdbstub",
- ],
- relative_install_path: "x86_64-linux-gnu",
- rustlibs: [
- "libgdbstub",
- "libgdbstub_arch",
- "libthiserror",
- ],
- },
- darwin: {
- enabled: false,
- },
- },
- arch: {
- x86_64: {
- rustlibs: ["libx86_64_rust"],
- },
- arm64: {
- rustlibs: ["libaarch64"],
- },
- },
-
edition: "2018",
features: [
"audio",
"default",
- "gpu",
"gfxstream",
- "usb"
- ],
-
- flags: [
- "-C overflow-checks=y",
- ],
- ld_flags: [
- "-Wl,--rpath,\\$$ORIGIN",
- "-Wl,--rpath,\\$$ORIGIN/../../lib64",
+ "gpu",
+ "usb",
],
rustlibs: [
"libacpi_tables",
@@ -156,7 +74,6 @@ rust_binary {
"libsync_rust",
"libtempfile",
"libvhost",
- "libvhost_user_devices",
"libvm_control",
"libvm_memory",
],
@@ -164,16 +81,6 @@ rust_binary {
"libenumn",
"libremain",
],
-}
-
-rust_defaults {
- name: "crosvm_defaults_test",
- defaults: ["crosvm_defaults"],
- crate_name: "crosvm",
- srcs: ["src/crosvm.rs"],
- test_suites: ["general-tests"],
- auto_gen_config: true,
- edition: "2018",
arch: {
x86_64: {
rustlibs: ["libx86_64_rust"],
@@ -183,7 +90,14 @@ rust_defaults {
},
},
target: {
+ linux_bionic_arm64: {
+ relative_install_path: "aarch64-linux-bionic",
+ },
+ darwin: {
+ enabled: false,
+ },
linux_glibc_x86_64: {
+ relative_install_path: "x86_64-linux-gnu",
features: [
"gdb",
"gdbstub",
@@ -195,13 +109,32 @@ rust_defaults {
],
},
},
+ ld_flags: [
+ "-Wl,--rpath,\\$$ORIGIN",
+ "-Wl,--rpath,\\$$ORIGIN/../../lib64",
+ ],
+}
+
+rust_defaults {
+ name: "crosvm_test_defaults",
+ defaults: ["crosvm_defaults"],
+ crate_name: "crosvm",
+ srcs: ["src/crosvm.rs"],
+ test_suites: ["general-tests"],
+ auto_gen_config: true,
+ edition: "2018",
features: [
+ "audio",
"default",
+ "gfxstream",
+ "gpu",
+ "usb",
],
rustlibs: [
"libacpi_tables",
"libarch",
"libassertions",
+ "libaudio_streams",
"libbase_rust",
"libbit_field",
"libdata_model",
@@ -211,6 +144,7 @@ rust_defaults {
"libkernel_cmdline",
"libkernel_loader",
"liblibc",
+ "liblibcras",
"libminijail_rust",
"libnet_util",
"libp9",
@@ -231,49 +165,81 @@ rust_defaults {
rust_test_host {
name: "crosvm_host_test_src_crosvm",
- defaults: ["crosvm_defaults_test"],
- features: [
- "audio",
- ],
- rustlibs: [
- "libaudio_streams",
- "liblibcras",
- ],
+ defaults: ["crosvm_test_defaults"],
test_options: {
unit_test: true,
},
+ arch: {
+ x86_64: {
+ rustlibs: ["libx86_64_rust"],
+ },
+ arm64: {
+ rustlibs: ["libaarch64"],
+ },
+ },
+ target: {
+ linux_glibc_x86_64: {
+ features: [
+ "gdb",
+ "gdbstub",
+ ],
+ rustlibs: [
+ "libgdbstub",
+ "libgdbstub_arch",
+ "libthiserror",
+ ],
+ },
+ },
+ ld_flags: [
+ "-Wl,--rpath,\\$$ORIGIN",
+ "-Wl,--rpath,\\$$ORIGIN/../../lib64",
+ ],
}
rust_test {
name: "crosvm_device_test_src_crosvm",
- defaults: ["crosvm_defaults_test"],
- features: [
- "audio",
- ],
- rustlibs: [
- "libaudio_streams",
- "liblibcras",
+ defaults: ["crosvm_test_defaults"],
+ arch: {
+ x86_64: {
+ rustlibs: ["libx86_64_rust"],
+ },
+ arm64: {
+ rustlibs: ["libaarch64"],
+ },
+ },
+ target: {
+ linux_glibc_x86_64: {
+ features: [
+ "gdb",
+ "gdbstub",
+ ],
+ rustlibs: [
+ "libgdbstub",
+ "libgdbstub_arch",
+ "libthiserror",
+ ],
+ },
+ },
+ ld_flags: [
+ "-Wl,--rpath,\\$$ORIGIN",
+ "-Wl,--rpath,\\$$ORIGIN/../../lib64",
],
}
rust_defaults {
- name: "crosvm_defaults_crosvm",
+ name: "crosvm_test_defaults_crosvm",
defaults: ["crosvm_defaults"],
crate_name: "crosvm",
srcs: ["src/main.rs"],
test_suites: ["general-tests"],
auto_gen_config: true,
edition: "2018",
- arch: {
- x86_64: {
- rustlibs: ["libx86_64_rust"],
- },
- arm64: {
- rustlibs: ["libaarch64"],
- },
- },
features: [
+ "audio",
"default",
+ "gfxstream",
+ "gpu",
+ "usb",
],
rustlibs: [
"libacpi_tables",
@@ -300,7 +266,6 @@ rust_defaults {
"libsync_rust",
"libtempfile",
"libvhost",
- "libvhost_user_devices",
"libvm_control",
"libvm_memory",
],
@@ -312,37 +277,19 @@ rust_defaults {
rust_test_host {
name: "crosvm_host_test_src_main",
- defaults: ["crosvm_defaults_crosvm"],
- features: [
- "audio",
- ],
- rustlibs: [
- "libaudio_streams",
- "liblibcras",
- ],
+ defaults: ["crosvm_test_defaults_crosvm"],
test_options: {
unit_test: true,
},
-}
-
-rust_test {
- name: "crosvm_device_test_src_main",
- defaults: ["crosvm_defaults_crosvm"],
-}
-
-rust_library {
- name: "libcrosvm",
- defaults: ["crosvm_defaults"],
- host_supported: true,
- crate_name: "crosvm",
- srcs: ["src/crosvm.rs"],
- edition: "2018",
- target: {
- linux_glibc: {
- features: [
- "gfxstream",
- ],
+ arch: {
+ x86_64: {
+ rustlibs: ["libx86_64_rust"],
+ },
+ arm64: {
+ rustlibs: ["libaarch64"],
},
+ },
+ target: {
linux_glibc_x86_64: {
features: [
"gdb",
@@ -355,6 +302,15 @@ rust_library {
],
},
},
+ ld_flags: [
+ "-Wl,--rpath,\\$$ORIGIN",
+ "-Wl,--rpath,\\$$ORIGIN/../../lib64",
+ ],
+}
+
+rust_test {
+ name: "crosvm_device_test_src_main",
+ defaults: ["crosvm_test_defaults_crosvm"],
arch: {
x86_64: {
rustlibs: ["libx86_64_rust"],
@@ -363,9 +319,38 @@ rust_library {
rustlibs: ["libaarch64"],
},
},
+ target: {
+ linux_glibc_x86_64: {
+ features: [
+ "gdb",
+ "gdbstub",
+ ],
+ rustlibs: [
+ "libgdbstub",
+ "libgdbstub_arch",
+ "libthiserror",
+ ],
+ },
+ },
+ ld_flags: [
+ "-Wl,--rpath,\\$$ORIGIN",
+ "-Wl,--rpath,\\$$ORIGIN/../../lib64",
+ ],
+}
+
+rust_library {
+ name: "libcrosvm",
+ defaults: ["crosvm_defaults"],
+ host_supported: true,
+ crate_name: "crosvm",
+ cargo_env_compat: true,
+ cargo_pkg_version: "",
+ srcs: ["src/crosvm.rs"],
+ edition: "2018",
features: [
"audio",
"default",
+ "gfxstream",
"gpu",
"usb",
],
@@ -393,7 +378,6 @@ rust_library {
"libsync_rust",
"libtempfile",
"libvhost",
- "libvhost_user_devices",
"libvm_control",
"libvm_memory",
],
@@ -401,4 +385,54 @@ rust_library {
"libenumn",
"libremain",
],
+ arch: {
+ x86_64: {
+ rustlibs: ["libx86_64_rust"],
+ },
+ arm64: {
+ rustlibs: ["libaarch64"],
+ },
+ },
+ target: {
+ linux_glibc_x86_64: {
+ features: [
+ "gdb",
+ "gdbstub",
+ ],
+ rustlibs: [
+ "libgdbstub",
+ "libgdbstub_arch",
+ "libthiserror",
+ ],
+ },
+ },
+ ld_flags: [
+ "-Wl,--rpath,\\$$ORIGIN",
+ "-Wl,--rpath,\\$$ORIGIN/../../lib64",
+ ],
+}
+
+rust_defaults {
+ name: "crosvm_defaults",
+ edition: "2018",
+ enabled: false,
+ target: {
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ android64: {
+ compile_multilib: "64",
+ enabled: true,
+ },
+ linux_bionic_arm64: {
+ enabled: true,
+ },
+ darwin: {
+ enabled: false,
+ },
+ },
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.virt",
+ ],
}
diff --git a/Cargo.toml b/Cargo.toml
index fa1b2914f..d967db1f3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -37,6 +37,7 @@ members = [
exclude = [
"assertions",
"base",
+ "common",
"cros_async",
"data_model",
"sync",
diff --git a/cargo2android.json b/cargo2android.json
new file mode 100644
index 000000000..176988ec1
--- /dev/null
+++ b/cargo2android.json
@@ -0,0 +1,15 @@
+{
+ "add-module-block": "cargo2android_module.bp",
+ "add-toplevel-block": "cargo2android_defaults.bp",
+ "dependencies": true,
+ "dependency-blocklist": ["aarch64", "x86_64"],
+ "device": true,
+ "features": "default,gfxstream",
+ "global_defaults": "crosvm_defaults",
+ "no-pkg-vers": true,
+ "no-subdir": true,
+ "patch": "patches/Android.bp.patch",
+ "run": true,
+ "test-blocklist": ["tests/plugins.rs"],
+ "tests": true
+} \ No newline at end of file
diff --git a/cargo2android_defaults.bp b/cargo2android_defaults.bp
new file mode 100644
index 000000000..e046a7836
--- /dev/null
+++ b/cargo2android_defaults.bp
@@ -0,0 +1,24 @@
+rust_defaults {
+ name: "crosvm_defaults",
+ edition: "2018",
+ enabled: false,
+ target: {
+ linux_glibc_x86_64: {
+ enabled: true,
+ },
+ android64: {
+ compile_multilib: "64",
+ enabled: true,
+ },
+ linux_bionic_arm64: {
+ enabled: true,
+ },
+ darwin: {
+ enabled: false,
+ },
+ },
+ apex_available: [
+ "//apex_available:platform",
+ "com.android.virt",
+ ],
+} \ No newline at end of file
diff --git a/cargo2android_module.bp b/cargo2android_module.bp
new file mode 100644
index 000000000..c4241d032
--- /dev/null
+++ b/cargo2android_module.bp
@@ -0,0 +1,25 @@
+arch: {
+ x86_64: {
+ rustlibs: ["libx86_64_rust"],
+ },
+ arm64: {
+ rustlibs: ["libaarch64"],
+ },
+},
+target: {
+ linux_glibc_x86_64: {
+ features: [
+ "gdb",
+ "gdbstub",
+ ],
+ rustlibs: [
+ "libgdbstub",
+ "libgdbstub_arch",
+ "libthiserror",
+ ],
+ },
+},
+ld_flags: [
+ "-Wl,--rpath,\\$$ORIGIN",
+ "-Wl,--rpath,\\$$ORIGIN/../../lib64",
+] \ No newline at end of file
diff --git a/gpu_display/src/display_wl.c b/gpu_display/src/display_wl.c
index c1b396ab7..b243120be 100644
--- a/gpu_display/src/display_wl.c
+++ b/gpu_display/src/display_wl.c
@@ -28,7 +28,11 @@
#include "aura-shell.h"
#include "linux-dmabuf-unstable-v1.h"
#include "viewporter.h"
+#ifdef ANDROID
#include "xdg-shell-client-protocol.h"
+#else
+#include "xdg-shell.h"
+#endif
#include "virtio-gpu-metadata-v1.h"
#include <wayland-client-core.h>
#include <wayland-client-protocol.h>
diff --git a/patches/Android.bp.patch b/patches/Android.bp.patch
new file mode 100644
index 000000000..813d67e65
--- /dev/null
+++ b/patches/Android.bp.patch
@@ -0,0 +1,27 @@
+diff --git a/Android.bp b/Android.bp
+index 21ebb3ac..519fb5d5 100644
+--- a/Android.bp
++++ b/Android.bp
+@@ -36,6 +36,7 @@ rust_binary {
+ name: "crosvm",
+ defaults: ["crosvm_defaults"],
+ host_supported: true,
++ prefer_rlib: true,
+ crate_name: "crosvm",
+ cargo_env_compat: true,
+ cargo_pkg_version: "0.1.0",
+@@ -92,7 +93,14 @@ rust_binary {
+ },
+ },
+ target: {
++ linux_bionic_arm64: {
++ relative_install_path: "aarch64-linux-bionic",
++ },
++ darwin: {
++ enabled: false,
++ },
+ linux_glibc_x86_64: {
++ relative_install_path: "x86_64-linux-gnu",
+ features: [
+ "gdb",
+ "gdbstub",