Skip to content

proposal: make the build.zig.ini file a strict subset of TOML #14289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Tracked by #14265
andrewrk opened this issue Jan 13, 2023 · 2 comments
Closed
Tracked by #14265

proposal: make the build.zig.ini file a strict subset of TOML #14289

andrewrk opened this issue Jan 13, 2023 · 2 comments
Labels
breaking Implementing this issue could cause existing code to no longer compile or have different behavior. enhancement Solving this issue will likely involve adding new logic or components to the codebase. proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. zig build system std.Build, the build runner, `zig build` subcommand, package management
Milestone

Comments

@andrewrk
Copy link
Member

andrewrk commented Jan 13, 2023

Extracted from #14265.

Currently the build.zig.ini file is not valid TOML. Example:

[package]
name=libffmpeg
version=5.1.2

[dependency]
name=libz
url=https://github.com/andrewrk/libz/archive/f0e53cc2391741034b144a2c2076ed8a9937b29b.tar.gz
hash=c9b30cffc40999d2c078ff350cbcee642970a224fe123c756d0892f876cf1aae

[dependency]
name=libmp3lame
url=https://github.com/andrewrk/libmp3lame/archive/497568e670bfeb14ab6ef47fb6459a2251358e43.tar.gz
hash=9ba4f49895b174a3f918d489238acbc146bd393575062b2e3be33488b688e36f

To make it valid TOML:

[package]
name="libffmpeg"
version="5.1.2"

[[dependency]]
name="libz"
url="https://github.com/andrewrk/libz/archive/f0e53cc2391741034b144a2c2076ed8a9937b29b.tar.gz"
hash="c9b30cffc40999d2c078ff350cbcee642970a224fe123c756d0892f876cf1aae"

[[dependency]]
name="libmp3lame"
url="https://github.com/andrewrk/libmp3lame/archive/497568e670bfeb14ab6ef47fb6459a2251358e43.tar.gz"
hash="9ba4f49895b174a3f918d489238acbc146bd393575062b2e3be33488b688e36f"

It also should be renamed with the .toml extension, and furthermore, [package] should be renamed to [project] to match the correct terminology.

Let's have a short list of accepted TOML features and only use those.

See competing proposal:

@andrewrk andrewrk added enhancement Solving this issue will likely involve adding new logic or components to the codebase. breaking Implementing this issue could cause existing code to no longer compile or have different behavior. proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. zig build system std.Build, the build runner, `zig build` subcommand, package management labels Jan 13, 2023
@andrewrk andrewrk added this to the 0.11.0 milestone Jan 13, 2023
@ghost
Copy link

ghost commented Jan 13, 2023

I don't like this. People might want to use their own TOML generators for tooling, but then they have to make sure they only generate a subset, which could itself be a hassle to do with their tools as well as causing confusion around the standard. In the worst case we splinter the TOML standard.

@thejoshwolfe
Copy link
Contributor

it does seem dishonest to name it .toml if it isn't really TOML. maybe a different extension would resolve that though.

After reading the spec, it seems like maybe we should use 'single quote' strings instead of "double quote" strings? To @EleanorNB's point, there are an awful lot of ways to express the same thing in TOML. Restricting to a subset solves that problem for the compiler's parser, but pushes the problem onto everyone's generator.

I've just got to complain about this line from the TOML spec: https://toml.io/en/v1.0.0

Any reference to an array of tables points to the most recently defined table element of the array.

TOML is a mistake. This is way too complex and confusing. What even is the O in the name. Woe is humanity. If only JSON had allowed comments and trailing commas; what a fantastic mess we could have avoided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Implementing this issue could cause existing code to no longer compile or have different behavior. enhancement Solving this issue will likely involve adding new logic or components to the codebase. proposal This issue suggests modifications. If it also has the "accepted" label then it is planned. zig build system std.Build, the build runner, `zig build` subcommand, package management
Projects
None yet
Development

No branches or pull requests

2 participants