From 657d4bbc0ddab5bfaf5b3df525e579568424bc7d Mon Sep 17 00:00:00 2001 From: Ryan Vandersmith Date: Sun, 18 Sep 2022 10:30:24 -0600 Subject: [PATCH 1/3] Add 'vessel.mo' as an alternative to 'vessel.dhall' --- Cargo.lock | 541 ++++++++++++++++++++++++++++++++++++++++++++++++++++- Cargo.toml | 1 + src/lib.rs | 56 +++--- 3 files changed, 563 insertions(+), 35 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a4fa7b2..4d73478 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,8 +19,8 @@ checksum = "372baaa5d3a422d8816b513bcdb2c120078c8614f7ecbcc3baf34a1634bbbe2e" dependencies = [ "abnf", "indexmap", - "itertools", - "pretty", + "itertools 0.9.0", + "pretty 0.5.2", ] [[package]] @@ -29,6 +29,15 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "aho-corasick" +version = "0.7.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4f55bd91a0978cbfd91c457a164bab8b4001c833b7f323132c0a4e1922dd44e" +dependencies = [ + "memchr", +] + [[package]] name = "annotate-snippets" version = "0.9.1" @@ -59,6 +68,15 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" +[[package]] +name = "ascii-canvas" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" +dependencies = [ + "term", +] + [[package]] name = "atty" version = "0.2.14" @@ -82,12 +100,42 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "beef" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" + +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + [[package]] name = "bitflags" version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitmaps" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031043d04099746d8db04daf1fa424b2bc8bd69d92b25962dcde24da39ab64a2" +dependencies = [ + "typenum", +] + [[package]] name = "block-buffer" version = "0.7.3" @@ -214,6 +262,12 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + [[package]] name = "dhall" version = "0.11.1" @@ -225,7 +279,7 @@ dependencies = [ "elsa", "hex", "home", - "itertools", + "itertools 0.9.0", "lazy_static", "once_cell", "percent-encoding", @@ -251,6 +305,12 @@ dependencies = [ "syn", ] +[[package]] +name = "diff" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" + [[package]] name = "digest" version = "0.8.1" @@ -269,6 +329,27 @@ dependencies = [ "generic-array 0.14.5", ] +[[package]] +name = "dirs-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + [[package]] name = "doc-comment" version = "0.3.3" @@ -290,6 +371,15 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "ena" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7402b94a93c24e742487327a7cd839dc9d36fec9de9fb25b09f2dae459f36c3" +dependencies = [ + "log", +] + [[package]] name = "encoding_rs" version = "0.8.31" @@ -299,6 +389,19 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "env_logger" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + [[package]] name = "fake-simd" version = "0.1.2" @@ -336,6 +439,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + [[package]] name = "flate2" version = "1.0.24" @@ -444,6 +553,17 @@ dependencies = [ "version_check", ] +[[package]] +name = "getrandom" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + [[package]] name = "h2" version = "0.3.13" @@ -542,6 +662,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +[[package]] +name = "humantime" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" + [[package]] name = "hyper" version = "0.14.19" @@ -590,6 +716,21 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "im-rc" +version = "15.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af1955a75fa080c677d3972822ec4bad316169ab1cfc6c257a942c2265dbe5fe" +dependencies = [ + "bitmaps", + "rand_core", + "rand_xoshiro", + "serde", + "sized-chunks", + "typenum", + "version_check", +] + [[package]] name = "indexmap" version = "1.9.1" @@ -624,6 +765,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8bf247779e67a9082a4790b45e71ac7cfd1321331a5c856a74a9faebdab78d0" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.2" @@ -639,6 +789,38 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "lalrpop" +version = "0.19.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b30455341b0e18f276fa64540aff54deafb54c589de6aca68659c63dd2d5d823" +dependencies = [ + "ascii-canvas", + "atty", + "bit-set", + "diff", + "ena", + "itertools 0.10.4", + "lalrpop-util", + "petgraph", + "pico-args", + "regex", + "regex-syntax", + "string_cache", + "term", + "tiny-keccak", + "unicode-xid", +] + +[[package]] +name = "lalrpop-util" +version = "0.19.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcf796c978e9b4d983414f4caedc9273aa33ee214c5b887bd55fde84c85d2dc4" +dependencies = [ + "regex", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -664,6 +846,22 @@ version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" +[[package]] +name = "line-col" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e69cdf6b85b5c8dce514f694089a2cf8b1a702f6cd28607bcb3cf296c9778db" + +[[package]] +name = "lock_api" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f80bf5aacaf25cbfc8210d1cfb718f2bf3b11c4c54e5afe36c236853a8ec390" +dependencies = [ + "autocfg", + "scopeguard", +] + [[package]] name = "log" version = "0.4.17" @@ -673,6 +871,29 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "logos" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf8b031682c67a8e3d5446840f9573eb7fe26efe7ec8d195c9ac4c0647c502f1" +dependencies = [ + "logos-derive", +] + +[[package]] +name = "logos-derive" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d849148dbaf9661a6151d1ca82b13bb4c4c128146a88d05253b38d4e2f496c" +dependencies = [ + "beef", + "fnv", + "proc-macro2", + "quote", + "regex-syntax", + "syn", +] + [[package]] name = "maplit" version = "1.0.2" @@ -718,6 +939,30 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "motoko" +version = "0.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61a859e64c2fce2a05c8eb25084343046bcba31532d8555584293448e444d2bf" +dependencies = [ + "env_logger", + "im-rc", + "lalrpop", + "lalrpop-util", + "line-col", + "log", + "logos", + "num-bigint", + "num-traits", + "ordered-float", + "pretty 0.11.3", + "regex", + "serde", + "serde_json", + "structopt", + "test-log", +] + [[package]] name = "native-tls" version = "0.2.10" @@ -736,6 +981,12 @@ dependencies = [ "tempfile", ] +[[package]] +name = "new_debug_unreachable" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" + [[package]] name = "nom" version = "5.1.2" @@ -747,6 +998,37 @@ dependencies = [ "version_check", ] +[[package]] +name = "num-bigint" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", + "serde", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + [[package]] name = "num_cpus" version = "1.13.1" @@ -820,6 +1102,39 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "ordered-float" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96bcbab4bfea7a59c2c0fe47211a1ac4e3e96bea6eb446d704f310bc5c732ae2" +dependencies = [ + "num-traits", + "serde", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-sys", +] + [[package]] name = "percent-encoding" version = "2.1.0" @@ -891,6 +1206,31 @@ dependencies = [ "sha-1", ] +[[package]] +name = "petgraph" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143" +dependencies = [ + "fixedbitset", + "indexmap", +] + +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pico-args" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db8bcd96cb740d03149cbad5518db9fd87126a10ab519c011893b1754134c468" + [[package]] name = "pin-project-lite" version = "0.2.9" @@ -909,13 +1249,31 @@ version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + [[package]] name = "pretty" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f60c0d9f6fc88ecdd245d90c1920ff76a430ab34303fc778d33b1d0a4c3bf6d3" dependencies = [ - "typed-arena", + "typed-arena 1.7.0", +] + +[[package]] +name = "pretty" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83f3aa1e3ca87d3b124db7461265ac176b40c277f37e503eaa29c9c75c037846" +dependencies = [ + "arrayvec", + "log", + "typed-arena 2.0.1", + "unicode-segmentation", ] [[package]] @@ -960,6 +1318,21 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" + +[[package]] +name = "rand_xoshiro" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa" +dependencies = [ + "rand_core", +] + [[package]] name = "redox_syscall" version = "0.2.13" @@ -969,6 +1342,34 @@ dependencies = [ "bitflags", ] +[[package]] +name = "redox_users" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +dependencies = [ + "getrandom", + "redox_syscall", + "thiserror", +] + +[[package]] +name = "regex" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" + [[package]] name = "remove_dir_all" version = "0.5.3" @@ -1015,6 +1416,12 @@ dependencies = [ "winreg", ] +[[package]] +name = "rustversion" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" + [[package]] name = "ryu" version = "1.0.10" @@ -1040,6 +1447,12 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + [[package]] name = "security-framework" version = "2.6.1" @@ -1071,9 +1484,9 @@ checksum = "a41d061efea015927ac527063765e73601444cdc344ba855bc7bd44578b25e1c" [[package]] name = "serde" -version = "1.0.137" +version = "1.0.144" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" +checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860" dependencies = [ "serde_derive", ] @@ -1090,9 +1503,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.137" +version = "1.0.144" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" +checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00" dependencies = [ "proc-macro2", "quote", @@ -1114,9 +1527,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.81" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" +checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44" dependencies = [ "itoa", "ryu", @@ -1160,12 +1573,34 @@ dependencies = [ "opaque-debug 0.3.0", ] +[[package]] +name = "siphasher" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" + +[[package]] +name = "sized-chunks" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16d69225bde7a69b235da73377861095455d298f2b970996eec25ddbb42b3d1e" +dependencies = [ + "bitmaps", + "typenum", +] + [[package]] name = "slab" version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" +[[package]] +name = "smallvec" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" + [[package]] name = "socket2" version = "0.4.4" @@ -1188,6 +1623,19 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "string_cache" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213494b7a2b503146286049378ce02b482200519accc31872ee8be91fa820a08" +dependencies = [ + "new_debug_unreachable", + "once_cell", + "parking_lot", + "phf_shared", + "precomputed-hash", +] + [[package]] name = "strsim" version = "0.8.0" @@ -1254,6 +1702,37 @@ dependencies = [ "winapi", ] +[[package]] +name = "term" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" +dependencies = [ + "dirs-next", + "rustversion", + "winapi", +] + +[[package]] +name = "termcolor" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "test-log" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38f0c854faeb68a048f0f2dc410c5ddae3bf83854ef0e4977d58306a5edef50e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "textwrap" version = "0.11.0" @@ -1263,6 +1742,35 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "thiserror" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c53f98874615aea268107765aa1ed8f6116782501d18e53d08b471733bea6c85" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8b463991b4eab2d801e724172285ec4195c650e8ec79b149e6c2a8e6dd3f783" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -1363,6 +1871,12 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9b2228007eba4120145f785df0f6c92ea538f5a3635a612ecf4e334c8c1446d" +[[package]] +name = "typed-arena" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0685c84d5d54d1c26f7d3eb96cd41550adb97baed141a761cf335d3d33bcd0ae" + [[package]] name = "typenum" version = "1.15.0" @@ -1408,6 +1922,12 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + [[package]] name = "url" version = "2.2.2" @@ -1447,6 +1967,7 @@ dependencies = [ "fern", "flate2", "log", + "motoko", "reqwest", "semver", "serde", diff --git a/Cargo.toml b/Cargo.toml index 5da30fb..339f65b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,3 +22,4 @@ topological-sort = "0.1" serde_dhall = "0.11" dhall = "0.11" semver = "1" +motoko = "0.0.10" diff --git a/src/lib.rs b/src/lib.rs index 8fc946a..56c505c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,9 +1,9 @@ -use anyhow::{self, Context, Result}; +use anyhow::{Context, Result, anyhow, Error}; use flate2::read::GzDecoder; use log::{debug, info, warn}; use semver::Version; use serde::{Deserialize, Serialize}; -use std::cfg; +use std::{cfg}; use std::collections::{HashMap, HashSet}; use std::env; use std::fs; @@ -28,7 +28,7 @@ impl Vessel { fn find_dominating_manifest() -> Result> { let cwd = env::current_dir().context("Unable to access the current directory")?; for (depth, path) in cwd.ancestors().enumerate() { - if path.join("vessel.dhall").exists() { + if path.join("vessel.dhall").exists() || path.join("vessel.mo").exists() { if depth != 0 { info!("Changing working directory to {}", path.display()); env::set_current_dir(&path).context(format!( @@ -45,8 +45,8 @@ impl Vessel { pub fn new(package_set_file: &Path) -> Result { let mut new_vessel = match Vessel::find_dominating_manifest()? { None => { - return Err(anyhow::anyhow!( - "Could not find a 'vessel.dhall' file in this directory or a parent one." + return Err(anyhow!( + "Could not find a 'vessel.dhall' or 'vessel.mo' file in this directory or a parent one." )) } Some(nested) => Vessel { @@ -66,11 +66,17 @@ impl Vessel { } fn read_manifest_file(&mut self) -> Result<()> { - let manifest_file = PathBuf::from("vessel.dhall"); - self.manifest = serde_dhall::from_file(manifest_file) - .static_type_annotation() - .parse() - .context("Failed to parse the vessel.dhall file")?; + let mo_file = PathBuf::from("vessel.mo"); + self.manifest = if mo_file.exists() { + motoko::vm::eval_into(&fs::read_to_string(mo_file)?) + .map_err(|e| anyhow!("Error while reading Motoko config file: {:?}", e))? + } else { + let dhall_file = PathBuf::from("vessel.dhall"); + serde_dhall::from_file(dhall_file) + .static_type_annotation() + .parse() + .context("Failed to parse the vessel.dhall file")? + }; Ok(()) } @@ -122,7 +128,7 @@ impl Vessel { pub fn install_compiler(&self) -> Result { let version = self.manifest.compiler.as_ref().ok_or_else(|| { - anyhow::anyhow!("No compiler version was specified in vessel.dhall") + anyhow!("No compiler version was specified in vessel.dhall") })?; download_compiler(version).map(|path| self.nested_path(path)) } @@ -130,7 +136,7 @@ impl Vessel { /// Verifies that every source file inside the given package compiles in the current package set pub fn verify_package(&self, moc: &Path, moc_args: &Option, name: &str) -> Result<()> { match self.package_set.find(name) { - None => Err(anyhow::anyhow!( + None => Err(anyhow!( "The package \"{}\" does not exist in the package set", name )), @@ -162,7 +168,7 @@ impl Vessel { } Ok(()) } else { - Err(anyhow::anyhow!( + Err(anyhow!( "Failed to verify \"{}\" with:\n{}", package.name, String::from_utf8(output.stderr)? @@ -173,7 +179,7 @@ impl Vessel { } pub fn verify_all(&self, moc: &Path, moc_args: &Option) -> Result<()> { - let mut errors: Vec<(Name, anyhow::Error)> = vec![]; + let mut errors: Vec<(Name, Error)> = vec![]; for package in &self.package_set.topo_sorted() { if errors.iter().any(|(n, _)| package.dependencies.contains(n)) { if let Err(err) = self.verify_package(moc, moc_args, &package.name) { @@ -184,7 +190,7 @@ impl Vessel { if errors.is_empty() { Ok(()) } else { - let err = anyhow::anyhow!( + let err = anyhow!( "Failed to verify: {:?}", errors .iter() @@ -241,7 +247,7 @@ pub fn download_compiler(version: &str) -> Result { } else if cfg!(target_os = "macos") { ("x86_64-darwin", "macos") } else { - return Err(anyhow::anyhow!( + return Err(anyhow!( "Installing the compiler is only supported on Linux or MacOS for now" )); }; @@ -263,7 +269,7 @@ pub fn download_compiler(version: &str) -> Result { .send()?; if !response.status().is_success() { - return Err(anyhow::anyhow!( + return Err(anyhow!( "Failed to download Motoko binaries for version {}, with \"{}\"\n\nDetails: {}", version, response.status(), @@ -339,7 +345,7 @@ fn download_tar_ball(tmp: &Path, dest: &Path, repo: &str, version: &str) -> Resu let response = reqwest::blocking::get(&target)?; if !response.status().is_success() { - return Err(anyhow::anyhow!( + return Err(anyhow!( "Failed to download tarball for repo \"{}\" at version \"{}\", with \"{}\"\n\nDetails: {}", repo, version, @@ -355,12 +361,12 @@ fn download_tar_ball(tmp: &Path, dest: &Path, repo: &str, version: &str) -> Resu // We expect an unpacked repo to contain exactly one directory let repo_dir = match fs::read_dir(tmp_dir.path())?.next() { - None => return Err(anyhow::anyhow!("Unpacked an empty tarball for {}", repo)), + None => return Err(anyhow!("Unpacked an empty tarball for {}", repo)), Some(dir) => dir?, }; if !repo_dir.path().is_dir() { - return Err(anyhow::anyhow!("Failed to unpack tarball for \"{}\"", repo)); + return Err(anyhow!("Failed to unpack tarball for \"{}\"", repo)); } fs::rename(repo_dir.path(), dest)?; @@ -376,7 +382,7 @@ fn clone_package(tmp: &Path, dest: &Path, repo: &str, version: &str) -> Result<( .output() .context(format!("Failed to clone the repo at {}", repo))?; if !clone_result.status.success() { - return Err(anyhow::anyhow!( + return Err(anyhow!( "Failed to clone the repo at: {}\nwith:\n{}", repo, std::str::from_utf8(&clone_result.stderr).unwrap() @@ -395,7 +401,7 @@ fn clone_package(tmp: &Path, dest: &Path, repo: &str, version: &str) -> Result<( repo_dir.display() ))?; if !checkout_result.status.success() { - return Err(anyhow::anyhow!( + return Err(anyhow!( "Failed to checkout version {} for the repo at: {}\nwith:\n{}", version, repo, @@ -424,7 +430,7 @@ pub fn fetch_latest_package_set() -> Result<(Url, Hash)> { .header(reqwest::header::USER_AGENT, "vessel") .send()?; if !response.status().is_success() { - return Err(anyhow::anyhow!( + return Err(anyhow!( "Failed to read Github releases: {:#?}", response )); @@ -481,12 +487,12 @@ pub fn init() -> Result<()> { } }; if package_set_path.exists() { - return Err(anyhow::anyhow!( + return Err(anyhow!( "Failed to initialize, there is an existing package-set.dhall file here" )); } if manifest_path.exists() { - return Err(anyhow::anyhow!( + return Err(anyhow!( "Failed to initialize, there is an existing vessel.dhall file here" )); } From 27464badd651d47b45fcf6f63ef3daa84dfe2186 Mon Sep 17 00:00:00 2001 From: Ryan Vandersmith Date: Mon, 19 Sep 2022 09:53:42 -0600 Subject: [PATCH 2/3] Reformat --- src/lib.rs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 56c505c..c3f7b52 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,9 +1,9 @@ -use anyhow::{Context, Result, anyhow, Error}; +use anyhow::{anyhow, Context, Error, Result}; use flate2::read::GzDecoder; use log::{debug, info, warn}; use semver::Version; use serde::{Deserialize, Serialize}; -use std::{cfg}; +use std::cfg; use std::collections::{HashMap, HashSet}; use std::env; use std::fs; @@ -69,7 +69,7 @@ impl Vessel { let mo_file = PathBuf::from("vessel.mo"); self.manifest = if mo_file.exists() { motoko::vm::eval_into(&fs::read_to_string(mo_file)?) - .map_err(|e| anyhow!("Error while reading Motoko config file: {:?}", e))? + .map_err(|e| anyhow!("Error while reading Motoko config file: {:?}", e))? } else { let dhall_file = PathBuf::from("vessel.dhall"); serde_dhall::from_file(dhall_file) @@ -126,10 +126,11 @@ impl Vessel { /// Downloads the compiler binaries at the version specified in the manifest /// and returns the path to them. pub fn install_compiler(&self) -> Result { - let version = - self.manifest.compiler.as_ref().ok_or_else(|| { - anyhow!("No compiler version was specified in vessel.dhall") - })?; + let version = self + .manifest + .compiler + .as_ref() + .ok_or_else(|| anyhow!("No compiler version was specified in vessel.dhall"))?; download_compiler(version).map(|path| self.nested_path(path)) } @@ -430,10 +431,7 @@ pub fn fetch_latest_package_set() -> Result<(Url, Hash)> { .header(reqwest::header::USER_AGENT, "vessel") .send()?; if !response.status().is_success() { - return Err(anyhow!( - "Failed to read Github releases: {:#?}", - response - )); + return Err(anyhow!("Failed to read Github releases: {:#?}", response)); } let releases: Vec = response.json()?; let release = &releases[0].tag_name; From b84a707f8d00e37467c799a61c0118a077a796ee Mon Sep 17 00:00:00 2001 From: Ryan Vandersmith Date: Mon, 19 Sep 2022 10:06:58 -0600 Subject: [PATCH 3/3] Update Nix hash --- default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/default.nix b/default.nix index 6a74b07..453007e 100644 --- a/default.nix +++ b/default.nix @@ -14,7 +14,7 @@ let filter = noNixFile; src = subpath ./.; }; - cargoSha256 = "sha256-lcbFUllXJ4+gAyVDsPw+vAa3WtQx7W0k85M7fpq5ep4"; + cargoSha256 = "sha256-nFeHtCuRcEBuYF69rzjNL0l50moTtFgFseb3EhgaD7g"; verifyCargoDeps = true; }; in rec {