aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-04-09 03:03:31 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-04-09 03:03:31 +0000
commit97b74f2bad2f39abdf50f4e4b57f4d0723c111cf (patch)
treeab26350355cda9625a5b1e6e839a33aac90c3c44
parenta55f22b4bb9e512e3eab1cb899415638e3b769cd (diff)
parentc660ea67d41c193b9c2beb54a965268f8dd89b83 (diff)
downloadcrosvm-97b74f2bad2f39abdf50f4e4b57f4d0723c111cf.tar.gz
Snap for 8429428 from c660ea67d41c193b9c2beb54a965268f8dd89b83 to tm-release
Change-Id: Ia2f681d1e7c65a1e717bc04e39aa18dad0817755
-rwxr-xr-xall2android.sh6
-rw-r--r--base/Android.bp6
-rw-r--r--base/base_poll_token_derive/Android.bp11
-rw-r--r--base/base_poll_token_derive/cargo2android.json7
-rw-r--r--base/cargo2android.json2
-rw-r--r--base/patches/Android.bp.patch81
-rw-r--r--common/cros_async/cargo2android.json9
-rw-r--r--common/io_uring/cargo2android.json9
-rw-r--r--cros_async/Android.bp9
-rw-r--r--io_uring/Android.bp9
-rw-r--r--serde_keyvalue/Android.bp9
-rw-r--r--serde_keyvalue/serde_keyvalue_derive/Android.bp9
12 files changed, 147 insertions, 20 deletions
diff --git a/all2android.sh b/all2android.sh
index 056b58755..004d27229 100755
--- a/all2android.sh
+++ b/all2android.sh
@@ -5,6 +5,11 @@
set -e
+if ! [ -x "$(command -v bpfmt)" ]; then
+ echo 'Error: bpfmt not found.' >&2
+ exit 1
+fi
+
cargo2android() {
local C2A=${C2A:-cargo2android.py}
echo "Using $C2A to run this script."
@@ -15,6 +20,7 @@ cargo2android() {
else
$C2A --run --device --tests $@
fi
+ bpfmt -w Android.bp || /bin/true
rm -f cargo.out
rm -rf target.tmp || /bin/true
}
diff --git a/base/Android.bp b/base/Android.bp
index 14264368b..f1b95b867 100644
--- a/base/Android.bp
+++ b/base/Android.bp
@@ -1,4 +1,4 @@
-// This file is generated by cargo2android.py --run --device --tests --global_defaults=crosvm_defaults --add_workspace --no-subdir.
+// This file is generated by cargo2android.py --config cargo2android.json.
// Do not modify this file as changes will be overridden on upgrade.
package {
@@ -60,7 +60,7 @@ rust_test {
],
},
},
- shared_libs: ["libcap"], // specified in src/unix/capabilities.rs
+ shared_libs: ["libcap"], // specified in src/unix/capabilities.rs
}
rust_library {
@@ -110,5 +110,5 @@ rust_library {
],
},
},
- shared_libs: ["libcap"], // specified in src/unix/capabilities.rs
+ shared_libs: ["libcap"], // specified in src/unix/capabilities.rs
}
diff --git a/base/base_poll_token_derive/Android.bp b/base/base_poll_token_derive/Android.bp
index aac1f15f1..83cff00b6 100644
--- a/base/base_poll_token_derive/Android.bp
+++ b/base/base_poll_token_derive/Android.bp
@@ -1,6 +1,15 @@
-// This file is generated by cargo2android.py --run --device --tests --global_defaults=crosvm_defaults --add_workspace.
+// This file is generated by cargo2android.py --config cargo2android.json.
// Do not modify this file as changes will be overridden on upgrade.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "external_crosvm_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-BSD
+ default_applicable_licenses: ["external_crosvm_license"],
+}
+
rust_test_host {
name: "base_poll_token_derive_test_poll_token_derive",
defaults: ["crosvm_defaults"],
diff --git a/base/base_poll_token_derive/cargo2android.json b/base/base_poll_token_derive/cargo2android.json
new file mode 100644
index 000000000..fba95e53f
--- /dev/null
+++ b/base/base_poll_token_derive/cargo2android.json
@@ -0,0 +1,7 @@
+{
+ "run": true,
+ "device": false,
+ "tests": true,
+ "global_defaults": "crosvm_defaults",
+ "add_workspace": true
+}
diff --git a/base/cargo2android.json b/base/cargo2android.json
index e580acc24..d6d53ef99 100644
--- a/base/cargo2android.json
+++ b/base/cargo2android.json
@@ -1,4 +1,6 @@
{
+ "add_workspace": true,
+ "device": true,
"global_defaults": "crosvm_defaults",
"no_presubmit": true,
"patch": "patches/Android.bp.patch",
diff --git a/base/patches/Android.bp.patch b/base/patches/Android.bp.patch
new file mode 100644
index 000000000..68b5d5bc4
--- /dev/null
+++ b/base/patches/Android.bp.patch
@@ -0,0 +1,81 @@
+diff --git a/base/Android.bp b/base/Android.bp
+index a3fe04d9..55ab423c 100644
+--- a/base/Android.bp
++++ b/base/Android.bp
+@@ -13,8 +13,6 @@ package {
+ rust_test {
+ name: "base_test_src_lib",
+ defaults: ["crosvm_defaults"],
+- // has rustc warnings
+- host_supported: true,
+ crate_name: "base",
+ cargo_env_compat: true,
+ cargo_pkg_version: "0.1.0",
+@@ -22,7 +20,7 @@ rust_test {
+ test_suites: ["general-tests"],
+ auto_gen_config: true,
+ test_options: {
+- unit_test: false,
++ unit_test: true,
+ },
+ edition: "2021",
+ rustlibs: [
+@@ -44,14 +42,31 @@ rust_test {
+ "libbase_poll_token_derive",
+ "libremain",
+ ],
+- static_libs: ["libstdio_fileno"],
++ target: {
++ android: {
++ rustlibs: ["libandroid_log_sys"],
++ },
++ linux_bionic_arm64: {
++ // For ARM architecture, we use aarch64-linux-android for BOTH
++ // device and host targets. As a result, host targets are also
++ // built with target_os = "android". Therefore, sys_util/src/android
++ // is used and thus this android module is required.
++ // This seems incorrect, but is inevitable because rustc doesn't
++ // yet support a Linux-based target using Bionic as libc. We can't
++ // use aarch64-unknown-linux-gnu because it's using glibc which
++ // we don't support for cross-host builds.
++ rustlibs: [
++ "libandroid_log_sys",
++ ],
++ },
++ },
++ shared_libs: ["libcap"], // specified in src/unix/capabilities.rs
+ }
+
+ rust_library {
+ name: "libbase_rust",
+ defaults: ["crosvm_defaults"],
+ stem: "libbase",
+- // has rustc warnings
+ host_supported: true,
+ crate_name: "base",
+ cargo_env_compat: true,
+@@ -77,5 +92,23 @@ rust_library {
+ "libbase_poll_token_derive",
+ "libremain",
+ ],
+- static_libs: ["libstdio_fileno"],
++ target: {
++ android: {
++ rustlibs: ["libandroid_log_sys"],
++ },
++ linux_bionic_arm64: {
++ // For ARM architecture, we use aarch64-linux-android for BOTH
++ // device and host targets. As a result, host targets are also
++ // built with target_os = "android". Therefore, sys_util/src/android
++ // is used and thus this android module is required.
++ // This seems incorrect, but is inevitable because rustc doesn't
++ // yet support a Linux-based target using Bionic as libc. We can't
++ // use aarch64-unknown-linux-gnu because it's using glibc which
++ // we don't support for cross-host builds.
++ rustlibs: [
++ "libandroid_log_sys",
++ ],
++ },
++ },
++ shared_libs: ["libcap"], // specified in src/unix/capabilities.rs
+ }
diff --git a/common/cros_async/cargo2android.json b/common/cros_async/cargo2android.json
index 9a64b6c75..0967ef424 100644
--- a/common/cros_async/cargo2android.json
+++ b/common/cros_async/cargo2android.json
@@ -1,8 +1 @@
-{
- "add_workspace": true,
- "device": true,
- "global_defaults": "crosvm_defaults",
- "no_presubmit": true,
- "run": true,
- "tests": true
-} \ No newline at end of file
+{}
diff --git a/common/io_uring/cargo2android.json b/common/io_uring/cargo2android.json
index 9a64b6c75..0967ef424 100644
--- a/common/io_uring/cargo2android.json
+++ b/common/io_uring/cargo2android.json
@@ -1,8 +1 @@
-{
- "add_workspace": true,
- "device": true,
- "global_defaults": "crosvm_defaults",
- "no_presubmit": true,
- "run": true,
- "tests": true
-} \ No newline at end of file
+{}
diff --git a/cros_async/Android.bp b/cros_async/Android.bp
index f05ab30fb..0ace21531 100644
--- a/cros_async/Android.bp
+++ b/cros_async/Android.bp
@@ -1,6 +1,15 @@
// This file is generated by cargo2android.py --config cargo2android.json.
// Do not modify this file as changes will be overridden on upgrade.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "external_crosvm_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-BSD
+ default_applicable_licenses: ["external_crosvm_license"],
+}
+
rust_test {
name: "cros_async_test_src_lib",
defaults: ["crosvm_defaults"],
diff --git a/io_uring/Android.bp b/io_uring/Android.bp
index a799e3e62..94fb7001e 100644
--- a/io_uring/Android.bp
+++ b/io_uring/Android.bp
@@ -1,6 +1,15 @@
// This file is generated by cargo2android.py --config cargo2android.json.
// Do not modify this file as changes will be overridden on upgrade.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "external_crosvm_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-BSD
+ default_applicable_licenses: ["external_crosvm_license"],
+}
+
rust_test {
name: "io_uring_test_src_lib",
defaults: ["crosvm_defaults"],
diff --git a/serde_keyvalue/Android.bp b/serde_keyvalue/Android.bp
index 1d975d551..4c9986eaf 100644
--- a/serde_keyvalue/Android.bp
+++ b/serde_keyvalue/Android.bp
@@ -1,6 +1,15 @@
// 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.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "external_crosvm_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-BSD
+ default_applicable_licenses: ["external_crosvm_license"],
+}
+
rust_library {
name: "libserde_keyvalue",
defaults: ["crosvm_defaults"],
diff --git a/serde_keyvalue/serde_keyvalue_derive/Android.bp b/serde_keyvalue/serde_keyvalue_derive/Android.bp
index e25155a25..8cee3f7c0 100644
--- a/serde_keyvalue/serde_keyvalue_derive/Android.bp
+++ b/serde_keyvalue/serde_keyvalue_derive/Android.bp
@@ -1,6 +1,15 @@
// This file is generated by cargo2android.py --run --device --tests --global_defaults=crosvm_defaults --add_workspace.
// Do not modify this file as changes will be overridden on upgrade.
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "external_crosvm_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-BSD
+ default_applicable_licenses: ["external_crosvm_license"],
+}
+
rust_proc_macro {
name: "libserde_keyvalue_derive",
defaults: ["crosvm_defaults"],