Skip to content

Commit fcec1ee

Browse files
cleaning code, remove old approach of installing missing runtime during installation
1 parent 56f387f commit fcec1ee

File tree

5 files changed

+49
-437
lines changed

5 files changed

+49
-437
lines changed

config/config.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,21 @@ func (c *ConfigType) AddTools(configs []plugins.ToolConfig) error {
149149
}
150150

151151
if pluginConfig.Runtime != "" {
152+
// Special handling for dartanalyzer - check for existing dart or flutter runtimes
153+
if toolConfig.Name == "dartanalyzer" {
154+
// Check if either dart or flutter runtime is already available
155+
if runtimeInfo := c.runtimes["flutter"]; runtimeInfo != nil {
156+
// Flutter runtime exists, use it
157+
continue
158+
}
159+
if runtimeInfo := c.runtimes["dart"]; runtimeInfo != nil {
160+
// Dart runtime exists, use it
161+
continue
162+
}
163+
// Neither runtime exists, proceed with installing dart runtime
164+
pluginConfig.Runtime = "dart"
165+
}
166+
152167
runtimeInfo := c.runtimes[pluginConfig.Runtime]
153168
if runtimeInfo == nil {
154169
// Get the default version for the runtime
@@ -159,6 +174,7 @@ func (c *ConfigType) AddTools(configs []plugins.ToolConfig) error {
159174
}
160175

161176
// Add the runtime to the config
177+
fmt.Println("Adding missing runtime to config", pluginConfig.Runtime, version)
162178
if err := c.AddRuntimes([]plugins.RuntimeConfig{{Name: pluginConfig.Runtime, Version: version}}); err != nil {
163179
return fmt.Errorf("failed to add runtime %s: %w", pluginConfig.Runtime, err)
164180
}

config/runtimes-installer-strict.go

Lines changed: 0 additions & 179 deletions
This file was deleted.

0 commit comments

Comments
 (0)