this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

mod/modfile: fix up comments in module.cue schema

We currently maintain a copy of mod/modfile/schema.cue by hand over at
cuelang.org. Automating this is covered by #2809 (with indirect support
of #3193)

To help make the copy-paste easier, and ahead of again copy-pasting to
bring the cuelang.org copy up to date with the addition of the 'source'
field, adjust the formatting of the source schema.cue (in particular
line wrapping), and make a couple of corrections in the process:

* default major versions are implemented; remove the TODO associated
with implementing them.
* Correct 'The special value "none"...' - the special value is "self"
when talking about a source. Also correct the circular language of
"self" being defined in terms of the contents of the module (that is
what source is seeking to define as the source of truth after all).

The whitespace changes in schema.cue have resulted in line number
changes which affect the loader_test.go expectations.

Signed-off-by: Paul Jolly <paul@myitcv.io>
Change-Id: I55ed3f054541476d8e3dc150f0ae4fa95bf3f061
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1195697
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>

+30 -29
+1 -1
cue/load/loader_test.go
··· 85 85 module: conflicting values 123 and string (mismatched types int and string): 86 86 $CWD/testdata/badmod/cue.mod/module.cue:2:9 87 87 cuelang.org/go/mod/modfile/schema.cue:56:12 88 - cuelang.org/go/mod/modfile/schema.cue:101:12 88 + cuelang.org/go/mod/modfile/schema.cue:98:12 89 89 path: "" 90 90 module: "" 91 91 root: ""
+29 -28
mod/modfile/schema.cue
··· 55 55 // module indicates the module's path. 56 56 module?: #Module | "" 57 57 58 + // version indicates the language version used by the code in this module 59 + // - the minimum version of CUE required to evaluate the code in this 60 + // module. When a later version of CUE is evaluating code in this module, 61 + // this will be used to choose version-specific behavior. If an earlier 62 + // version of CUE is used, an error will be given. 63 + language?: version?: #Semver 64 + 58 65 // source holds information about the source of the files within the 59 66 // module. This field is mandatory at publish time. 60 67 source?: #Source 61 - 62 - // version indicates the language version used by the code 63 - // in this module - the minimum version of CUE required 64 - // to evaluate the code in this module. When a later version of CUE 65 - // is evaluating code in this module, this will be used to 66 - // choose version-specific behavior. If an earlier version of CUE 67 - // is used, an error will be given. 68 - language?: version?: #Semver 69 68 70 69 // description describes the purpose of this module. 71 70 description?: string ··· 73 72 // deps holds dependency information for modules, keyed by module path. 74 73 deps?: [#Module]: #Dep 75 74 76 - // custom holds arbitrary data intended for use by 77 - // third-party tools. Each field at the top level 78 - // represents a tooling namespace, conventionally 79 - // a module or domain name. Data migrated from legacy 75 + // custom holds arbitrary data intended for use by third-party tools. 76 + // Each field at the top level represents a tooling namespace, 77 + // conventionally a module or domain name. Data migrated from legacy 80 78 // module.cue files is placed in the "legacy" namespace. 81 79 custom?: [#Module | "legacy"]: [_]: _ 82 80 83 81 #Dep: { 84 - // v indicates the minimum required version of the module. 85 - // This can be null if the version is unknown and the module 86 - // entry is only present to be replaced. 82 + // v indicates the minimum required version of the module. This can 83 + // be null if the version is unknown and the module entry is only 84 + // present to be replaced. 87 85 v!: #Semver | null 88 86 89 - // default indicates this module is used as a default in case 90 - // more than one major version is specified for the same module 91 - // path. Imports must specify the exact major version for a 92 - // module path if there is more than one major version for that 93 - // path and default is not set for exactly one of them. 94 - // TODO implement this. 87 + // default indicates this module is used as a default in case more 88 + // than one major version is specified for the same module path. 89 + // Imports must specify the exact major version for a module path if 90 + // there is more than one major version for that path and default is 91 + // not set for exactly one of them. 95 92 default?: bool 96 93 } 97 94 98 - // #Module constrains a module path. 99 - // The major version indicator is optional, but should always be present 100 - // in a normalized module.cue file. 95 + // #Module constrains a module path. The major version indicator is 96 + // optional, but should always be present in a normalized module.cue 97 + // file. 101 98 #Module: string 102 99 103 100 // #Semver constrains a semantic version. ··· 110 107 // This regular expression is taken from https://semver.org/spec/v2.0.0.html 111 108 #Semver: =~#"^v(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$"# 112 109 113 - // WIP: (([\-_~a-zA-Z0-9][.\-_~a-zA-Z0-9]*[\-_~a-zA-Z0-9])|([\-_~a-zA-Z0-9]))(/([\-_~a-zA-Z0-9][.\-_~a-zA-Z0-9]*[\-_~a-zA-Z0-9])|([\-_~a-zA-Z0-9]))* 114 110 #Module: =~#"^[^@]+(@v(0|[1-9]\d*))$"# 115 111 116 112 // The module declaration is required. ··· 124 120 #Source: { 125 121 // kind specifies the kind of source. 126 122 // 127 - // The special value "none" signifies that the module that is 128 - // standalone, associated with no particular source other than 129 - // the contents of the module itself. 123 + // The special value "self" signifies a module is stand-alone, associated 124 + // with no particular source. The module's file list is determined from 125 + // the contents of the directory (and its subdirectories) that contains 126 + // the cue.mod directory. 127 + // 128 + // See https://cuelang.org/docs/reference/modules/#determining-zip-file-contents 129 + // for details on all the possible values for kind, and how they relate 130 + // to determining the list of files in a module. 130 131 kind!: "self" | "git" 131 132 132 133 // TODO support for other VCSs: