Skip to content

Commit 9e82b10

Browse files
cleaning code, remove old approach of installing missing runtime during installation
1 parent 3c6a080 commit 9e82b10

File tree

5 files changed

+26
-445
lines changed

5 files changed

+26
-445
lines changed

config/config.go

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

156156
if pluginConfig.Runtime != "" {
157+
// Special handling for dartanalyzer - check for existing dart or flutter runtimes
158+
if toolConfig.Name == "dartanalyzer" {
159+
// Check if either dart or flutter runtime is already available
160+
if runtimeInfo := c.runtimes["flutter"]; runtimeInfo != nil {
161+
// Flutter runtime exists, use it
162+
continue
163+
}
164+
if runtimeInfo := c.runtimes["dart"]; runtimeInfo != nil {
165+
// Dart runtime exists, use it
166+
continue
167+
}
168+
// Neither runtime exists, proceed with installing dart runtime
169+
pluginConfig.Runtime = "dart"
170+
}
171+
157172
runtimeInfo := c.runtimes[pluginConfig.Runtime]
158173
if runtimeInfo == nil {
159174
// Get the default version for the runtime
@@ -164,6 +179,7 @@ func (c *ConfigType) AddTools(configs []plugins.ToolConfig) error {
164179
}
165180

166181
// Add the runtime to the config
182+
fmt.Println("Adding missing runtime to codacy.yaml", pluginConfig.Runtime, version)
167183
if err := c.AddRuntimes([]plugins.RuntimeConfig{{Name: pluginConfig.Runtime, Version: version}}); err != nil {
168184
return fmt.Errorf("failed to add runtime %s: %w", pluginConfig.Runtime, err)
169185
}

config/runtimes-installer-strict.go

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

0 commit comments

Comments
 (0)