Skip to content

Commit 48aa042

Browse files
committed
[TO_BE_DISCUSSED] Force recompile of whole library if it is being modified
By ignoring cache files, we can force all the files in a library to be recompiled. This ensures that "all" warnings (introduced in previous commit) are being displayed every time. Cons: recompile time will increase a lot while developing bigger libraries
1 parent 2fd815b commit 48aa042

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

builder_utils/utils.go

+7
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,13 @@ func ObjFileIsUpToDate(ctx *types.Context, sourceFile, objectFile, dependencyFil
248248
logger := ctx.GetLogger()
249249
debugLevel := ctx.DebugLevel
250250

251+
if ctx.IgnoreDependencyCache {
252+
if debugLevel >= 20 {
253+
logger.Fprintln(os.Stdout, constants.LOG_LEVEL_DEBUG, "Skipping dependency detection on {0}", sourceFile)
254+
}
255+
return false, nil
256+
}
257+
251258
if debugLevel >= 20 {
252259
logger.Fprintln(os.Stdout, constants.LOG_LEVEL_DEBUG, "Checking previous results for {0} (result = {1}, dep = {2})", sourceFile, objectFile, dependencyFile)
253260
}

phases/libraries_builder.go

+2
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,12 @@ func compileLibraries(ctx *types.Context, libraries []*types.Library, buildPath
102102

103103
for _, library := range libraries {
104104
if library.IsBeingModified {
105+
ctx.IgnoreDependencyCache = true
105106
ctx.WarningsLevel = "all"
106107
}
107108
libraryObjectFiles, err := compileLibrary(ctx, library, buildPath, buildProperties, includes)
108109
if library.IsBeingModified {
110+
ctx.IgnoreDependencyCache = false
109111
ctx.WarningsLevel = warningLevelToBeRestored
110112
}
111113
if err != nil {

types/context.go

+3
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ type Context struct {
101101
// Reuse old tools since the backing storage didn't change
102102
CanUseCachedTools bool
103103

104+
// Ignore dependency .d files while compiling
105+
IgnoreDependencyCache bool
106+
104107
// Experimental: use arduino-preprocessor to create prototypes
105108
UseArduinoPreprocessor bool
106109
}

0 commit comments

Comments
 (0)