Skip to content
Merged
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
20 changes: 19 additions & 1 deletion internal/cli/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ func formatPlugins(plugins []string) (formatted []*pluginInfo) {
info := &pluginInfo{}
plugin, info.Path, _ = strings.Cut(plugin, "=")
info.Name, info.Version, _ = strings.Cut(plugin, "@")
// Resolve local path to absolute since build runs in a temp directory
if len(info.Path) > 0 {
if absPath, err := filepath.Abs(info.Path); err == nil {
info.Path = absPath
}
}
formatted = append(formatted, info)
}
return formatted
Expand Down Expand Up @@ -185,7 +191,12 @@ func createMainGoFile(b *buildingMaterial) (err error) {
for _, p := range b.plugins {
// If user set a path, use it to replace the module with local path
if len(p.Path) > 0 {
replacement := fmt.Sprintf("%s@%s=%s", p.Name, p.Version, p.Path)
var replacement string
if len(p.Version) > 0 {
replacement = fmt.Sprintf("%s@%s=%s", p.Name, p.Version, p.Path)
} else {
replacement = fmt.Sprintf("%s=%s", p.Name, p.Path)
}
err = b.newExecCmd("go", "mod", "edit", "-replace", replacement).Run()
} else if len(p.Version) > 0 {
// If user specify a version, use it to get specific version of the module
Expand Down Expand Up @@ -415,6 +426,13 @@ func copyDirEntries(sourceFs fs.FS, sourceDir, targetDir string, ignoreDir ...st
if strings.HasPrefix(path, s) {
return true
}
// Also ignore nested occurrences, e.g. src/plugins/foo/node_modules
if strings.Contains(path, string(filepath.Separator)+s) {
return true
}
if strings.Contains(path, "/"+s) {
return true
}
}
return false
}
Expand Down
Loading