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
57 changes: 41 additions & 16 deletions desktop/internal/core/toolchain.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,28 @@ type ToolchainExport struct {
Value string `json:"value"`
}

// ToolchainDiscoveryPlanProjectFile is one platform-applicable projectFile
// candidate Core asks the host to observe along the directory ancestor chain.
type ToolchainDiscoveryPlanProjectFile struct {
ID string `json:"id,omitempty"`
ProjectKind string `json:"projectKind"`
Path string `json:"path"`
Home string `json:"home,omitempty"`
Requires []string `json:"requires"`
}

// ToolchainDiscoveryPlanTool is the declared scan and provider surface of one tool.
type ToolchainDiscoveryPlanTool struct {
Tool string `json:"tool"`
PluginID string `json:"pluginID"`
Scans []ToolchainDiscoveryScan `json:"scans"`
Providers []string `json:"providers"`
HomeLayouts []ToolchainHomeLayout `json:"homeLayouts"`
ExecutableLayouts []ToolchainExecutableLayout `json:"executableLayouts"`
Version ToolchainVersionRule `json:"version"`
PathPrepend []string `json:"pathPrepend"`
Environment []ToolchainEnvironmentHome `json:"environment"`
Tool string `json:"tool"`
PluginID string `json:"pluginID"`
Scans []ToolchainDiscoveryScan `json:"scans"`
Providers []string `json:"providers"`
HomeLayouts []ToolchainHomeLayout `json:"homeLayouts"`
ExecutableLayouts []ToolchainExecutableLayout `json:"executableLayouts"`
Version ToolchainVersionRule `json:"version"`
PathPrepend []string `json:"pathPrepend"`
Environment []ToolchainEnvironmentHome `json:"environment"`
ProjectFiles []ToolchainDiscoveryPlanProjectFile `json:"projectFiles"`
}

// ToolchainEnvironmentHome is one login-shell home variable a definition reads.
Expand Down Expand Up @@ -243,9 +254,22 @@ type ToolchainSkippedInstallation struct {
Reason string `json:"reason"`
}

// ToolchainProjectCandidate is one declared project-local environment or wrapper
// candidate and its resolution or pending-trust state.
type ToolchainProjectCandidate struct {
CandidateID string `json:"candidateID"`
ProjectKind string `json:"projectKind"`
Path string `json:"path"`
Home string `json:"home,omitempty"`
Executable string `json:"executable,omitempty"`
Version *string `json:"version,omitempty"`
Reason string `json:"reason,omitempty"`
}

