refactor: use starmelon for derive macros
infra/homer/examples was the start of my work on macros for Elm. I have greatly refined these ideas in starmelon. Delete the multi step build process and replace it with a single call to starmelon.
This commit is contained in:
parent
afb53518a5
commit
0576ae168a
4 changed files with 28 additions and 4 deletions
2
always-rebuild.do
Normal file
2
always-rebuild.do
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
redo-always
|
||||||
|
redo-ifchange release
|
||||||
4
release.do
Normal file
4
release.do
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
redo-ifchange Cargo.toml
|
||||||
|
find src/ -type f | xargs redo-ifchange
|
||||||
|
|
||||||
|
cargo build --release
|
||||||
15
src/main.rs
15
src/main.rs
|
|
@ -446,10 +446,21 @@ globalThis.runOnInput = function(data) {
|
||||||
// now. Another way to do this would be with an Arc. This will panic if the
|
// now. Another way to do this would be with an Arc. This will panic if the
|
||||||
// mailbox is currently borrowed
|
// mailbox is currently borrowed
|
||||||
match mailbox.replace(None) {
|
match mailbox.replace(None) {
|
||||||
Some(Ok(output)) => {
|
Some(Ok(buffer)) => {
|
||||||
|
match output {
|
||||||
|
None => {
|
||||||
io::stdout()
|
io::stdout()
|
||||||
.write_all(&output)
|
.write_all(&buffer)
|
||||||
.map_err(|io_err| CompilerError::WriteOutputFailed(io_err, "stdout".into()))?;
|
.map_err(|io_err| CompilerError::WriteOutputFailed(io_err, "stdout".into()))?;
|
||||||
|
},
|
||||||
|
Some(filename) => {
|
||||||
|
let mut f = fs::File::create(&filename)
|
||||||
|
.map_err(|io_err| CompilerError::WriteOutputFailed(io_err, filename))?;
|
||||||
|
|
||||||
|
f.write_all(&buffer)
|
||||||
|
.map_err(|io_err| CompilerError::WriteOutputFailed(io_err, "stdout".into()))?;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Some(Err(problem)) => {
|
Some(Err(problem)) => {
|
||||||
println!("had a problem {}", problem);
|
println!("had a problem {}", problem);
|
||||||
|
|
|
||||||
7
starmelon-binary.do
Normal file
7
starmelon-binary.do
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
if test -f ../../target/debug/gen-css-selectors; then
|
||||||
|
redo-ifchange always-rebuild
|
||||||
|
ls -al ../../../target/release/starmelon | redo-stamp
|
||||||
|
else;
|
||||||
|
cargo build --release
|
||||||
|
ls -al ../../../target/release/starmelon | redo-stamp
|
||||||
|
fi
|
||||||
Loading…
Add table
Add a link
Reference in a new issue