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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ jobs:

- name: Build shim executable
run: |
go build -v -ldflags="-s -w" -trimpath -o dist/dtvem-shim${{ matrix.goos == 'windows' && '.exe' || '' }} ./src/cmd/shim
go build -v -ldflags="-s -w" -trimpath -tags shim -o dist/dtvem-shim${{ matrix.goos == 'windows' && '.exe' || '' }} ./src/cmd/shim
shell: bash
env:
GOOS: ${{ matrix.goos }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ jobs:

- name: Build shim executable
run: |
go build -v -ldflags="-s -w" -trimpath -o dist/dtvem-shim${{ matrix.goos == 'windows' && '.exe' || '' }} ./src/cmd/shim
go build -v -ldflags="-s -w" -trimpath -tags shim -o dist/dtvem-shim${{ matrix.goos == 'windows' && '.exe' || '' }} ./src/cmd/shim
shell: bash
env:
GOOS: ${{ matrix.goos }}
Expand Down
2 changes: 1 addition & 1 deletion rnr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ build-cli:

build-shim:
description: Build the shim executable
cmd: go build -v -ldflags="-s -w" -trimpath -o dist/dtvem-shim.exe ./src/cmd/shim
cmd: go build -v -ldflags="-s -w" -trimpath -tags shim -o dist/dtvem-shim.exe ./src/cmd/shim

# Deployment (Windows)
deploy-local:
Expand Down
58 changes: 0 additions & 58 deletions src/internal/runtime/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,61 +34,3 @@ type ShimProvider interface {
// Returns an empty map if no special environment is needed.
GetEnvironment(version string) (map[string]string, error)
}

// Provider defines the full interface that all runtime providers must implement.
// It embeds ShimProvider and adds operations that require heavier dependencies.
type Provider interface {
ShimProvider

// Install downloads and installs a specific version of the runtime
Install(version string) error

// Uninstall removes an installed version of the runtime
Uninstall(version string) error

// ListInstalled returns all installed versions of this runtime
ListInstalled() ([]InstalledVersion, error)

// ListAvailable returns all available versions that can be installed
// This might query online sources or use cached data
ListAvailable() ([]AvailableVersion, error)

// InstallPath returns the installation directory for a given version
InstallPath(version string) (string, error)

// GlobalVersion returns the globally configured version, if any
GlobalVersion() (string, error)

// SetGlobalVersion sets the global default version
SetGlobalVersion(version string) error

// LocalVersion returns the locally configured version for the current directory
// This reads from dtvem.config.json
LocalVersion() (string, error)

// SetLocalVersion sets the local version for the current directory
SetLocalVersion(version string) error

// CurrentVersion returns the currently active version
// (checks local first, then global)
CurrentVersion() (string, error)

// DetectInstalled scans the system for existing installations of this runtime
// Returns a list of detected versions with their paths and sources
DetectInstalled() ([]DetectedVersion, error)

// GlobalPackages detects globally installed packages for a specific installation
// Takes the installation path and returns a list of package names
// Returns empty slice if the runtime doesn't support global packages
GlobalPackages(installPath string) ([]string, error)

// InstallGlobalPackages reinstalls global packages to a specific version
// Takes the version and list of package names to install
// Returns nil if the runtime doesn't support global packages
InstallGlobalPackages(version string, packages []string) error

// ManualPackageInstallCommand returns the command string for manually installing packages
// Used to provide help text to users if automatic package installation fails
// Returns empty string if the runtime doesn't support global packages
ManualPackageInstallCommand(packages []string) string
}
64 changes: 64 additions & 0 deletions src/internal/runtime/provider_full.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//go:build !shim

package runtime

// Provider defines the full interface that all runtime providers must implement.
// It embeds ShimProvider and adds operations that require heavier dependencies
// (HTTP, archive extraction, manifest fetching). These methods are not compiled
// into the shim binary; in shim builds, Provider is an alias for ShimProvider
// (see provider_shim.go).
type Provider interface {
ShimProvider

// Install downloads and installs a specific version of the runtime
Install(version string) error

// Uninstall removes an installed version of the runtime
Uninstall(version string) error

// ListInstalled returns all installed versions of this runtime
ListInstalled() ([]InstalledVersion, error)

// ListAvailable returns all available versions that can be installed
// This might query online sources or use cached data
ListAvailable() ([]AvailableVersion, error)

// InstallPath returns the installation directory for a given version
InstallPath(version string) (string, error)

// GlobalVersion returns the globally configured version, if any
GlobalVersion() (string, error)

// SetGlobalVersion sets the global default version
SetGlobalVersion(version string) error

// LocalVersion returns the locally configured version for the current directory
// This reads from dtvem.config.json
LocalVersion() (string, error)

// SetLocalVersion sets the local version for the current directory
SetLocalVersion(version string) error

// CurrentVersion returns the currently active version
// (checks local first, then global)
CurrentVersion() (string, error)

// DetectInstalled scans the system for existing installations of this runtime
// Returns a list of detected versions with their paths and sources
DetectInstalled() ([]DetectedVersion, error)

// GlobalPackages detects globally installed packages for a specific installation
// Takes the installation path and returns a list of package names
// Returns empty slice if the runtime doesn't support global packages
GlobalPackages(installPath string) ([]string, error)

// InstallGlobalPackages reinstalls global packages to a specific version
// Takes the version and list of package names to install
// Returns nil if the runtime doesn't support global packages
InstallGlobalPackages(version string, packages []string) error

// ManualPackageInstallCommand returns the command string for manually installing packages
// Used to provide help text to users if automatic package installation fails
// Returns empty string if the runtime doesn't support global packages
ManualPackageInstallCommand(packages []string) string
}
13 changes: 13 additions & 0 deletions src/internal/runtime/provider_shim.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//go:build shim

package runtime

// Provider is the public type used throughout the codebase for registered
// runtime implementations. In default builds Provider is the full interface
// declared in provider_full.go; in shim builds it collapses to ShimProvider
// so the heavy methods (Install, ListAvailable, etc.) are never referenced
// in the shim binary's import graph.
//
// The registry stores values of type Provider, so this alias keeps the
// registry and its callers (e.g. internal/shim, cmd/shim) unchanged.
type Provider = ShimProvider
2 changes: 2 additions & 0 deletions src/internal/runtime/provider_test_harness.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//go:build !shim

package runtime

import (
Expand Down
5 changes: 5 additions & 0 deletions src/runtimes/node/lifecycle.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
//go:build !shim

// Lifecycle computation is only used by the dtvem CLI (e.g., `list-all`) and
// embeds ~50KB of schedule.json. Tagged !shim so neither the code nor the
// embedded data is linked into the shim binary.
package node

import (
Expand Down
Loading
Loading