// ToolchainCandidates is what a settings page shows for one tool.
type ToolchainCandidates struct {
Tool string `json:"tool"`
Project []ToolchainProjectCandidate `json:"project"`
Shell []ToolchainShellCandidate `json:"shell"`
Installations []ToolchainInstallation `json:"installations"`
Skipped []ToolchainSkippedInstallation `json:"skipped"`
Expand Down Expand Up @@ -336,13 +360,14 @@ type ToolchainResolutionTrace struct {

// ToolchainResolution is the complete, deterministic resolution of one tool.
type ToolchainResolution struct {
OperationID string `json:"operationID"`
Tool string `json:"tool"`
Directory string `json:"directory"`
Outcome ToolchainOutcome `json:"outcome"`
Trace []ToolchainResolutionTrace `json:"trace"`
Unmet []json.RawMessage `json:"unmet"`
Conflicts []json.RawMessage `json:"conflicts"`
OperationID string `json:"operationID"`
Tool string `json:"tool"`
Directory string `json:"directory"`
Outcome ToolchainOutcome `json:"outcome"`
ProjectCandidates []ToolchainProjectCandidate `json:"projectCandidates"`
Trace []ToolchainResolutionTrace `json:"trace"`
Unmet []json.RawMessage `json:"unmet"`
Conflicts []json.RawMessage `json:"conflicts"`
}

// ToolchainPin is one saved directory installation reference.
Expand Down
36 changes: 28 additions & 8 deletions desktop/internal/core/toolchain_catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import (
"context"
)

// ToolchainCatalog contains registrations owned by this machine, independent of project pins.
// ToolchainCatalog contains registrations and workspace trust owned by this machine, independent of project pins.
type ToolchainCatalog struct {
Version int `json:"version"`
Tools map[string]ToolchainCatalogEntry `json:"tools"`
Version int `json:"version"`
Tools map[string]ToolchainCatalogEntry `json:"tools"`
TrustedWorkspaces []string `json:"trustedWorkspaces,omitempty"`
}

type ToolchainCatalogEntry struct {
Expand All @@ -16,8 +17,9 @@ type ToolchainCatalogEntry struct {
}

type ToolchainCatalogState struct {
Document ToolchainCatalog `json:"document"`
Storage struct {
Document ToolchainCatalog `json:"document"`
ProjectCodeAllowed bool `json:"projectCodeAllowed,omitempty"`
Storage struct {
RelativePath string `json:"relativePath"`
MaximumBytes int64 `json:"maximumBytes"`
} `json:"storage"`
Expand All @@ -29,17 +31,27 @@ type ToolchainCatalogEdit struct {
DefaultHome *string `json:"defaultHome"`
}

type ToolchainWorkspaceTrustEdit struct {
Workspace string `json:"workspace"`
Trusted bool `json:"trusted"`
}

type ToolchainCatalogPublication struct {
Changed bool `json:"changed"`
Document *string `json:"document"`
Catalog ToolchainCatalog `json:"catalog"`
}

func (c *Client) ReadToolchainCatalog(ctx context.Context, document *string, platform string) (ToolchainCatalogState, error) {
return c.ReadToolchainCatalogForWorkspace(ctx, document, platform, "")
}

func (c *Client) ReadToolchainCatalogForWorkspace(ctx context.Context, document *string, platform, workspaceRoot string) (ToolchainCatalogState, error) {
return settingsSurfaceResult[ToolchainCatalogState](ctx, c, "toolchains.catalogState", "state", struct {
Document *string `json:"document"`
Platform string `json:"platform"`
}{document, platform})
Document *string `json:"document"`
Platform string `json:"platform"`
WorkspaceRoot string `json:"workspaceRoot,omitempty"`
}{document, platform, workspaceRoot})
}

func (c *Client) EditToolchainCatalog(ctx context.Context, document *string, platform string, edits []ToolchainCatalogEdit) (ToolchainCatalogPublication, error) {
Expand All @@ -49,3 +61,11 @@ func (c *Client) EditToolchainCatalog(ctx context.Context, document *string, pla
Edits []ToolchainCatalogEdit `json:"edits"`
}{document, platform, edits})
}

func (c *Client) EditToolchainWorkspaceTrust(ctx context.Context, document *string, platform string, trust ToolchainWorkspaceTrustEdit) (ToolchainCatalogPublication, error) {
return settingsSurfaceResult[ToolchainCatalogPublication](ctx, c, "toolchains.editCatalog", "edit", struct {
Document *string `json:"document"`
Platform string `json:"platform"`
WorkspaceTrust ToolchainWorkspaceTrustEdit `json:"workspaceTrust"`
}{document, platform, trust})
}
32 changes: 32 additions & 0 deletions desktop/internal/i18n/shared.generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions desktop/internal/settingswindow/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,12 @@ type ToolchainInspector interface {
Inspect(context.Context, toolchain.Snapshot, string, string) (core.ToolchainSelection, error)
}

// ToolchainTrustLoader updates machine-local permission to probe and run tool
// environments or wrappers inside the open project, then reloads its snapshot.
type ToolchainTrustLoader interface {
SetWorkspaceTrust(context.Context, toolchain.Snapshot, bool) (toolchain.Snapshot, error)
}

// PluginSettingsLoader reads and publishes captured native sources off the UI thread.
// Load translates the plugin's own text for the language; a save's readback keeps the
// language its editor was loaded in.
Expand Down
Loading
Loading