diff options
-rw-r--r-- | Android.bp | 10 | ||||
-rw-r--r-- | cargo_embargo.json | 7 | ||||
-rw-r--r-- | patches/rules.mk.diff | 25 | ||||
-rw-r--r-- | rules.mk | 29 |
4 files changed, 61 insertions, 10 deletions
@@ -1,5 +1,7 @@ // This file is generated by cargo_embargo. -// Do not modify this file as changes will be overridden on upgrade. +// Do not modify this file after the first "rust_*" or "genrule" module +// because the changes will be overridden on upgrade. +// Content before the first "rust_*" or "genrule" module is preserved. package { default_applicable_licenses: ["external_rust_crates_lazy_static_license"], @@ -43,7 +45,7 @@ rust_test { crate_name: "test", cargo_env_compat: true, cargo_pkg_version: "1.4.0", - srcs: ["tests/test.rs"], + crate_root: "tests/test.rs", test_suites: ["general-tests"], auto_gen_config: true, test_options: { @@ -59,7 +61,7 @@ rust_library { crate_name: "lazy_static", cargo_env_compat: true, cargo_pkg_version: "1.4.0", - srcs: ["src/lib.rs"], + crate_root: "src/lib.rs", edition: "2015", apex_available: [ "//apex_available:platform", @@ -75,7 +77,7 @@ rust_library_rlib { crate_name: "lazy_static", cargo_env_compat: true, cargo_pkg_version: "1.4.0", - srcs: ["src/lib.rs"], + crate_root: "src/lib.rs", edition: "2015", features: [ "spin", diff --git a/cargo_embargo.json b/cargo_embargo.json index e32afad..7a5c7b3 100644 --- a/cargo_embargo.json +++ b/cargo_embargo.json @@ -7,7 +7,8 @@ "lazy_static": { "dep_blocklist": [ "libdoc_comment" - ] + ], + "rulesmk_patch": "patches/rules.mk.diff" } }, "variants": [ @@ -30,6 +31,10 @@ "no_std": true } } + }, + { + "generate_androidbp": false, + "generate_rulesmk": true } ] } diff --git a/patches/rules.mk.diff b/patches/rules.mk.diff new file mode 100644 index 0000000..6ccc19a --- /dev/null +++ b/patches/rules.mk.diff @@ -0,0 +1,25 @@ +diff --git a/rules.mk b/rules.mk.desired +index f088ce8..89de36e 100644 +--- a/rules.mk ++++ b/rules.mk.desired +@@ -11,5 +11,20 @@ MODULE_SRCS := $(LOCAL_DIR)/src/lib.rs + MODULE_RUST_EDITION := 2015 + MODULE_LIBRARY_DEPS := \ + ++ifeq ($(call TOBOOL,$(TRUSTY_USERSPACE)),false) ++ ++# avoid cyclic dependence by adding dependencies manually ++MODULE_ADD_IMPLICIT_DEPS := false ++ ++MODULE_RUSTFLAGS += \ ++ --cfg 'feature="spin"' \ ++ --cfg 'feature="spin_no_std"' \ ++ ++MODULE_DEPS := \ ++ external/rust/crates/spin \ ++ trusty/user/base/lib/libcompiler_builtins-rust \ ++ trusty/user/base/lib/libcore-rust ++ ++endif + + include make/library.mk @@ -1,11 +1,30 @@ -# This file is generated by cargo2rulesmk.py --run. -# Do not modify this file as changes will be overridden on upgrade. +# This file is generated by cargo_embargo. +# Do not modify this file after the LOCAL_DIR line +# because the changes will be overridden on upgrade. +# Content before the first line starting with LOCAL_DIR is preserved. LOCAL_DIR := $(GET_LOCAL_DIR) MODULE := $(LOCAL_DIR) MODULE_CRATE_NAME := lazy_static -MODULE_SRCS := \ - $(LOCAL_DIR)/src/lib.rs \ - +MODULE_RUST_CRATE_TYPES := rlib +MODULE_SRCS := $(LOCAL_DIR)/src/lib.rs MODULE_RUST_EDITION := 2015 +MODULE_LIBRARY_DEPS := \ + +ifeq ($(call TOBOOL,$(TRUSTY_USERSPACE)),false) + +# avoid cyclic dependence by adding dependencies manually +MODULE_ADD_IMPLICIT_DEPS := false + +MODULE_RUSTFLAGS += \ + --cfg 'feature="spin"' \ + --cfg 'feature="spin_no_std"' \ + +MODULE_DEPS := \ + external/rust/crates/spin \ + trusty/user/base/lib/libcompiler_builtins-rust \ + trusty/user/base/lib/libcore-rust + +endif + include make/library.mk |