summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/lib.rs2
-rw-r--r--core/modules.rs20
2 files changed, 22 insertions, 0 deletions
diff --git a/core/lib.rs b/core/lib.rs
index 91f91a1c9..2fcfa178b 100644
--- a/core/lib.rs
+++ b/core/lib.rs
@@ -45,3 +45,5 @@ pub fn v8_version() -> &'static str {
fn test_v8_version() {
assert!(v8_version().len() > 3);
}
+
+crate_modules!();
diff --git a/core/modules.rs b/core/modules.rs
index 21c2481dd..c02bd4cab 100644
--- a/core/modules.rs
+++ b/core/modules.rs
@@ -449,6 +449,26 @@ impl fmt::Display for Deps {
}
}
+#[macro_export]
+macro_rules! crate_modules {
+ () => {
+ pub const DENO_CRATE_PATH: &'static str = env!("CARGO_MANIFEST_DIR");
+ };
+}
+
+#[macro_export]
+macro_rules! include_crate_modules {
+ ( $( $x:ident ),* ) => {
+ {
+ let mut temp: HashMap<String, String> = HashMap::new();
+ $(
+ temp.insert(stringify!($x).to_string(), $x::DENO_CRATE_PATH.to_string());
+ )*
+ temp
+ }
+ };
+}
+
#[cfg(test)]
mod tests {
use super::*;