feat: livetable derive generates working code

Database identifiers are parsed and merged with table definition.
Add support machinery for multi-stage derive macros.
This commit is contained in:
YetAnotherMinion 2021-10-08 23:56:02 +01:00 committed by nobody
commit afb53518a5
Signed by: GrocerPublishAgent
GPG key ID: D460CD54A9E3AB86

View file

@ -62,22 +62,17 @@ fn exec(
output: Option<PathBuf>,
verbosity: u64,
) -> Result<(), Problem> {
// Our first elm make call is where we build the users program. There is a pretty good chance
// this won't work.
let mut command = Command::new("elm");
command
.arg("make")
.arg("--output")
.arg("/dev/null")
.stdin(Stdio::null());
if verbosity < 1 {
command.stderr(Stdio::null());
command.stdout(Stdio::null());
} else {
let pipe = dup_stderr()
.map_err(|io_err| CompilerError::ReadInputFailed(io_err, "stdout".into()))?;
command.stdout(pipe);
command.stderr(Stdio::piped());
}
.arg("/dev/null");
//.stdin(Stdio::null());
//.stdout(Stdio::null());
// I am using the default inherit stderr behavior here.
//.stderr(Stdio::piped());
if debug {
command.arg("--debug");
@ -85,14 +80,18 @@ fn exec(
command.arg(&file);
let start = Instant::now();
match command.status() {
Ok(exit_status) => {
if !exit_status.success() {
// TODO report the stdout from the elm compiler
return Err(Problem::Wildcard("elm failed".into()));
match command.output() {
Ok(output) => {
if !output.status.success() {
io::stderr().write_all(&output.stderr).unwrap();
return Err(CompilerError::FailedBuildingFixture.into());
}
if verbosity > 0 {
io::stderr().write_all(&output.stderr).unwrap();
}
}
Err(_) => {
Err(io_err) => {
// TODO handle this one
return Err(Problem::Wildcard("elm failed".into()));
}
}
@ -699,7 +698,7 @@ fn setup_generator_project(verbosity: u64, elm_project_dir: PathBuf) -> Result<P
let mut hasher = PortableHash::new();
std::io::copy(&mut elm_json_file, &mut hasher).unwrap();
let checksum: u64 = hasher.finish();
println!("elm.json checksum {}", checksum);
eprintln!("elm.json checksum {}", checksum);
let checksum_file = our_temp_dir.join("elm-json-checksum");
if checksum_file.exists() {