From c845bf95a318ad1c11d56f2342800ccd1291bb4c Mon Sep 17 00:00:00 2001 From: YetAnotherMinion Date: Mon, 27 Sep 2021 04:39:30 +0100 Subject: [PATCH] feat: pack starmelon with upx --- default.upx.do | 15 +++++++++++++++ src/reporting.rs | 6 +++++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 default.upx.do diff --git a/default.upx.do b/default.upx.do new file mode 100644 index 0000000..34162da --- /dev/null +++ b/default.upx.do @@ -0,0 +1,15 @@ +mkdir -p obj + +case $1 in + "starmelon.upx") + git ls-files src | xargs redo-ifchange + cargo build --release >&2 + cp ../../../target/release/starmelon obj/ + strip obj/starmelon >&2; + upx -1 -o "$3" obj/starmelon >&2; + ;; + *) + echo "no rule to build '$1'" >&2; + exit 1; + ;; +esac diff --git a/src/reporting.rs b/src/reporting.rs index aa82e64..b9d5a55 100644 --- a/src/reporting.rs +++ b/src/reporting.rs @@ -123,6 +123,7 @@ impl SetupError { impl CompilerError { pub fn to_doc(&self) -> Doc { + let mut title = "COMPILER ERROR"; use CompilerError::*; let message = match self { MissingElmJson(io_err) => Doc::text("TODO missing elm.json"), @@ -140,7 +141,10 @@ impl CompilerError { //) } FailedBuildingFixture => Doc::text("TODO failed building fixture elm"), - ReadInputFailed(io_err, path) => Doc::text("TODO read file failed"), + ReadInputFailed(io_err, path) => { + title = "IO ERROR"; + Doc::text("TODO read file failed") + }, WriteOutputFailed(io_err, path) => { Doc::text(format!("TODO write file failed {:?} {:?}", io_err, path)) }