Skip to content

Commit 50d91a0

Browse files
authored
docs: Add proto v0.59 blog post. (#2633)
* Update installers. * Add blog. * Update docs. * Fix else if. * Add image.
1 parent 84d7413 commit 50d91a0

10 files changed

Lines changed: 265 additions & 31 deletions

File tree

dist-workspace.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ targets = [
1616
"x86_64-pc-windows-msvc",
1717
]
1818
installers = ["shell", "powershell"]
19-
install-path = ["$MOON_INSTALL_DIR/", "$MOON_HOME/bin", "~/.moon/bin"]
19+
install-path = ["$MOON_INSTALL_DIR/", "$MOON_HOME/bin", "$XDG_DATA_HOME/moon/bin", "~/.moon/bin"]
2020
install-success-msg = "\nSuccessfully installed! Take your repo to the moon!\nNeed help? Join our Discord: https://discord.gg/qCh9MEynv2\n"
2121
pr-run-mode = "upload"
2222
publish-jobs = ["./release-npm"]
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
---
2+
slug: proto-v0.59
3+
title: proto v0.59 - Java support, a new version parser, improved OpenTelemetry, and more
4+
authors: [milesj]
5+
tags: [java, jdk, jre, foojay, versions, semver, calver, scopes, otel]
6+
image: ./img/proto/v0.59.png
7+
---
8+
9+
In this release, we're shipping one of our most requested tools to date, Java, alongside a
10+
ground-up rewrite of our version parsing layer that makes it possible.
11+
12+
<!--truncate-->
13+
14+
## Java support
15+
16+
Java has been requested since proto's early days, but between the sheer number of vendors,
17+
distributions, and packaging formats, it was never a simple plugin to write. Until now, the closest
18+
workaround was the `asdf` backend, which doesn't work on Windows. That changes today, as proto now
19+
ships with a built-in Java plugin, powered by the [foojay.io Disco API](https://foojay.io/)!
20+
21+
The plugin is available through 3 tool identifiers: `java` or `jdk` for the full development kit,
22+
and `jre` for the slimmer runtime-only package.
23+
24+
```shell
25+
$ proto install java
26+
$ proto install jre 21
27+
```
28+
29+
On top of installing Java itself (with shims for `java`, `javac`, and `jar`), the plugin will
30+
detect versions from `.java-version` and `.sdkmanrc` files (easing migration from other version
31+
managers), and will export `JAVA_HOME` for
32+
[activated shells](/docs/proto/commands/activate).
33+
34+
### Choosing a distribution
35+
36+
Java isn't a single tool with a single publisher it's an ecosystem of vendors, each shipping
37+
their own builds. By default, the plugin installs the `openjdk` distribution (Oracle OpenJDK
38+
builds), but you can choose another by prefixing the version with a scope:
39+
40+
```toml title=".prototools"
41+
jdk = "temurin-21"
42+
```
43+
44+
Over 30 distributions are supported through the Disco API, including Temurin, Zulu, Corretto,
45+
Liberica, GraalVM, Microsoft, SapMachine, Semeru, Kona, Dragonwell, and more. Common
46+
[SDKMAN!](https://sdkman.io/) shorthands (`tem`, `amzn`, `librca`, etc) are also accepted, both in
47+
version specifications and in `.sdkmanrc` files.
48+
49+
And lastly, if you need early access builds instead of general availability, or want to route
50+
through a self-hosted Disco API, the plugin supports both:
51+
52+
```toml title=".prototools"
53+
[tools.java]
54+
api-url = "https://custom-foojay.hosted.com/disco/v3.0"
55+
release-type = "ea"
56+
```
57+
58+
## A new version specification parser
59+
60+
Since its inception, proto has parsed versions with the [`semver`](https://crates.io/crates/semver)
61+
crate, wrapped in layers of regex and string munging to squeeze in everything that crate wasn't
62+
designed for calendar versions, partial versions, and tool-specific quirks. This approach has
63+
been a constant source of edge cases, so in this release, we threw it all away and wrote a custom
64+
grammar-based parser designed for how proto actually consumes versions.
65+
66+
What does this unlock? For starters, first-class
67+
[version scopes](/docs/proto/tool-spec#version-scopes): a named prefix attached to a version or
68+
requirement, such as `openjdk-21.0.2`, `zulu-26`, or `pypy-2.1`. Scopes are what power
69+
Java distributions above, are passed through the WASM plugin API for any plugin to consume, and
70+
remote version lists are now cached per scope.
71+
72+
Beyond scopes, the new parser brings consistency to both versioning schemes:
73+
74+
- [Semantic versions](/docs/proto/tool-spec#semantic-versions) and
75+
[calendar versions](/docs/proto/tool-spec#calendar-versions) now support the same features:
76+
pre-releases, build metadata (`+123`), leading `v` prefixes, and
77+
[requirements and ranges](/docs/proto/tool-spec#requirements-and-ranges) (`^`, `~`, comparison
78+
operators, wildcards, `&&`, `||`).
79+
- Calendar versions are parsed with dash separators exclusively, so ambiguous values like `24.12`
80+
are always treated as semantic versions.
81+
- Better error messages when a version fails to parse, instead of cryptic `semver` errors.
82+
83+
## OpenTelemetry improvements
84+
85+
We introduced [OpenTelemetry support](./proto-v0.58#opentelemetry-support) in the last release,
86+
with traces, metrics, and logs exported over gRPC. In this release, we've expanded the
87+
implementation:
88+
89+
- Added experimental HTTP transport support, enabled with
90+
`OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf`.
91+
- Added experimental TLS support for both HTTP and gRPC transports.
92+
- Added support for the standard `OTEL_SERVICE_NAME`, `OTEL_*_EXPORTER`,
93+
`OTEL_EXPORTER_OTLP_*_PROTOCOL`, and `OTEL_EXPORTER_OTLP_*_ENDPOINT` environment variables
94+
(including their signal-specific variants).
95+
96+
If your environment already configures OTEL exporters through these variables, proto will now
97+
respect them out of the box.
98+
99+
## Smarter `PATH` handling in shims
100+
101+
This release fixes two long-standing `PATH` issues in `proto run` and shim executions:
102+
103+
- When a tool requires another tool to function (npm requires node), the required tool's paths were
104+
placed _before_ the paths of the tool being ran. For example, `npm run` scripts that execute
105+
`npm` would resolve node's bundled npm, instead of the npm version managed by proto. The tool
106+
being ran now takes precedence.
107+
- When falling back to a global executable on `PATH`, proto could recursively execute forever if
108+
that executable was itself a proto shim from _another store_ (typically caused by `HOME` or
109+
`PROTO_HOME` changing, or symlinked paths). We now skip shims from foreign stores during the
110+
lookup, and detect and error on the loop instead of hanging.
111+
112+
## Breaking changes
113+
114+
### Calendar version build segments
115+
116+
As part of the new parser, the proto-specific "micro" build segment (dot or underscore separated)
117+
has been removed from calendar versions. Use standard build metadata instead.
118+
119+
```
120+
2024-02-26.123 -> 2024-02-26+123
121+
2024-02-26_123-alpha.0 -> 2024-02-26-alpha.0+123
122+
```
123+
124+
## Other changes
125+
126+
View the [official release](https://github.com/moonrepo/proto/releases/tag/v0.59.0) for a full
127+
list of changes.
128+
129+
- Added `bzip2`, `xz`, and `z` codec support for self-compressed binaries (not packed with tar or
130+
zip), as well as `.tar.Z` (LZW) archive support.
131+
- Updated archive unpacking to be streamed when applicable, reducing memory usage.
132+
- Updated offline detection to take AI agent firewall policies into account. If networking is
133+
disabled, we mark as offline, otherwise if it's open or filtered, we mark it as online.
134+
- Fixed an issue where `proto clean` would not recursively clean certain directories.
135+
- Fixed an issue where we didn't check for an internet connection when downloading a plugin from an
136+
OCI registry or GitHub.
137+
- Updated Rust to v1.97.

website/blog/img/proto/v0.59.png

998 KB
Loading

website/docs/proto/reporting.mdx

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,54 @@ This is opt-in, and enabled with the following global options (or environment va
5757

5858
- `--otel` (`PROTO_OTEL`) - Export traces and metrics over OTLP.
5959
- `--otel-logs` (`PROTO_OTEL_LOGS`) - Also export log events as OTLP logs.
60-
- `--otel-service-name <name>` (`PROTO_OTEL_SERVICE_NAME`) - The service name to report.
60+
- `--otel-service-name <name>` (`PROTO_OTEL_SERVICE_NAME`) - The service name to report. If not
61+
provided, the standard `OTEL_SERVICE_NAME` environment variable is used.
62+
<VersionLabel version="0.59.0" />
6163

6264
The OTLP destination and transport are configured using the standard `OTEL_EXPORTER_OTLP_*`
6365
environment variables, like `OTEL_EXPORTER_OTLP_ENDPOINT`.
6466

6567
```shell
68+
$ export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318"
69+
$ proto --otel install node
70+
```
71+
72+
### Transports<VersionLabel version="0.59.0" />
73+
74+
OTLP payloads can be delivered over HTTP (`http/protobuf`) or gRPC (`grpc`). The transport is
75+
selected with the standard environment variables, where the per-signal variable takes precedence
76+
over the generic one:
77+
78+
- `OTEL_EXPORTER_OTLP_TRACES_PROTOCOL`, `OTEL_EXPORTER_OTLP_METRICS_PROTOCOL`,
79+
`OTEL_EXPORTER_OTLP_LOGS_PROTOCOL` - The transport for an individual signal.
80+
- `OTEL_EXPORTER_OTLP_PROTOCOL` - The transport for all signals. When not set, defaults to
81+
`http/protobuf`.
82+
83+
The same precedence applies to endpoints, using `OTEL_EXPORTER_OTLP_ENDPOINT` and the per-signal
84+
`OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` (and friends) variables. When an endpoint starts with
85+
`https://`, TLS is enabled, and the collector's certificate is verified against the operating
86+
system's trust store.
87+
88+
```shell
89+
# OTLP over gRPC
90+
$ export OTEL_EXPORTER_OTLP_PROTOCOL="grpc"
6691
$ export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317"
6792
$ proto --otel install node
6893
```
6994

95+
:::caution
96+
97+
The HTTP transport and TLS support are currently considered experimental.
98+
99+
:::
100+
101+
### Disabling signals<VersionLabel version="0.59.0" />
102+
103+
The standard environment variables can also force signals off, even when the options above have
104+
enabled them. `OTEL_SDK_DISABLED=true` disables all signals, while `OTEL_TRACES_EXPORTER=none`,
105+
`OTEL_METRICS_EXPORTER=none`, and `OTEL_LOGS_EXPORTER=none` disable an individual signal. These
106+
variables can only disable a signal, never enable one.
107+
70108
### Metrics
71109

72110
When OTEL is enabled, proto records the following metrics. Names ending in `.attempts` are counters,

website/docs/proto/tool-spec.mdx

Lines changed: 54 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ tool = "1.2.3"
120120
### Guidelines
121121

122122
- major, minor, patch - `0-9` of any length
123-
- pre, build - `a-z`, `0-9`, `-`, `.`
123+
- pre, build - `a-z`, `A-Z`, `0-9`, `-`, `_`, `.`
124+
- Must start with a letter or number.
125+
- A leading `v` or `V` prefix is accepted and ignored (`v1.2.3`).
124126

125127
> [Learn more about this format!](https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions)
126128
@@ -138,31 +140,65 @@ tool = "2025-02-26"
138140

139141
- `<year>-<month>` - 2024-02
140142
- `<year>-<month>-<day>` - 2024-02-26
141-
- `<year>-<month>-<day>.<build>` - 2024-02-26.123
142-
- `<year>-<month>-<day>_<build>` - 2024-02-26_123
143-
- `<year>-<month>-<day>.<build>-<pre>` - 2024-02-26.123-alpha.0
144-
- `<year>-<month>-<day>_<build>-<pre>` - 2024-02-26_123-alpha.0
145143
- `<year>-<month>-<day>-<pre>` - 2024-02-26-alpha.0
144+
- `<year>-<month>-<day>+<build>` - 2024-02-26+123
145+
- `<year>-<month>-<day>-<pre>+<build>` - 2024-02-26-alpha.0+123
146146

147147
### Guidelines
148148

149-
- year - `0-9` of 1-4 length
149+
- year - `0-9` of 2-4 length
150150
- If the year is not YYYY format, it will use the year 2000 as the base. For example, `24` becomes
151151
`2024`, and `124` becomes `2124`.
152152
- month - `0-9` of 1-2 length
153153
- Supports with and without a leading zero (`02` vs `2`).
154154
- Does not support invalid months (`0` or `13`).
155155
- day - `0-9` of 1-2 length
156-
- Can be omitted, even with build/pre.
156+
- Can be omitted, even with pre/build.
157157
- Supports with and without a leading zero (`02` vs `2`).
158158
- Does not support invalid days (`0` or `32`).
159-
- build - `0-9` of any length
160-
- Also known as a "micro" number.
161-
- The leading dot `.` format is preferred.
162-
- pre - `a-z`, `0-9`, `-`, `.`
159+
- pre - `a-z`, `A-Z`, `0-9`, `-`, `_`, `.`
160+
- Must start with a letter, so that it is not mistaken for a day number.
161+
- build - `a-z`, `A-Z`, `0-9`, `-`, `_`, `.`
162+
- Uses the same `+` prefixed build metadata syntax as semver.
163+
- A leading `v` or `V` prefix is accepted and ignored (`v2024-02`).
164+
165+
:::caution
166+
167+
The dot (`2024-02-26.123`) and underscore (`2024-02-26_123`) suffixed "micro" build segments from
168+
older proto versions were removed in v0.59. Use build metadata instead, for example
169+
`2024-02-26+123`.
170+
171+
:::
163172

164173
> [Learn more about this format!](https://calver.org/#scheme)
165174
175+
## Version scopes<VersionLabel version="0.59.0" />
176+
177+
Both version formats support an optional scope, which is a named prefix attached to the version
178+
with a dash. What a scope represents is defined by each tool's plugin — for example, the built-in
179+
Java plugin uses scopes to choose a [distribution vendor](./tools) — but the format itself is
180+
universal.
181+
182+
```toml title=".prototools"
183+
java = "openjdk-21.0.2"
184+
jdk = "temurin-21"
185+
```
186+
187+
### Syntax
188+
189+
- `<scope>-<version>` - openjdk-21.0.2, zulu-2026-01-15
190+
- `<scope>-<requirement>` - temurin-21, ^zulu-26
191+
192+
### Guidelines
193+
194+
- scope - `a-z`, `A-Z`, `0-9`, `-`, `_`, `.`
195+
- Must start with a letter or number.
196+
- May itself contain dashes, as the scope ends where a valid version or requirement begins. For
197+
example, `graalvm-community-24.1.2` is the scope `graalvm-community` with the version `24.1.2`.
198+
- Scopes also work within [requirements and ranges](#requirements-and-ranges), for example
199+
`temurin-21 || zulu-22`.
200+
- Available version lists are fetched and cached separately for each scope.
201+
166202
## Requirements and ranges
167203

168204
Besides an explicit version, we also support partial versions known as version requirements or
@@ -178,8 +214,9 @@ tool-c = ">=2000-10"
178214

179215
### Syntax
180216

181-
- Requirement - `[<op>]<pattern>` - `1.2.3`, `>4.5`, `~3`, `^2000-10`, etc
182-
- AND range - `<requirement>[,] <requirement> ...` - `>=1, <2`, `^1.3 <=1.3.9`, etc
217+
- Requirement - `[<op>]<pattern>` - `1.2.3`, `>4.5`, `~3`, `^2000-10`, `1.x`, etc
218+
- AND range - `<requirement>[,|&&] <requirement> ...` - `>=1, <2`, `>=1 && <2`, `^1.3 <=1.3.9`,
219+
etc
183220
- OR range - `<requirement> || <requirement> ...` - `^1.2 || ^2.3`, `~2000-10 || ~2010-2`, etc
184221

185222
### Guidelines
@@ -191,9 +228,11 @@ tool-c = ">=2000-10"
191228
compatible)
192229
- To specify an _exact_ version, use the `=` operator explicitly.
193230
- pattern
194-
- Dot-separated semver, with optional major and patch numbers.
231+
- Dot-separated semver, with optional minor and patch numbers.
195232
- Dash-separated calver, with optional month and day numbers.
196-
- Pre-release and build metadata are only supported when suffixed to full versions.
233+
- Numbers may be a wildcard (`*`, `x`, `X`) to match any value, for example `1.x` or `2024-2-*`.
234+
- May be prefixed with a [version scope](#version-scopes).
235+
- Pre-releases may be suffixed to partial versions, but must start with a letter.
197236

198237
For example, if you want to use `npm` 11.6.2 but 11.6.3 has an issue, use:
199238
`npm = "^11.6.4 || =11.6.2"`

website/static/install/moon.ps1

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,18 @@ $DownloadUrl = if ($Version -eq "latest") {
3131
"https://github.com/moonrepo/moon/releases/download/v${Version}/${Target}"
3232
}
3333

34+
$HomeDir = if ($env:MOON_HOME) {
35+
$env:MOON_HOME
36+
} elseif ($env:XDG_DATA_HOME) {
37+
"$($env:XDG_DATA_HOME)\moon"
38+
} else {
39+
"${Home}\.moon"
40+
}
41+
3442
$InstallDir = if ($env:MOON_INSTALL_DIR) {
3543
$env:MOON_INSTALL_DIR
3644
} else {
37-
"${Home}\.moon\bin"
45+
"${HomeDir}\bin"
3846
}
3947

4048
$BinPath = "${InstallDir}\moon.exe"

website/static/install/moon.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,16 @@ else
6161
download_url="https://github.com/moonrepo/moon/releases/download/v${version}/${target}"
6262
fi
6363

64+
if [[ -n "$MOON_HOME" ]]; then
65+
home_dir="$MOON_HOME"
66+
elif [[ -n "$XDG_DATA_HOME" ]]; then
67+
home_dir="$XDG_DATA_HOME/moon"
68+
else
69+
home_dir="$HOME/.moon"
70+
fi
71+
6472
if [ -z "$MOON_INSTALL_DIR" ]; then
65-
install_dir="$HOME/.moon/bin"
73+
install_dir="$home_dir/bin"
6674
else
6775
install_dir="$MOON_INSTALL_DIR"
6876
fi

website/static/install/proto.ps1

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,17 @@ $DownloadUrl = if ($Version -eq "latest") {
2929
"https://github.com/moonrepo/proto/releases/download/v${Version}/${Target}.zip"
3030
}
3131

32-
$TempDir = "${HOME}\.proto\temp\proto\${Target}"
33-
$DownloadFile = "${TempDir}.zip"
34-
35-
$InstallDir = if ($env:PROTO_HOME) {
36-
"$($env:PROTO_HOME)\bin"
32+
$HomeDir = if ($env:PROTO_HOME) {
33+
$env:PROTO_HOME
34+
} elseif ($env:XDG_DATA_HOME) {
35+
"$($env:XDG_DATA_HOME)\proto"
3736
} else {
38-
"${Home}\.proto\bin"
37+
"${Home}\.proto"
3938
}
4039

40+
$TempDir = "${HomeDir}\temp\proto\${Target}"
41+
$DownloadFile = "${TempDir}.zip"
42+
$InstallDir = "${HomeDir}\bin"
4143
$BinPath = "${InstallDir}\proto.exe"
4244
$ShimPath = "${InstallDir}\proto-shim.exe"
4345

0 commit comments

Comments
 (0)