Skip to content

Commit

Permalink
[TO_BE_DISCUSSED] Force recompile of whole library if it is being mod…
Browse files Browse the repository at this point in the history
…ified

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
  • Loading branch information
facchinm committed Oct 9, 2018
1 parent 2fd815b commit 48aa042
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions builder_utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,13 @@ func ObjFileIsUpToDate(ctx *types.Context, sourceFile, objectFile, dependencyFil
logger := ctx.GetLogger()
debugLevel := ctx.DebugLevel

if ctx.IgnoreDependencyCache {
if debugLevel >= 20 {
logger.Fprintln(os.Stdout, constants.LOG_LEVEL_DEBUG, "Skipping dependency detection on {0}", sourceFile)
}
return false, nil
}

if debugLevel >= 20 {
logger.Fprintln(os.Stdout, constants.LOG_LEVEL_DEBUG, "Checking previous results for {0} (result = {1}, dep = {2})", sourceFile, objectFile, dependencyFile)
}
Expand Down
2 changes: 2 additions & 0 deletions phases/libraries_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,12 @@ func compileLibraries(ctx *types.Context, libraries []*types.Library, buildPath

for _, library := range libraries {
if library.IsBeingModified {
ctx.IgnoreDependencyCache = true
ctx.WarningsLevel = "all"
}
libraryObjectFiles, err := compileLibrary(ctx, library, buildPath, buildProperties, includes)
if library.IsBeingModified {
ctx.IgnoreDependencyCache = false
ctx.WarningsLevel = warningLevelToBeRestored
}
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions types/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ type Context struct {
// Reuse old tools since the backing storage didn't change
CanUseCachedTools bool

// Ignore dependency .d files while compiling
IgnoreDependencyCache bool

// Experimental: use arduino-preprocessor to create prototypes
UseArduinoPreprocessor bool
}
Expand Down

0 comments on commit 48aa042

Please sign in to comment.