ek9_query_package_version
Answers with version (the 'defines package' literal) and the line it is on for one .ek9 file; null with an error when the file declares no package.
When to use it
'What is the package version' is one call with file:'package.ek9'. The lightest read of the user's version literal, and the baseline to capture before ek9_increment_version or ek9_set_version.
When not to use it
- The whole package directive (name, deps, capabilities, publishable) - use
ek9_query_package. - The EK9 COMPILER's own version, not the user's package - use
ek9_version. - Changing the version - use
ek9_increment_version,ek9_set_versionorek9_set_feature_version.
Details
Version format is major.minor.patch[-feature]-build. Read from the source as soon as it parses - no prior ek9_compile, no subprocess. version is null (never an explanation string) when the file has no package block or does not parse; the error block says which.
Arguments
| Argument | Type | Required | What it is |
|---|---|---|---|
file | string | yes | The .ek9 file holding the 'defines package' block, workspace-relative (typically 'package.ek9'); an absolute path inside the workspace is accepted. |
Recorded calls
Real calls, recorded against small projects and checked on every build - a changed answer fails it.
Query returns version
Request
{
"file" : "<workspace-root>/package.ek9"
}
Response
{
"file" : "package.ek9",
"line" : 5,
"meta" : {
"serverMs" : "<timing>"
},
"module" : "com.example.pkg",
"status" : "ok",
"summary" : "version 1.0.0-0",
"version" : "1.0.0-0"
}
See also
- Part of the release workflow: Bump version + run tests with coverage + build artefact + install locally + verify.