├── .clang-format ├── .dockerignore ├── .git-blame-ignore-revs ├── .gitattributes ├── .github └── workflows │ ├── build.yaml │ └── dockerfiles │ ├── alpine │ ├── debian-bullseye │ ├── fedora-38 │ ├── node │ ├── rocky-8 │ ├── rocky-9 │ ├── ubuntu-22.04 │ └── wasm ├── .gitignore ├── .vscode ├── c_cpp_properties.json └── settings.json ├── .wakeignore ├── .wakemanifest ├── .wakeroot ├── LICENSE ├── LICENSE.Apache2 ├── Makefile ├── README.md ├── bin └── stamp ├── build.wake ├── debian ├── .gitignore ├── README ├── changelog.in ├── compat ├── control ├── copyright ├── rules └── source │ └── format ├── docs ├── extensions └── vscode │ ├── .eslintrc.json │ ├── .gitignore │ ├── .vscode-test.mjs │ ├── .vscode │ ├── extensions.json │ ├── launch.json │ └── tasks.json │ ├── .vscodeignore │ ├── LICENSE.txt │ ├── README.md │ ├── esbuild.js │ ├── images │ └── sifive_icon.png │ ├── language-configuration.json │ ├── online_images │ ├── diagnostics.gif │ ├── goto.gif │ ├── highlight.gif │ ├── hover.gif │ ├── rename.gif │ ├── report_issue.gif │ ├── show_defs_doc.gif │ ├── show_defs_folder.gif │ ├── stdlib.gif │ └── syntax_highlighting.png │ ├── package-lock.json │ ├── package.json.in │ ├── src │ ├── extension.ts │ └── test │ │ └── extension.test.ts │ ├── syntaxes │ └── wake.tmLanguage.json │ ├── tsconfig.json │ ├── vsce-stdin │ └── vscode.wake ├── lib └── wake │ └── stamp ├── rust ├── entity │ ├── Cargo.lock │ ├── Cargo.toml │ └── src │ │ ├── api_key.rs │ │ ├── blob.rs │ │ ├── blob_store.rs │ │ ├── job.rs │ │ ├── job_audit.rs │ │ ├── job_history.rs │ │ ├── job_use.rs │ │ ├── job_uses.rs │ │ ├── local_blob_store.rs │ │ ├── mod.rs │ │ ├── output_dir.rs │ │ ├── output_file.rs │ │ ├── output_symlink.rs │ │ └── prelude.rs ├── log_viewer │ ├── Cargo.lock │ ├── Cargo.toml │ ├── build.wake │ └── src │ │ └── main.rs ├── migration │ ├── Cargo.lock │ ├── Cargo.toml │ ├── README.md │ └── src │ │ ├── lib.rs │ │ ├── m20220101_000001_create_blob_tables.rs │ │ ├── m20220101_000002_create_table.rs │ │ ├── m20230706_104843_api_keys.rs │ │ ├── m20230707_144317_record_uses.rs │ │ ├── m20231117_162713_add_created_at.rs │ │ ├── m20231127_232833_drop_use_time.rs │ │ ├── m20231128_000751_normalize_uses_table.rs │ │ ├── m20240509_163905_add_label_to_job.rs │ │ ├── m20240517_195757_add_updated_at_to_blob.rs │ │ ├── m20240522_185420_create_job_history.rs │ │ ├── m20240731_152842_create_job_size_proc.rs │ │ ├── m20240731_201632_create_job_blob_timestamp_index.rs │ │ ├── m20240805_163520_create_blob_id_fk_indexes.rs │ │ ├── m20240809_213440_add_job_audit_table.rs │ │ ├── m20240819_193352_add_output_indexes.rs │ │ ├── m20240919_214610_add_hidden_to_output_dir.rs │ │ └── main.rs └── rsc │ ├── .config.json │ ├── Cargo.lock │ ├── Cargo.toml │ ├── postgres-tests.wake │ ├── rsc.wake │ └── src │ ├── bin │ ├── rsc │ │ ├── add_job.rs │ │ ├── api_key_check.rs │ │ ├── blob.rs │ │ ├── blob_store_impls.rs │ │ ├── config.rs │ │ ├── dashboard.rs │ │ ├── main.rs │ │ ├── read_job.rs │ │ └── types.rs │ └── rsc_tool │ │ ├── config.rs │ │ ├── main.rs │ │ └── table.rs │ ├── database.rs │ └── lib.rs ├── scripts ├── compile_commands ├── compile_commands.py ├── digraph ├── sphinx │ ├── .gitignore │ ├── Makefile │ └── source │ │ ├── .gitignore │ │ ├── _static │ │ └── stamp │ │ ├── conf.py │ │ └── contents.rst ├── wake │ ├── .gitignore │ ├── __init__.py │ └── wake.py ├── wake2rst.py ├── which_clang_files └── which_wake_files ├── share ├── doc │ └── wake │ │ ├── basic_wake_tutorial.md │ │ ├── datastructures.txt │ │ ├── how-to │ │ ├── create-a-release.adoc │ │ └── test-the-vscode-extension.adoc │ │ ├── logging.md │ │ ├── quickref.md │ │ ├── syntax │ │ ├── emacs │ │ │ └── wake-mode.el │ │ ├── joe │ │ │ ├── wake-4.1.jsf │ │ │ └── wake-4.6.jsf │ │ └── vim │ │ │ ├── ftdetect │ │ │ └── wake.vim │ │ │ └── syntax │ │ │ └── wake.vim │ │ ├── tour │ │ ├── packages.adoc │ │ ├── targets.adoc │ │ └── tuples.adoc │ │ ├── tutorial.md │ │ ├── wake-for-fsharp-developers.md │ │ └── wake-for-scala-developers.adoc └── wake │ ├── html │ ├── main.js │ ├── profile.html │ ├── style.css │ ├── timeline_arrow_lib.js │ ├── timeline_main.js │ ├── timeline_template.html │ └── utf8.js │ └── lib │ ├── .wakeroot │ ├── core │ ├── boolean.wake │ ├── double.wake │ ├── integer.wake │ ├── json.wake │ ├── list.wake │ ├── map.wake │ ├── option.wake │ ├── order.wake │ ├── print.wake │ ├── regexp.wake │ ├── result.wake │ ├── string.wake │ ├── syntax.wake │ ├── tree.wake │ ├── tuple.wake │ ├── types.wake │ ├── unsafe.wake │ └── vector.wake │ ├── gcc_wake │ ├── gcc.wake │ └── pkgconfig.wake │ ├── nothing │ └── nothing.wake │ ├── rust_wake │ └── cargo.wake │ └── system │ ├── environment.wake │ ├── http.wake │ ├── io.wake │ ├── job.wake │ ├── job_cache_runner.wake │ ├── path.wake │ ├── plan.wake │ ├── remote_cache_api.wake │ ├── remote_cache_api_test.wake │ ├── remote_cache_runner.wake │ ├── runner.wake │ └── sources.wake ├── src ├── compat │ ├── aligned_alloc.c │ ├── aligned_alloc.h │ ├── compat.wake │ ├── mtime.c │ ├── mtime.h │ ├── nofollow.h │ ├── physmem.c │ ├── physmem.h │ ├── readable.c │ ├── readable.h │ ├── rusage.c │ ├── rusage.h │ ├── sigwinch.c │ ├── sigwinch.h │ ├── spawn.c │ ├── spawn.h │ ├── utimens.c │ ├── utimens.h │ ├── windows.c │ └── windows.h ├── dst │ ├── bind.cpp │ ├── bind.h │ ├── dst.wake │ ├── expr.cpp │ ├── expr.h │ ├── todst.cpp │ └── todst.h ├── job_cache │ ├── bloom.h │ ├── daemon_cache.cpp │ ├── daemon_cache.h │ ├── db_helpers.h │ ├── eviction_command.h │ ├── eviction_policy.cpp │ ├── eviction_policy.h │ ├── hash.h │ ├── job-cache.wake │ ├── job_cache.cpp │ ├── job_cache.h │ ├── job_cache_impl_common.cpp │ ├── job_cache_impl_common.h │ ├── message_parser.h │ ├── message_sender.h │ ├── schema.sql │ ├── types.cpp │ └── types.h ├── json │ ├── jlexer.cpp.gz │ ├── jlexer.re │ ├── jparser.cpp │ ├── json.wake │ ├── json5.cpp │ ├── json5.h │ ├── lexint.cpp │ ├── lexint.h │ ├── utf8.cpp │ └── utf8.h ├── optimizer │ ├── cse.cpp │ ├── inline.cpp │ ├── optimizer.wake │ ├── purity.cpp │ ├── scope.cpp │ ├── ssa.cpp │ ├── ssa.h │ ├── sweep.cpp │ ├── tossa.cpp │ └── usage.cpp ├── parser │ ├── cst.cpp │ ├── cst.h │ ├── lexer.cpp.gz │ ├── lexer.h │ ├── lexer.re │ ├── parser.cpp.gz │ ├── parser.h.gz │ ├── parser.wake │ ├── parser.y.m4 │ ├── syntax.cpp │ ├── syntax.h │ ├── wakefiles.cpp │ └── wakefiles.h ├── runtime │ ├── config.cpp │ ├── config.h │ ├── database.cpp │ ├── database.h │ ├── double.cpp │ ├── exception.cpp │ ├── gc.cpp │ ├── gc.h │ ├── integer.cpp │ ├── job.cpp │ ├── job.h │ ├── json.cpp │ ├── prim.cpp │ ├── prim.h │ ├── profile.cpp │ ├── profile.h │ ├── regexp.cpp │ ├── runtime.cpp │ ├── runtime.h │ ├── runtime.wake │ ├── sources.cpp │ ├── sources.h │ ├── status.cpp │ ├── status.h │ ├── string.cpp │ ├── target.cpp │ ├── tuple.cpp │ ├── tuple.h │ ├── value.cpp │ ├── value.h │ └── vector.cpp ├── src.wake ├── types │ ├── data.cpp │ ├── data.h │ ├── datatype.cpp │ ├── datatype.h │ ├── dsu.h │ ├── internal.cpp │ ├── internal.h │ ├── primfn.h │ ├── sums.cpp │ ├── sums.h │ ├── type.cpp │ ├── type.h │ └── types.wake ├── util │ ├── diagnostic.h │ ├── execpath.cpp │ ├── execpath.h │ ├── file.cpp │ ├── file.h │ ├── fragment.cpp │ ├── fragment.h │ ├── hash.h │ ├── location.cpp │ ├── location.h │ ├── mkdir_parents.cpp │ ├── mkdir_parents.h │ ├── optional.h │ ├── poll.cpp │ ├── poll.h │ ├── rank.cpp │ ├── rank.h │ ├── segment.h │ ├── sfinae.h │ ├── shell.cpp │ ├── shell.h │ ├── term.cpp │ ├── term.h │ ├── unlink.cpp │ ├── unlink.h │ └── util.wake ├── wakefs │ ├── daemon_client.cpp │ ├── fuse.cpp │ ├── fuse.h │ ├── namespace.cpp │ ├── namespace.h │ └── wakefs.wake └── wcl │ ├── defer.h │ ├── diff.h │ ├── doc.h │ ├── doc_state.h │ ├── filepath.cpp │ ├── filepath.h │ ├── hash.h │ ├── iterator.h │ ├── optional.h │ ├── result.h │ ├── tracing.cpp │ ├── tracing.h │ ├── trie.h │ ├── unique_fd.h │ ├── wcl.wake │ ├── xoshiro_256.cpp │ └── xoshiro_256.h ├── tests ├── .wakeignore ├── .wakeroot ├── README.md ├── command-line │ ├── clean │ │ ├── .wakeroot │ │ ├── pass.sh │ │ └── stdout │ └── qv │ │ ├── .wakeroot │ │ ├── fail.sh │ │ └── stderr ├── config │ ├── empty │ │ ├── .wakeroot │ │ ├── pass.sh │ │ └── stdout │ ├── extra_keys │ │ ├── .wakeroot │ │ ├── pass.sh │ │ ├── stderr │ │ ├── stdout │ │ └── wake_user.json │ ├── invalid_user_config │ │ ├── .wakeroot │ │ ├── fail.sh │ │ ├── stderr │ │ └── wake_user.json │ ├── invalid_wakeroot │ │ ├── .wakeroot │ │ ├── fail.sh │ │ └── stderr │ ├── missing_user_config │ │ ├── .wakeroot │ │ ├── pass.sh │ │ └── stdout │ └── nominal │ │ ├── .wakeroot │ │ ├── pass.sh │ │ ├── stdout │ │ └── wake_user.json ├── dst │ ├── colon │ │ ├── .wakeroot │ │ ├── fail.sh │ │ ├── stderr │ │ └── test.wake │ ├── packages │ │ ├── .wakeroot │ │ ├── fail.sh │ │ ├── stderr │ │ ├── test.wake │ │ ├── test2.wake │ │ ├── test3.wake │ │ └── test4.wake │ └── typedef │ │ ├── .wakeroot │ │ ├── fail.sh │ │ ├── stderr │ │ └── test.wake ├── inspection │ └── canceled │ │ ├── .wakeroot │ │ ├── pass.sh │ │ ├── stderr │ │ ├── stdout │ │ └── test.wake ├── job-cache │ ├── basic-fetch │ │ ├── .wakeroot │ │ ├── pass.sh │ │ ├── some-input.txt │ │ └── test.wake │ ├── basic-lru │ │ ├── .wakeroot │ │ ├── pass.sh │ │ └── test.wake │ ├── dup-output │ │ ├── .wakeroot │ │ ├── pass.sh │ │ └── test.wake │ ├── overwrite-smaller │ │ ├── .wakeroot │ │ ├── pass.sh │ │ └── test.wake │ ├── runner-hash │ │ ├── .wakeroot │ │ ├── pass.sh │ │ ├── some-input.txt │ │ └── test.wake │ └── symlink-dir │ │ ├── .wakeroot │ │ ├── pass.sh │ │ └── test.wake ├── parser │ └── unicode │ │ ├── .wakeroot │ │ ├── pass.sh │ │ └── test.wake ├── remote-cache │ └── disable-cache-cascade │ │ ├── .wakeroot │ │ ├── pass.sh │ │ └── test.wake ├── runtime │ └── symlinks │ │ ├── .wakeroot │ │ ├── pass.sh │ │ └── test.wake ├── standard-library │ ├── json-normalize-merge │ │ ├── compat-identity │ │ │ ├── .wakeroot │ │ │ ├── infinity.json │ │ │ ├── nan.json │ │ │ ├── pass.sh │ │ │ ├── stdout │ │ │ └── unicode.json │ │ ├── compat-valid │ │ │ ├── .wakeroot │ │ │ ├── input.json │ │ │ ├── pass.sh │ │ │ └── stdout │ │ ├── compat │ │ │ ├── .wakeroot │ │ │ ├── infinity.json │ │ │ ├── nan.json │ │ │ ├── pass.sh │ │ │ ├── stderr │ │ │ ├── stdout │ │ │ ├── unicode-merge.json │ │ │ └── unicode.json │ │ ├── deduplicate │ │ │ ├── .wakeroot │ │ │ ├── invalid-boolean.json │ │ │ ├── invalid-double.json │ │ │ ├── invalid-int.json │ │ │ ├── invalid-nesting.json │ │ │ ├── invalid-string.json │ │ │ ├── pass.sh │ │ │ ├── stderr │ │ │ ├── stdout │ │ │ ├── valid-nesting.json │ │ │ └── valid.json │ │ ├── json-test.wake │ │ ├── mergeJSON │ │ │ ├── .wakeroot │ │ │ ├── override.json │ │ │ ├── pass.sh │ │ │ ├── recurse.json │ │ │ ├── stderr │ │ │ └── stdout │ │ └── overrideJSON │ │ │ ├── .wakeroot │ │ │ ├── override.json │ │ │ ├── pass.sh │ │ │ ├── recurse.json │ │ │ └── stdout │ ├── list │ │ ├── .wakeroot │ │ ├── pass.sh │ │ ├── stdout │ │ └── test.wake │ ├── runner │ │ ├── .wakeroot │ │ ├── pass.sh │ │ ├── stdout │ │ └── test.wake │ ├── string │ │ ├── .wakeroot │ │ ├── pass.sh │ │ ├── stdout │ │ └── test.wake │ └── tree │ │ ├── .wakeroot │ │ ├── pass.sh │ │ ├── stdout │ │ └── test.wake ├── tests.wake ├── type-system │ ├── extract-fail │ │ ├── .wakeroot │ │ ├── fail.sh │ │ ├── stderr │ │ └── test.wake │ ├── extract-pass │ │ ├── .wakeroot │ │ ├── pass.sh │ │ └── test.wake │ ├── lambda-fail │ │ ├── .wakeroot │ │ ├── fail.sh │ │ ├── stderr │ │ └── test.wake │ ├── lambda-pass │ │ ├── .wakeroot │ │ ├── pass.sh │ │ └── test.wake │ ├── match-fail │ │ ├── .wakeroot │ │ ├── fail.sh │ │ ├── stderr │ │ ├── stdout │ │ └── test.wake │ ├── match-pass │ │ ├── .wakeroot │ │ ├── pass.sh │ │ ├── stderr │ │ └── test.wake │ ├── multi-match-fail │ │ ├── .wakeroot │ │ ├── fail.sh │ │ ├── stderr │ │ ├── stdout │ │ └── test.wake │ ├── multi-match-pass │ │ ├── .wakeroot │ │ ├── pass.sh │ │ ├── stderr │ │ └── test.wake │ ├── require-fail │ │ ├── .wakeroot │ │ ├── fail.sh │ │ ├── stderr │ │ └── test.wake │ ├── require-pass │ │ ├── .wakeroot │ │ ├── pass.sh │ │ └── test.wake │ └── value-restriction │ │ ├── .wakeroot │ │ ├── pass.sh │ │ └── test.wake ├── wake-format │ ├── bad-no-format │ │ ├── bad-no-format.wake │ │ ├── fail.sh │ │ └── stderr │ ├── basic │ │ ├── basic.wake │ │ ├── pass.sh │ │ ├── stderr │ │ └── stdout │ └── disallowed-input │ │ ├── disallowed-input.wake │ │ ├── pass.sh │ │ └── stdout ├── wake-unit │ ├── stderr │ ├── stdout │ └── unit-test.sh └── wakebox │ ├── false │ ├── .wakeroot │ ├── fail.sh │ └── input.json │ ├── hardlink │ ├── input.json │ └── pass.sh │ ├── isolate-retcode │ ├── .wakeroot │ ├── input.json │ └── pass.sh │ ├── loopback-up │ ├── .wakeroot │ ├── input.json │ └── pass.sh │ ├── timeout-exceeded │ ├── .wakeroot │ ├── input.json │ └── pass.sh │ ├── timeout-met │ ├── .wakeroot │ ├── input.json │ └── pass.sh │ └── true │ ├── .wakeroot │ ├── input.json │ └── pass.sh ├── tools ├── bsp-wake │ ├── bsp.wake │ └── main.cpp ├── fuse-waked │ ├── fuse-waked.wake │ └── main.cpp ├── job-cache │ ├── job-cache.wake │ └── main.cpp ├── lsp-wake │ ├── astree.cpp │ ├── astree.h │ ├── json_converter.cpp │ ├── json_converter.h │ ├── lsp.wake │ ├── main.cpp │ └── symbol_definition.h ├── shim-wake │ ├── main.cpp │ └── shim.wake ├── tools.wake ├── wake-format │ ├── actions.h │ ├── catters.h │ ├── common.h │ ├── emitter.cpp │ ├── emitter.h │ ├── formatter.h │ ├── main.cpp │ ├── predicates.h │ ├── types.h │ └── wake-format.wake ├── wake-hash │ ├── hash.wake │ └── main.cpp ├── wake-unit │ ├── cli_options.cpp │ ├── diff.cpp │ ├── doc.cpp │ ├── filepath.cpp │ ├── fuzz_test_job_cache.cpp │ ├── iterator.cpp │ ├── main.cpp │ ├── optional.cpp │ ├── result.cpp │ ├── shell.cpp │ ├── term.cpp │ ├── trie.cpp │ ├── unit.cpp │ ├── unit.h │ └── wake-unit.wake ├── wake │ ├── cli_options.h │ ├── describe.cpp │ ├── describe.h │ ├── main.cpp │ ├── markup.cpp │ ├── markup.h │ └── wake.wake └── wakebox │ ├── main.cpp │ └── wakebox.wake ├── vendor ├── blake2 │ ├── LICENSE.CC0 │ ├── blake2-impl.h │ ├── blake2.h │ ├── blake2.wake │ ├── blake2b-ref.c │ └── config.h ├── emscripten.wake ├── fuse.wake ├── git.wake ├── gmp.wake ├── gopt │ ├── CHANGELOG.txt │ ├── LICENSE.TFL │ ├── README.txt │ ├── gopt-arg.c │ ├── gopt-arg.h │ ├── gopt-errors.c │ ├── gopt.c │ ├── gopt.h │ └── gopt.wake ├── lemon │ ├── lemon.c │ ├── lemon.wake │ └── lempar.c ├── ncurses.wake ├── re2.patch ├── re2.wake ├── re2c.wake ├── siphash │ ├── LICENSE.CC0 │ ├── siphash.c │ └── siphash.wake ├── sqlite3.wake ├── squashfuse │ └── squashfuse.wake ├── utf8proc │ ├── LICENSE.MIT │ ├── LICENSE.UNICODE │ ├── utf8proc.c │ ├── utf8proc.h │ ├── utf8proc.wake │ └── utf8proc_data.c ├── vendor.wake └── whereami │ ├── LICENSE.WTFPLv2 │ ├── whereami.c │ ├── whereami.h │ └── whereami.wake └── wake.spec.in /.dockerignore: -------------------------------------------------------------------------------- 1 | .circleci 2 | -------------------------------------------------------------------------------- /.git-blame-ignore-revs: -------------------------------------------------------------------------------- 1 | # Run `make formatAll` over the entire repo 2 | 9db9154683802a60ee3d927adbb1339ed6ed2016 3 | 4 | # Fixup cases of bad auto formatting from 9db9154 5 | 6e3504c5778b4c13f1e18c0bc2db013d0296516c 6 | 7 | # Format all wake code with wake-format 8 | 9842a536d98ae7eb290696ead21e91e346ed1552 9 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.wake linguist-language=python 2 | -------------------------------------------------------------------------------- /.github/workflows/dockerfiles/alpine: -------------------------------------------------------------------------------- 1 | FROM alpine:3.14.0 2 | 3 | RUN apk add m4 g++ make pkgconf git tar xz gmp-dev re2-dev sqlite-dev fuse-dev ncurses-dev dash sqlite-static ncurses-static linux-headers jq openssl-dev 4 | 5 | WORKDIR /build 6 | 7 | ENV VERSION=1.80.0 8 | ENV RUST_FOLDER="rust-$VERSION-x86_64-unknown-linux-musl" 9 | ENV RUST_TAR="$RUST_FOLDER.tar.gz" 10 | RUN wget "https://static.rust-lang.org/dist/$RUST_TAR" 11 | RUN tar -xf $RUST_TAR 12 | RUN sh ./$RUST_FOLDER/install.sh --verbose 13 | 14 | RUN wget https://github.com/libfuse/libfuse/releases/download/fuse-2.9.9/fuse-2.9.9.tar.gz 15 | RUN tar xvzf fuse-2.9.9.tar.gz 16 | RUN cd fuse-2.9.9 && ./configure && make && cp lib/.libs/libfuse.a /usr/lib 17 | -------------------------------------------------------------------------------- /.github/workflows/dockerfiles/debian-bullseye: -------------------------------------------------------------------------------- 1 | FROM debian:bullseye 2 | 3 | RUN apt-get update && apt-get install -y build-essential m4 devscripts git fuse libfuse-dev libgmp-dev libncurses5-dev libre2-dev libsqlite3-dev pkg-config squashfuse wget iproute2 jq libssl-dev 4 | 5 | 6 | WORKDIR /build 7 | ENV VERSION=1.80.0 8 | ENV RUST_FOLDER="rust-$VERSION-x86_64-unknown-linux-gnu" 9 | ENV RUST_TAR="$RUST_FOLDER.tar.gz" 10 | RUN wget "https://static.rust-lang.org/dist/$RUST_TAR" 11 | RUN tar -xf $RUST_TAR 12 | RUN sh ./$RUST_FOLDER/install.sh --verbose --prefix=/usr 13 | -------------------------------------------------------------------------------- /.github/workflows/dockerfiles/fedora-38: -------------------------------------------------------------------------------- 1 | FROM fedora:38 2 | 3 | RUN echo fastestmirror=1 >> /etc/dnf/dnf.conf 4 | RUN dnf clean all 5 | RUN dnf update -y 6 | RUN dnf install -y rpm-build rpm-devel rpmlint make python39 bash diffutils patch rpmdevtools m4 tar xz dash git which make gcc gcc-c++ fuse fuse-devel gmp-devel ncurses-devel sqlite-devel re2-devel squashfuse wget iproute jq openssl-devel 7 | RUN rpmdev-setuptree 8 | 9 | 10 | WORKDIR /build 11 | ENV VERSION=1.80.0 12 | ENV RUST_FOLDER="rust-$VERSION-x86_64-unknown-linux-gnu" 13 | ENV RUST_TAR="$RUST_FOLDER.tar.gz" 14 | RUN wget "https://static.rust-lang.org/dist/$RUST_TAR" 15 | RUN tar -xf $RUST_TAR 16 | RUN sh ./$RUST_FOLDER/install.sh --verbose 17 | -------------------------------------------------------------------------------- /.github/workflows/dockerfiles/node: -------------------------------------------------------------------------------- 1 | FROM node:latest 2 | 3 | RUN apt-get update && apt-get install -y build-essential devscripts git fuse libfuse-dev libgmp-dev libncurses5-dev libre2-dev libsqlite3-dev pkg-config squashfuse wget jq 4 | 5 | RUN useradd -m -d /build build 6 | 7 | WORKDIR /build 8 | ENV VERSION=1.80.0 9 | ENV RUST_FOLDER="rust-$VERSION-x86_64-unknown-linux-gnu" 10 | ENV RUST_TAR="$RUST_FOLDER.tar.gz" 11 | RUN wget "https://static.rust-lang.org/dist/$RUST_TAR" 12 | RUN tar -xf $RUST_TAR 13 | RUN sh ./$RUST_FOLDER/install.sh --verbose --prefix=/usr 14 | -------------------------------------------------------------------------------- /.github/workflows/dockerfiles/rocky-8: -------------------------------------------------------------------------------- 1 | FROM rockylinux/rockylinux:8 2 | 3 | RUN echo fastestmirror=1 >> /etc/dnf/dnf.conf 4 | RUN dnf clean all 5 | RUN dnf install -y epel-release 6 | RUN dnf install -y rpm-build rpm-devel rpmlint make python36 bash diffutils patch rpmdevtools m4 tar xz dash git which make gcc gcc-c++ fuse fuse-devel gmp-devel ncurses-devel sqlite-devel re2-devel squashfuse wget iproute jq openssl-devel 7 | RUN rpmdev-setuptree 8 | 9 | 10 | WORKDIR /build 11 | ENV VERSION=1.80.0 12 | ENV RUST_FOLDER="rust-$VERSION-x86_64-unknown-linux-gnu" 13 | ENV RUST_TAR="$RUST_FOLDER.tar.gz" 14 | RUN wget "https://static.rust-lang.org/dist/$RUST_TAR" 15 | RUN tar -xf $RUST_TAR 16 | RUN sh ./$RUST_FOLDER/install.sh --verbose 17 | -------------------------------------------------------------------------------- /.github/workflows/dockerfiles/rocky-9: -------------------------------------------------------------------------------- 1 | FROM rockylinux/rockylinux:9 2 | 3 | RUN echo fastestmirror=1 >> /etc/dnf/dnf.conf 4 | RUN dnf clean all 5 | RUN dnf install -y epel-release 6 | RUN dnf --enablerepo=crb install -y fuse-devel 7 | RUN dnf install -y rpm-build rpm-devel rpmlint make python3 bash diffutils patch rpmdevtools m4 tar xz dash git which make gcc gcc-c++ fuse gmp-devel ncurses-devel sqlite-devel re2-devel squashfuse dash wget iproute jq openssl-devel 8 | 9 | RUN rpmdev-setuptree 10 | 11 | WORKDIR /build 12 | ENV VERSION=1.80.0 13 | ENV RUST_FOLDER="rust-$VERSION-x86_64-unknown-linux-gnu" 14 | ENV RUST_TAR="$RUST_FOLDER.tar.gz" 15 | RUN wget "https://static.rust-lang.org/dist/$RUST_TAR" 16 | RUN tar -xf $RUST_TAR 17 | RUN sh ./$RUST_FOLDER/install.sh --verbose 18 | -------------------------------------------------------------------------------- /.github/workflows/dockerfiles/ubuntu-22.04: -------------------------------------------------------------------------------- 1 | FROM ubuntu:22.04 2 | 3 | RUN apt-get update && apt-get install -y build-essential m4 debhelper devscripts git fuse libfuse-dev libgmp-dev libncurses5-dev libre2-dev libsqlite3-dev pkg-config squashfuse wget iproute2 jq libssl-dev 4 | 5 | WORKDIR /build 6 | ENV VERSION=1.80.0 7 | ENV RUST_FOLDER="rust-$VERSION-x86_64-unknown-linux-gnu" 8 | ENV RUST_TAR="$RUST_FOLDER.tar.gz" 9 | RUN wget "https://static.rust-lang.org/dist/$RUST_TAR" 10 | RUN tar -xf $RUST_TAR 11 | RUN sh ./$RUST_FOLDER/install.sh --verbose --prefix=/usr 12 | -------------------------------------------------------------------------------- /.github/workflows/dockerfiles/wasm: -------------------------------------------------------------------------------- 1 | FROM emscripten/emsdk:latest 2 | 3 | RUN apt-get update && apt-get install -y build-essential devscripts git fuse libfuse-dev libgmp-dev libncurses5-dev libre2-dev libsqlite3-dev pkg-config squashfuse wget jq 4 | 5 | RUN useradd -m -d /build build 6 | 7 | WORKDIR /build 8 | ENV VERSION=1.80.0 9 | ENV RUST_FOLDER="rust-$VERSION-x86_64-unknown-linux-gnu" 10 | ENV RUST_TAR="$RUST_FOLDER.tar.gz" 11 | RUN wget "https://static.rust-lang.org/dist/$RUST_TAR" 12 | RUN tar -xf $RUST_TAR 13 | RUN sh ./$RUST_FOLDER/install.sh --verbose --prefix=/usr 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | manifest.wake 2 | *.o 3 | .build 4 | .fuse* 5 | .cache-hit 6 | .cache-misses 7 | .job-cache 8 | compile_commands.json 9 | /.compile_commands 10 | /.vscode/*.log 11 | /**/wake.db* 12 | /**/wake.log 13 | /wake.db* 14 | /wake.spec 15 | /src/parser/lexer.cpp 16 | /src/parser/parser.y 17 | /src/parser/parser.c 18 | /src/parser/parser.h 19 | /src/parser/parser.out 20 | /src/parser/parser.cpp 21 | /src/json/jlexer.cpp 22 | /bin/wake* 23 | /bin/preload-wake 24 | /bin/preload-wake.* 25 | /bin/evict-shared-cache* 26 | /bin/wakebox 27 | /bin/wakebox.* 28 | /bin/wake-format.* 29 | /bin/job-cache 30 | /bin/job-cache.* 31 | /src/version.h 32 | /lib/wake/bsp-wake 33 | /lib/wake/bsp-wake.* 34 | /lib/wake/lsp-wake 35 | /lib/wake/lsp-wake.* 36 | /lib/wake/fuse-waked 37 | /lib/wake/fuse-waked.* 38 | /lib/wake/shim-wake 39 | /lib/wake/shim-wake.* 40 | /lib/wake/wake-hash 41 | /lib/wake/wake-hash.* 42 | /lib/wake/libpreload-wake.* 43 | /vendor/lemon/lemon.* 44 | /tmp 45 | *.swp 46 | *.swo 47 | *.swn 48 | .cargo 49 | /rust/target/* 50 | /rust/migration/target/* 51 | /rust/entity/target/* 52 | /rust/log_viewer/target/* 53 | /rust/rsc/target/* 54 | -------------------------------------------------------------------------------- /.vscode/c_cpp_properties.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "name": "Mac", 5 | "includePath": [ 6 | "${workspaceFolder}/**", 7 | "/opt/local/include" 8 | ], 9 | "defines": [], 10 | "macFrameworkPath": [ 11 | "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks" 12 | ], 13 | "compilerPath": "/usr/bin/clang", 14 | "cStandard": "c11", 15 | "cppStandard": "c++14", 16 | "intelliSenseMode": "macos-clang-x64" 17 | }, 18 | { 19 | "name": "Linux", 20 | "includePath": [ 21 | "${workspaceFolder}/**" 22 | ], 23 | "defines": [], 24 | "compilerPath": "/usr/bin/gcc", 25 | "cStandard": "c11", 26 | "cppStandard": "c++14", 27 | "intelliSenseMode": "linux-gcc-x64" 28 | } 29 | ], 30 | "version": 4 31 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "iosfwd": "cpp" 4 | } 5 | } -------------------------------------------------------------------------------- /.wakeignore: -------------------------------------------------------------------------------- 1 | tmp/** 2 | debian/** 3 | -------------------------------------------------------------------------------- /.wakeroot: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This source repository includes software from various sources. 2 | Each file includes a header which describes the relevant license. 3 | 4 | In broad strokes: 5 | wake LICENSE.Apache2 everything not in vendor/ 6 | 7 | BLAKE2 LICENSE.CC0 vendor/blake2/ 8 | gopt LICENSE.TFL vendor/gopt/ 9 | lemon public domain vendor/lemon/ 10 | SipHash LICENSE.CC0 vendor/siphash/ 11 | Unicode data LICENSE.UNICODE vendor/utf8proc/utf8proc_data.c 12 | utf8proc LICENSE.MIT vendor/utf8proc/utf8proc.[ch] 13 | whereami LICENSE.WTFPL vendor/whereami/ 14 | vscode extension clients LICENSE.MIT extensions/vscode/lsp-client/src/vendor 15 | -------------------------------------------------------------------------------- /bin/stamp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sifiveinc/wake/0b5e100b5580bc0503092294254e1f0b5e46e01b/bin/stamp -------------------------------------------------------------------------------- /debian/.gitignore: -------------------------------------------------------------------------------- 1 | changelog 2 | .debhelper/ 3 | debhelper-build-stamp 4 | files 5 | wake.substvars 6 | wake/ 7 | -------------------------------------------------------------------------------- /debian/README: -------------------------------------------------------------------------------- 1 | The Debian Package wake 2 | ---------------------------- 3 | 4 | Wake is a build orchestration tool and language. 5 | If you have a build whose steps cannot be adequately expressed in 6 | make/tup/bazel/etc, you probably need wake. 7 | If you don't want to waste time rebuilding things that don't need it, 8 | or that your colleagues already built, you might appreciate wake. 9 | 10 | -- Wesley W. Terpstra Sat, 25 May 2019 04:48:16 +0000 11 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: wake 2 | Section: devel 3 | Priority: optional 4 | Maintainer: Wesley W. Terpstra 5 | Build-Depends: debhelper (>= 9), libfuse-dev (>= 2.8.0), libsqlite3-dev (>= 3.6.0), libgmp-dev (>= 4.3.0), libncurses5-dev (>= 5.7), pkg-config, git, libre2-dev (>= 20130101), dash, 6 | Standards-Version: 4.1.3 7 | Homepage: https://github.com/sifive/wake 8 | Vcs-Browser: https://github.com/sifive/wake 9 | Vcs-Git: https://github.com/sifive/wake.git 10 | 11 | Package: wake 12 | Architecture: any 13 | Depends: fuse, dash, iproute2, ${shlibs:Depends}, ${misc:Depends} 14 | Recommends: fuse3, libzstd, liblz4, liblzma, liblzo2, zlib1g 15 | Description: flexible build orchestration tool and language 16 | Wake is a build orchestration tool and language. 17 | If you have a build whose steps cannot be adequately expressed in 18 | make/tup/bazel/etc, you probably need wake. 19 | If you don't want to waste time rebuilding things that don't need it, 20 | or that your colleagues already built, you might appreciate wake. 21 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | %: 4 | dh $@ 5 | 6 | override_dh_auto_build-arch: 7 | make wake.db 8 | ./bin/wake build default 9 | 10 | override_dh_auto_install-arch: 11 | ./bin/wake install "debian/wake/usr" 12 | mkdir -p debian/wake/var/cache/wake 13 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /docs: -------------------------------------------------------------------------------- 1 | share/doc/wake/ -------------------------------------------------------------------------------- /extensions/vscode/.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "root": true, 3 | "parser": "@typescript-eslint/parser", 4 | "parserOptions": { 5 | "ecmaVersion": 6, 6 | "sourceType": "module" 7 | }, 8 | "plugins": [ 9 | "@typescript-eslint" 10 | ], 11 | "rules": { 12 | "@typescript-eslint/naming-convention": [ 13 | "warn", 14 | { 15 | "selector": "import", 16 | "format": [ "camelCase", "PascalCase" ] 17 | } 18 | ], 19 | "@typescript-eslint/semi": "warn", 20 | "curly": "warn", 21 | "eqeqeq": "warn", 22 | "no-throw-literal": "warn", 23 | "semi": "off" 24 | }, 25 | "ignorePatterns": [ 26 | "out", 27 | "dist", 28 | "**/*.d.ts" 29 | ] 30 | } -------------------------------------------------------------------------------- /extensions/vscode/.gitignore: -------------------------------------------------------------------------------- 1 | package.json 2 | .vscode/ 3 | .vscode-test-web/ 4 | node_modules/ 5 | out/ 6 | dist/ 7 | wake-*.vsix 8 | -------------------------------------------------------------------------------- /extensions/vscode/.vscode-test.mjs: -------------------------------------------------------------------------------- 1 | import { defineConfig } from '@vscode/test-cli'; 2 | 3 | export default defineConfig({ 4 | files: 'out/test/**/*.test.js', 5 | }); 6 | -------------------------------------------------------------------------------- /extensions/vscode/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "dbaeumer.vscode-eslint", 6 | "ms-vscode.extension-test-runner" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /extensions/vscode/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that compiles the extension and then opens it inside a new window 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | { 6 | "version": "0.2.0", 7 | "configurations": [ 8 | { 9 | "name": "Run Extension", 10 | "type": "extensionHost", 11 | "request": "launch", 12 | "args": [ 13 | "--extensionDevelopmentPath=${workspaceFolder}" 14 | ], 15 | "outFiles": [ 16 | "${workspaceFolder}/out/**/*.js" 17 | ], 18 | "preLaunchTask": "${defaultBuildTask}" 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /extensions/vscode/.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | // See https://go.microsoft.com/fwlink/?LinkId=733558 2 | // for the documentation about the tasks.json format 3 | { 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "type": "npm", 8 | "script": "watch", 9 | "problemMatcher": "$tsc-watch", 10 | "isBackground": true, 11 | "presentation": { 12 | "reveal": "never" 13 | }, 14 | "group": { 15 | "kind": "build", 16 | "isDefault": true 17 | } 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /extensions/vscode/.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | src/** 4 | .gitignore 5 | .yarnrc 6 | **/tsconfig.json 7 | **/.eslintrc.json 8 | **/*.map 9 | **/*.ts 10 | **/.vscode-test.* 11 | out/** 12 | node_modules/** 13 | vsce-stdin 14 | vscode.wake 15 | package.json.in 16 | esbuild.js 17 | -------------------------------------------------------------------------------- /extensions/vscode/images/sifive_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sifiveinc/wake/0b5e100b5580bc0503092294254e1f0b5e46e01b/extensions/vscode/images/sifive_icon.png -------------------------------------------------------------------------------- /extensions/vscode/language-configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "comments": { 3 | // symbol used for single line comment. Remove this entry if your language does not support line comments 4 | "lineComment": "#" 5 | }, 6 | // symbols used as brackets 7 | "brackets": [ 8 | ["{", "}"], 9 | ["[", "]"], 10 | ["(", ")"] 11 | ], 12 | // symbols that are auto closed when typing 13 | "autoClosingPairs": [ 14 | ["{", "}"], 15 | ["[", "]"], 16 | ["(", ")"], 17 | ["\"", "\""], 18 | ["'", "'"], 19 | ["`", "`"] 20 | ], 21 | // symbols that can be used to surround a selection 22 | "surroundingPairs": [ 23 | ["{", "}"], 24 | ["[", "]"], 25 | ["(", ")"], 26 | ["\"", "\""], 27 | ["'", "'"], 28 | ["`", "`"] 29 | ] 30 | } -------------------------------------------------------------------------------- /extensions/vscode/online_images/diagnostics.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sifiveinc/wake/0b5e100b5580bc0503092294254e1f0b5e46e01b/extensions/vscode/online_images/diagnostics.gif -------------------------------------------------------------------------------- /extensions/vscode/online_images/goto.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sifiveinc/wake/0b5e100b5580bc0503092294254e1f0b5e46e01b/extensions/vscode/online_images/goto.gif -------------------------------------------------------------------------------- /extensions/vscode/online_images/highlight.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sifiveinc/wake/0b5e100b5580bc0503092294254e1f0b5e46e01b/extensions/vscode/online_images/highlight.gif -------------------------------------------------------------------------------- /extensions/vscode/online_images/hover.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sifiveinc/wake/0b5e100b5580bc0503092294254e1f0b5e46e01b/extensions/vscode/online_images/hover.gif -------------------------------------------------------------------------------- /extensions/vscode/online_images/rename.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sifiveinc/wake/0b5e100b5580bc0503092294254e1f0b5e46e01b/extensions/vscode/online_images/rename.gif -------------------------------------------------------------------------------- /extensions/vscode/online_images/report_issue.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sifiveinc/wake/0b5e100b5580bc0503092294254e1f0b5e46e01b/extensions/vscode/online_images/report_issue.gif -------------------------------------------------------------------------------- /extensions/vscode/online_images/show_defs_doc.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sifiveinc/wake/0b5e100b5580bc0503092294254e1f0b5e46e01b/extensions/vscode/online_images/show_defs_doc.gif -------------------------------------------------------------------------------- /extensions/vscode/online_images/show_defs_folder.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sifiveinc/wake/0b5e100b5580bc0503092294254e1f0b5e46e01b/extensions/vscode/online_images/show_defs_folder.gif -------------------------------------------------------------------------------- /extensions/vscode/online_images/stdlib.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sifiveinc/wake/0b5e100b5580bc0503092294254e1f0b5e46e01b/extensions/vscode/online_images/stdlib.gif -------------------------------------------------------------------------------- /extensions/vscode/online_images/syntax_highlighting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sifiveinc/wake/0b5e100b5580bc0503092294254e1f0b5e46e01b/extensions/vscode/online_images/syntax_highlighting.png -------------------------------------------------------------------------------- /extensions/vscode/src/test/extension.test.ts: -------------------------------------------------------------------------------- 1 | import * as assert from 'assert'; 2 | 3 | // You can import and use all API from the 'vscode' module 4 | // as well as import your extension to test it 5 | import * as vscode from 'vscode'; 6 | // import * as myExtension from '../../extension'; 7 | 8 | suite('Extension Test Suite', () => { 9 | vscode.window.showInformationMessage('Start all tests.'); 10 | }); 11 | -------------------------------------------------------------------------------- /extensions/vscode/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "Node16", 4 | "target": "ES2022", 5 | "outDir": "out", 6 | "lib": [ 7 | "ES2022" 8 | ], 9 | "sourceMap": true, 10 | "rootDir": "src", 11 | "strict": true, /* enable all strict type-checking options */ 12 | /* Additional Checks */ 13 | "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ 14 | "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ 15 | "noUnusedParameters": true, /* Report errors on unused parameters. */ 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /extensions/vscode/vsce-stdin: -------------------------------------------------------------------------------- 1 | y 2 | -------------------------------------------------------------------------------- /lib/wake/stamp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sifiveinc/wake/0b5e100b5580bc0503092294254e1f0b5e46e01b/lib/wake/stamp -------------------------------------------------------------------------------- /rust/entity/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "entity" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [lib] 7 | name = "entity" 8 | path = "src/mod.rs" 9 | 10 | [dependencies] 11 | sea-orm = "0.12.6" 12 | -------------------------------------------------------------------------------- /rust/entity/src/api_key.rs: -------------------------------------------------------------------------------- 1 | //! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6 2 | 3 | use sea_orm::entity::prelude::*; 4 | 5 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] 6 | #[sea_orm(table_name = "api_key")] 7 | pub struct Model { 8 | #[sea_orm(primary_key, auto_increment = false)] 9 | pub id: Uuid, 10 | #[sea_orm(unique)] 11 | pub key: String, 12 | pub desc: String, 13 | pub created_at: DateTime, 14 | } 15 | 16 | #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] 17 | pub enum Relation {} 18 | 19 | impl ActiveModelBehavior for ActiveModel {} 20 | -------------------------------------------------------------------------------- /rust/entity/src/blob.rs: -------------------------------------------------------------------------------- 1 | //! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6 2 | 3 | use sea_orm::entity::prelude::*; 4 | 5 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] 6 | #[sea_orm(table_name = "blob")] 7 | pub struct Model { 8 | #[sea_orm(primary_key, auto_increment = false)] 9 | pub id: Uuid, 10 | pub key: String, 11 | pub store_id: Uuid, 12 | pub size: i64, 13 | pub created_at: DateTime, 14 | pub updated_at: DateTime, 15 | } 16 | 17 | #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] 18 | pub enum Relation { 19 | #[sea_orm( 20 | belongs_to = "super::blob_store::Entity", 21 | from = "Column::StoreId", 22 | to = "super::blob_store::Column::Id", 23 | on_update = "NoAction", 24 | on_delete = "Restrict" 25 | )] 26 | BlobStore, 27 | #[sea_orm(has_many = "super::output_file::Entity")] 28 | OutputFile, 29 | } 30 | 31 | impl Related for Entity { 32 | fn to() -> RelationDef { 33 | Relation::BlobStore.def() 34 | } 35 | } 36 | 37 | impl Related for Entity { 38 | fn to() -> RelationDef { 39 | Relation::OutputFile.def() 40 | } 41 | } 42 | 43 | impl ActiveModelBehavior for ActiveModel {} 44 | -------------------------------------------------------------------------------- /rust/entity/src/blob_store.rs: -------------------------------------------------------------------------------- 1 | //! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6 2 | 3 | use sea_orm::entity::prelude::*; 4 | 5 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] 6 | #[sea_orm(table_name = "blob_store")] 7 | pub struct Model { 8 | #[sea_orm(primary_key, auto_increment = false)] 9 | pub id: Uuid, 10 | pub r#type: String, 11 | } 12 | 13 | #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] 14 | pub enum Relation { 15 | #[sea_orm(has_many = "super::blob::Entity")] 16 | Blob, 17 | #[sea_orm(has_many = "super::local_blob_store::Entity")] 18 | LocalBlobStore, 19 | } 20 | 21 | impl Related for Entity { 22 | fn to() -> RelationDef { 23 | Relation::Blob.def() 24 | } 25 | } 26 | 27 | impl Related for Entity { 28 | fn to() -> RelationDef { 29 | Relation::LocalBlobStore.def() 30 | } 31 | } 32 | 33 | impl ActiveModelBehavior for ActiveModel {} 34 | -------------------------------------------------------------------------------- /rust/entity/src/job_audit.rs: -------------------------------------------------------------------------------- 1 | //! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6 2 | 3 | use sea_orm::entity::prelude::*; 4 | 5 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] 6 | #[sea_orm(table_name = "job_audit")] 7 | pub struct Model { 8 | #[sea_orm(primary_key)] 9 | pub id: i32, 10 | pub hash: String, 11 | pub event: String, 12 | pub created_at: DateTime, 13 | } 14 | 15 | #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] 16 | pub enum Relation {} 17 | 18 | impl ActiveModelBehavior for ActiveModel {} 19 | -------------------------------------------------------------------------------- /rust/entity/src/job_history.rs: -------------------------------------------------------------------------------- 1 | //! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6 2 | 3 | use sea_orm::entity::prelude::*; 4 | 5 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] 6 | #[sea_orm(table_name = "job_history")] 7 | pub struct Model { 8 | #[sea_orm(primary_key, auto_increment = false)] 9 | pub hash: String, 10 | pub hits: i32, 11 | pub misses: i32, 12 | pub evictions: i32, 13 | pub created_at: DateTime, 14 | pub updated_at: DateTime, 15 | } 16 | 17 | #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] 18 | pub enum Relation {} 19 | 20 | impl ActiveModelBehavior for ActiveModel {} 21 | -------------------------------------------------------------------------------- /rust/entity/src/job_use.rs: -------------------------------------------------------------------------------- 1 | //! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6 2 | 3 | use sea_orm::entity::prelude::*; 4 | 5 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] 6 | #[sea_orm(table_name = "job_use")] 7 | pub struct Model { 8 | #[sea_orm(primary_key, auto_increment = false)] 9 | pub id: Uuid, 10 | pub job_id: Uuid, 11 | pub created_at: DateTime, 12 | } 13 | 14 | #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] 15 | pub enum Relation { 16 | #[sea_orm( 17 | belongs_to = "super::job::Entity", 18 | from = "Column::JobId", 19 | to = "super::job::Column::Id", 20 | on_update = "NoAction", 21 | on_delete = "Cascade" 22 | )] 23 | Job, 24 | } 25 | 26 | impl Related for Entity { 27 | fn to() -> RelationDef { 28 | Relation::Job.def() 29 | } 30 | } 31 | 32 | impl ActiveModelBehavior for ActiveModel {} 33 | -------------------------------------------------------------------------------- /rust/entity/src/job_uses.rs: -------------------------------------------------------------------------------- 1 | //! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6 2 | 3 | use sea_orm::entity::prelude::*; 4 | 5 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] 6 | #[sea_orm(table_name = "job_uses")] 7 | pub struct Model { 8 | #[sea_orm(primary_key)] 9 | pub id: i32, 10 | pub job_id: i32, 11 | pub created_at: DateTime, 12 | } 13 | 14 | #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] 15 | pub enum Relation { 16 | #[sea_orm( 17 | belongs_to = "super::job::Entity", 18 | from = "Column::JobId", 19 | to = "super::job::Column::Id", 20 | on_update = "NoAction", 21 | on_delete = "Cascade" 22 | )] 23 | Job, 24 | } 25 | 26 | impl Related for Entity { 27 | fn to() -> RelationDef { 28 | Relation::Job.def() 29 | } 30 | } 31 | 32 | impl ActiveModelBehavior for ActiveModel {} 33 | -------------------------------------------------------------------------------- /rust/entity/src/local_blob_store.rs: -------------------------------------------------------------------------------- 1 | //! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6 2 | 3 | use sea_orm::entity::prelude::*; 4 | 5 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] 6 | #[sea_orm(table_name = "local_blob_store")] 7 | pub struct Model { 8 | #[sea_orm(primary_key, auto_increment = false)] 9 | pub id: Uuid, 10 | pub root: String, 11 | pub created_at: DateTime, 12 | } 13 | 14 | #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] 15 | pub enum Relation { 16 | #[sea_orm( 17 | belongs_to = "super::blob_store::Entity", 18 | from = "Column::Id", 19 | to = "super::blob_store::Column::Id", 20 | on_update = "NoAction", 21 | on_delete = "Restrict" 22 | )] 23 | BlobStore, 24 | } 25 | 26 | impl Related for Entity { 27 | fn to() -> RelationDef { 28 | Relation::BlobStore.def() 29 | } 30 | } 31 | 32 | impl ActiveModelBehavior for ActiveModel {} 33 | -------------------------------------------------------------------------------- /rust/entity/src/mod.rs: -------------------------------------------------------------------------------- 1 | //! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6 2 | 3 | pub mod prelude; 4 | 5 | pub mod api_key; 6 | pub mod blob; 7 | pub mod blob_store; 8 | pub mod job; 9 | pub mod job_audit; 10 | pub mod job_history; 11 | pub mod job_use; 12 | pub mod local_blob_store; 13 | pub mod output_dir; 14 | pub mod output_file; 15 | pub mod output_symlink; 16 | -------------------------------------------------------------------------------- /rust/entity/src/output_dir.rs: -------------------------------------------------------------------------------- 1 | //! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6 2 | 3 | use sea_orm::entity::prelude::*; 4 | 5 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] 6 | #[sea_orm(table_name = "output_dir")] 7 | pub struct Model { 8 | #[sea_orm(primary_key, auto_increment = false)] 9 | pub id: Uuid, 10 | pub path: String, 11 | pub mode: i32, 12 | pub job_id: Uuid, 13 | pub created_at: DateTime, 14 | pub hidden: bool, 15 | } 16 | 17 | #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] 18 | pub enum Relation { 19 | #[sea_orm( 20 | belongs_to = "super::job::Entity", 21 | from = "Column::JobId", 22 | to = "super::job::Column::Id", 23 | on_update = "NoAction", 24 | on_delete = "Cascade" 25 | )] 26 | Job, 27 | } 28 | 29 | impl Related for Entity { 30 | fn to() -> RelationDef { 31 | Relation::Job.def() 32 | } 33 | } 34 | 35 | impl ActiveModelBehavior for ActiveModel {} 36 | -------------------------------------------------------------------------------- /rust/entity/src/output_file.rs: -------------------------------------------------------------------------------- 1 | //! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6 2 | 3 | use sea_orm::entity::prelude::*; 4 | 5 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] 6 | #[sea_orm(table_name = "output_file")] 7 | pub struct Model { 8 | #[sea_orm(primary_key, auto_increment = false)] 9 | pub id: Uuid, 10 | pub path: String, 11 | pub mode: i32, 12 | pub job_id: Uuid, 13 | pub blob_id: Uuid, 14 | pub created_at: DateTime, 15 | } 16 | 17 | #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] 18 | pub enum Relation { 19 | #[sea_orm( 20 | belongs_to = "super::blob::Entity", 21 | from = "Column::BlobId", 22 | to = "super::blob::Column::Id", 23 | on_update = "NoAction", 24 | on_delete = "Restrict" 25 | )] 26 | Blob, 27 | #[sea_orm( 28 | belongs_to = "super::job::Entity", 29 | from = "Column::JobId", 30 | to = "super::job::Column::Id", 31 | on_update = "NoAction", 32 | on_delete = "Cascade" 33 | )] 34 | Job, 35 | } 36 | 37 | impl Related for Entity { 38 | fn to() -> RelationDef { 39 | Relation::Blob.def() 40 | } 41 | } 42 | 43 | impl Related for Entity { 44 | fn to() -> RelationDef { 45 | Relation::Job.def() 46 | } 47 | } 48 | 49 | impl ActiveModelBehavior for ActiveModel {} 50 | -------------------------------------------------------------------------------- /rust/entity/src/output_symlink.rs: -------------------------------------------------------------------------------- 1 | //! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6 2 | 3 | use sea_orm::entity::prelude::*; 4 | 5 | #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] 6 | #[sea_orm(table_name = "output_symlink")] 7 | pub struct Model { 8 | #[sea_orm(primary_key, auto_increment = false)] 9 | pub id: Uuid, 10 | pub path: String, 11 | pub link: String, 12 | pub job_id: Uuid, 13 | pub created_at: DateTime, 14 | } 15 | 16 | #[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] 17 | pub enum Relation { 18 | #[sea_orm( 19 | belongs_to = "super::job::Entity", 20 | from = "Column::JobId", 21 | to = "super::job::Column::Id", 22 | on_update = "NoAction", 23 | on_delete = "Cascade" 24 | )] 25 | Job, 26 | } 27 | 28 | impl Related for Entity { 29 | fn to() -> RelationDef { 30 | Relation::Job.def() 31 | } 32 | } 33 | 34 | impl ActiveModelBehavior for ActiveModel {} 35 | -------------------------------------------------------------------------------- /rust/entity/src/prelude.rs: -------------------------------------------------------------------------------- 1 | //! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.6 2 | 3 | pub use super::api_key::Entity as ApiKey; 4 | pub use super::blob::Entity as Blob; 5 | pub use super::blob_store::Entity as BlobStore; 6 | pub use super::job::Entity as Job; 7 | pub use super::job_audit::Entity as JobAudit; 8 | pub use super::job_history::Entity as JobHistory; 9 | pub use super::job_use::Entity as JobUse; 10 | pub use super::local_blob_store::Entity as LocalBlobStore; 11 | pub use super::output_dir::Entity as OutputDir; 12 | pub use super::output_file::Entity as OutputFile; 13 | pub use super::output_symlink::Entity as OutputSymlink; 14 | -------------------------------------------------------------------------------- /rust/log_viewer/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "log_viewer" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | chrono = { version = "0.4.26", features = ["serde"] } 10 | clap = { version = "4.3.23", features = ["derive"] } 11 | crossterm = "0.26.1" 12 | miette = { version = "5.10.0", features = ["fancy"] } 13 | palette = "0.7.2" 14 | serde = { version = "1.0.171", features = ["std", "derive"] } 15 | serde-aux = "4.2.0" 16 | serde_json = "1.0.100" 17 | -------------------------------------------------------------------------------- /rust/log_viewer/build.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2023 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | from rust import _ 20 | 21 | def buildWakeLogViewer Unit = 22 | makeCargoExecutable "log_viewer" "rust/log_viewer" 23 | |> cargoBuildWith (defaultCargoToolchain Unit) 24 | -------------------------------------------------------------------------------- /rust/migration/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "migration" 3 | version = "0.1.0" 4 | edition = "2021" 5 | publish = false 6 | 7 | [lib] 8 | name = "migration" 9 | path = "src/lib.rs" 10 | 11 | [dependencies] 12 | async-std = { version = "1", features = ["attributes", "tokio1"] } 13 | 14 | [dependencies.sea-orm-migration] 15 | version = "0.12.6" 16 | features = [ 17 | # Enable at least one `ASYNC_RUNTIME` and `DATABASE_DRIVER` feature if you want to run migration via CLI. 18 | # View the list of supported features at https://www.sea-ql.org/SeaORM/docs/install-and-config/database-and-async-runtime. 19 | # e.g. 20 | "runtime-tokio-native-tls", # ASYNC_RUNTIME feature 21 | 22 | "sqlx-postgres", # `Postgres DATABASE_DRIVER feature 23 | "sqlx-sqlite" # SQLite3 DATABASE_DRIVER feature 24 | ] 25 | -------------------------------------------------------------------------------- /rust/migration/README.md: -------------------------------------------------------------------------------- 1 | # Running Migrator CLI 2 | 3 | - Generate a new migration file 4 | ```sh 5 | cargo run -- migrate generate MIGRATION_NAME 6 | ``` 7 | - Apply all pending migrations 8 | ```sh 9 | cargo run 10 | ``` 11 | ```sh 12 | cargo run -- up 13 | ``` 14 | - Apply first 10 pending migrations 15 | ```sh 16 | cargo run -- up -n 10 17 | ``` 18 | - Rollback last applied migrations 19 | ```sh 20 | cargo run -- down 21 | ``` 22 | - Rollback last 10 applied migrations 23 | ```sh 24 | cargo run -- down -n 10 25 | ``` 26 | - Drop all tables from the database, then reapply all migrations 27 | ```sh 28 | cargo run -- fresh 29 | ``` 30 | - Rollback all applied migrations, then reapply all migrations 31 | ```sh 32 | cargo run -- refresh 33 | ``` 34 | - Rollback all applied migrations 35 | ```sh 36 | cargo run -- reset 37 | ``` 38 | - Check the status of all migrations 39 | ```sh 40 | cargo run -- status 41 | ``` 42 | -------------------------------------------------------------------------------- /rust/migration/src/m20230706_104843_api_keys.rs: -------------------------------------------------------------------------------- 1 | use sea_orm_migration::prelude::*; 2 | 3 | #[derive(DeriveMigrationName)] 4 | pub struct Migration; 5 | 6 | #[async_trait::async_trait] 7 | impl MigrationTrait for Migration { 8 | async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { 9 | manager 10 | .create_table( 11 | Table::create() 12 | .table(ApiKey::Table) 13 | .col( 14 | ColumnDef::new(ApiKey::Id) 15 | .uuid() 16 | .not_null() 17 | .primary_key() 18 | .default(SimpleExpr::FunctionCall(PgFunc::gen_random_uuid())), 19 | ) 20 | .col(ColumnDef::new(ApiKey::Key).string().not_null().unique_key()) 21 | .col(ColumnDef::new(ApiKey::Desc).string().not_null()) 22 | .to_owned(), 23 | ) 24 | .await 25 | } 26 | 27 | async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { 28 | manager 29 | .drop_table(Table::drop().table(ApiKey::Table).to_owned()) 30 | .await 31 | } 32 | } 33 | 34 | /// Learn more at https://docs.rs/sea-query#iden 35 | #[derive(DeriveIden)] 36 | enum ApiKey { 37 | Table, 38 | Id, 39 | Key, 40 | Desc, 41 | } 42 | -------------------------------------------------------------------------------- /rust/migration/src/m20231127_232833_drop_use_time.rs: -------------------------------------------------------------------------------- 1 | use sea_orm_migration::prelude::*; 2 | 3 | #[derive(DeriveMigrationName)] 4 | pub struct Migration; 5 | 6 | #[async_trait::async_trait] 7 | impl MigrationTrait for Migration { 8 | async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { 9 | manager 10 | .alter_table( 11 | Table::alter() 12 | .table(JobUses::Table) 13 | .drop_column(JobUses::Time) 14 | .to_owned(), 15 | ) 16 | .await 17 | } 18 | 19 | async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { 20 | manager 21 | .alter_table( 22 | Table::alter() 23 | .table(JobUses::Table) 24 | .add_column( 25 | ColumnDef::new(JobUses::Time) 26 | .timestamp() 27 | .not_null() 28 | .default(SimpleExpr::Keyword(Keyword::CurrentTimestamp)), 29 | ) 30 | .to_owned(), 31 | ) 32 | .await 33 | } 34 | } 35 | 36 | #[derive(DeriveIden)] 37 | enum JobUses { 38 | Table, 39 | Time, 40 | } 41 | -------------------------------------------------------------------------------- /rust/migration/src/m20231128_000751_normalize_uses_table.rs: -------------------------------------------------------------------------------- 1 | use sea_orm_migration::prelude::*; 2 | 3 | #[derive(DeriveMigrationName)] 4 | pub struct Migration; 5 | 6 | #[async_trait::async_trait] 7 | impl MigrationTrait for Migration { 8 | async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { 9 | manager 10 | .rename_table( 11 | Table::rename() 12 | .table(JobUses::Table, JobUse::Table) 13 | .to_owned(), 14 | ) 15 | .await 16 | } 17 | 18 | async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { 19 | manager 20 | .rename_table( 21 | Table::rename() 22 | .table(JobUse::Table, JobUses::Table) 23 | .to_owned(), 24 | ) 25 | .await 26 | } 27 | } 28 | 29 | #[derive(DeriveIden)] 30 | enum JobUses { 31 | Table, 32 | } 33 | 34 | #[derive(DeriveIden)] 35 | enum JobUse { 36 | Table, 37 | } 38 | -------------------------------------------------------------------------------- /rust/migration/src/m20240509_163905_add_label_to_job.rs: -------------------------------------------------------------------------------- 1 | use sea_orm_migration::prelude::*; 2 | 3 | #[derive(DeriveMigrationName)] 4 | pub struct Migration; 5 | 6 | #[async_trait::async_trait] 7 | impl MigrationTrait for Migration { 8 | async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { 9 | manager 10 | .alter_table( 11 | Table::alter() 12 | .table(Job::Table) 13 | .add_column(ColumnDef::new(Job::Label).string().not_null().default("")) 14 | .to_owned(), 15 | ) 16 | .await 17 | } 18 | 19 | async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { 20 | manager 21 | .alter_table( 22 | Table::alter() 23 | .table(Job::Table) 24 | .drop_column(Job::Label) 25 | .to_owned(), 26 | ) 27 | .await 28 | } 29 | } 30 | 31 | #[derive(DeriveIden)] 32 | pub enum Job { 33 | Table, 34 | Label, 35 | } 36 | -------------------------------------------------------------------------------- /rust/migration/src/m20240517_195757_add_updated_at_to_blob.rs: -------------------------------------------------------------------------------- 1 | use sea_orm_migration::prelude::*; 2 | 3 | #[derive(DeriveMigrationName)] 4 | pub struct Migration; 5 | 6 | #[async_trait::async_trait] 7 | impl MigrationTrait for Migration { 8 | async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { 9 | manager 10 | .alter_table( 11 | Table::alter() 12 | .table(Blob::Table) 13 | .add_column( 14 | ColumnDef::new(Blob::UpdatedAt) 15 | .timestamp() 16 | .not_null() 17 | .default(SimpleExpr::Keyword(Keyword::CurrentTimestamp)), 18 | ) 19 | .to_owned(), 20 | ) 21 | .await 22 | } 23 | 24 | async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { 25 | manager 26 | .alter_table( 27 | Table::alter() 28 | .table(Blob::Table) 29 | .drop_column(Blob::UpdatedAt) 30 | .to_owned(), 31 | ) 32 | .await 33 | } 34 | } 35 | 36 | #[derive(DeriveIden)] 37 | enum Blob { 38 | Table, 39 | UpdatedAt, 40 | } 41 | -------------------------------------------------------------------------------- /rust/migration/src/m20240919_214610_add_hidden_to_output_dir.rs: -------------------------------------------------------------------------------- 1 | use sea_orm_migration::prelude::*; 2 | 3 | #[derive(DeriveMigrationName)] 4 | pub struct Migration; 5 | 6 | #[async_trait::async_trait] 7 | impl MigrationTrait for Migration { 8 | async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { 9 | manager 10 | .alter_table( 11 | Table::alter() 12 | .table(OutputDir::Table) 13 | .add_column(ColumnDef::new(OutputDir::Hidden).boolean().not_null().default(false)) 14 | .to_owned(), 15 | ) 16 | .await 17 | } 18 | 19 | async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { 20 | manager 21 | .alter_table( 22 | Table::alter() 23 | .table(OutputDir::Table) 24 | .drop_column(OutputDir::Hidden) 25 | .to_owned(), 26 | ) 27 | .await 28 | } 29 | } 30 | 31 | #[derive(DeriveIden)] 32 | enum OutputDir { 33 | Table, 34 | Hidden, 35 | } 36 | 37 | -------------------------------------------------------------------------------- /rust/migration/src/main.rs: -------------------------------------------------------------------------------- 1 | use sea_orm_migration::prelude::*; 2 | 3 | #[async_std::main] 4 | async fn main() { 5 | cli::run_cli(migration::Migrator).await; 6 | } 7 | -------------------------------------------------------------------------------- /rust/rsc/.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "database_url": "postgres://localhost:5433/test", 3 | "server_address": "0.0.0.0:3002", 4 | "connection_pool_max_connect": 90, 5 | "connection_pool_timeout": 60, 6 | "standalone": false, 7 | "active_store": "ac9b4685-f36e-4726-9073-c992597ec134", 8 | "log_directory": null, 9 | "blob_eviction": { 10 | "tick_rate": 60, 11 | "ttl": 3600, 12 | "chunk_size": 16000, 13 | "file_chunk_size": 100 14 | }, 15 | "job_eviction": { 16 | "ttl": { 17 | "tick_rate": 600, 18 | "ttl": 86400, 19 | "chunk_size": 16000 20 | } 21 | }, 22 | "job_size_calculate": { 23 | "tick_rate": 60, 24 | "chunk_size": 100 25 | }, 26 | "load_shed": { 27 | "tick_rate": 30, 28 | "target": 80.0, 29 | "min_runtime": 0.5 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /rust/rsc/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rsc" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | entity = { path = "../entity" } 8 | migration = { path = "../migration" } 9 | sea-orm = { version = "0.12.15", features = ["sqlx-postgres", "runtime-tokio-native-tls"]} 10 | serde = "1.0.164" 11 | futures = "0.3.29" 12 | tokio = { version = "1.28.2", features = ["full"] } 13 | tokio-util = { version = "0.7.1", features = ["io"] } 14 | tracing = "0.1" 15 | tracing-subscriber = "0.3" 16 | axum = { version = "0.6.18", features = ["multipart"] } 17 | tower = "0.4.12" 18 | hyper = "0.14.27" 19 | serde_bytes = "0.11.9" 20 | blake3 = "1.4.0" 21 | data-encoding = "2.4.0" 22 | rand = "0.8.5" 23 | inquire = { version = "0.6.2", features = [] } 24 | atty = "0.2.14" 25 | papergrid = "0.9.1" 26 | textwrap = "0.16.0" 27 | chrono = "0.4.26" 28 | config = "0.13.3" 29 | serde_json = "1.0.100" 30 | clap = { version = "4.3.23", features = ["derive"] } 31 | is-terminal = "0.4.9" 32 | async-trait = "0.1.74" 33 | itertools = "0.12.1" 34 | mime = "0.3.17" 35 | rlimit = "0.10.1" 36 | tracing-appender = "0.2.3" 37 | sysinfo = "0.31.2" 38 | -------------------------------------------------------------------------------- /rust/rsc/src/bin/rsc/api_key_check.rs: -------------------------------------------------------------------------------- 1 | use axum::{ 2 | http::{header::AUTHORIZATION, Request, StatusCode}, 3 | middleware::Next, 4 | response::{IntoResponse, Response}, 5 | }; 6 | use entity::api_key; 7 | use sea_orm::{ColumnTrait, DatabaseConnection, EntityTrait, QueryFilter}; 8 | use std::sync::Arc; 9 | 10 | fn unauth() -> Response { 11 | StatusCode::UNAUTHORIZED.into_response() 12 | } 13 | 14 | // NOTE: This is not secure, its just to prevent otherwise trusted 15 | // users from polluting the cache. 16 | pub async fn api_key_check_middleware( 17 | request: Request, 18 | next: Next, 19 | conn: Arc, 20 | ) -> Response { 21 | let headers = request.headers(); 22 | 23 | // First get the key, if the user doesn't provide 24 | // a key give up on them. 25 | let Some(key) = headers.get(AUTHORIZATION) else { 26 | return unauth(); 27 | }; 28 | 29 | // Convert the key to unicode if possible 30 | let Ok(key) = key.to_str() else { 31 | return unauth(); 32 | }; 33 | 34 | // Next check the database for a key 35 | let Ok(Some(_)) = api_key::Entity::find() 36 | .filter(api_key::Column::Key.eq(key)) 37 | .one(conn.as_ref()) 38 | .await 39 | else { 40 | return unauth(); 41 | }; 42 | 43 | // Ok they're all good, run their request 44 | next.run(request).await 45 | } 46 | -------------------------------------------------------------------------------- /rust/rsc/src/bin/rsc_tool/config.rs: -------------------------------------------------------------------------------- 1 | use config::{Config, ConfigError, Environment, File}; 2 | use serde::{Deserialize, Serialize}; 3 | 4 | #[derive(Debug, Deserialize, Default)] 5 | pub struct RSCToolConfigOverride { 6 | pub database_url: Option, 7 | } 8 | 9 | #[derive(Debug, Deserialize, Serialize)] 10 | pub struct RSCToolConfig { 11 | pub database_url: String, 12 | } 13 | 14 | impl RSCToolConfig { 15 | pub fn new(overrides: RSCToolConfigOverride) -> Result { 16 | // Gather the config 17 | let config = Config::builder() 18 | .add_source(Environment::with_prefix("WAKE_RSC_CONFIG")) 19 | .add_source(File::with_name(".config").required(false)) 20 | .set_override_option("database_url", overrides.database_url)? 21 | .build()?; 22 | 23 | config.try_deserialize() 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /rust/rsc/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod database; 2 | -------------------------------------------------------------------------------- /scripts/compile_commands: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | rm .compile_commands/*.json 4 | EMIT_COMPILE_COMMANDS=1 make 5 | python3 ./scripts/compile_commands.py 6 | -------------------------------------------------------------------------------- /scripts/compile_commands.py: -------------------------------------------------------------------------------- 1 | # Copyright 2022 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | from os import listdir 17 | from os.path import isfile, join 18 | import json 19 | 20 | out = [] 21 | cmd_dir = ".compile_commands" 22 | for compile_command_path in [f for f in listdir(cmd_dir) if isfile(join(cmd_dir, f))]: 23 | with open(join(cmd_dir, compile_command_path)) as compile_command_file: 24 | cmd_json = json.load(compile_command_file) 25 | out.append(cmd_json) 26 | 27 | with open("compile_commands.json", "w") as compile_cmd_json: 28 | json.dump(out, compile_cmd_json, indent=2) 29 | -------------------------------------------------------------------------------- /scripts/sphinx/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | -------------------------------------------------------------------------------- /scripts/sphinx/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SPHINXPROJ = wake-manual 9 | SOURCEDIR = source 10 | BUILDDIR = build 11 | 12 | # Put it first so that "make" without argument is like "make help". 13 | help: 14 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 15 | 16 | .PHONY: help Makefile 17 | 18 | # Catch-all target: route all unknown targets to Sphinx using the new 19 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 20 | %: Makefile 21 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 22 | -------------------------------------------------------------------------------- /scripts/sphinx/source/.gitignore: -------------------------------------------------------------------------------- 1 | core 2 | system 3 | lib.rst 4 | -------------------------------------------------------------------------------- /scripts/sphinx/source/_static/stamp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sifiveinc/wake/0b5e100b5580bc0503092294254e1f0b5e46e01b/scripts/sphinx/source/_static/stamp -------------------------------------------------------------------------------- /scripts/sphinx/source/contents.rst: -------------------------------------------------------------------------------- 1 | .. Wake documentation master file, created by 2 | sphinx-quickstart on Tue Jun 11 09:45:33 2019. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to Wake's documentation! 7 | ================================ 8 | 9 | .. toctree:: 10 | :maxdepth: 2 11 | :caption: Contents: 12 | 13 | lib.rst 14 | 15 | Indices and tables 16 | ================== 17 | 18 | * :ref:`genindex` 19 | * :ref:`modindex` 20 | * :ref:`search` 21 | -------------------------------------------------------------------------------- /scripts/wake/.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | -------------------------------------------------------------------------------- /scripts/wake/__init__.py: -------------------------------------------------------------------------------- 1 | __import__('pkg_resources').declare_namespace(__name__) 2 | -------------------------------------------------------------------------------- /scripts/which_clang_files: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | HERE="$( dirname -- "${0}"; )" 4 | WAKE_ROOT="${HERE}/../" 5 | 6 | if [[ ${1} == "all" ]]; then 7 | SOURCE_FILES=$(find ${WAKE_ROOT} -type f \( -name "*.h" -o -name "*.cpp" -o -name "*.c" \) | grep -v 'vendor/' | grep -v "lexer.cpp" | grep -v "parser\." | grep -v "version.h") 8 | 9 | echo $SOURCE_FILES 10 | 11 | # Flag if any files were found 12 | if [ "$SOURCE_FILES" ]; then 13 | exit 0 14 | fi 15 | exit 1 16 | fi 17 | 18 | if [[ ${1} == "changed" ]]; then 19 | CHANGED_FILES=$(git --git-dir ${WAKE_ROOT}.git diff --name-only | grep '\.h\|\.cpp\|\.c' | grep -v 'vendor/') 20 | STAGED_FILES=$(git --git-dir ${WAKE_ROOT}.git diff --name-only --cached | grep '\.h\|\.cpp\|\.c' | grep -v 'vendor/') 21 | MERGED="${CHANGED_FILES} ${STAGED_FILES}" 22 | 23 | echo ${MERGED} 24 | 25 | # Flag if any files were found 26 | if [ "${MERGED}" ]; then 27 | exit 0 28 | fi 29 | exit 1 30 | fi 31 | 32 | echo "unknown parameter: '${1}'" 33 | exit 1 34 | -------------------------------------------------------------------------------- /scripts/which_wake_files: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | HERE="$( dirname -- "${0}"; )" 4 | WAKE_ROOT="${HERE}/../" 5 | 6 | if [[ ${1} == "all" ]]; then 7 | SOURCE_FILES=$(find ${WAKE_ROOT} -type f \( -name "*.wake" \) | grep -v "tests/" | grep -v "manifest.wake") 8 | 9 | echo $SOURCE_FILES 10 | 11 | # Flag if any files were found 12 | if [ "$SOURCE_FILES" ]; then 13 | exit 0 14 | fi 15 | exit 1 16 | fi 17 | 18 | if [[ ${1} == "changed" ]]; then 19 | CHANGED_FILES=$(git --git-dir ${WAKE_ROOT}.git diff --name-only | grep '\.wake$' | grep -v 'tests/' | grep -v "manifest.wake") 20 | STAGED_FILES=$(git --git-dir ${WAKE_ROOT}.git diff --name-only --cached | grep '\.wake$' | grep -v 'tests/' | grep -v "manifest.wake") 21 | MERGED="${CHANGED_FILES} ${STAGED_FILES}" 22 | 23 | echo ${MERGED} 24 | 25 | # Flag if any files were found 26 | if [ "${MERGED}" ]; then 27 | exit 0 28 | fi 29 | exit 1 30 | fi 31 | 32 | echo "unknown parameter: '${1}'" 33 | exit 1 34 | -------------------------------------------------------------------------------- /share/doc/wake/syntax/vim/ftdetect/wake.vim: -------------------------------------------------------------------------------- 1 | au BufRead,BufNewFile *.wake set filetype=wake 2 | -------------------------------------------------------------------------------- /share/wake/lib/.wakeroot: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /share/wake/lib/nothing/nothing.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2019 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package nothing 17 | 18 | from wake import _ 19 | -------------------------------------------------------------------------------- /src/compat/aligned_alloc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #define _DEFAULT_SOURCE 19 | #define _ISOC11_SOURCE 20 | 21 | #include "aligned_alloc.h" 22 | 23 | #include 24 | 25 | void *my_aligned_alloc(size_t alignment, size_t size) { 26 | return aligned_alloc(alignment, size); // This is a C11 feature 27 | } 28 | -------------------------------------------------------------------------------- /src/compat/aligned_alloc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef ALIGNED_ALLOC_H 19 | #define ALIGNED_ALLOC_H 20 | 21 | #include 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | extern void *my_aligned_alloc(size_t alignment, size_t size); 28 | 29 | #ifdef __cplusplus 30 | }; 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/compat/compat.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2019 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | 20 | target compat variant = 21 | src @here variant Nil Nil Nil 22 | -------------------------------------------------------------------------------- /src/compat/mtime.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | // Open Group Base Specifications Issue 7 19 | #define _XOPEN_SOURCE 700 20 | #define _POSIX_C_SOURCE 200809L 21 | 22 | // OS/X only makes st_mtimespec available as an extension 23 | #define _DARWIN_C_SOURCE 1 24 | 25 | #include "mtime.h" 26 | 27 | #include 28 | 29 | #ifdef __APPLE__ 30 | #define st_mtim st_mtimespec 31 | #endif 32 | 33 | int64_t getmtime_ns(const char *file) { 34 | struct stat sbuf; 35 | int ret = lstat(file, &sbuf); 36 | if (ret == -1) return -1; 37 | return sbuf.st_mtim.tv_nsec * INT64_C(1000000000) + sbuf.st_mtim.tv_sec; 38 | } 39 | -------------------------------------------------------------------------------- /src/compat/mtime.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef MTIME_H 19 | #define MTIME_H 20 | 21 | #include 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | // Return the modification timestamp in nanoseconds since 1970. 28 | // On error, returns -1 and sets errno. 29 | extern int64_t getmtime_ns(const char *file); 30 | 31 | #ifdef __cplusplus 32 | }; 33 | #endif 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /src/compat/nofollow.h: -------------------------------------------------------------------------------- 1 | /* Add OS/X definitions missing from Open Group Base Specifications Issue 7 2 | * 3 | * Copyright 2019 SiFive, Inc. 4 | * Copyright 2001-2007 Miklos Szeredi 5 | * Copyright 2011 Sebastian Pipping 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You should have received a copy of LICENSE.Apache2 along with 10 | * this software. If not, you may obtain a copy at 11 | * 12 | * https://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software 15 | * distributed under the License is distributed on an "AS IS" BASIS, 16 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 17 | * See the License for the specific language governing permissions and 18 | * limitations under the License. 19 | */ 20 | 21 | #if !defined(O_NOFOLLOW) && defined(__APPLE__) 22 | #define O_NOFOLLOW 0x0100 23 | #endif 24 | 25 | #if !defined(O_DIRECTORY) && defined(__APPLE__) 26 | #define O_DIRECTORY 0x100000 27 | #endif 28 | -------------------------------------------------------------------------------- /src/compat/physmem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef PHYSMEM_H 19 | #define PHYSMEM_H 20 | 21 | #include 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | uint64_t get_physical_memory(); 28 | 29 | #ifdef __cplusplus 30 | }; 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/compat/readable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef READABLE_H 19 | #define READABLE_H 20 | 21 | #include 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | // Return if the file is not readable (1) or not (0). 28 | int is_readable(const char *filename); 29 | 30 | #ifdef __cplusplus 31 | }; 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/compat/sigwinch.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | // SIGWINCH is an extension 19 | // #define _XOPEN_SOURCE 700 20 | // #define _POSIX_C_SOURCE 200809L 21 | 22 | #include "sigwinch.h" 23 | 24 | #include 25 | 26 | int wake_SIGWINCH = SIGWINCH; 27 | -------------------------------------------------------------------------------- /src/compat/sigwinch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef SIGWINCH_H 19 | #define SIGWINCH_H 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | // SIGWINCH is sadly not defined in any standard as yet. 26 | extern int wake_SIGWINCH; 27 | 28 | #ifdef __cplusplus 29 | }; 30 | #endif 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/compat/spawn.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | // vfork is a deprecated API in POSIX, but is defined in BSD 19 | #define _BSD_SOURCE 20 | #define _DEFAULT_SOURCE 21 | 22 | #include "spawn.h" 23 | 24 | #include 25 | #include 26 | 27 | pid_t wake_spawn(const char *cmd, char **cmdline, char **environ) { 28 | pid_t pid = vfork(); 29 | if (pid == 0) { 30 | execve(cmdline[0], cmdline, environ); 31 | _exit(127); 32 | } 33 | return pid; 34 | } 35 | -------------------------------------------------------------------------------- /src/compat/spawn.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef SPAWN_H 19 | #define SPAWN_H 20 | 21 | #include 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | pid_t wake_spawn(const char *cmd, char **cmdline, char **environ); 28 | 29 | #ifdef __cplusplus 30 | }; 31 | #endif 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/compat/utimens.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | // Open Group Base Specifications Issue 7 19 | #define _XOPEN_SOURCE 700 20 | #define _POSIX_C_SOURCE 200809L 21 | 22 | // OS/X only makes utimensat available as an extension 23 | #define _DARWIN_C_SOURCE 1 24 | 25 | #include "utimens.h" 26 | 27 | #include 28 | #include 29 | 30 | int wake_utimensat(int dirfd, const char *path, const struct timespec ts[2]) { 31 | return utimensat(dirfd, path, ts, AT_SYMLINK_NOFOLLOW); 32 | } 33 | -------------------------------------------------------------------------------- /src/compat/utimens.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef UTIMENS_H 19 | #define UTIMENS_H 20 | 21 | #include 22 | #include 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | int wake_utimensat(int dirfd, const char *path, const struct timespec ts[2]); 29 | 30 | #ifdef __cplusplus 31 | }; 32 | #endif 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /src/compat/windows.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #if defined(_WIN32) 19 | 20 | int is_windows() { return 1; } 21 | 22 | #elif defined(__EMSCRIPTEN__) 23 | #include 24 | 25 | int is_windows() { 26 | // clang-format off 27 | return EM_ASM_INT({ 28 | if (process.platform == 'win32') { 29 | return 1; 30 | } else { 31 | return 0; 32 | } 33 | }); 34 | // clang-format on 35 | } 36 | 37 | #else 38 | 39 | int is_windows() { return 0; } 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /src/compat/windows.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef WINDOWS_H 19 | #define WINDOWS_H 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | extern int is_windows(); 26 | 27 | #ifdef __cplusplus 28 | }; 29 | #endif 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /src/dst/bind.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef BIND_H 19 | #define BIND_H 20 | 21 | #include 22 | 23 | #include "types/primfn.h" 24 | 25 | struct Top; 26 | struct Expr; 27 | 28 | // Eliminate DefMap + Top + Subscribe expressions 29 | std::unique_ptr bind_refs(std::unique_ptr top, const PrimMap &pmap, bool &isTreeBuilt); 30 | bool flatten_exports(Top &top); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/dst/dst.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2019 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | 20 | target dst variant = 21 | src @here variant (types, parser, util, Nil) (re2, Nil) Nil 22 | -------------------------------------------------------------------------------- /src/job_cache/bloom.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | #include "hash.h" 23 | 24 | // TODO: Make the bloom filter bigger 25 | class BloomFilter { 26 | uint64_t bits = 0; 27 | 28 | public: 29 | void add_hash(Hash256 hash) { bits |= 1 << (hash.data[0] & 0x1F); } 30 | size_t size() const { return sizeof(bits); } 31 | const uint8_t *data() const { return reinterpret_cast(&bits); } 32 | }; 33 | -------------------------------------------------------------------------------- /src/job_cache/job-cache.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2022 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | from gcc_wake import _ 20 | 21 | target jobCacheLib variant = 22 | require Pass schemaSql = source "src/job_cache/schema.sql" 23 | 24 | src @here variant (json, gopt, blake2, wcl, util, Nil) (sqlite3,) (schemaSql,) 25 | -------------------------------------------------------------------------------- /src/json/jlexer.cpp.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sifiveinc/wake/0b5e100b5580bc0503092294254e1f0b5e46e01b/src/json/jlexer.cpp.gz -------------------------------------------------------------------------------- /src/json/json.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2019 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | 20 | target json variant = 21 | src @here variant (util, Nil) Nil Nil 22 | -------------------------------------------------------------------------------- /src/json/lexint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef LEX_INT_H 19 | #define LEX_INT_H 20 | 21 | #include 22 | 23 | uint32_t lex_oct(const unsigned char *s, const unsigned char *e); 24 | uint32_t lex_hex(const unsigned char *s, const unsigned char *e); 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /src/json/utf8.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef UTF8_H 19 | #define UTF8_H 20 | 21 | #include 22 | #include 23 | 24 | bool push_utf8(std::string &result, uint32_t c); 25 | int pop_utf8(uint32_t *rune, const char *str); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/optimizer/optimizer.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2019 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | 20 | target optimizer variant = 21 | src @here variant (dst, types, util, Nil) (gmp, Nil) Nil 22 | -------------------------------------------------------------------------------- /src/parser/lexer.cpp.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sifiveinc/wake/0b5e100b5580bc0503092294254e1f0b5e46e01b/src/parser/lexer.cpp.gz -------------------------------------------------------------------------------- /src/parser/parser.cpp.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sifiveinc/wake/0b5e100b5580bc0503092294254e1f0b5e46e01b/src/parser/parser.cpp.gz -------------------------------------------------------------------------------- /src/parser/parser.h.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sifiveinc/wake/0b5e100b5580bc0503092294254e1f0b5e46e01b/src/parser/parser.h.gz -------------------------------------------------------------------------------- /src/parser/parser.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2019 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | 20 | target parser variant = 21 | src @here variant (json, util, Nil) (re2, utf8proc, Nil) Nil 22 | -------------------------------------------------------------------------------- /src/runtime/profile.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef PROFILE_H 19 | #define PROFILE_H 20 | 21 | #include 22 | #include 23 | 24 | struct Profile { 25 | std::map children; 26 | unsigned count; 27 | 28 | Profile() : count(0) {} 29 | void report(const char *file, const std::string &cmd) const; 30 | }; 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/runtime/runtime.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2019 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | 20 | target runtime variant = 21 | src 22 | @here 23 | variant 24 | (optimizer, dst, types, json, util, Nil) 25 | (util, gmp, sqlite3, re2, ncurses, jobCacheLib, Nil) 26 | Nil 27 | -------------------------------------------------------------------------------- /src/runtime/sources.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef SOURCES_H 19 | #define SOURCES_H 20 | 21 | #include 22 | #include 23 | 24 | struct Runtime; 25 | 26 | bool chdir_workspace(const char *chdirto, std::string &wake_cwd, std::string &src_dir); 27 | bool make_workspace(const std::string &dir); 28 | 29 | std::string check_version(bool workspace, const char *config_version, const char *wake_version); 30 | bool find_all_sources(Runtime &runtime, bool workspace); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/types/internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef INTERNAL_TYPES 19 | #define INTERNAL_TYPES 20 | 21 | #include "primfn.h" 22 | 23 | PRIMTYPE(type_rcat); 24 | PRIMTYPE(type_vcat); 25 | PRIMTYPE(type_scmp); 26 | PRIMTYPE(type_icmp); 27 | PRIMTYPE(type_cmp_nan_lt); 28 | PRIMTYPE(type_tget); 29 | 30 | PrimMap prim_register_internal(); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /src/types/types.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2019 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | 20 | target types variant = 21 | src @here variant (parser, util, Nil) Nil Nil 22 | -------------------------------------------------------------------------------- /src/util/execpath.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef EXEC_PATH 19 | #define EXEC_PATH 20 | 21 | #include 22 | #include 23 | 24 | std::string get_cwd(); 25 | std::string find_execpath(); 26 | std::string find_in_path(const std::string &file, const std::string &path); 27 | std::string find_path(const char *const *env); 28 | std::string find_path(const std::vector &env); 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /src/util/fragment.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include "fragment.h" 19 | 20 | Location FileFragment::location() const { 21 | // end-1 puts end1 on a byte within the last included codepoint 22 | uint32_t end1 = end != start ? end - 1 : end; 23 | return Location(content->filename(), content->coordinates(content->segment().start + start), 24 | content->coordinates(content->segment().start + end1)); 25 | } 26 | -------------------------------------------------------------------------------- /src/util/mkdir_parents.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include 19 | 20 | #include 21 | 22 | // Similar to the shell command: 'mkdir -p'. 23 | // Creates missing parent directories. 24 | // Does not error if directory already exists. 25 | int mkdir_with_parents(const std::string &path, mode_t mode); 26 | -------------------------------------------------------------------------------- /src/util/segment.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef SEGMENT_H 19 | #define SEGMENT_H 20 | 21 | #include 22 | 23 | struct StringSegment { 24 | const uint8_t *start; 25 | const uint8_t *end; 26 | 27 | size_t size() const { return end - start; } 28 | std::string str() const { 29 | return std::string(reinterpret_cast(start), end - start); 30 | } 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /src/util/shell.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef SHELL_H 19 | #define SHELL_H 20 | 21 | #include 22 | 23 | // Note: it is impossible to represent \0 in shell (or ANY program) arguments 24 | std::string shell_escape(const char *x); 25 | 26 | inline std::string shell_escape(const std::string &x) { return shell_escape(x.c_str()); } 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/util/unlink.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef UNLINK_H 19 | #define UNLINK_H 20 | 21 | // Remove all files under 'path'. 22 | // If path is absolute, parentfd is ignored 23 | // If path is relative and parentfd=AT_FDCWD, relative to current directory 24 | // Otherwise, path is taken relative to the parentfd directory 25 | int deep_unlink(int parentfd, const char *path); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /src/util/util.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2019 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | 20 | target util variant = 21 | src @here variant (compat, wcl, Nil) (wcl, whereami, siphash, ncurses, Nil) Nil 22 | -------------------------------------------------------------------------------- /src/wakefs/wakefs.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2019 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | 20 | target wakefs variant = 21 | src @here variant (json, util, Nil) Nil Nil 22 | -------------------------------------------------------------------------------- /src/wcl/hash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #pragma once 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | namespace wcl { 25 | inline uint64_t hash_combine(uint64_t a, uint64_t b) { 26 | return a ^ (b + 0x9e3779b9 + (a << 6) + (a >> 2)); 27 | } 28 | } // namespace wcl 29 | -------------------------------------------------------------------------------- /src/wcl/iterator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2023 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #pragma once 19 | 20 | #include 21 | 22 | namespace wcl { 23 | template 24 | auto split_by_fn(const T& v, Iter begin, Iter end, F f) -> std::vector { 25 | auto start_part = begin; 26 | auto end_part = begin; 27 | std::vector out; 28 | while (end_part < end) { 29 | if (*end_part == v) { 30 | out.emplace_back(f(start_part, end_part)); 31 | end_part++; 32 | start_part = end_part; 33 | } else { 34 | end_part++; 35 | } 36 | } 37 | out.emplace_back(start_part, end_part); 38 | return out; 39 | } 40 | 41 | } // namespace wcl 42 | -------------------------------------------------------------------------------- /src/wcl/wcl.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2022 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | 20 | target wcl variant = 21 | src @here variant Nil Nil Nil 22 | -------------------------------------------------------------------------------- /tests/.wakeignore: -------------------------------------------------------------------------------- 1 | # Ignore all wakefiles below this point 2 | */** 3 | -------------------------------------------------------------------------------- /tests/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/README.md: -------------------------------------------------------------------------------- 1 | In order to create a new test, you need three things: 2 | 1. a directory wake/tests/category/testname 3 | 2. an empty `.wakeroot` file in that directory 4 | 3. an executable `pass.sh` or `fail.sh` in that directory 5 | 6 | All of these files must be `git add`-ed. 7 | 8 | Your shell script will be provided with the name of the wake executable to 9 | test as its only option. It is helpful to default to just 'wake' for that 10 | option so that the test can be run individually from the command-line. 11 | This can be achieved by invoking wake with `"${1:-wake}"`. 12 | 13 | To pass: 14 | - `pass.sh` scripts are expected to exit with 0 15 | - `fail.sh` scripts are expected to NOT exit with 0 16 | - if a file `stdout` exists; the shell script must produce this standard output 17 | - if a file `stderr` exists; the shell script must produce this standard error 18 | 19 | Generally, tests also include a `test.wake` which the shell script runs. 20 | -------------------------------------------------------------------------------- /tests/command-line/clean/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/command-line/clean/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | WAKE="${1:+$1/wake}" 3 | "${WAKE:-wake}" -q --init . 4 | "${WAKE:-wake}" -q -x 'write "bug" ""' 5 | "${WAKE:-wake}" --clean 6 | -------------------------------------------------------------------------------- /tests/command-line/clean/stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sifiveinc/wake/0b5e100b5580bc0503092294254e1f0b5e46e01b/tests/command-line/clean/stdout -------------------------------------------------------------------------------- /tests/command-line/qv/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/command-line/qv/fail.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | WAKE="${1:+$1/wake}" 3 | "${WAKE:-wake}" -qv -x Unit 4 | -------------------------------------------------------------------------------- /tests/command-line/qv/stderr: -------------------------------------------------------------------------------- 1 | Cannot specify both -v and -q! 2 | -------------------------------------------------------------------------------- /tests/config/empty/.wakeroot: -------------------------------------------------------------------------------- 1 | { 2 | "user_config": "", 3 | "log_header":"", 4 | "log_header_source_width":0 5 | } 6 | -------------------------------------------------------------------------------- /tests/config/empty/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | if [ $(uname) != Linux ] ; then 4 | cat stdout 5 | exit 0 6 | fi 7 | 8 | WAKE="${1:+$1/wake}" 9 | "${WAKE:-wake}" --config 10 | -------------------------------------------------------------------------------- /tests/config/empty/stdout: -------------------------------------------------------------------------------- 1 | Wake config: 2 | user_config = '' (WakeRoot) 3 | version = '' (Default) 4 | log_header = '' (WakeRoot) 5 | log_header_source_width = '0' (WakeRoot) 6 | label_filter = '.*' (Default) 7 | eviction_config = '{type = ttl, seconds_to_live = 604800}' (Default) 8 | cache_miss_on_failure = 'false' (Default) 9 | log_header_align = 'false' (Default) 10 | bulk_logging_dir = '' (Default) 11 | shared_cache_timeout_config = '{ 12 | read_retries = 3, 13 | connect_retries = 14, 14 | max_misses_from_failure = 20, 15 | message_timeout_seconds = 10, 16 | }' (Default) 17 | -------------------------------------------------------------------------------- /tests/config/extra_keys/.wakeroot: -------------------------------------------------------------------------------- 1 | { 2 | "user_config": "./wake_user.json", 3 | "not-a-root-key": 1234, 4 | "log_header":"", 5 | "log_header_source_width":0 6 | } 7 | -------------------------------------------------------------------------------- /tests/config/extra_keys/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | if [ $(uname) != Linux ] ; then 4 | cat stdout 5 | cat stderr 1>&2 6 | exit 0 7 | fi 8 | 9 | WAKE="${1:+$1/wake}" 10 | "${WAKE:-wake}" --config 11 | -------------------------------------------------------------------------------- /tests/config/extra_keys/stderr: -------------------------------------------------------------------------------- 1 | .wakeroot: Key 'not-a-root-key' may not be set in .wakeroot. 2 | ./wake_user.json: Key 'version' may not be set in user config but it may be set in .wakeroot. 3 | ./wake_user.json: Key 'not-a-key' may not be set in user config. 4 | -------------------------------------------------------------------------------- /tests/config/extra_keys/stdout: -------------------------------------------------------------------------------- 1 | Wake config: 2 | user_config = './wake_user.json' (WakeRoot) 3 | version = '' (Default) 4 | log_header = '' (WakeRoot) 5 | log_header_source_width = '0' (WakeRoot) 6 | label_filter = '.*' (Default) 7 | eviction_config = '{type = ttl, seconds_to_live = 604800}' (Default) 8 | cache_miss_on_failure = 'false' (Default) 9 | log_header_align = 'false' (Default) 10 | bulk_logging_dir = '' (Default) 11 | shared_cache_timeout_config = '{ 12 | read_retries = 3, 13 | connect_retries = 14, 14 | max_misses_from_failure = 20, 15 | message_timeout_seconds = 10, 16 | }' (Default) 17 | -------------------------------------------------------------------------------- /tests/config/extra_keys/wake_user.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "1.2.3.4", 3 | "not-a-key": 1234 4 | } 5 | -------------------------------------------------------------------------------- /tests/config/invalid_user_config/.wakeroot: -------------------------------------------------------------------------------- 1 | { 2 | "user_config": "./wake_user.json", 3 | "log_header":"", 4 | "log_header_source_width":0 5 | } 6 | -------------------------------------------------------------------------------- /tests/config/invalid_user_config/fail.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | WAKE="${1:+$1/wake}" 4 | "${WAKE:-wake}" --config 5 | -------------------------------------------------------------------------------- /tests/config/invalid_user_config/stderr: -------------------------------------------------------------------------------- 1 | ./wake_user.json: ./wake_user.json must be a valid JSON object: Was expecting ID/STR, got a COMMA at string:2:1 2 | -------------------------------------------------------------------------------- /tests/config/invalid_user_config/wake_user.json: -------------------------------------------------------------------------------- 1 | { 2 | , 3 | } 4 | -------------------------------------------------------------------------------- /tests/config/invalid_wakeroot/.wakeroot: -------------------------------------------------------------------------------- 1 | { 2 | , 3 | } 4 | -------------------------------------------------------------------------------- /tests/config/invalid_wakeroot/fail.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | WAKE="${1:+$1/wake}" 4 | "${WAKE:-wake}" --config 5 | -------------------------------------------------------------------------------- /tests/config/invalid_wakeroot/stderr: -------------------------------------------------------------------------------- 1 | Failed to load .wakeroot: .wakeroot must be a valid JSON object: Was expecting ID/STR, got a COMMA at string:2:1 2 | -------------------------------------------------------------------------------- /tests/config/missing_user_config/.wakeroot: -------------------------------------------------------------------------------- 1 | { 2 | "user_config": "./wake_user.json", 3 | "log_header":"", 4 | "log_header_source_width":0 5 | } 6 | -------------------------------------------------------------------------------- /tests/config/missing_user_config/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | if [ $(uname) != Linux ] ; then 4 | cat stdout 5 | exit 0 6 | fi 7 | 8 | WAKE="${1:+$1/wake}" 9 | "${WAKE:-wake}" --config 10 | -------------------------------------------------------------------------------- /tests/config/missing_user_config/stdout: -------------------------------------------------------------------------------- 1 | Wake config: 2 | user_config = './wake_user.json' (WakeRoot) 3 | version = '' (Default) 4 | log_header = '' (WakeRoot) 5 | log_header_source_width = '0' (WakeRoot) 6 | label_filter = '.*' (Default) 7 | eviction_config = '{type = ttl, seconds_to_live = 604800}' (Default) 8 | cache_miss_on_failure = 'false' (Default) 9 | log_header_align = 'false' (Default) 10 | bulk_logging_dir = '' (Default) 11 | shared_cache_timeout_config = '{ 12 | read_retries = 3, 13 | connect_retries = 14, 14 | max_misses_from_failure = 20, 15 | message_timeout_seconds = 10, 16 | }' (Default) 17 | -------------------------------------------------------------------------------- /tests/config/nominal/.wakeroot: -------------------------------------------------------------------------------- 1 | { 2 | "user_config": "./wake_user.json", 3 | "log_header": "foobar $source: ", 4 | "log_header_source_width": 13, 5 | "log_header_align": true, 6 | "cache_miss_on_failure": true, 7 | "eviction_config": {"type": "lru", "low_cache_size": 512, "max_cache_size": 1024}, 8 | "shared_cache_timeout_config": { 9 | "read_retries": 20, 10 | "connect_retries": 3, 11 | "max_misses_from_failure": 20, 12 | "message_timeout_seconds": 100 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/config/nominal/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | if [ $(uname) != Linux ] ; then 4 | cat stdout 5 | exit 0 6 | fi 7 | 8 | WAKE="${1:+$1/wake}" 9 | WAKE_SHARED_CACHE_MAX_SIZE=1024 "${WAKE:-wake}" --config 10 | -------------------------------------------------------------------------------- /tests/config/nominal/stdout: -------------------------------------------------------------------------------- 1 | Wake config: 2 | user_config = './wake_user.json' (WakeRoot) 3 | version = '' (Default) 4 | log_header = 'foobar $source: ' (WakeRoot) 5 | log_header_source_width = '13' (WakeRoot) 6 | label_filter = '.*' (Default) 7 | eviction_config = '{type = lru, low_cache_size = 512, max_cache_size = 1024}' (WakeRoot) 8 | cache_miss_on_failure = 'true' (WakeRoot) 9 | log_header_align = 'true' (WakeRoot) 10 | bulk_logging_dir = '/tmp/wake_bulk_logs' (UserConfig) 11 | shared_cache_timeout_config = '{ 12 | read_retries = 20, 13 | connect_retries = 3, 14 | max_misses_from_failure = 20, 15 | message_timeout_seconds = 100, 16 | }' (WakeRoot) 17 | -------------------------------------------------------------------------------- /tests/config/nominal/wake_user.json: -------------------------------------------------------------------------------- 1 | { 2 | "bulk_logging_dir": "/tmp/wake_bulk_logs" 3 | } 4 | -------------------------------------------------------------------------------- /tests/dst/colon/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/dst/colon/fail.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | WAKE="${1:+$1/wake}" 4 | "${WAKE:-wake}" -q test 5 | -------------------------------------------------------------------------------- /tests/dst/colon/stderr: -------------------------------------------------------------------------------- 1 | test.wake:2:[21-32]: tag-name for a type must be a simple identifier, not '(x: Integer)' 2 | test.wake:4:21: type 'Integer: Integer' already has a tag-name 3 | test.wake:7:[30-36]: pattern '(z: Integer)' already has a type 4 | test.wake:9:[26-32]: pattern '(y: Integer)' already has a type 5 | test.wake:12:[32-38]: expression '4: Integer' already has a type 6 | >>> Aborting without execution <<< 7 | -------------------------------------------------------------------------------- /tests/dst/colon/test.wake: -------------------------------------------------------------------------------- 1 | #test.wake:2:[21-32]: tag-name for a type must be a simple identifier, not '(x: Integer)' 2 | export def foo = 4: (x: Integer): Integer 3 | #test.wake:4:21: type 'Integer: Integer' already has a tag-name 4 | export def bar = 4: x: Integer: Integer 5 | 6 | #test.wake:7:[30-36]: pattern '(z: Integer)' already has a type 7 | export def fn ((z: Integer): Integer) = z 8 | #test.wake:9:[26-32]: pattern '(y: Integer)' already has a type 9 | export def (y: Integer): Integer = 4 10 | 11 | #test.wake:12:[32-39]: expression '4: Integer' already has a type 12 | export def baz = (4: Integer): Integer 13 | 14 | export def test _ = 15 | Pass "fail" 16 | -------------------------------------------------------------------------------- /tests/dst/packages/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/dst/packages/fail.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | WAKE="${1:+$1/wake}" 4 | "${WAKE:-wake}" --in foo -q test 5 | -------------------------------------------------------------------------------- /tests/dst/packages/test2.wake: -------------------------------------------------------------------------------- 1 | package foo2 2 | 3 | #test2.wake:4:[12-16]: global definition 'glob1' also defined at test.wake:30:[12-16] 4 | global def glob1 = "asd" 5 | #test2.wake:7:[13-17]: global type 'Glob1' also defined at test.wake:31:[13-17] 6 | #test2.wake:7:[21-25]: global definition 'Glob1' also defined at test.wake:31:[21-25] 7 | global data Glob1 = Glob1 8 | #test2.wake:9:[14-18]: global topic 'glob1' also defined at test.wake:32:[14-18] 9 | global topic glob1: Integer 10 | -------------------------------------------------------------------------------- /tests/dst/packages/test3.wake: -------------------------------------------------------------------------------- 1 | package foo 2 | 3 | #test3.wake:4:[5-8]: package-local definition 'pkg1' also defined at test.wake:25:[12-15] 4 | def pkg1 = "34" 5 | #test3.wake:7:[6-9]: package-local type 'Pkg1' also defined at test.wake:26:[13-16] 6 | #test3.wake:7:[13-16]: package-local definition 'Pkg1' also defined at test.wake:26:[20-23] 7 | data Pkg1 = Pkg1 8 | #test3.wake:9:[7-10]: package-local topic 'pkg1' also defined at test.wake:27:[14-17] 9 | topic pkg1: Integer 10 | -------------------------------------------------------------------------------- /tests/dst/packages/test4.wake: -------------------------------------------------------------------------------- 1 | package some_package 2 | 3 | export def unused = "hello" 4 | 5 | export topic unusedTopic: Integer 6 | export topic usedTopic: Integer 7 | -------------------------------------------------------------------------------- /tests/dst/typedef/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/dst/typedef/fail.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | WAKE="${1:+$1/wake}" 4 | "${WAKE:-wake}" -q test 5 | -------------------------------------------------------------------------------- /tests/dst/typedef/stderr: -------------------------------------------------------------------------------- 1 | test.wake:2:17: type argument 'X' must be lower-case 2 | test.wake:5:21: type argument 'a' already defined at test.wake:5:17 3 | test.wake:24:19: type argument 'X' must be lower-case 4 | test.wake:28:23: type argument 'a' already defined at test.wake:28:19 5 | test.wake:40:[13-15]: data type 'foo' must be upper-case or operator 6 | test.wake:42:[13-15]: type 'Foo' was previously defined at test.wake:2:[13-15] 7 | test.wake:45:[13-21]: data type 'Bing' should not be tagged with 'x' 8 | test.wake:49:[3-11]: constructor 'Rabbit' should not be tagged with 'a' 9 | test.wake:51:[3-7]: constructor 'lower' must be upper-case or operator 10 | test.wake:53:[24-29]: excess type argument 'String' supplied to 'binary ==>' 11 | test.wake:56:[14-20]: tuple type 'binary +++' must be upper-case 12 | test.wake:60:[14-24]: tuple type 'Banger' should not be tagged with 'z' 13 | test.wake:21:[18-23]: type error; function '+' expected argument 'x' of type: 14 | Integer 15 | but was supplied argument 'foo_ok' of type: 16 | List a 17 | test.wake:12:32: unbound type variable 'a' 18 | test.wake:33:20: unbound type variable 'b' 19 | test.wake:9:13: unbound type variable 'z' 20 | test.wake:33:20: unbound type variable 'b' 21 | >>> Aborting without execution <<< 22 | -------------------------------------------------------------------------------- /tests/inspection/canceled/.wakeroot: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /tests/inspection/canceled/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | set -e 4 | WAKE="${1:+$1/wake}" 5 | 6 | # Start from any empty db every time for stable job ids 7 | rm -f wake.db 8 | 9 | # Use || true to ignore the expected non-0 return from timeout 10 | timeout 1 ${WAKE} test || true 11 | 12 | ${WAKE} --canceled --simple 13 | -------------------------------------------------------------------------------- /tests/inspection/canceled/stderr: -------------------------------------------------------------------------------- 1 | Early termination requested 2 | -------------------------------------------------------------------------------- /tests/inspection/canceled/stdout: -------------------------------------------------------------------------------- 1 | # (1) 2 | $ sleep 1000 3 | -------------------------------------------------------------------------------- /tests/inspection/canceled/test.wake: -------------------------------------------------------------------------------- 1 | from wake import _ 2 | 3 | export def test _: Result Unit Error = 4 | def _ = 5 | makeExecPlan ("sleep", "1000",) Nil 6 | | runJobWith defaultRunner 7 | 8 | Pass Unit 9 | -------------------------------------------------------------------------------- /tests/job-cache/basic-fetch/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/job-cache/basic-fetch/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | if [ $(uname) != Linux ] ; then 4 | exit 0 5 | fi 6 | 7 | set -e 8 | WAKE="${1:+$1/wake}" 9 | 10 | rm test.txt || true 11 | rm wake.db || true 12 | rm -rf .cache-hit || true 13 | rm -rf .cache-misses || true 14 | rm -rf .job-cache || true 15 | WAKE_SHARED_CACHE_FAST_CLOSE=1 DEBUG_WAKE_SHARED_CACHE=1 WAKE_LOCAL_JOB_CACHE=.job-cache "${WAKE:-wake}" test 16 | 17 | rm wake.db 18 | rm -rf .cache-misses 19 | WAKE_SHARED_CACHE_FAST_CLOSE=1 DEBUG_WAKE_SHARED_CACHE=1 WAKE_LOCAL_JOB_CACHE=.job-cache "${WAKE:-wake}" test 20 | if [ -z "$(ls -A .cache-hit)" ]; then 21 | echo "No cache hit found" 22 | exit 1 23 | fi 24 | if [ -d ".cache-misses" ]; then 25 | echo "Found a cache miss" 26 | exit 1 27 | fi 28 | 29 | # Verify correct bits 30 | rm test_gold.txt || true 31 | cat some-input.txt > test_gold.txt && cat some-input.txt >> test_gold.txt 32 | diff test.txt test_gold.txt >&2 33 | 34 | # Cleanup 35 | echo "fourth round" >&2 36 | rm test.txt 37 | rm test_gold.txt 38 | -------------------------------------------------------------------------------- /tests/job-cache/basic-fetch/some-input.txt: -------------------------------------------------------------------------------- 1 | this is a test 2 | -------------------------------------------------------------------------------- /tests/job-cache/basic-fetch/test.wake: -------------------------------------------------------------------------------- 1 | from wake import _ 2 | 3 | publish source = "some-input.txt", 4 | 5 | export def test (_: List String): Result (List String) Error = 6 | require Pass source = source "some-input.txt" 7 | require Pass outputs = 8 | makePlan "basic_test" (source,) "cat some-input.txt > test.txt && cat some-input.txt >> test.txt" 9 | | runJobWith defaultRunner 10 | | getJobOutputs 11 | Pass (map (_.getPathName) outputs) 12 | -------------------------------------------------------------------------------- /tests/job-cache/basic-lru/.wakeroot: -------------------------------------------------------------------------------- 1 | { 2 | "eviction_config": { 3 | "type": "lru", 4 | "max_cache_size": 80, 5 | "low_cache_size": 50 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tests/job-cache/basic-lru/test.wake: -------------------------------------------------------------------------------- 1 | from wake import _ 2 | 3 | export def test (lst: List String): Result (List String) Error = 4 | require Some x = head lst 5 | else failWithError "must provide at least one argument" 6 | 7 | require Pass outputs = 8 | makePlan "basic_test" Nil "echo {x}: deadbeefdeadbeef > {x}.txt" 9 | | runJobWith defaultRunner 10 | | getJobOutputs 11 | Pass (map (_.getPathName) outputs) 12 | -------------------------------------------------------------------------------- /tests/job-cache/dup-output/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/job-cache/dup-output/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | if [ $(uname) != Linux ] ; then 4 | exit 0 5 | fi 6 | 7 | set -e 8 | WAKE="${1:+$1/wake}" 9 | rm wake.db || true 10 | rm -rf .cache-hit || true 11 | rm -rf .cache-misses || true 12 | rm -rf .job-cache || true 13 | WAKE_SHARED_CACHE_FAST_CLOSE=1 DEBUG_WAKE_SHARED_CACHE=1 WAKE_LOCAL_JOB_CACHE=.job-cache "${WAKE:-wake}" test 14 | rm wake.db 15 | rm -rf .cache-misses 16 | WAKE_SHARED_CACHE_FAST_CLOSE=1 DEBUG_WAKE_SHARED_CACHE=1 WAKE_LOCAL_JOB_CACHE=.job-cache "${WAKE:-wake}" test 17 | if [ -z "$(ls -A .cache-hit)" ]; then 18 | echo "No cache hit found" 19 | exit 1 20 | fi 21 | if [ -d ".cache-misses" ]; then 22 | echo "Found a cache miss" 23 | exit 1 24 | fi 25 | 26 | # Verif 27 | echo foobar | diff - test1.txt 28 | echo foobar | diff - test2.txt 29 | 30 | # Cleanup 31 | rm test1.txt 32 | rm test2.txt 33 | -------------------------------------------------------------------------------- /tests/job-cache/dup-output/test.wake: -------------------------------------------------------------------------------- 1 | from wake import _ 2 | 3 | export def test (_: List String): Result (List String) Error = 4 | require Pass outputs = 5 | makePlan "basic_test" Nil "echo foobar > test1.txt && echo foobar > test2.txt" 6 | | runJobWith defaultRunner 7 | | getJobOutputs 8 | Pass (map (_.getPathName) outputs) 9 | -------------------------------------------------------------------------------- /tests/job-cache/overwrite-smaller/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/job-cache/overwrite-smaller/test.wake: -------------------------------------------------------------------------------- 1 | export def test (_: List String): Result (List String) Error = 2 | require Some payload = getenv "PAYLOAD" 3 | else failWithError "$PAYLOAD was not set" 4 | require Pass outputs = 5 | makePlan "basic_test" Nil "echo {payload} > test.txt" 6 | | runJobWith defaultRunner 7 | | getJobOutputs 8 | Pass (map (_.getPathName) outputs) 9 | -------------------------------------------------------------------------------- /tests/job-cache/runner-hash/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/job-cache/runner-hash/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | if [ $(uname) != Linux ] ; then 4 | exit 0 5 | fi 6 | 7 | set -e 8 | WAKE="${1:+$1/wake}" 9 | 10 | rm test.txt || true 11 | rm wake.db || true 12 | rm -rf .cache-hit || true 13 | rm -rf .cache-misses || true 14 | rm -rf .job-cache || true 15 | WAKE_SHARED_CACHE_FAST_CLOSE=1 DEBUG_WAKE_SHARED_CACHE=1 WAKE_LOCAL_JOB_CACHE=.job-cache "${WAKE:-wake}" test1 16 | 17 | rm wake.db 18 | rm -rf .cache-misses 19 | WAKE_SHARED_CACHE_FAST_CLOSE=1 DEBUG_WAKE_SHARED_CACHE=1 WAKE_LOCAL_JOB_CACHE=.job-cache "${WAKE:-wake}" test2 20 | 21 | 22 | if [ -z "$(ls -A .cache-misses)" ]; then 23 | echo "Expected a cache miss!!" 24 | exit 1 25 | fi 26 | 27 | if [ -d ".cache-hit" ]; then 28 | echo "Found an unexpected cache hit" 29 | exit 1 30 | fi 31 | 32 | # Verify correct bits 33 | rm test_gold.txt || true 34 | cat some-input.txt > test_gold.txt && cat some-input.txt >> test_gold.txt 35 | diff test.txt test_gold.txt >&2 36 | 37 | # Cleanup 38 | echo "fourth round" >&2 39 | rm test.txt 40 | rm test_gold.txt 41 | -------------------------------------------------------------------------------- /tests/job-cache/runner-hash/some-input.txt: -------------------------------------------------------------------------------- 1 | this is a test 2 | -------------------------------------------------------------------------------- /tests/job-cache/runner-hash/test.wake: -------------------------------------------------------------------------------- 1 | from wake import _ 2 | 3 | publish source = 4 | "some-input.txt", 5 | 6 | def mkTestPlan (s: String): Result Plan Error = 7 | require Pass source = source "some-input.txt" 8 | 9 | makePlan 10 | "runner_hash_test" 11 | (source,) 12 | "cat some-input.txt > test.txt && cat some-input.txt >> test.txt" 13 | | setPlanResources (s,) 14 | | Pass 15 | 16 | def resourceAwareCacheRunner = 17 | def hashResource input = 18 | Pass (catWith "." input.getRunnerInputResources) 19 | 20 | mkJobCacheRunner hashResource "/workspace" fuseRunner 21 | 22 | def runTestJob (s: String) = 23 | require Pass plan = mkTestPlan s 24 | 25 | require Pass outputs = 26 | plan 27 | | runJobWith resourceAwareCacheRunner 28 | | getJobOutputs 29 | 30 | Pass (map (_.getPathName) outputs) 31 | 32 | export def test1 (_: List String): Result (List String) Error = 33 | runTestJob "test1" 34 | 35 | export def test2 (_: List String): Result (List String) Error = 36 | runTestJob "test2" 37 | 38 | -------------------------------------------------------------------------------- /tests/job-cache/symlink-dir/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/job-cache/symlink-dir/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | if [ $(uname) != Linux ] ; then 4 | exit 0 5 | fi 6 | 7 | set -e 8 | WAKE="${1:+$1/wake}" 9 | rm wake.db || true 10 | rm -rf .cache-hit || true 11 | rm -rf .cache-misses || true 12 | rm -rf .job-cache || true 13 | WAKE_SHARED_CACHE_FAST_CLOSE=1 DEBUG_WAKE_SHARED_CACHE=1 WAKE_LOCAL_JOB_CACHE=.job-cache "${WAKE:-wake}" test 14 | rm wake.db 15 | rm -rf .cache-misses 16 | WAKE_SHARED_CACHE_FAST_CLOSE=1 DEBUG_WAKE_SHARED_CACHE=1 WAKE_LOCAL_JOB_CACHE=.job-cache "${WAKE:-wake}" test 17 | if [ -z "$(ls -A .cache-hit)" ]; then 18 | echo "No cache hit found" 19 | exit 1 20 | fi 21 | if [ -d ".cache-misses" ]; then 22 | echo "Found a cache miss" 23 | exit 1 24 | fi 25 | 26 | # Verify 27 | echo foo | diff - test.txt 28 | diff $(readlink bar/baz.txt) test.txt 29 | 30 | # Cleanup 31 | rm -rf ./bar 32 | rm test.txt 33 | -------------------------------------------------------------------------------- /tests/job-cache/symlink-dir/test.wake: -------------------------------------------------------------------------------- 1 | export def test (_: List String): Result (List String) Error = 2 | require Pass outputs = 3 | makePlan "basic_test" Nil "echo foo > test.txt && mkdir -p bar && ln -s test.txt bar/baz.txt" 4 | | runJobWith defaultRunner 5 | | getJobOutputs 6 | Pass (map (_.getPathName) outputs) 7 | -------------------------------------------------------------------------------- /tests/parser/unicode/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/parser/unicode/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | WAKE="${1:+$1/wake}" 4 | "${WAKE:-wake}" test 5 | -------------------------------------------------------------------------------- /tests/parser/unicode/test.wake: -------------------------------------------------------------------------------- 1 | def testBool _ = 2 | require True = "\u0073\u0323\u0307" ==* "\u1e69" 3 | require True = "ṩ" ==* "ṩ" 4 | require True = "ṩ{"-"}ṩ" ==* "ṩ-ṩ" 5 | require False = 'ṩ' ==* 'ṩ' 6 | def xṩ = 44 7 | def _ = xṩ 8 | require False = "xϓ" ==* "xΎ" 9 | require False = unicodeIdentifier "xϓ" ==* "xΎ" 10 | def xϓ = 33 11 | def _ = xΎ 12 | True 13 | 14 | def test x = 15 | if testBool x then 16 | Pass Unit 17 | else 18 | Fail (makeError "normalization bad") 19 | 20 | -------------------------------------------------------------------------------- /tests/remote-cache/disable-cache-cascade/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/remote-cache/disable-cache-cascade/pass.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | WAKE="${1:+$1/wake}" 5 | 6 | rm -f .build/tmp/disable_remote_cache 7 | 8 | "${WAKE:-wake}" -x "test Unit" 9 | 10 | # Verify the disable cache file exists 11 | if [ ! -f .build/tmp/disable_remote_cache ]; then 12 | echo "Expected disable cache file to exist at .build/tmp/disable_remote_cache" 13 | exit 1 14 | fi 15 | 16 | # Clean up 17 | rm -f .build/tmp/disable_remote_cache 18 | 19 | exit 0 20 | -------------------------------------------------------------------------------- /tests/remote-cache/disable-cache-cascade/test.wake: -------------------------------------------------------------------------------- 1 | from wake import _ 2 | from remote_cache import _ 3 | 4 | export def test Unit: Result Unit Error = 5 | # Create a test RSC API instance pointing to a non-responsive endpoint with quick timeout 6 | def api = RemoteCacheApi "10.255.255.1" 8080 (RemoteCachePolicyPushPull "test-auth") (Some 1) (Some 1) 7 | require Pass _ = testDisablingCacheWithEndpoints api 8 | 9 | Pass Unit 10 | -------------------------------------------------------------------------------- /tests/runtime/symlinks/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/runtime/symlinks/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | set -ex 4 | 5 | WAKE="${1:+$1/wake}" 6 | WAKE="${WAKE:-wake}" 7 | 8 | rm -f datFile badLink goodLink wake.db 9 | "${WAKE}" -v test 10 | "${WAKE}" -v test 11 | 12 | rm wake.db 13 | "${WAKE}" -v test 14 | 15 | rm -f badLink goodLink 16 | ln -s badFile badLink 17 | ln -s datFile goodLink 18 | "${WAKE}" -v test 19 | "${WAKE}" -v test 20 | 21 | rm -f datFile badLink goodLink wake.db 22 | ln -s badFile badLink 23 | ln -s datFile goodLink 24 | "${WAKE}" -v test 25 | "${WAKE}" -v test 26 | 27 | rm -f datFile badLink goodLink .fuse.log 28 | echo "Symlinks work!" 29 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/compat-identity/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/compat-identity/infinity.json: -------------------------------------------------------------------------------- 1 | [ 2 | Infinity 3 | ] 4 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/compat-identity/nan.json: -------------------------------------------------------------------------------- 1 | { 2 | "double": NaN 3 | } 4 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/compat-identity/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | ln ../json-test.wake . 4 | WAKE="${1:+$1/wake}" 5 | "${WAKE:-wake}" --quiet --stdout=warning,report 'jsonTest normalizeJSONIdentity' \ 6 | infinity.json \ 7 | nan.json \ 8 | unicode.json 9 | rm json-test.wake 10 | rm -r build 11 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/compat-identity/stdout: -------------------------------------------------------------------------------- 1 | [Infinity] 2 | {"double":NaN} 3 | "éℍ¼" 4 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/compat-identity/unicode.json: -------------------------------------------------------------------------------- 1 | "éℍ¼" 2 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/compat-valid/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/compat-valid/input.json: -------------------------------------------------------------------------------- 1 | { 2 | "object": { 3 | "string": "test", 4 | "double": 2.9979e8, 5 | "int": 3 6 | }, 7 | "array": [ 8 | "x", 9 | null 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/compat-valid/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | ln ../json-test.wake . 4 | WAKE="${1:+$1/wake}" 5 | "${WAKE:-wake}" --quiet --stdout=warning,report 'jsonTest normalizeJSONCompat' input.json 6 | rm json-test.wake 7 | rm -r build 8 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/compat-valid/stdout: -------------------------------------------------------------------------------- 1 | {"array":["x",null],"object":{"double":299790000e0,"int":3,"string":"test"}} 2 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/compat/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/compat/infinity.json: -------------------------------------------------------------------------------- 1 | [ 2 | Infinity 3 | ] 4 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/compat/nan.json: -------------------------------------------------------------------------------- 1 | { 2 | "double": NaN 3 | } 4 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/compat/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | ln ../json-test.wake . 4 | WAKE="${1:+$1/wake}" 5 | "${WAKE:-wake}" --quiet --stdout=warning,report 'jsonTest normalizeJSONCompat' \ 6 | infinity.json \ 7 | nan.json \ 8 | unicode.json \ 9 | unicode-merge.json 10 | rm json-test.wake 11 | rm -r build 12 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/compat/stderr: -------------------------------------------------------------------------------- 1 | /[0]: For compatibility, JSON doubles should not be infinite. 2 | /double: For compatibility, JSON doubles should not be NaN values. 3 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/compat/stdout: -------------------------------------------------------------------------------- 1 | ["éℍ¼","Only the é should change (to precomposed U+00E9)"] 2 | {"eacute":"é"} 3 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/compat/unicode-merge.json: -------------------------------------------------------------------------------- 1 | { 2 | "eacute": "é", 3 | "eacute": "é" 4 | } 5 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/compat/unicode.json: -------------------------------------------------------------------------------- 1 | [ 2 | "éℍ¼", 3 | "Only the é should change (to precomposed U+00E9)" 4 | ] 5 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/deduplicate/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/deduplicate/invalid-boolean.json: -------------------------------------------------------------------------------- 1 | { 2 | "boolean": true, 3 | "boolean": false 4 | } 5 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/deduplicate/invalid-double.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "double": 2.9979e8, 4 | "double": 3.14159 5 | } 6 | ] 7 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/deduplicate/invalid-int.json: -------------------------------------------------------------------------------- 1 | { 2 | "wrap": { 3 | "int": 1, 4 | "int": 2 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/deduplicate/invalid-nesting.json: -------------------------------------------------------------------------------- 1 | { 2 | "object": { 3 | "int": 1 4 | }, 5 | "object": { 6 | "int": 2 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/deduplicate/invalid-string.json: -------------------------------------------------------------------------------- 1 | { 2 | "wrap": [ 3 | { 4 | "string": "test 1", 5 | "string": "test 2" 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/deduplicate/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | ln ../json-test.wake . 4 | WAKE="${1:+$1/wake}" 5 | "${WAKE:-wake}" --quiet --stdout=warning,report 'jsonTest normalizeJSONCompat' \ 6 | valid.json \ 7 | valid-nesting.json \ 8 | invalid-boolean.json \ 9 | invalid-double.json \ 10 | invalid-int.json \ 11 | invalid-string.json \ 12 | invalid-nesting.json 13 | rm json-test.wake 14 | rm -r build 15 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/deduplicate/stderr: -------------------------------------------------------------------------------- 1 | /boolean: For compatibility, JSON objects should not have duplicate keys. While we try to recover from this where possible, not every type can combine multiple different values. The incompatible values are: [true, false] 2 | /[0]/double: For compatibility, JSON objects should not have duplicate keys. While we try to recover from this where possible, not every type can combine multiple different values. The incompatible values are: [299790000e0, 3.1415899999999999] 3 | /wrap/int: For compatibility, JSON objects should not have duplicate keys. While we try to recover from this where possible, not every type can combine multiple different values. The incompatible values are: [1, 2] 4 | /wrap/[0]/string: For compatibility, JSON objects should not have duplicate keys. While we try to recover from this where possible, not every type can combine multiple different values. The incompatible values are: ["test 1", "test 2"] 5 | /object/int: For compatibility, JSON objects should not have duplicate keys. While we try to recover from this where possible, not every type can combine multiple different values. The incompatible values are: [1, 2] 6 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/deduplicate/stdout: -------------------------------------------------------------------------------- 1 | {"object":{"array":["x",null],"boolean":true,"double":299790000e0,"int":3,"null":null,"string":"test"}} 2 | {"object":{"array":["x",null]}} 3 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/deduplicate/valid-nesting.json: -------------------------------------------------------------------------------- 1 | { 2 | "object": { 3 | "array": [ 4 | "x" 5 | ] 6 | }, 7 | "object": { 8 | "array": [ 9 | null 10 | ] 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/deduplicate/valid.json: -------------------------------------------------------------------------------- 1 | { 2 | "object": { 3 | "string": "test", 4 | "double": null, 5 | "int": 3, 6 | "boolean": true, 7 | "array": ["x"] 8 | }, 9 | "object": { 10 | "string": "test", 11 | "double": 2.9979e8, 12 | "int": null, 13 | "null": null, 14 | "array": [null] 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/json-test.wake: -------------------------------------------------------------------------------- 1 | package test_wake_json 2 | 3 | from wake import _ 4 | 5 | export def jsonTest (normalization: JSONNormalize) (inputs: List String): Result Unit Error = 6 | def testFn = 7 | normalizeJSONWith normalization 8 | findFailFn (test (_) testFn) inputs 9 | | rmap (\_ Unit) 10 | 11 | export def jsonArrayTest (joinFn: List JValue => Result JValue Error) (inputs: List String): Result Unit Error = 12 | def preprocessFn json = 13 | getJArray json 14 | | getOrElse Nil 15 | findFailFn (test preprocessFn joinFn) inputs 16 | | rmap (\_ Unit) 17 | 18 | def test (preprocessFn: JValue => a) (testFn: a => Result JValue Error) (input: String): Result Unit Error = 19 | require Pass inputPath = 20 | # There doesn't seem to be an easy way to get `source` to recognize the 21 | # input file, so claim it instead. 22 | claimFileAsPath input "build/claimed-json/{input}" 23 | require Pass json = 24 | parseJSONFile inputPath 25 | def testResult = 26 | json 27 | | preprocessFn 28 | | testFn 29 | match testResult 30 | Pass output = 31 | output 32 | | formatJSON 33 | | println 34 | | Pass 35 | Fail err = 36 | err.getErrorCause 37 | | printlnLevel logError 38 | | Pass 39 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/mergeJSON/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/mergeJSON/override.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "firstKey": 1 4 | }, 5 | 2, 6 | { 7 | "secondKey": 3 8 | } 9 | ] 10 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/mergeJSON/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | ln ../json-test.wake . 4 | WAKE="${1:+$1/wake}" 5 | "${WAKE:-wake}" --quiet --stdout=warning,report 'jsonArrayTest mergeJSON' \ 6 | recurse.json \ 7 | override.json 8 | rm json-test.wake 9 | rm -r build 10 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/mergeJSON/recurse.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "key": { 4 | "firstSubkey": 1 5 | } 6 | }, 7 | { 8 | "key": { 9 | "secondSubkey": 2 10 | } 11 | } 12 | ] 13 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/mergeJSON/stderr: -------------------------------------------------------------------------------- 1 | /: Values of different types may not be combined. The incompatible values are: [{"firstKey":1}, 2, {"secondKey":3}] 2 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/mergeJSON/stdout: -------------------------------------------------------------------------------- 1 | {"key":{"firstSubkey":1,"secondSubkey":2}} 2 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/overrideJSON/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/overrideJSON/override.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "firstKey": 1 4 | }, 5 | 2, 6 | { 7 | "secondKey": 3 8 | } 9 | ] 10 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/overrideJSON/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | ln ../json-test.wake . 4 | WAKE="${1:+$1/wake}" 5 | "${WAKE:-wake}" --quiet --stdout=warning,report 'jsonArrayTest (_.overrideJSON | Pass)' \ 6 | recurse.json \ 7 | override.json 8 | rm json-test.wake 9 | rm -r build 10 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/overrideJSON/recurse.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "key": { 4 | "firstSubkey": 1 5 | } 6 | }, 7 | { 8 | "key": { 9 | "secondSubkey": 2 10 | } 11 | } 12 | ] 13 | -------------------------------------------------------------------------------- /tests/standard-library/json-normalize-merge/overrideJSON/stdout: -------------------------------------------------------------------------------- 1 | {"key":{"firstSubkey":1,"secondSubkey":2}} 2 | {"secondKey":3} 3 | -------------------------------------------------------------------------------- /tests/standard-library/list/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/standard-library/list/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | WAKE="${1:+$1/wake}" 4 | 5 | "${WAKE:-wake}" --stdout=warning,report test1 6 | "${WAKE:-wake}" --stdout=warning,report test2 7 | "${WAKE:-wake}" --stdout=warning,report test3 8 | "${WAKE:-wake}" --stdout=warning,report test4 9 | "${WAKE:-wake}" --stdout=warning,report test5 10 | "${WAKE:-wake}" --stdout=warning,report test6 11 | "${WAKE:-wake}" --stdout=warning,report test7 12 | "${WAKE:-wake}" --stdout=warning,report test8 13 | "${WAKE:-wake}" --stdout=warning,report test9 14 | "${WAKE:-wake}" --stdout=warning,report test10 15 | "${WAKE:-wake}" --stdout=warning,report test11 16 | "${WAKE:-wake}" --stdout=warning,report test12 17 | "${WAKE:-wake}" --stdout=warning,report test13 18 | "${WAKE:-wake}" --stdout=warning,report test14 19 | "${WAKE:-wake}" --stdout=warning,report test15 20 | "${WAKE:-wake}" --stdout=warning,report test16 21 | "${WAKE:-wake}" --stdout=warning,report test17 22 | "${WAKE:-wake}" --stdout=warning,report test18 23 | -------------------------------------------------------------------------------- /tests/standard-library/list/stdout: -------------------------------------------------------------------------------- 1 | (0, 1, 2, Nil), (3, 4, 5, Nil), (6, 7, 8, Nil), (9, 10, Nil), Nil 2 | 0, 1, 2, Nil 3 | 0, 1, 2, Nil 4 | 0, 2, Nil 5 | "", "bat", Nil 6 | True 7 | True 8 | False 9 | False 10 | True 11 | True 12 | False 13 | True 14 | False 15 | 3, Nil 16 | Nil 17 | 0, 1, Nil 18 | "bar", Nil 19 | -------------------------------------------------------------------------------- /tests/standard-library/list/test.wake: -------------------------------------------------------------------------------- 1 | # groupBy tests 2 | export def test1 _ = seq 11 | groupBy (\l\r icmp (l/3) (r/3)) 3 | 4 | # intersect tests 5 | export def test2 _ = intersect icmp (seq 3) (seq 4) 6 | export def test3 _ = intersect icmp (seq 3) (seq 3) 7 | export def test4 _ = intersect icmp (seq 3) (4, 2, 0, Nil) 8 | export def test5 _ = intersect scmp ("", "bar", "bat", Nil) ("", "foo", "bat", Nil) 9 | 10 | # subset tests 11 | export def test6 _ = subset icmp (seq 3) (seq 4) 12 | export def test7 _ = subset icmp (seq 3) (seq 3) 13 | export def test8 _ = subset icmp (seq 3) (seq 2) 14 | export def test9 _ = subset icmp (seq 3) (4, 2, 0, Nil) 15 | export def test10 _ = subset icmp Nil Nil 16 | export def test11 _ = subset icmp Nil (seq 1) 17 | export def test12 _ = subset icmp (seq 1) Nil 18 | export def test13 _ = subset scmp ("", Nil) ("", "foo", "bar", Nil) 19 | export def test14 _ = subset scmp ("", "bat", Nil) ("", "foo", "bar", Nil) 20 | 21 | # subtract tests 22 | export def test15 _ = subtract icmp (seq 4) (seq 3) 23 | export def test16 _ = subtract icmp (seq 3) (seq 3) 24 | export def test17 _ = subtract icmp (seq 3) (2, Nil) 25 | export def test18 _ = subtract scmp ("", "bar", "bat", Nil) ("", "foo", "bat", Nil) 26 | -------------------------------------------------------------------------------- /tests/standard-library/runner/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/standard-library/runner/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | WAKE="${1:+$1/wake}" 4 | 5 | # Since we are writing jobs to the database in this test we should clear it for each run if it 6 | # happens to exist from a previous run 7 | rm -f wake.db wake.log 8 | 9 | "${WAKE:-wake}" --stdout=warning,report testRunnerFailFinish 10 | -------------------------------------------------------------------------------- /tests/standard-library/runner/stdout: -------------------------------------------------------------------------------- 1 | False 2 | -------------------------------------------------------------------------------- /tests/standard-library/runner/test.wake: -------------------------------------------------------------------------------- 1 | export def testRunnerFailFinish _ = 2 | def run job input = 3 | def (Runner _ virtRun) = virtualRunner 4 | require Pass _ = virtRun job (Pass input) 5 | 6 | # Force a failure outside of the actual job 7 | failWithError "Mark job as failure" 8 | 9 | def testRunner = makeRunner "" run 10 | 11 | makeExecPlan ("", Nil) Nil 12 | | runJobWith testRunner 13 | | isJobOk 14 | -------------------------------------------------------------------------------- /tests/standard-library/string/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/standard-library/string/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | WAKE="${1:+$1/wake}" 4 | "${WAKE:-wake}" --stdout=warning,report testToBytes 5 | "${WAKE:-wake}" --stdout=warning,report testToUnicode 6 | "${WAKE:-wake}" --stdout=warning,report testEquality 7 | -------------------------------------------------------------------------------- /tests/standard-library/string/stdout: -------------------------------------------------------------------------------- 1 | 91, 97, 201, 170, 204, 175, 32, 112, 202, 176, 105, 203, 144, 32, 101, 201, 170, 204, 175, 93, Nil 2 | "[aɪ̯ pʰiː eɪ̯]" 3 | True 4 | -------------------------------------------------------------------------------- /tests/standard-library/string/test.wake: -------------------------------------------------------------------------------- 1 | def unicodeStr = 2 | "[aɪ̯ pʰiː eɪ̯]" 3 | 4 | def unicodeBytes = 5 | 91, 97, 201, 170, 204, 175, 32, 112, 202, 176, 105, 203, 144, 32, 101, 201, 170, 204, 175, 93, Nil 6 | 7 | export def testToBytes _ = 8 | unicodeStr 9 | | unicodeToBytes 10 | 11 | export def testToUnicode _ = 12 | unicodeBytes 13 | | bytesToUnicode 14 | 15 | export def testEquality _ = 16 | require True = (unicodeStr | unicodeToBytes | bytesToUnicode) ==* unicodeStr 17 | 18 | require 91, 97, 201, 170, 204, 175, 32, 112, 202, 176, 105, 203, 144, 32, 101, 201, 170, 204, 175, 93, Nil = 19 | unicodeBytes 20 | | bytesToUnicode 21 | | unicodeToBytes 22 | else False 23 | 24 | True 25 | 26 | -------------------------------------------------------------------------------- /tests/standard-library/tree/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/standard-library/tree/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | WAKE="${1:+$1/wake}" 4 | "${WAKE:-wake}" --stdout=warning,report test 5 | -------------------------------------------------------------------------------- /tests/standard-library/tree/stdout: -------------------------------------------------------------------------------- 1 | Pair 6 "A", Pair 1 "B", Pair 12 "C", Pair 0 "D", Pair 13 "E", Pair 5 "F", Nil 2 | -------------------------------------------------------------------------------- /tests/standard-library/tree/test.wake: -------------------------------------------------------------------------------- 1 | def unfiltered = 2 | "D", 3 | "B", 4 | "D", 5 | "B", 6 | "D", 7 | "F", 8 | "A", 9 | "D", 10 | "B", 11 | "D", 12 | "B", 13 | "D", 14 | "C", 15 | "E", 16 | "F", 17 | Nil 18 | def accumulateFn accum str = 19 | tinsertWith (\_\r r) str accum 20 | export def test _ = 21 | zip (len unfiltered | seq) unfiltered 22 | | foldl accumulateFn (tnew (scmp _.getPairSecond _.getPairSecond)) 23 | | treeToList 24 | -------------------------------------------------------------------------------- /tests/type-system/extract-fail/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/type-system/extract-fail/fail.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | WAKE="${1:+$1/wake}" 4 | "${WAKE:-wake}" -q test 5 | -------------------------------------------------------------------------------- /tests/type-system/extract-fail/stderr: -------------------------------------------------------------------------------- 1 | test.wake:29:14: introduced free type variables 'a' and 'b' are actually the same 2 | test.wake:20:[5-33]: type error; expression 'Pair (_: Integer) (_: String)' of type: 3 | Pair Integer String 4 | does not match explicit type ascription of: 5 | Pair Integer Integer 6 | test.wake:25:[5-12]: type error; expression 'Pair _ _' of type: 7 | Pair Integer Integer 8 | does not match explicit type ascription of: 9 | Pair Integer String 10 | test.wake:29:14: introduced free type variables 'a' and 'b' are actually the same 11 | test.wake:5:[59-67]: type error; pattern for case 'Pair' expected type: 12 | Pair Integer String 13 | but the argument 'Pair 44 1' has type: 14 | Pair Integer Integer 15 | test.wake:32:14: introduced type variable 'a' is not free; it has type: 16 | Integer 17 | test.wake:34:20: introduced free type variables 'b' and 'c' are actually the same 18 | test.wake:10:[5-33]: type error; expression 'Pair (_: Integer) (_: String)' of type: 19 | Pair Integer Integer 20 | does not match explicit type ascription of: 21 | Pair Integer String 22 | test.wake:10:[59-67]: type error; pattern for case 'Pair' expected type: 23 | Pair Integer String 24 | but the argument 'Pair 44 1' has type: 25 | Pair Integer Integer 26 | >>> Aborting without execution <<< 27 | -------------------------------------------------------------------------------- /tests/type-system/extract-pass/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/type-system/extract-pass/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | WAKE="${1:+$1/wake}" 4 | "${WAKE:-wake}" -v test 5 | -------------------------------------------------------------------------------- /tests/type-system/extract-pass/test.wake: -------------------------------------------------------------------------------- 1 | def Pair (_: Integer) (_: String) = Pair 44 "as" 2 | def Pair (_: Integer) (_: String): Pair Integer String = Pair 44 "as" 3 | def Pair _ _: Pair Integer String = Pair 44 "as" 4 | 5 | def id x = x 6 | def Pair (_: a => a) (_: b => b) = Pair (id: a => a) (id: b => b) 7 | def Pair (_: (a => b) => (List a => List b)) _ = Pair map 99 8 | 9 | export def test _ = Pass 0 10 | -------------------------------------------------------------------------------- /tests/type-system/lambda-fail/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/type-system/lambda-fail/fail.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | WAKE="${1:+$1/wake}" 4 | "${WAKE:-wake}" -q test 5 | -------------------------------------------------------------------------------- /tests/type-system/lambda-fail/stderr: -------------------------------------------------------------------------------- 1 | test.wake:5:26: type error; function '"{x}"' expected argument of type: 2 | String 3 | but was supplied argument 'x' of type: 4 | Integer 5 | test.wake:10:[11-61]: type error; pattern for case 'Pair' expected type: 6 | Pair Integer String 7 | but the argument '(Pair (x: Inte..String String)' has type: 8 | Pair String String 9 | test.wake:15:[17-28]: type error; function '"{x}-{y}"' expected argument 'x' of type: 10 | String 11 | but was supplied argument '(x: Integer)' of type: 12 | Integer 13 | test.wake:17:15: unbound type variable 'a' 14 | test.wake:22:[5-17]: type error; expression 'f4 (Pair x y)' of type: 15 | Integer 16 | does not match explicit type ascription of: 17 | String 18 | test.wake:27:[27-37]: type error; function 'x + y' expected argument 'y' of type: 19 | Integer 20 | but was supplied argument '(y: String)' of type: 21 | String 22 | test.wake:32:[5-60]: type error; pattern for case 'Pair' expected type: 23 | Pair Integer Integer 24 | but the argument 'f6 (Pair (x: I..nteger String)' has type: 25 | Pair Integer String 26 | >>> Aborting without execution <<< 27 | -------------------------------------------------------------------------------- /tests/type-system/lambda-pass/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/type-system/lambda-pass/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | WAKE="${1:+$1/wake}" 4 | "${WAKE:-wake}" -v test 5 | -------------------------------------------------------------------------------- /tests/type-system/lambda-pass/test.wake: -------------------------------------------------------------------------------- 1 | def f0 = \(x: Integer) (x+1): Integer 2 | def f1 = \(Pair (x: Integer) (y: String): Pair Integer String) "{str x}-{y}" 3 | def f2: a => a = \(x:a) (x:a) 4 | def f3 (Pair x y): Integer = x + y 5 | def f4 (Pair (x: Integer) (y: Integer): Pair Integer Integer): Integer = x + y 6 | 7 | export def test _ = 8 | def _ = 9 | f0 66 10 | | (Pair _ "zz") 11 | | f1 12 | | f2 13 | def _ = f3 (Pair 11 12) 14 | def _ = f4 (Pair 11 12) 15 | Pass 0 16 | -------------------------------------------------------------------------------- /tests/type-system/match-fail/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/type-system/match-fail/fail.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | WAKE="${1:+$1/wake}" 4 | "${WAKE:-wake}" -q test 5 | -------------------------------------------------------------------------------- /tests/type-system/match-fail/stderr: -------------------------------------------------------------------------------- 1 | test.wake:61:12: type error; function 'f8' expected argument of type: 2 | Unit 3 | but was supplied argument '8' of type: 4 | Integer 5 | test.wake:3:16: introduced type variable 'a' is not free; it has type: 6 | Unit 7 | test.wake:[10-11]:[35-13]: type error; expression 'match _\n x: Unit = x' of type: 8 | Unit => Unit 9 | does not match explicit type ascription of: 10 | String => String 11 | test.wake:14:16: introduced free type variables 'a' and 'b' are actually the same 12 | test.wake:19:16: introduced type variable 'a' is not free; it has type: 13 | Integer 14 | test.wake:[27-29]:[36-11]: type error; expression 'match _\n 0 = True\n _ = False' of type: 15 | Integer => Boolean 16 | does not match explicit type ascription of: 17 | String => Boolean 18 | test.wake:36:3: type error; function 'True' expected argument of type: 19 | Integer 20 | but was supplied argument '0' of type: 21 | String 22 | test.wake:43:62: type error; pattern for case 'Pair' expected type: 23 | Pair (Pair Integer String) Boolean 24 | but the argument 'x' has type: 25 | Pair (Pair String String) Boolean 26 | test.wake:53:[14-24]: type error; expression '(_: Double)' of type: 27 | String 28 | does not match explicit type ascription of: 29 | Double 30 | >>> Aborting without execution <<< 31 | -------------------------------------------------------------------------------- /tests/type-system/match-fail/stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sifiveinc/wake/0b5e100b5580bc0503092294254e1f0b5e46e01b/tests/type-system/match-fail/stdout -------------------------------------------------------------------------------- /tests/type-system/match-pass/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/type-system/match-pass/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | WAKE="${1:+$1/wake}" 4 | "${WAKE:-wake}" -v test 5 | -------------------------------------------------------------------------------- /tests/type-system/match-pass/stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sifiveinc/wake/0b5e100b5580bc0503092294254e1f0b5e46e01b/tests/type-system/match-pass/stderr -------------------------------------------------------------------------------- /tests/type-system/match-pass/test.wake: -------------------------------------------------------------------------------- 1 | # This should be polymorphic 2 | def f0: a => a = match _ 3 | x:a = x:a 4 | 5 | # Refining type polymorphic 6 | def f0a: Unit => Unit = f0 7 | def f0b: Integer => Integer = f0 8 | 9 | # The literal should force the type 10 | def f1: Integer => Boolean = match _ 11 | 0 = True 12 | _ = False 13 | 14 | export def test _ = 15 | def Unit = f0a Unit 16 | 17 | require True = 18 | 5 == f0b 5 19 | else 20 | Fail "f0 bad" 21 | 22 | require True = 23 | f1 0 24 | else 25 | Fail "f1 bad" 26 | 27 | Pass "ok" 28 | -------------------------------------------------------------------------------- /tests/type-system/multi-match-fail/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/type-system/multi-match-fail/fail.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | WAKE="${1:+$1/wake}" 4 | "${WAKE:-wake}" -q test 5 | -------------------------------------------------------------------------------- /tests/type-system/multi-match-fail/stderr: -------------------------------------------------------------------------------- 1 | test.wake:11:[3-13]: type error; expression '(_: String)' of type: 2 | Integer 3 | does not match explicit type ascription of: 4 | String 5 | test.wake:10:[3-14]: type error; function 'x+1' expected argument 'x' of type: 6 | Integer 7 | but was supplied argument '(x: Integer)' of type: 8 | String 9 | test.wake:16:25: type error; case analysis of '_' with type: 10 | String 11 | does not match the pattern requirement of type: 12 | Boolean 13 | test.wake:24:[3-13]: type error; function 'x+1' expected argument 'x' of type: 14 | Integer 15 | but was supplied argument '(x: String)' of type: 16 | String 17 | test.wake:30:[12-123]: type error; expression 'f3 (Pair (x: I..teger Integer)' of type: 18 | Integer 19 | does not match explicit type ascription of: 20 | String 21 | test.wake:36:[12-122]: type error; pattern for case 'Pair' expected type: 22 | Pair Integer Integer 23 | but the argument 'f4 (Pair (x: I..nteger String)' has type: 24 | Pair Integer String 25 | test.wake:42:[89-99]: type error; function 'x+y+a+b' expected argument 'b' of type: 26 | Integer 27 | but was supplied argument '(b: String)' of type: 28 | String 29 | >>> Aborting without execution <<< 30 | -------------------------------------------------------------------------------- /tests/type-system/multi-match-fail/stdout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sifiveinc/wake/0b5e100b5580bc0503092294254e1f0b5e46e01b/tests/type-system/multi-match-fail/stdout -------------------------------------------------------------------------------- /tests/type-system/multi-match-pass/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/type-system/multi-match-pass/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | WAKE="${1:+$1/wake}" 4 | "${WAKE:-wake}" -v test 5 | -------------------------------------------------------------------------------- /tests/type-system/multi-match-pass/stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sifiveinc/wake/0b5e100b5580bc0503092294254e1f0b5e46e01b/tests/type-system/multi-match-pass/stderr -------------------------------------------------------------------------------- /tests/type-system/multi-match-pass/test.wake: -------------------------------------------------------------------------------- 1 | # This should type-check 2 | def f0 = match _ _ 3 | (x: Integer) (True: Boolean) = x+1 4 | (x: Integer) (False: Boolean) = x+0 5 | 6 | # So should this 7 | def f1 (Pair (x: Integer) (y: Integer): Pair Integer Integer) (Pair (a: Integer) (b: Integer): Pair Integer Integer): Integer = 8 | x+y+a+b 9 | 10 | export def test _ = 11 | require True = 12 | 12 == f0 11 True 13 | else 14 | Fail "f0 bad" 15 | 16 | require True = 17 | 10 == f1 (Pair 1 2) (Pair 3 4) 18 | else 19 | Fail "f1 bad" 20 | 21 | Pass "ok" 22 | -------------------------------------------------------------------------------- /tests/type-system/require-fail/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/type-system/require-fail/fail.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | WAKE="${1:+$1/wake}" 4 | "${WAKE:-wake}" -q test 5 | -------------------------------------------------------------------------------- /tests/type-system/require-fail/stderr: -------------------------------------------------------------------------------- 1 | test.wake:[21-22]:[3-14]: the required pattern can never fail; use a def instead 2 | test.wake:4:43: unbound type variable 'a' 3 | test.wake:19:22: type error; expression '_' of type: 4 | List String 5 | does not match explicit type ascription of: 6 | List Integer 7 | test.wake:14:[31-36]: type error; pattern for case 'binary ,' expected type: 8 | List String 9 | but the argument 'seq 10' has type: 10 | List Integer 11 | test.wake:9:[31-39]: type error; pattern for case 'Some' expected type: 12 | Option Integer 13 | but the argument 'Some "zz"' has type: 14 | Option String 15 | test.wake:4:20: unbound type variable 'a' 16 | >>> Aborting without execution <<< 17 | -------------------------------------------------------------------------------- /tests/type-system/require-fail/test.wake: -------------------------------------------------------------------------------- 1 | def test _ = 2 | # Unbound type variable at 'a' (test.wake:4:43) 3 | # Unbound type variable at 'a' (test.wake:4:20) 4 | require Pass (_: a) = Fail "xx": Result a String 5 | # Pattern for case 'Some' expected type: 6 | # Option Integer 7 | # but the argument 'Some "zz"' (test.wake:9:[31-39]) has type: 8 | # Option String 9 | require Some (_: Integer) = Some "zz" 10 | # Pattern for case 'binary ,' expected type: 11 | # List String 12 | # but the argument 'seq 10' (test.wake:14:[31-36]) has type: 13 | # List Integer 14 | require _: String, _, Nil = seq 10 15 | # Type error; expression '_' (test.wake:19:22) of type: 16 | # List String 17 | # does not match explicit type ascription at test.wake:19:[25-36] of: 18 | # List Integer 19 | require _: String, _: List Integer = seq 10 20 | # The required pattern at test.wake:[21-22]:[3-14] can never fail; use def instead. 21 | require _: Integer = 98 22 | Pass "hello" 23 | -------------------------------------------------------------------------------- /tests/type-system/require-pass/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/type-system/require-pass/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | WAKE="${1:+$1/wake}" 4 | "${WAKE:-wake}" -v test 5 | -------------------------------------------------------------------------------- /tests/type-system/require-pass/test.wake: -------------------------------------------------------------------------------- 1 | def f0 x = 2 | require Some (_: Integer): Option Integer = int x 3 | else Fail "bad" : Result String String 4 | 5 | require Pass (_: Double) = Fail "ok" : Result Double String 6 | 7 | Pass "unreachable" 8 | 9 | export def test _ = 10 | require Fail z = f0 "22" 11 | Pass z 12 | -------------------------------------------------------------------------------- /tests/type-system/value-restriction/.wakeroot: -------------------------------------------------------------------------------- 1 | {"log_header":"", "log_header_source_width":0} 2 | -------------------------------------------------------------------------------- /tests/type-system/value-restriction/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | WAKE="${1:+$1/wake}" 4 | "${WAKE:-wake}" -v test 5 | -------------------------------------------------------------------------------- /tests/type-system/value-restriction/test.wake: -------------------------------------------------------------------------------- 1 | def foo _ x = x 2 | # wake is not Standard ML; 'id' should still be polymorphic (no value restriction) 3 | def id = foo Unit 4 | 5 | export def test _ = println "{str (id 4)}-{id "2"}" 6 | -------------------------------------------------------------------------------- /tests/wake-format/bad-no-format/bad-no-format.wake: -------------------------------------------------------------------------------- 1 | def name Unit = 2 | # wake-format off 3 | def other = 4 | here 5 | def other = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" 6 | another 7 | -------------------------------------------------------------------------------- /tests/wake-format/bad-no-format/fail.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | "${1}/wake-format" --no-rng bad-no-format.wake 4 | CODE="$?" 5 | 6 | rm bad-no-format.wake.tmp.00000000000000000000000000000000 7 | 8 | exit $CODE 9 | -------------------------------------------------------------------------------- /tests/wake-format/bad-no-format/stderr: -------------------------------------------------------------------------------- 1 | wake-format failed to format 'bad-no-format.wake'. 2 | This is probably due to bad indentation caused by '# wake-format off' 3 | Please complete the following steps: 4 | 1) Submit a copy of 'bad-no-format.wake' to the wake-format authors so they can improve the tool. 5 | 2) Review 'bad-no-format.wake.tmp.00000000000000000000000000000000' for the syntax errors mentioned below. 6 | 3) Edit 'bad-no-format.wake' to have the correct indentation expected by wake-format 7 | 8 | bad-no-format.wake.tmp.00000000000000000000000000000000:3:17: syntax error; definitions must be followed by an '= expression' 9 | bad-no-format.wake.tmp.00000000000000000000000000000000:4:9: syntax error; found '\n', a newline, but was expecting one of: 10 | decreased-indentation 11 | 12 | -------------------------------------------------------------------------------- /tests/wake-format/basic/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | tmp=$(mktemp ./basic.wake.XXXXXX) 4 | out=$(mktemp ./basic.wake.out.XXXXXX) 5 | 6 | # Running wake-format on itself shouldn't create any new changes 7 | "${1}/wake-format" basic.wake > "$tmp" 8 | "${1}/wake-format" "$tmp" > "$out" 9 | 10 | # nothing output if they are the same 11 | diff "$out" "$tmp" 12 | 13 | # re-emit to compare against stdout 14 | cat "$out" 15 | 16 | rm "$out" 17 | rm "$tmp" 18 | -------------------------------------------------------------------------------- /tests/wake-format/basic/stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sifiveinc/wake/0b5e100b5580bc0503092294254e1f0b5e46e01b/tests/wake-format/basic/stderr -------------------------------------------------------------------------------- /tests/wake-format/disallowed-input/disallowed-input.wake: -------------------------------------------------------------------------------- 1 | # Input that wake-format doesn't attempt to format correctly 2 | 3 | def t10 = ( 4 | x 5 | + 5 6 | # comment 7 | ) 8 | 9 | def t11 = ( 10 | x 11 | + 5 # comment 12 | # comment 13 | # comment 14 | ) 15 | 16 | def t12 = ( 17 | x 18 | + 5 19 | # comment 20 | # comment 21 | # comment 22 | ) 23 | 24 | # trailing comment -------------------------------------------------------------------------------- /tests/wake-format/disallowed-input/pass.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | tmp=$(mktemp ./basic.wake.XXXXXX) 4 | out=$(mktemp ./basic.wake.out.XXXXXX) 5 | 6 | # Running wake-format on itself shouldn't create any new changes 7 | "${1}/wake-format" disallowed-input.wake > "$tmp" 8 | "${1}/wake-format" "$tmp" > "$out" 9 | 10 | # nothing output if they are the same 11 | diff "$out" "$tmp" 12 | 13 | # re-emit to compare against stdout 14 | cat "$out" 15 | 16 | rm "$out" 17 | rm "$tmp" 18 | -------------------------------------------------------------------------------- /tests/wake-format/disallowed-input/stdout: -------------------------------------------------------------------------------- 1 | # Input that wake-format doesn't attempt to format correctly 2 | 3 | def t10 = 4 | ( 5 | x + 5 6 | # comment 7 | ) 8 | 9 | def t11 = 10 | ( 11 | x + 5 # comment 12 | # comment 13 | # comment 14 | ) 15 | 16 | def t12 = 17 | ( 18 | x + 5 19 | # comment 20 | # comment 21 | # comment 22 | ) 23 | 24 | # trailing comment 25 | 26 | -------------------------------------------------------------------------------- /tests/wake-unit/stderr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sifiveinc/wake/0b5e100b5580bc0503092294254e1f0b5e46e01b/tests/wake-unit/stderr -------------------------------------------------------------------------------- /tests/wake-unit/unit-test.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | set -e 4 | 5 | TERM=xterm-256color script --return --quiet -c "$1 --no-color --tag threaded" /dev/null 6 | 7 | # We run the tests *twice* so that shared caching can run without a clean slate 8 | TERM=xterm-256color script --return --quiet -c "$1 --no-color --tag threaded" /dev/null > /dev/null 9 | 10 | rm -rf job_cache_test 11 | rm -rf .job_cache_test 12 | rm -rf job_cache_test2 13 | rm -rf .job_cache_test2 -------------------------------------------------------------------------------- /tests/wakebox/false/.wakeroot: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/wakebox/false/fail.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # It's not valid to call wakebox with an empty PATH. 3 | # So we fill PATH with some typical values. 4 | export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin 5 | 6 | ${1}/wakebox -p input.json 7 | -------------------------------------------------------------------------------- /tests/wakebox/false/input.json: -------------------------------------------------------------------------------- 1 | { 2 | "command": [ 3 | "false" 4 | ], 5 | "environment": [ 6 | "USER=root", 7 | "HOME=/root", 8 | "PATH=/usr/bin:/bin:/usr/sbin:/sbin" 9 | ], 10 | "directory": ".", 11 | "stdin": "", 12 | "user-id": 0, 13 | "group-id": 0, 14 | "mount-ops": [], 15 | "visible": [] 16 | } 17 | -------------------------------------------------------------------------------- /tests/wakebox/hardlink/input.json: -------------------------------------------------------------------------------- 1 | { 2 | "command": [ 3 | "/bin/sh", 4 | "-c", 5 | "touch link_file_src.txt\nln link_file_src.txt link_file_dst.txt\necho \"pass\" > link_file_src.txt\ncat link_file_dst.txt" 6 | ], 7 | "environment": [ 8 | "USER=root", 9 | "HOME=/root", 10 | "PATH=/usr/bin:/bin:/usr/sbin:/sbin" 11 | ], 12 | "directory": ".", 13 | "stdin": "", 14 | "user-id": 0, 15 | "group-id": 0, 16 | "mount-ops": [ 17 | { 18 | "type": "workspace", 19 | "destination": "." 20 | } 21 | ], 22 | "visible": [] 23 | } 24 | -------------------------------------------------------------------------------- /tests/wakebox/hardlink/pass.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # It's not valid to call wakebox with an empty PATH. 3 | # So we fill PATH with some typical values. 4 | export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin 5 | 6 | trap 'rm link_file_src.txt link_file_dst.txt' EXIT 7 | 8 | STDOUT=$(${1}/wakebox -p input.json) 9 | 10 | [ "$STDOUT" = "pass" ] || exit 1 11 | -------------------------------------------------------------------------------- /tests/wakebox/isolate-retcode/.wakeroot: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/wakebox/isolate-retcode/input.json: -------------------------------------------------------------------------------- 1 | { 2 | "command": [ 3 | "sh", "-c", "exit 97" 4 | ], 5 | "environment": [ 6 | "USER=root", 7 | "HOME=/root", 8 | "PATH=/usr/bin:/bin:/usr/sbin:/sbin" 9 | ], 10 | "directory": ".", 11 | "stdin": "", 12 | "user-id": 0, 13 | "group-id": 0, 14 | "mount-ops": [], 15 | "visible": [] 16 | } 17 | -------------------------------------------------------------------------------- /tests/wakebox/isolate-retcode/pass.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # It's not valid to call wakebox with an empty PATH. 3 | # So we fill PATH with some typical values. 4 | export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin 5 | 6 | 7 | ${1}/wakebox -I -p input.json -o result.json 8 | RET=$? 9 | 10 | trap "rm result.json" EXIT 11 | 12 | [ $RET -ne 0 ] && exit 99 13 | 14 | [ $(cat result.json | jq .usage.status) -ne 97 ] && exit 98 15 | 16 | exit 0 17 | -------------------------------------------------------------------------------- /tests/wakebox/loopback-up/.wakeroot: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/wakebox/loopback-up/input.json: -------------------------------------------------------------------------------- 1 | { 2 | "command": [ 3 | "ip", "addr", "show", "dev", "lo" 4 | ], 5 | "environment": [ 6 | "USER=root", 7 | "HOME=/root", 8 | "PATH=/usr/bin:/bin:/usr/sbin:/sbin" 9 | ], 10 | "directory": ".", 11 | "stdin": "", 12 | "user-id": 0, 13 | "group-id": 0, 14 | "isolate-network": true, 15 | "mount-ops": [], 16 | "visible": [] 17 | } 18 | -------------------------------------------------------------------------------- /tests/wakebox/loopback-up/pass.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # It's not valid to call wakebox with an empty PATH. 3 | # So we fill PATH with some typical values. 4 | export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin 5 | 6 | # capture the output, and then print it out on error 7 | 8 | STDOUT=$(${1}/wakebox -p input.json) 9 | RET="$?" 10 | 11 | if [ "$RET" -ne 0 ] || [ ! $(echo "$STDOUT" | grep -o UP | head -1) = "UP" ]; then 12 | echo $STDOUT 1>&2 13 | exit 1 14 | fi 15 | -------------------------------------------------------------------------------- /tests/wakebox/timeout-exceeded/.wakeroot: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/wakebox/timeout-exceeded/input.json: -------------------------------------------------------------------------------- 1 | { 2 | "command": [ 3 | "/bin/sh", "-c", "touch hello; sleep 2 && true" 4 | ], 5 | "environment": [ 6 | "USER=root", 7 | "HOME=/root", 8 | "PATH=/usr/bin:/bin:/usr/sbin:/sbin" 9 | ], 10 | "directory": ".", 11 | "stdin": "", 12 | "user-id": 0, 13 | "group-id": 0, 14 | "mount-ops": [ 15 | { 16 | "type": "workspace", 17 | "destination": "." 18 | } 19 | ], 20 | "visible": [], 21 | "command-timeout": 1, 22 | } 23 | -------------------------------------------------------------------------------- /tests/wakebox/timeout-exceeded/pass.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # It's not valid to call wakebox with an empty PATH. 4 | # So we fill PATH with some typical values. 5 | export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin 6 | 7 | ${1}/wakebox -p input.json -o result.json 8 | 9 | trap "rm result.json hello" EXIT 10 | 11 | [ "$(cat result.json | jq '."timed-out"')" = "true" ] && \ 12 | [ "$(cat result.json | jq -r '.outputs[]')" = "hello" ] && exit 0 13 | 14 | exit 1 15 | -------------------------------------------------------------------------------- /tests/wakebox/timeout-met/.wakeroot: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/wakebox/timeout-met/input.json: -------------------------------------------------------------------------------- 1 | { 2 | "command": [ 3 | "/bin/sh", "-c", "sleep 1 && true" 4 | ], 5 | "environment": [ 6 | "USER=root", 7 | "HOME=/root", 8 | "PATH=/usr/bin:/bin:/usr/sbin:/sbin" 9 | ], 10 | "directory": ".", 11 | "stdin": "", 12 | "user-id": 0, 13 | "group-id": 0, 14 | "mount-ops": [], 15 | "visible": [], 16 | "command-timeout": 5 17 | } 18 | -------------------------------------------------------------------------------- /tests/wakebox/timeout-met/pass.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # It's not valid to call wakebox with an empty PATH. 4 | # So we fill PATH with some typical values. 5 | export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin 6 | 7 | ${1}/wakebox -p input.json -o result.json 8 | 9 | trap "rm result.json" EXIT 10 | 11 | [ "$(cat result.json | jq '."timed-out"')" = "false" ] && exit 0 12 | 13 | exit 1 14 | -------------------------------------------------------------------------------- /tests/wakebox/true/.wakeroot: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/wakebox/true/input.json: -------------------------------------------------------------------------------- 1 | { 2 | "command": [ 3 | "true" 4 | ], 5 | "environment": [ 6 | "USER=root", 7 | "HOME=/root", 8 | "PATH=/usr/bin:/bin:/usr/sbin:/sbin" 9 | ], 10 | "directory": ".", 11 | "stdin": "", 12 | "user-id": 0, 13 | "group-id": 0, 14 | "mount-ops": [], 15 | "visible": [] 16 | } 17 | -------------------------------------------------------------------------------- /tests/wakebox/true/pass.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # It's not valid to call wakebox with an empty PATH. 3 | # So we fill PATH with some typical values. 4 | export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin 5 | 6 | ${1}/wakebox -p input.json 7 | -------------------------------------------------------------------------------- /tools/bsp-wake/bsp.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2019 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | 20 | target buildBSP variant: Result (List Path) Error = 21 | tool @here Nil variant "lib/wake/bsp-wake" (json, util, Nil) Nil Nil 22 | -------------------------------------------------------------------------------- /tools/fuse-waked/fuse-waked.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2019 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | from gcc_wake import _ 20 | 21 | target buildFuseDaemon variant: Result (List Path) Error = match variant 22 | _ -> tool @here Nil variant "lib/wake/fuse-waked" (json, fuse, util, Nil) Nil Nil 23 | -------------------------------------------------------------------------------- /tools/job-cache/job-cache.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2023 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | 20 | target buildJobCache variant: Result (List Path) Error = 21 | tool @here Nil variant "bin/job-cache" (jobCacheLib, util, Nil) Nil Nil 22 | -------------------------------------------------------------------------------- /tools/lsp-wake/lsp.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2021 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | 20 | target buildLSP variant: Result (List Path) Error = match variant 21 | Pair "wasm-cpp14-release" _ -> 22 | # wake-format off 23 | def extraLFlags = 24 | "-s", 'EXPORTED_FUNCTIONS=_instantiateServer,_processRequest', 25 | "-s", 'DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=[$cwrap]', 26 | "-s", 'EXPORT_NAME="wakeLspModule"', 27 | 28 | tool @here Nil variant "lib/wake/lsp-wake" (dst, util, wcl, Nil) Nil extraLFlags 29 | _ -> tool @here Nil variant "lib/wake/lsp-wake" (dst, util, wcl, Nil) Nil Nil 30 | -------------------------------------------------------------------------------- /tools/shim-wake/shim.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2019 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | from gcc_wake import _ 20 | 21 | target buildShim variant: Result (List Path) Error = 22 | tool @here Nil variant "lib/wake/shim-wake" (blake2, compat, wcl, Nil) Nil Nil 23 | -------------------------------------------------------------------------------- /tools/wake-format/wake-format.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2022 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | 20 | target buildWakeFormat variant = 21 | tool @here Nil variant "bin/wake-format" (parser, gopt, wcl, util, dst, Nil) Nil Nil 22 | -------------------------------------------------------------------------------- /tools/wake-hash/hash.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2023 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | from gcc_wake import _ 20 | 21 | target buildHash variant: Result (List Path) Error = 22 | tool @here Nil variant "lib/wake/wake-hash" (blake2, compat, Nil) Nil Nil 23 | -------------------------------------------------------------------------------- /tools/wake-unit/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include "unit.h" 19 | 20 | TEST(sanity_check1) { 21 | EXPECT_EQUAL("foo", "foo"); 22 | ASSERT_EQUAL("bar", "bar"); 23 | EXPECT_EQUAL(10, 10); 24 | ASSERT_EQUAL(11, 11); 25 | } 26 | 27 | TEST(sanity_check2) { 28 | EXPECT_TRUE(true); 29 | ASSERT_TRUE(true); 30 | EXPECT_FALSE(false); 31 | ASSERT_FALSE(false); 32 | } 33 | -------------------------------------------------------------------------------- /tools/wake-unit/wake-unit.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2019 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | 20 | export target buildWakeUnit variant = 21 | tool @here Nil variant "bin/wake-unit" (ncurses, runtime, wcl, Nil) Nil Nil 22 | -------------------------------------------------------------------------------- /tools/wake/markup.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef MARKUP_H 19 | #define MARKUP_H 20 | 21 | #include 22 | #include 23 | #include 24 | 25 | struct Expr; 26 | 27 | void markup_json(const std::string &libdir, std::ostream &os, Expr *root); 28 | void markup_html(const std::string &libdir, std::ostream &os, Expr *root); 29 | void format_reexports(std::ostream &os, const char *package, const char *kind, 30 | const std::vector &mixed); 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /tools/wake/wake.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2021 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | 20 | target buildWake variant = 21 | tool @here Nil variant "bin/wake" (runtime, gopt, Nil) Nil Nil 22 | -------------------------------------------------------------------------------- /tools/wakebox/wakebox.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2021 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | 20 | target buildWakeBox variant = 21 | tool @here Nil variant "bin/wakebox" (json, gopt, wakefs, util, Nil) Nil Nil 22 | -------------------------------------------------------------------------------- /vendor/blake2/blake2.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2019 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | 20 | target blake2 variant = 21 | vendor @here variant "1.0" `.*\.h` `.*\.c` 22 | -------------------------------------------------------------------------------- /vendor/blake2/config.h: -------------------------------------------------------------------------------- 1 | #define SUFFIX 2 | -------------------------------------------------------------------------------- /vendor/fuse.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2019 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | 20 | def fuse _ = 21 | Pass (pkg "fuse") 22 | -------------------------------------------------------------------------------- /vendor/gmp.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2019 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | 20 | def gmp _ = 21 | Pass (pkg "gmp") 22 | -------------------------------------------------------------------------------- /vendor/gopt/CHANGELOG.txt: -------------------------------------------------------------------------------- 1 | 10.0: complete rewrite 2 | -------------------------------------------------------------------------------- /vendor/gopt/LICENSE.TFL: -------------------------------------------------------------------------------- 1 | The Truly Free Licence 2 | 3 | The Truly Free Licence (TFL) is a complete abandonment of all intellectual property rights: 4 | 5 | I, Tom Vajzovic, am the author of this software and its documentation. I 6 | permanently abandon all intellectual property rights in them, including 7 | copyright, trademarks, design rights, database right, patents, and the right 8 | to be identified as the author. 9 | 10 | I am fairly certain that the software does what the documentation says it 11 | does, but I do not guarantee that it does, or that it does what you think it 12 | should. I do not guarantee that it will not have undesirable effects. 13 | 14 | You are free to use, modify and distribute this software as you please, but 15 | you do so at your own risk. If you do not pass on this warning then you may 16 | be responsible for any problems encountered by those who obtain the software 17 | through you. 18 | 19 | This means that I give you permission to do any of the following (all of 20 | which might otherwise be objectionable or unlawful): 21 | 22 | - make money out of my software and not give me a share 23 | - distribute my software and remove my name or contact details from it 24 | - make modifications to my software and retain intellectual property rights in them 25 | -------------------------------------------------------------------------------- /vendor/gopt/README.txt: -------------------------------------------------------------------------------- 1 | gopt.h: header file including full documentation 2 | gopt.c: source code 3 | gopt-errors.c: source code for optional error message function 4 | gopt-usage.c: example program 5 | -------------------------------------------------------------------------------- /vendor/gopt/gopt-arg.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | #include "gopt-arg.h" 23 | 24 | struct option *arg(struct option opts[], const char *name) { 25 | for (int i = 0; !(opts[i].flags & GOPT_LAST); ++i) 26 | if (!strcmp(opts[i].long_name, name)) 27 | return opts + i; 28 | 29 | fprintf(stderr, "Wake option parser bug: %s\n", name); 30 | exit(1); 31 | } 32 | -------------------------------------------------------------------------------- /vendor/gopt/gopt-arg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 SiFive, Inc. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You should have received a copy of LICENSE.Apache2 along with 7 | * this software. If not, you may obtain a copy at 8 | * 9 | * https://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | #ifndef GOPT_ARG_H_INCLUDED 19 | #define GOPT_ARG_H_INCLUDED 20 | 21 | #include "gopt.h" 22 | 23 | #ifdef __cplusplus 24 | extern "C" { 25 | #endif 26 | 27 | /* 28 | Search for an option by long name. 29 | */ 30 | struct option *arg(struct option opts[], const char *name); 31 | 32 | #ifdef __cplusplus 33 | } 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /vendor/gopt/gopt.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2019 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | 20 | target gopt variant = 21 | vendor @here variant "10.0" `.*\.h` `gopt(|-errors|-arg).c` 22 | -------------------------------------------------------------------------------- /vendor/ncurses.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2019 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | from gcc_wake import _ 20 | 21 | def ncurses = match _ 22 | Pair "wasm-cpp14-release" _ -> Pass (makeSysLib "ncurses") 23 | _ -> 24 | pkgConfig "ncurses tinfo" 25 | | getOrElseFn (\Unit pkg "ncurses") 26 | | editSysLibCFlags (filter (matches `-I.*` _)) # remove feature test manipulation 27 | | Pass 28 | -------------------------------------------------------------------------------- /vendor/re2.patch: -------------------------------------------------------------------------------- 1 | --- util/mutex.h.orig 2021-08-29 10:01:58.819148565 -0700 2 | +++ util/mutex.h 2021-08-29 10:02:29.611102870 -0700 3 | @@ -26,7 +26,9 @@ 4 | #endif 5 | #endif 6 | 7 | -#if defined(MUTEX_IS_WIN32_SRWLOCK) 8 | +#if defined(NO_THREADS) 9 | +typedef char MutexType; 10 | +#elif defined(MUTEX_IS_WIN32_SRWLOCK) 11 | typedef SRWLOCK MutexType; 12 | #elif defined(MUTEX_IS_PTHREAD_RWLOCK) 13 | #include 14 | @@ -64,7 +66,16 @@ 15 | Mutex& operator=(const Mutex&) = delete; 16 | }; 17 | 18 | -#if defined(MUTEX_IS_WIN32_SRWLOCK) 19 | +#if defined(NO_THREADS) 20 | + 21 | +Mutex::Mutex() { } 22 | +Mutex::~Mutex() { } 23 | +void Mutex::Lock() { } 24 | +void Mutex::Unlock() { } 25 | +void Mutex::ReaderLock() { } 26 | +void Mutex::ReaderUnlock() { } 27 | + 28 | +#elif defined(MUTEX_IS_WIN32_SRWLOCK) 29 | 30 | Mutex::Mutex() { InitializeSRWLock(&mutex_); } 31 | Mutex::~Mutex() { } 32 | -------------------------------------------------------------------------------- /vendor/siphash/siphash.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2019 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | 20 | target siphash variant = 21 | vendor @here variant "1.0" `.*\.h` `.*\.c` 22 | -------------------------------------------------------------------------------- /vendor/sqlite3.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2019 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | 20 | def sqlite3 _ = 21 | Pass (pkg "sqlite3") 22 | -------------------------------------------------------------------------------- /vendor/utf8proc/LICENSE.MIT: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person obtaining a 2 | copy of this software and associated documentation files (the "Software"), 3 | to deal in the Software without restriction, including without limitation 4 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | and/or sell copies of the Software, and to permit persons to whom the 6 | Software is furnished to do so, subject to the following conditions: 7 | 8 | The above copyright notice and this permission notice shall be included in 9 | all copies or substantial portions of the Software. 10 | 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 16 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 17 | DEALINGS IN THE SOFTWARE. 18 | -------------------------------------------------------------------------------- /vendor/utf8proc/utf8proc.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2019 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | from gcc_wake import _ 20 | 21 | # Prefer to use system utf8proc if available 22 | def utf8proc variant = match (pkgConfig "utf8proc") 23 | Some x -> Pass x 24 | None -> vendor @here variant "2.2.0" `.*\.h|utf8proc_data\.c` `utf8proc\.c` 25 | -------------------------------------------------------------------------------- /vendor/whereami/LICENSE.WTFPLv2: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- 2 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 3 | Version 2, December 2004 4 | 5 | Copyright (C) 2004 Sam Hocevar 6 | 7 | Everyone is permitted to copy and distribute verbatim or modified 8 | copies of this license document, and changing it is allowed as long 9 | as the name is changed. 10 | 11 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 12 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 13 | 14 | 0. You just DO WHAT THE FUCK YOU WANT TO. 15 | 1. Bla bla bla 16 | 2. Montesqieu et camembert, vive la France, zut alors! 17 | 18 | -------------------------------------------------------------------------------- 19 | 20 | WTFPLv2 is very permissive, see http://www.wtfpl.net/faq/ 21 | 22 | However, if this WTFPLV2 is REALLY a blocker and is the reason you can't use 23 | this project, contact me and I'll dual license it. 24 | 25 | -------------------------------------------------------------------------------- 26 | -------------------------------------------------------------------------------- /vendor/whereami/whereami.wake: -------------------------------------------------------------------------------- 1 | # Copyright 2019 SiFive, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You should have received a copy of LICENSE.Apache2 along with 6 | # this software. If not, you may obtain a copy at 7 | # 8 | # https://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | package build_wake 17 | 18 | from wake import _ 19 | 20 | target whereami variant = 21 | vendor @here variant "1.0" `.*\.h` `.*\.c` 22 | --------------------------------------------------------------------------------