Support hex.pm's LicenseRef-* licence identifiers
Hex supports SPDX licence identifiers, but it also supports non-SPDX licences. By prefixing a licence identifier with LicenseRef-, a user can upload a package with a non-SPDX licence. However, Gleam's command line tool will exit with an error if a user's gleam.toml specifies any non-SPDX licence:
$ gleam run -- --help
error: File IO failure
An error occurred while trying to parse this file:
/src/gleam-licence-example/gleam.toml
The error message from the file IO library was:
TOML parse error at line 4, column 13
|
4 | licences = ["LicenseRef-my-licence"]
| ^^^^^^^^^^^^^^^^^^
LicenseRef-my-licence is not a known SPDX License identifier
I'd like to request that the gleam command line tool support non-SPDX licences, either by prefixing them with LicenseRef-. This would have no implications on any other community-run package indexes (like packages.gleam.run) which could, if desired, still require packages to use a SPDX licence. It would simply fix the current situation which is that gleam applications and libraries are only able to use SPDX licences, and nothing else.
This could be implemented simply and without breaking changes by altering the serde deserializer function to check for a licence string starting with LicenseRef- https://github.com/gleam-lang/gleam/blob/main/compiler-core/src/config.rs#L65
Alternatively, the constraints on licence identifiers could be removed entirely, leaving it up to the individual developer to decide if they want to use SPDX, or LicenseRef- to be compliant with hex.pm, or let them use whatever identifier they like.
Source: gleam-lang/gleam