Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions rust/contracts/run-configuration-v2.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,33 @@
"type": "string",
"pattern": "^(?!/)(?!.*(^|/)\\.\\.(?:/|$)).*$"
},
"runTypeReference": {
"type": "object",
"description": "A configuration of a run configuration type a build system declares (buildSystems[].runConfigurationTypes).",
"required": ["pluginID", "buildSystemID", "type"],
"properties": {
"pluginID": { "$ref": "#/$defs/runTypeIdentifier" },
"buildSystemID": { "$ref": "#/$defs/runTypeIdentifier" },
"type": { "$ref": "#/$defs/runTypeIdentifier" },
"values": {
"type": "object",
"description": "Field values by declared field ID; hidden fields are not saved.",
"maxProperties": 16,
"propertyNames": { "$ref": "#/$defs/runTypeIdentifier" },
"additionalProperties": {
"oneOf": [
{ "type": "boolean" },
{ "type": "string", "maxLength": 4096 },
{ "type": "array", "maxItems": 64, "items": { "type": "string", "maxLength": 4096 } }
]
}
}
},
"additionalProperties": false
},
"runTypeIdentifier": {
"type": "string", "minLength": 1, "maxLength": 200, "pattern": "^[A-Za-z0-9._-]+$"
},
"buildProviderReference": {
"type": "object",
"required": [
Expand Down Expand Up @@ -242,6 +269,10 @@
}
},
"disabled": { "type": "boolean" },
"allowMultipleInstances": {
"type": "boolean",
"description": "Starting the configuration while it runs starts another instance beside it instead of stopping the running one."
},
"source": { "type": "string" }
},
"additionalProperties": false,
Expand All @@ -263,6 +294,22 @@
}
}
}
}, {
"if": { "properties": { "provider": { "const": "build.run-type" } } },
"then": {
"required": ["extensions"],
"properties": {
"execution": { "enum": ["application", "task"] },
"command": false,
"toolchains": { "maxProperties": 0 },
"debug": false,
"members": { "maxItems": 0 },
"extensions": {
"required": ["build"],
"properties": { "build": { "$ref": "#/$defs/runTypeReference" } }
}
}
}
}, {
"if": { "properties": { "provider": { "pattern": "^process\\." } } },
"then": {
Expand Down
99 changes: 78 additions & 21 deletions rust/contracts/rust-core-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,7 @@ or removing a command fails until the table changes in the same commit.
| `build.resolveOptions` | Check stored build options against the declaration and return effective values, choices, and the fingerprint |
| `build.modelPlan` | Expand the command that prints a command-sourced build model, or the request a build provider answers |
| `build.taskPlan` | Expand one declared or model task for a workspace, project, or target |
| `build.runConfigurationPlan` | Expand a saved configuration of a declared run configuration type into an argv plan |
| `build.testPlan` | Plan a test run for a scope, suite, or case and say where its reports will be |
| `build.prepareDebugPlan` | Plan same-plugin native debug preparation |
| `build.decodeDebugPreparation` | Validate an existing instance-contained native debug program and bounded process facts |
Expand Down Expand Up @@ -713,8 +714,8 @@ or removing a command fails until the table changes in the same commit.
| `runConfig.updateToolPreferences` | Replace only generic preferences in the local layer, preserving legacy defaults and unrelated metadata |
| `runConfig.saveEditorChanges` | Prepare the file changes of the local and optional project layers for one editor save |
| `runConfig.createUserConfiguration` | Validate a typed user configuration and return the file changes that save it |
| `runConfig.configurationTypes` | List the built-in run configuration types a user can create, with the availability of a kind this platform cannot run |
| `runConfig.editorForm` | Describe the editor fields and current values of a built-in run configuration |
| `runConfig.configurationTypes` | List the run configuration types a user can create, built-in and plugin-declared, with the availability of a kind this platform cannot run |
| `runConfig.editorForm` | Describe the editor fields and current values of a built-in or plugin-declared run configuration |
| `runConfig.saveConfiguration` | Validate an editor form's values and return field errors or the file changes that save it |
| `runConfig.deleteConfiguration` | Return the file changes that delete a saved user configuration |
| `runConfig.copyConfiguration` | Return the file changes that save a copy of any configuration under a new name |
Expand Down Expand Up @@ -3912,23 +3913,27 @@ becomes `bash -e`), else `bash`, both looked up on `PATH`. PowerShell uses
`pwsh` outside Windows and `powershell` on Windows, with `-NoLogo -NoProfile`;
batch uses `cmd /d`. A chosen interpreter drops the automatic arguments.

`runConfig.configurationTypes` accepts `{}` and returns `{types: [{provider,
availability?}]}`, every kind a user can create, in display order. Every
platform creates and edits every kind; a kind this platform cannot run carries
the `availability` its configurations resolve with (`unsupportedPlatform` for
batch outside Windows), so hosts can say so before the user saves one.

`runConfig.editorForm` accepts `{root, provider?, configurationId?, values?}`
and describes the editor of a new configuration of `provider` or of the saved
`configurationId` (its provider must match `provider` when both are given).
`runConfig.configurationTypes` accepts `{runTypePlugins?}` and returns
`{types: [{provider, availability?}], localizations?}`, every kind a user can
create, in display order: the built-in process runs, then the types installed
plugins declare (see [Plugin-declared types](#plugin-declared-types)). Every
platform creates and edits every built-in kind; a kind this platform cannot run
carries the `availability` its configurations resolve with
(`unsupportedPlatform` for batch outside Windows), so hosts can say so before
the user saves one.

`runConfig.editorForm` accepts `{root, provider?, runType?, configurationId?,
values?, runTypePlugins?}` and describes the editor of a new configuration of
`provider` (with `runType` for a declared type) or of the saved
`configurationId` (its provider and type must match when both are given).
`values` holds the open editor's unsaved values; they replace the saved ones so
automatic values follow the edit. It returns `{formVersion, provider,
configurationId, values, fields, availability?}`. `availability` is present
when this platform cannot run the kind, as in `runConfig.configurationTypes`;
the form still edits and saves it. `formVersion` is `1`; a host refuses a newer
one. `values` maps field IDs to the current values. `fields` is the ordered list
of `{id, kind, required?, placement?, automatic?, options?, visibleWhen?,
note?, shellFamily?}`:
note?, shellFamily?, label?, description?, placeholder?, optionLabels?}`:

| Attribute | Meaning |
| --- | --- |
Expand All @@ -3937,21 +3942,30 @@ note?, shellFamily?}`:
| `automatic` | The value used while the field is empty, shown as its placeholder |
| `visibleWhen` | `{field, equals}`: shown only while that field has that value |
| `note` | An explanation key; `windowsOnly` says the field matters only on Windows |
| `label`, `description`, `placeholder` | Text a plugin declared for its field, already translated; built-in fields have none and hosts label them from the field ID |
| `optionLabels` | On a declared `choice` field, the display title of each value that has one |
| `shellFamily` | On an `executable` field, the family of shell it takes: `posix` (sh, bash, zsh and the like), `powershell` (Windows PowerShell and `pwsh`) or `cmd`. A host that finds the installed shells may offer those of the family as choices beside the automatic value and a path of the user's own; the value is still a program name or path. The `interpreter` field of each script kind has it |

Hosts draw the fields in order, skip a field whose `kind` they do not know and
send back every value they received, including keys they do not show, so a
later Core adds fields without a host change. Script kinds show `name`,
`storeAsProjectFile`, `source` (`file` or `text`), `script`, `text`,
later Core adds fields without a host change. Every editor starts with the
header fields `name`, `storeAsProjectFile` and `allowMultipleInstances`.
Script kinds then show `source` (`file` or `text`), `script`, `text`,
`scriptOptions`, `workingDirectory`, `environment`, `interpreter`,
`interpreterArguments` and, for PowerShell, `executionPolicyBypass`; a program
shows `name`, `storeAsProjectFile`, `program`, `programArguments`,
`workingDirectory` and `environment`. An empty name saves the automatic name,
the script or program file name. A saved entry that is not a built-in process
run is `not_supported`.

`runConfig.saveConfiguration` accepts `{root, provider, configurationId?,
values, plugins?}`. It replies `{status: "invalid", errors: [{field, code}]}`
shows `program`, `programArguments`, `workingDirectory` and `environment`. An
empty name saves the automatic name, the script or program file name. A saved
entry that is neither a built-in process run nor of a declared type is
`not_supported`.

`allowMultipleInstances` (IntelliJ IDEA's "Allow multiple instances") is saved
on the configuration only when `true` and resolved like any other key. While a
configuration runs, starting it again stops the running process first; with
`allowMultipleInstances` the host starts another process beside it and keeps a
console for each.

`runConfig.saveConfiguration` accepts `{root, provider, runType?,
configurationId?, values, plugins?, runTypePlugins?}`. It replies `{status: "invalid", errors: [{field, code}]}`
when a value is wrong, else `{status: "saved", id, changes}`. `code` is
`required`, `conflict`, `notAllowed`, `tooLong`, `invalidCharacter`,
`invalidPath`, `notFound`, `outsideProject` (a working directory outside the
Expand Down Expand Up @@ -3979,6 +3993,48 @@ generated run with the same selector, so copying a generated one also saves the
original whole in the local layer under its own ID; both stay listed, and the
original stops following later name changes of the build model.

#### Plugin-declared types

A build system may declare run configuration types
(`buildSystems[].runConfigurationTypes` in the plugin contract): data only,
the fields of the editor and the command line the values make, so a plugin
adds a kind such as Go Build without a backend. The editor commands take the
installed plugins as `runTypePlugins: {language?, plugins: [{manifest,
localizations?}]}`, in the order their types are listed. A manifest that does
not validate adds nothing. With a `language`, `runConfig.configurationTypes`
and `runConfig.editorForm` return `localizations`, one report per plugin that
declares a type, shaped as the report of `plugins.settings`: the host reads
the `readRequired` candidates from the package and sends them back as
`localizations` (package-relative path to text), and Core applies the first
one that fits. A file that does not fit is reported as
`plugin.build.invalidLocalization` and the manifest's wording is kept.

A declared type is listed as `{provider: "build.run-type", runType:
{pluginID, buildSystemID, type}, displayName, execution, description?,
icon?}`, with translated text. Its editor shows the header fields, the
declared fields as `field:<id>` with their translated `label`, `description`,
`placeholder` and `optionLabels`, then `programArguments` when the type's
arguments take `${userArguments}`, `workingDirectory`, `environment` and
`beforeLaunch`. A declared field's `kind` is `text`, `choice`, `checkbox`,
`file`, `directory` or `arguments`; its `visibleWhen` names another
`field:<id>`. The form of a declared type carries `runType` instead of
`availability`. A type no installed plugin declares, such as after the plugin
was removed, is `not_supported` in the editor; its saved configurations stay
in the run files.

Saving checks the visible declared fields (`required`, `notFound`,
`tooLong`, `invalidCharacter` and the path codes, keyed `field:<id>`) and
saves the entry with provider `build.run-type` in the plugin's document of
the chosen layer (`.lithe/run/plugin/<pluginID>.toml` or
`<pluginID>.local.toml`). It keeps `extensions.build: {pluginID,
buildSystemID, type, values}`, the visible fields' values by declared field
ID (a string, a boolean, or the list of arguments of an `arguments` field;
files and directories project-relative inside the project), with the
program arguments, working directory and environment in `args`, `cwd` and
`env`, and the type's `execution` (`application` or `task`). `runConfig.resolve` lists it
with the plugin it needs. `build.runConfigurationPlan` expands it into the
argv plan the host starts like a task plan.

#### Folders and order

A configuration may name a `folder`, the folder it is listed in within its
Expand Down Expand Up @@ -5109,6 +5165,7 @@ and the directories are absolute host paths used only as substitution text.
| `build.decodeConfigurationEdit` | `{ snapshot, edits, result }` | `edit: { sourceID, revision, changed }`; validates bounded receipt and exact draft/source identity; native adapter verifies staged hash and publishes atomically |
| `build.modelPlan`, `build.dependencyPlan` | plan fields plus `project?` (dependencies), `outputFile?`, and for provider sources `refresh?` (boolean) and `tool?: { executable }` (absolute path) | `plan`: `{ buildSystemID, root, arguments, environment, workingDirectory, execution, optionFingerprint, output, decoder, executesProjectCode, mayUseNetwork }`; for a `provider` source `{ buildSystemID, root, provider: { method, params }, decoder, executesProjectCode, mayUseNetwork, optionFingerprint }`, where `method` is `lithe/build/model` or `lithe/build/dependencies` and `params` is `{ buildSystemID, root, options, optionArguments, environment, project?, refresh?, tool? }`; `refresh` appears only when `true` and `tool` only when the host sent it |
| `build.taskPlan` | plan fields plus `task`, `project?`, `target?`, `modelTask?`, `userArguments?` | command `plan` with `arguments`, `environment`, `workingDirectory`, `execution`, and `optionFingerprint`; a provider task instead returns `provider: {method: "lithe/build/execute", params}` with effective options, selected task/entities, user arguments and effect metadata |
| `build.runConfigurationPlan` | `manifest`, `buildSystemID`, required `workspaceRoot`, and `request: {configurationId, localDocument?, instances: [{root, options?, modelInputs?}], pluginDirectory?, workspaceStateDirectory?}` | `plan` as `build.taskPlan` returns it plus `runType: {pluginID, buildSystemID, type}`: the global arguments, then the type's `arguments` with the saved field values, the instance's options and the configuration's program arguments, at the configuration's working directory, with its environment over the options'. The instance is the deepest one whose root holds the working directory, or the only one; `plugin.build.invalidSelection` when several exist and none holds it or the configuration belongs to another plugin or build system, `plugin.build.unavailable` when the type is no longer declared, `plugin.build.invalidRunConfiguration` with `field: values.<fieldID>` when a saved value no longer fits. A configuration that is missing, disabled, unavailable or of another provider fails the call |
| `build.testPlan` | plan fields plus `project?`, `target?`, `suite?`, `case?`, `userArguments?`, `projects?` (the model's project directories) | command plan or `provider: {method: "lithe/build/test", params}`, plus `results`: `null`, `{ decoder, reports }` with workspace-relative globs (for the selected project, or for the root and every listed project when none is selected), or command-only `{ decoder: "hostIntegration" }`. Command filters that templates cannot place, such as a case without its suite when the tool only addresses `Suite#case`, are `plugin.build.invalidSelection`; Provider filters remain separate typed values and must be declared supported |
| `build.testDiscoveryPlan` | common plan fields plus `refresh?`, `tool?`; no project/output file | `plan.provider` for `lithe/build/discoverTests`, only with `test.discovery: true`, using the same effective options and effect metadata |
| `build.decodeTestDiscovery` | common plan fields plus canonical `result` | `discovery.tests` with validated `{id, suite, case, project?, target?}` selectors; bounded at 10,000 items/32 MiB, deterministic and exactly runnable; malformed replies reject in full |
Expand Down
Loading
Loading