plum

#treesitter#compiler#wasm

git clone https://git.pyrossh.dev/plum

A statically typed, imperative programming language inspired by rust, python


a473b02 — Peter John 2026-09-18T11:05:35+05:30
build: add release binary tooling (cross, R2 upload, versioned README links)
Files changed (3) hide show
  1. .gitignore +3 -0
  2. Makefile.toml +129 -0
  3. README.md +22 -0
.gitignore CHANGED
@@ -15,3 +15,6 @@ codegen
15
15
  # Added by cargo
16
16
 
17
17
  /target
18
+
19
+ # `cargo make dist-macos`/`dist-linux-docker` output — uploaded to R2, not committed
20
+ /dist
Makefile.toml CHANGED
@@ -66,3 +66,132 @@ if [ "$found_vscode" = "0" ]; then
66
66
  echo "VSCode not installed (run \`plum editor vscode\` first) — skipping"
67
67
  fi
68
68
  '''
69
+
70
+ # ---- release binaries -------------------------------------------------------
71
+ #
72
+ # Only the `plum` binary itself is distributed — `plum-lsp`, the tree-sitter
73
+ # grammar `.so`, and the VSCode extension bundle are all embedded INTO it by
74
+ # plum-cli/build.rs already, and `plum editor helix`/`vscode` extract them at
75
+ # install time. There's nothing separate to ship.
76
+ #
77
+ # Linux/Windows are cross-compiled via https://github.com/cross-rs/cross
78
+ # (`cargo install cross --git https://github.com/cross-rs/cross`, needs
79
+ # Docker) — it ships a proper per-target C toolchain (gcc-multilib for Linux,
80
+ # mingw-w64 for Windows), which a bare `cargo build --target ...` doesn't have
81
+ # and this project needs (tree-sitter's scanner.c/parser.c are compiled via
82
+ # the `cc` crate). macOS still builds natively since that's what's running
83
+ # this Makefile.
84
+ #
85
+ # `cargo make release` is the one-shot version: builds all 3 platforms, tags
86
+ # v<version> locally, regenerates README.md's download links, and uploads
87
+ # everything to R2. Version comes from plum-cli/Cargo.toml — bump that first.
88
+
89
+ [env]
90
+ PLUM_VERSION = { script = ["grep -m1 '^version' plum-cli/Cargo.toml | sed -E 's/version = \"(.*)\"/\\1/'"] }
91
+
92
+ [tasks.dist-macos]
93
+ description = "Build a release plum-cli binary for this Mac into dist/plum-cli/"
94
+ script_runner = "@shell"
95
+ script = '''
96
+ set -e
97
+ cargo build --release -p plum-cli
98
+ mkdir -p dist/plum-cli
99
+ ARCH=$(uname -m)
100
+ case "$ARCH" in
101
+ arm64|aarch64) ARCH=arm64 ;;
102
+ x86_64) ARCH=x86_64 ;;
103
+ esac
104
+ OUT="dist/plum-cli/plum-darwin-$ARCH"
105
+ cp target/release/plum "$OUT"
106
+ echo "built $OUT"
107
+ '''
108
+
109
+ [tasks.dist-linux]
110
+ description = "Cross-build a release plum-cli binary for Linux x86_64 (via `cross`) into dist/plum-cli/"
111
+ script_runner = "@shell"
112
+ script = '''
113
+ set -e
114
+ cross build --release -p plum-cli --target x86_64-unknown-linux-gnu
115
+ mkdir -p dist/plum-cli
116
+ cp target/x86_64-unknown-linux-gnu/release/plum dist/plum-cli/plum-linux-x86_64
117
+ echo "built dist/plum-cli/plum-linux-x86_64"
118
+ '''
119
+
120
+ [tasks.dist-windows]
121
+ description = "Cross-build a release plum-cli binary for Windows x86_64 (via `cross`) into dist/plum-cli/"
122
+ script_runner = "@shell"
123
+ script = '''
124
+ set -e
125
+ cross build --release -p plum-cli --target x86_64-pc-windows-gnu
126
+ mkdir -p dist/plum-cli
127
+ cp target/x86_64-pc-windows-gnu/release/plum.exe dist/plum-cli/plum-windows-x86_64.exe
128
+ echo "built dist/plum-cli/plum-windows-x86_64.exe"
129
+ '''
130
+
131
+ [tasks.dist-all]
132
+ description = "Build release plum-cli binaries for macOS, Linux, and Windows into dist/plum-cli/"
133
+ dependencies = ["dist-macos", "dist-linux", "dist-windows"]
134
+
135
+ [tasks.tag-release]
136
+ description = "Create a local git tag v<version> (from plum-cli/Cargo.toml) for this release, if it doesn't already exist"
137
+ script_runner = "@shell"
138
+ script = '''
139
+ set -e
140
+ TAG="v${PLUM_VERSION}"
141
+ if git rev-parse "$TAG" >/dev/null 2>&1; then
142
+ echo "tag $TAG already exists, skipping"
143
+ else
144
+ git tag -a "$TAG" -m "plum-cli $TAG"
145
+ echo "created tag $TAG locally — push it yourself with: git push origin $TAG"
146
+ fi
147
+ '''
148
+
149
+ [tasks.update-readme]
150
+ description = "Rewrite README.md's prebuilt-binaries block (between the <!-- prebuilt-binaries:... --> markers) to point at the current version"
151
+ script_runner = "@shell"
152
+ script = '''
153
+ set -e
154
+ BASE="https://git.pyrossh.dev/releases/plum-cli/v${PLUM_VERSION}"
155
+ awk -v base="$BASE" '
156
+ /<!-- prebuilt-binaries:start -->/ {
157
+ print
158
+ print "| Platform | Download |"
159
+ print "| --- | --- |"
160
+ print "| macOS (Apple Silicon) | [plum-darwin-arm64](" base "/plum-darwin-arm64) |"
161
+ print "| Linux (x86_64) | [plum-linux-x86_64](" base "/plum-linux-x86_64) |"
162
+ print "| Windows (x86_64) | [plum-windows-x86_64.exe](" base "/plum-windows-x86_64.exe) |"
163
+ print ""
164
+ print "Make it executable and put it on your `PATH`, e.g. on macOS/Linux:"
165
+ print ""
166
+ print "```sh"
167
+ print "curl -L -o plum " base "/plum-darwin-arm64"
168
+ print "chmod +x plum"
169
+ print "mv plum ~/.cargo/bin/plum # or anywhere else already on your PATH"
170
+ print "```"
171
+ in_block = 1
172
+ next
173
+ }
174
+ /<!-- prebuilt-binaries:end -->/ { in_block = 0 }
175
+ in_block == 1 { next }
176
+ { print }
177
+ ' README.md > README.md.tmp
178
+ mv README.md.tmp README.md
179
+ echo "updated README.md prebuilt-binaries links to v${PLUM_VERSION}"
180
+ '''
181
+
182
+ [tasks.release]
183
+ description = "Build macOS/Linux/Windows release binaries, tag v<version>, update README download links, and upload all 3 to R2 (requires the `git` rclone remote — see `rclone config show git`)"
184
+ dependencies = ["dist-all", "tag-release", "update-readme"]
185
+ script_runner = "@shell"
186
+ script = '''
187
+ set -e
188
+ # `--s3-no-check-bucket`: the R2 access token here is scoped to this one
189
+ # bucket with no ListBuckets/CreateBucket permission, so rclone's default
190
+ # "does this bucket exist?" preflight (which needs one of those) fails —
191
+ # skip it and assume the bucket (already created out-of-band) exists.
192
+ rclone copy dist/plum-cli/ "git:git/releases/plum-cli/v${PLUM_VERSION}/" --s3-no-check-bucket --progress
193
+ echo ""
194
+ echo "published v${PLUM_VERSION}. Remaining steps:"
195
+ echo " git add README.md && git commit -m \"release v${PLUM_VERSION}\""
196
+ echo " git push && git push origin v${PLUM_VERSION}"
197
+ '''
README.md CHANGED
@@ -22,6 +22,28 @@ cargo install --path plum-cli
22
22
 
23
23
  Installs a release build as `plum` in `~/.cargo/bin`, which `cargo` puts on your `PATH` for you — no `sudo`/`/usr/local/bin` needed. Re-run this after pulling changes to the compiler; it doesn't auto-update. Use `cargo run -p plum-cli --` instead while actively developing the compiler itself.
24
24
 
25
+ ### Prebuilt binaries
26
+
27
+ No Rust toolchain needed — download the `plum` binary directly (it embeds `plum-lsp`, the tree-sitter grammar, and the VSCode extension bundle; `plum editor helix`/`plum editor vscode` extract them on install):
28
+
29
+ <!-- prebuilt-binaries:start -->
30
+ | Platform | Download |
31
+ | --- | --- |
32
+ | macOS (Apple Silicon) | [plum-darwin-arm64](https://git.pyrossh.dev/releases/plum-cli/v0.1.0/plum-darwin-arm64) |
33
+ | Linux (x86_64) | [plum-linux-x86_64](https://git.pyrossh.dev/releases/plum-cli/v0.1.0/plum-linux-x86_64) |
34
+ | Windows (x86_64) | [plum-windows-x86_64.exe](https://git.pyrossh.dev/releases/plum-cli/v0.1.0/plum-windows-x86_64.exe) |
35
+
36
+ Make it executable and put it on your `PATH`, e.g. on macOS/Linux:
37
+
38
+ ```sh
39
+ curl -L -o plum https://git.pyrossh.dev/releases/plum-cli/v0.1.0/plum-darwin-arm64
40
+ chmod +x plum
41
+ mv plum ~/.cargo/bin/plum # or anywhere else already on your PATH
42
+ ```
43
+ <!-- prebuilt-binaries:end -->
44
+
45
+ Maintainers: `cargo make release` builds macOS/Linux/Windows binaries (Linux/Windows via [cross](https://github.com/cross-rs/cross), needs Docker), tags `v<version>`, regenerates the links above, and uploads all three to R2 (see `Makefile.toml`; needs [cargo-make](https://github.com/sagiegurari/cargo-make) and the `git` rclone remote configured for R2).
46
+
25
47
  ## Layout and comments
26
48
 
27
49
  Blocks are indentation-sensitive (2 spaces), like Python — there's no `{ }` for grouping statements. `#` starts a line comment.