-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mod/modfile: parse module.cue according to language.version
This change makes it possible to make changes to the module.cue schema while still using a closed schema for earlier versions. We refuse module.cue files that declare a version newer than the current CUE version. The language.version field is now mandatory in modules mode because otherwise we cannot tell which schema we should be using. Also remove the unimplemented features from the schema for now: they're always there in the history and the proposal when we come to implement them, but they complicate the schema for no good reason. One unfortunate thing is that the error message when a field is defined that's explicitly unimplemented is not good. In the absence of an `error` CUE builtin, we should be able to fix that in a subsequent CL by inspecting the error to see whether any of the lines include the `unimplemented` identifier. Signed-off-by: Roger Peppe <[email protected]> Change-Id: I7bfef3b37e5b66bdbd8fe0614c1b815c7d9f1285 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1193275 TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Daniel Martí <[email protected]> Unity-Result: CUE porcuepine <[email protected]>
- Loading branch information
Showing
81 changed files
with
594 additions
and
273 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,10 @@ | ||
# Check that cue mod init skips the language version | ||
# when it lacks any version information at all. | ||
# Check that cue mod init fails when it lacks any version | ||
# information at all. | ||
# A zero pseudo-version is one such case, as there are no semver numbers. | ||
env CUE_EXPERIMENT=modules | ||
env CUE_VERSION_OVERRIDE=v0.0.0-00010101000000-000000000000 | ||
exec cue mod init foo.example | ||
cmp cue.mod/module.cue want-module | ||
! exec cue mod init foo.example | ||
cmp stderr want-stderr | ||
|
||
# cue mod tidy should be a no-op after cue mod init | ||
env CUE_CACHE_DIR=$WORK/.tmp/cache | ||
exec cue mod tidy | ||
cmp cue.mod/module.cue want-module | ||
|
||
-- want-module -- | ||
module: "foo.example@v0" | ||
-- want-stderr -- | ||
cannot round-trip module file: no language version declared in module.cue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.