Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Allow use of a dependency helper source file during library detection #2758

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
Loading
from
Draft
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
Allow use of a dependency helper source file during library detection
  • Loading branch information
cmaglie committed Nov 18, 2024
commit f593a73686d39eca4cafbb304075e3e2bbb043c5
28 changes: 23 additions & 5 deletions 28 internal/arduino/builder/internal/detector/detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,14 @@ func (l *SketchLibrariesDetector) findIncludesUntilDone(
l.logger.Info(i18n.Tr("Skipping dependencies detection for precompiled library %[1]s", library.Name))
}
} else {
for _, sourceDir := range library.SourceDirs() {
l.queueSourceFilesFromFolder(sourceFileQueue, sourceDir.Dir, sourceDir.Recurse,
if helperSource := library.DependencyHelper(); helperSource != nil {
l.queueSourceFile(sourceFileQueue, helperSource,
library.SourceDir, librariesBuildPath.Join(library.DirName), library.UtilityDir)
} else {
for _, sourceDir := range library.SourceDirs() {
l.queueSourceFilesFromFolder(sourceFileQueue, sourceDir.Dir, sourceDir.Recurse,
library.SourceDir, librariesBuildPath.Join(library.DirName), library.UtilityDir)
}
}
}
first = false
Expand All @@ -441,16 +446,29 @@ func (l *SketchLibrariesDetector) queueSourceFilesFromFolder(
}

for _, filePath := range filePaths {
sourceFile, err := makeSourceFile(sourceDir, buildDir, filePath, extraIncludePath...)
if err != nil {
if err := l.queueSourceFile(sourceFileQueue, filePath, sourceDir, buildDir, extraIncludePath...); err != nil {
return err
}
sourceFileQueue.push(sourceFile)
}

return nil
}

func (l *SketchLibrariesDetector) queueSourceFile(
sourceFileQueue *uniqueSourceFileQueue,
filePath *paths.Path,
sourceDir *paths.Path,
buildDir *paths.Path,
extraIncludePath ...*paths.Path,
) error {
sourceFile, err := makeSourceFile(sourceDir, buildDir, filePath, extraIncludePath...)
if err != nil {
return err
}
sourceFileQueue.push(sourceFile)
return nil
}

func (l *SketchLibrariesDetector) failIfImportedLibraryIsWrong() error {
if len(l.importedLibraries) == 0 {
return nil
Expand Down
11 changes: 11 additions & 0 deletions 11 internal/arduino/libraries/libraries.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,3 +239,14 @@ func (library *Library) SourceHeaders() ([]string, error) {
}
return library.sourceHeaders, nil
}

// DependencyHelper returns the path to the dependency helper file.
func (library *Library) DependencyHelper() *paths.Path {
if c := library.SourceDir.Join("arduino_deps.c"); c.Exist() {
return c
}
if cpp := library.SourceDir.Join("arduino_deps.cpp"); cpp.Exist() {
return cpp
}
return nil
}
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.