Add reproduction for workspace build.rs failure

This commit is contained in:
Nicolas Mattia 2020-02-11 20:28:56 +01:00
parent 11ac47b4cc
commit 65e8bba46a
6 changed files with 39 additions and 0 deletions

View file

@ -139,6 +139,8 @@ rec
doDoc = true;
};
workspace-build-rs = naersk.buildPackage ./test/workspace-build-rs;
# Fails with some remarshal error
#servo = naersk.buildPackage
#sources.servo

6
test/workspace-build-rs/Cargo.lock generated Normal file
View file

@ -0,0 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "hello-from-generated-code"
version = "0.1.0"

View file

@ -0,0 +1,2 @@
[workspace]
members = [ "crate-a" ]

View file

@ -0,0 +1,6 @@
# Cargo.toml
# adapted from https://doc.rust-lang.org/cargo/reference/build-script-examples.html
[package]
name = "hello-from-generated-code"
version = "0.1.0"

View file

@ -0,0 +1,16 @@
use std::env;
use std::fs;
use std::path::Path;
fn main() {
let out_dir = env::var_os("OUT_DIR").unwrap();
let dest_path = Path::new(&out_dir).join("hello.rs");
fs::write(
&dest_path,
"pub fn message() -> &'static str {
\"Hello, World!\"
}
"
).unwrap();
println!("cargo:rerun-if-changed=build.rs");
}

View file

@ -0,0 +1,7 @@
// src/main.rs
include!(concat!(env!("OUT_DIR"), "/hello.rs"));
fn main() {
println!("{}", message());
}