grain icon indicating copy to clipboard operation
grain copied to clipboard

feat(silo): Initial Silo scaffolding

Open ospencer opened this issue 2 months ago • 0 comments

This PR does some initial project scaffolding for Silo, Grain's new project manager and build system. This isn't quite an initial version, but rather some project setup to provide a foundation for us to work from as we build out functionality. It's not yet hooked up to our release process to allow us to continue Grain releases while we develop Silo in tandem.

Two commands are present, new and build:

$ silo --help
Build and manage Grain projects 🌾

Usage: silo [options] <command>

Options:
    -h, -help, --help  Display help
    -v, --version      Print version and exit

Commands:
    new    Create a new Grain project
    build  Compile the current project

Run silo <command> --help for help with individual commands.

Silo will eventually manage build artifacts itself rather than offload that functionality to grainc, manage dependencies (including the standard library), run wasm files, and more (though not necessarily all of these before an initial release).

As Silo does not yet handle dependencies/stdlib, build.stdlib must be set in your silo.toml to build projects.

I put together a Silo README as a basis for our Silo documentation which includes the following silo.toml configuration information, but I put it here in the PR description as well for easy access.

[package]
name = "my-package" # the name of this package

[build]
elide-type-info = false # compiles without Grain type info
include-dirs = ["../dir1", "../dir2"] # add paths to compiler code lookup
import-memory = false # imports the wasm memory instead of exporting one
initial-memory-pages = 64 # the number of wasm memory pages to start with
maximum-memory-pages = 128 # the limit of wasm memory pages to grow to
memory-base = 4096 # the memory address to begin Grain allocations
gc = true # enable or disable Grain's garbage collector
stdlib = "../custom-stdlib" # set the location of the standard library to use
use-start-section = false # use a wasm (start) section to run code on startup
wasi-polyfill = "src/wasi-polyfill.gr" # code to polyfill wasi imports

[build.wasm-features]
bulk-memory = true # enable or disable wasm bulk memory
tail-call = true # enable or disable wasm tail calls

[bin]
name = "my-name.wasm" # the name of the resulting wasm file
path = "src/main.gr" # the entrypoint of compilation
source-map = false # produce a source map file
wat = false # produce a WebAssembly Text (.wat) file

ospencer avatar Apr 21 '24 22:04 ospencer