Skip to content

Allow the builder to be aware of package_index properties #173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 13 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
allow tools with same name and different vendor
  • Loading branch information
facchinm authored and cmaglie committed Jan 11, 2018
commit 137b4560060d8155cd006bb80ec2d2f5cb9be7a8
8 changes: 4 additions & 4 deletions tools_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ func collectAllToolsFolders(from string) ([]string, error) {
return folders, i18n.WrapError(err)
}

func toolsSliceContains(tools *[]*types.Tool, name, version string) bool {
func toolsSliceContains(tools *[]*types.Tool, name, version string, vendor string) bool {
for _, tool := range *tools {
if name == tool.Name && version == tool.Version {
if name == tool.Name && version == tool.Version && vendor == tool.Vendor {
return true
}
}
Expand All @@ -148,7 +148,7 @@ func loadToolsFrom(tools *[]*types.Tool, builtinToolsVersionsFilePath string) er
toolName := strings.Split(rowParts[0], ".")[1]
toolVendor := strings.Split(rowParts[0], ".")[0]
toolVersion := rowParts[1]
if !toolsSliceContains(tools, toolName, toolVersion) {
if !toolsSliceContains(tools, toolName, toolVersion, toolVendor) {
*tools = append(*tools, &types.Tool{Name: toolName, Vendor: toolVendor, Version: toolVersion, Folder: folder})
}
}
Expand Down Expand Up @@ -192,7 +192,7 @@ func loadToolsFromFolderStructure(tools *[]*types.Tool, folder string) error {
return i18n.WrapError(err)
}
toolVendor := filepath.Base(strings.Replace(folder, filepath.Base(folder), "", -1))
if !toolsSliceContains(tools, toolName.Name(), toolVersion.Name()) {
if !toolsSliceContains(tools, toolName.Name(), toolVersion.Name(), toolVendor) {
*tools = append(*tools, &types.Tool{Name: toolName.Name(), Vendor: toolVendor, Version: toolVersion.Name(), Folder: toolFolder})
}
}
Expand Down