summaryrefslogtreecommitdiff
path: root/test/build-script
diff options
context:
space:
mode:
Diffstat (limited to 'test/build-script')
-rw-r--r--test/build-script/TARGETS61
-rw-r--r--test/build-script/bar.rs15
-rw-r--r--test/build-script/baz.rs5
-rw-r--r--test/build-script/build.rs7
-rw-r--r--test/build-script/foo.rs6
-rw-r--r--test/build-script/main.rs6
6 files changed, 100 insertions, 0 deletions
diff --git a/test/build-script/TARGETS b/test/build-script/TARGETS
new file mode 100644
index 0000000..b896499
--- /dev/null
+++ b/test/build-script/TARGETS
@@ -0,0 +1,61 @@
+{ "baz-lib":
+ { "type": ["@", "rules", "rust", "library"]
+ , "name": ["baz"]
+ , "stage": ["baz"]
+ , "crate_root": ["baz.rs"]
+ , "edition": ["2021"]
+ , "version": ["1", "2", "3", "rc-1"]
+ }
+, "build_script":
+ { "type": ["@", "rules", "cargo", "build_script"]
+ , "name": ["build_script"]
+ , "crate_root": ["build.rs"]
+ , "edition": ["2018"]
+ , "stage": ["bar"]
+ , "deps": ["baz-lib"]
+ }
+, "bar-lib":
+ { "type": ["@", "rules", "rust", "library"]
+ , "name": ["bar"]
+ , "stage": ["bar"]
+ , "build_script": ["build_script"]
+ , "deps": ["baz-lib"]
+ , "crate_root": ["bar.rs"]
+ , "edition": ["2021"]
+ }
+, "bar-missing-baz":
+ { "type": ["@", "rules", "rust", "library"]
+ , "name": ["bar"]
+ , "stage": ["bar"]
+ , "crate_root": ["bar.rs"]
+ , "edition": ["2021"]
+ }
+, "foo-lib":
+ { "type": ["@", "rules", "rust", "library"]
+ , "name": ["foo"]
+ , "stage": ["foo"]
+ , "crate_root": ["foo.rs"]
+ , "edition": ["2021"]
+ , "deps": ["bar-lib"]
+ }
+, "main":
+ { "type": ["@", "rules", "rust", "binary"]
+ , "name": ["main"]
+ , "stage": ["bin"]
+ , "crate_root": ["main.rs"]
+ , "deps": ["foo-lib"]
+ }
+, "main-wrong-dep":
+ { "type": ["@", "rules", "rust", "binary"]
+ , "name": ["main"]
+ , "stage": ["bin"]
+ , "crate_root": ["main.rs"]
+ , "deps": ["bar-lib"]
+ }
+, "main-missing-dep":
+ { "type": ["@", "rules", "rust", "binary"]
+ , "name": ["main"]
+ , "stage": ["bin"]
+ , "crate_root": ["main.rs"]
+ }
+}
diff --git a/test/build-script/bar.rs b/test/build-script/bar.rs
new file mode 100644
index 0000000..30de275
--- /dev/null
+++ b/test/build-script/bar.rs
@@ -0,0 +1,15 @@
+
+#[cfg(not(bar))]
+pub fn hello(){
+ println!("hello bar");
+}
+
+#[cfg(bar)]
+pub fn hello(){
+ println!("hello build script");
+}
+
+pub fn add(a: i32, b: i32) -> i32 {
+ a + b
+}
+
diff --git a/test/build-script/baz.rs b/test/build-script/baz.rs
new file mode 100644
index 0000000..4222589
--- /dev/null
+++ b/test/build-script/baz.rs
@@ -0,0 +1,5 @@
+
+pub fn hello(){
+
+println!("hello baz");
+ } \ No newline at end of file
diff --git a/test/build-script/build.rs b/test/build-script/build.rs
new file mode 100644
index 0000000..35a358c
--- /dev/null
+++ b/test/build-script/build.rs
@@ -0,0 +1,7 @@
+
+
+fn main() {
+
+println!("cargo:rustc-cfg=bar");
+
+}
diff --git a/test/build-script/foo.rs b/test/build-script/foo.rs
new file mode 100644
index 0000000..c2dca08
--- /dev/null
+++ b/test/build-script/foo.rs
@@ -0,0 +1,6 @@
+extern crate bar;
+pub fn hello(){
+
+bar::hello();
+ println!("hello foo");
+ } \ No newline at end of file
diff --git a/test/build-script/main.rs b/test/build-script/main.rs
new file mode 100644
index 0000000..6da0e2e
--- /dev/null
+++ b/test/build-script/main.rs
@@ -0,0 +1,6 @@
+extern crate foo;
+
+fn main() {
+
+foo::hello();
+}