summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCole Faust <colefaust@google.com>2024-03-21 14:12:44 -0700
committerCole Faust <colefaust@google.com>2024-03-21 14:26:48 -0700
commit110d191d73e8b42aec329a358d332cd6862cbc78 (patch)
tree0b9a4453a315d92909fa1fb2812ddc3566efc11d
parent8881a661ae63e1124eb47b45f08d9fa1225a5f00 (diff)
downloadn2-upstream.tar.gz
Import n2 to androidupstream
Test: m n2 Third-Party Import of: https://github.com/evmar/n2 Request Document: go/android3p For CL Reviewers: go/android3p#reviewing-a-cl For Build Team: go/ab-third-party-imports Bug: http://b/328273370 Original import of the code can be found at: https://googleplex-android.googlesource.com/platform/external/n2/+/refs/heads/third-party-review. Security Questionnaire: http://b/328273370#comment1 Change-Id: Iab199b146d606cb1e8212f5c38d8612a5845b6bf
-rw-r--r--Android.bp33
-rw-r--r--METADATA14
-rw-r--r--MODULE_LICENSE_APACHE20
-rw-r--r--OWNERS2
-rw-r--r--src/lib.rs11
5 files changed, 55 insertions, 5 deletions
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..a1b1b4b
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,33 @@
+
+// TODO: Add a module for the tests. The tests require libfiletime, which is not in android.
+
+rust_library_host {
+ name: "libn2",
+ crate_name: "n2",
+ srcs: ["src/lib.rs"],
+ edition: "2018",
+ cargo_env_compat: true,
+ // n2 prints the value of CARGO_PKG_VERSION when using the --version argument, we need to set
+ // this property to define the environment variable, but don't actually care about the value.
+ cargo_pkg_version: "android",
+ rustlibs: [
+ "libanyhow",
+ "libargh",
+ "liblibc",
+ "librustc_hash",
+ ],
+}
+
+rust_binary_host {
+ name: "n2",
+ crate_name: "n2",
+ srcs: ["src/main.rs"],
+ edition: "2018",
+ rustlibs: [
+ "libn2",
+ "libanyhow",
+ "libargh",
+ "liblibc",
+ "librustc_hash",
+ ],
+}
diff --git a/METADATA b/METADATA
new file mode 100644
index 0000000..d86949a
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,14 @@
+name: "n2"
+description: "an alternative ninja implementation"
+
+third_party {
+ homepage: "https://github.com/evmar/n2"
+ identifier {
+ type: "Git"
+ value: "https://github.com/evmar/n2"
+ primary_source: true
+ }
+ version: "8881a661ae63e1124eb47b45f08d9fa1225a5f00"
+ license_type: NOTICE
+ last_upgrade_date { year: 2024 month: 3 day: 21 }
+}
diff --git a/MODULE_LICENSE_APACHE2 b/MODULE_LICENSE_APACHE2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/MODULE_LICENSE_APACHE2
diff --git a/OWNERS b/OWNERS
new file mode 100644
index 0000000..412db17
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1,2 @@
+include platform/build/soong:main:/OWNERS
+include platform/system/core:main:/janitors/OWNERS
diff --git a/src/lib.rs b/src/lib.rs
index c1e8cb0..0989e56 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -22,9 +22,10 @@ mod terminal;
mod trace;
mod work;
-#[cfg(not(any(windows, target_arch = "wasm32")))]
-use jemallocator::Jemalloc;
+// TODO: Import Jemalloc into android and re-enable it here.
+// #[cfg(not(any(windows, target_arch = "wasm32")))]
+// use jemallocator::Jemalloc;
-#[cfg(not(any(windows, target_arch = "wasm32")))]
-#[global_allocator]
-static GLOBAL: Jemalloc = Jemalloc;
+// #[cfg(not(any(windows, target_arch = "wasm32")))]
+// #[global_allocator]
+// static GLOBAL: Jemalloc = Jemalloc;