Skip to content

Commit 70d7768

Browse files
committed
Define valid platform bundled libraries folder names in the platform package
1 parent 2cbdb07 commit 70d7768

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

project/platform/platform.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,17 @@ func IsRequiredConfigurationFile(filePath *paths.Path) bool {
4040
}
4141
return false
4242
}
43+
44+
// See: https://arduino.github.io/arduino-cli/latest/platform-specification/#platform-bundled-libraries
45+
var bundledLibrariesFolderNames = map[string]struct{}{
46+
"libraries": empty,
47+
}
48+
49+
func BundledLibrariesFolderNames() []string {
50+
folderNames := make([]string, 0, len(bundledLibrariesFolderNames))
51+
for folderName := range bundledLibrariesFolderNames {
52+
folderNames = append(folderNames, folderName)
53+
}
54+
55+
return folderNames
56+
}

project/project.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,10 @@ func findSubprojects(superproject Type, apexSuperprojectType projecttype.Type) [
108108
immediateSubprojects = append(immediateSubprojects, findProjectsUnderPath(subprojectPath, projecttype.Sketch, true)...)
109109
}
110110
case projecttype.Platform:
111-
subprojectPath := superproject.Path.Join("libraries")
112-
immediateSubprojects = append(immediateSubprojects, findProjectsUnderPath(subprojectPath, projecttype.Library, false)...)
111+
for _, subprojectFolderName := range platform.BundledLibrariesFolderNames() {
112+
subprojectPath := superproject.Path.Join(subprojectFolderName)
113+
immediateSubprojects = append(immediateSubprojects, findProjectsUnderPath(subprojectPath, projecttype.Library, false)...)
114+
}
113115
case projecttype.PackageIndex:
114116
// Platform indexes don't have subprojects
115117
return nil

0 commit comments

Comments
 (0)