Skip to content

Include hpp and hh files when searching for libraries #196

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

Merged
merged 1 commit into from
Nov 28, 2016
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/arduino.cc/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import (
)

var MAIN_FILE_VALID_EXTENSIONS = map[string]bool{".ino": true, ".pde": true}
var ADDITIONAL_FILE_VALID_EXTENSIONS = map[string]bool{".h": true, ".c": true, ".hpp": true, ".cpp": true, ".s": true}
var ADDITIONAL_FILE_VALID_EXTENSIONS = map[string]bool{".h": true, ".c": true, ".hpp": true, ".hh": true, ".cpp": true, ".s": true}
var ADDITIONAL_FILE_VALID_EXTENSIONS_NO_HEADERS = map[string]bool{".c": true, ".cpp": true, ".s": true}

var LIBRARY_MANDATORY_PROPERTIES = []string{constants.LIBRARY_NAME, constants.LIBRARY_VERSION, constants.LIBRARY_AUTHOR, constants.LIBRARY_MAINTAINER}
Expand Down
2 changes: 1 addition & 1 deletion src/arduino.cc/builder/builder_utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func compileFilesWithExtensionWithRecipe(objectFiles []string, sourcePath string
}

func findFilesInFolder(sourcePath string, extension string, recurse bool) ([]string, error) {
files, err := utils.ReadDirFiltered(sourcePath, utils.FilterFilesWithExtension(extension))
files, err := utils.ReadDirFiltered(sourcePath, utils.FilterFilesWithExtensions(extension))
if err != nil {
return nil, i18n.WrapError(err)
}
Expand Down
2 changes: 1 addition & 1 deletion src/arduino.cc/builder/libraries_loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (s *LibrariesLoader) Run(ctx *types.Context) error {

headerToLibraries := make(map[string][]*types.Library)
for _, library := range libraries {
headers, err := utils.ReadDirFiltered(library.SrcFolder, utils.FilterFilesWithExtension(".h"))
headers, err := utils.ReadDirFiltered(library.SrcFolder, utils.FilterFilesWithExtensions(".h", ".hpp", ".hh"))
if err != nil {
return i18n.WrapError(err)
}
Expand Down
4 changes: 2 additions & 2 deletions src/arduino.cc/builder/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ func FilterDirs(files []os.FileInfo) []os.FileInfo {
return filtered
}

func FilterFilesWithExtension(extension string) filterFiles {
func FilterFilesWithExtensions(extensions ...string) filterFiles {
return func(files []os.FileInfo) []os.FileInfo {
var filtered []os.FileInfo
for _, file := range files {
if !file.IsDir() && filepath.Ext(file.Name()) == extension {
if !file.IsDir() && SliceContains(extensions, filepath.Ext(file.Name())) {
filtered = append(filtered, file)
}
}
Expand Down