Skip to content

Improve core archive info #288

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 3 commits into from
Sep 7, 2018
Merged
Show file tree
Hide file tree
Changes from 2 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
7 changes: 6 additions & 1 deletion builder_utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -558,5 +558,10 @@ func GetCachedCoreArchiveFileName(fqbn, coreFolder string) string {
coreFolder = absCoreFolder
} // silently continue if absolute path can't be detected
hash := utils.MD5Sum([]byte(coreFolder))
return "core_" + fqbnToUnderscore + "_" + hash + ".a"
realName := "core_" + fqbnToUnderscore + "_" + hash + ".a"
if len(realName) > 100 {
// avoid really long names, simply hash the final part
realName = "core_" + utils.MD5Sum([]byte(fqbnToUnderscore+"_"+hash)) + ".a"
}
return realName
}
1 change: 1 addition & 0 deletions constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ const LOG_LEVEL_INFO = "info"
const LOG_LEVEL_WARN = "warn"
const MSG_ARCH_FOLDER_NOT_SUPPORTED = "'arch' folder is no longer supported! See http://goo.gl/gfFJzU for more information"
const MSG_ARCHIVING_CORE_CACHE = "Archiving built core (caching) in: {0}"
const MSG_CORE_CACHE_UNAVAILABLE = "Unable to cache built core, please tell {0} maintainers to follow http://goo.gl/QdCUjo"
const MSG_BOARD_UNKNOWN = "Board {0} (platform {1}, package {2}) is unknown"
const MSG_BOOTLOADER_FILE_MISSING = "Bootloader file specified but missing: {0}"
const MSG_BUILD_OPTIONS_CHANGED = "Build options changed, rebuilding all"
Expand Down
8 changes: 6 additions & 2 deletions phases/core_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,14 @@ func compileCore(ctx *types.Context, buildPath string, buildCachePath string, bu

// archive core.a
if targetArchivedCore != "" {
err := builder_utils.CopyFile(archiveFile, targetArchivedCore)
if ctx.Verbose {
logger.Println(constants.LOG_LEVEL_INFO, constants.MSG_ARCHIVING_CORE_CACHE, targetArchivedCore)
if err == nil {
logger.Println(constants.LOG_LEVEL_INFO, constants.MSG_ARCHIVING_CORE_CACHE, targetArchivedCore)
} else {
logger.Println(constants.LOG_LEVEL_INFO, constants.MSG_CORE_CACHE_UNAVAILABLE, ctx.ActualPlatform.PlatformId)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This blames any error while copying the file on the core maintainers. I suppose the intended case is where the core does not use the proper .a filename, so the copy cannot find it? If so, then perhaps a separate check should be made to see if the .a filename exists and give this error if it does not? If the file does exist, but the copy fails, a new error message should probably be shown?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also add arduino.ar as a possible target but this clashes badly with specifications at http://goo.gl/QdCUjo .
I think that adding this check will make life terrible for maintainers of "incompatible" cores for a bit but will enormously speedup the adoption of proper naming (esp8266 just merged it in mainline esp8266/Arduino@85e6809#diff-d638a47d1ca0e2a5585fb34c7d7fb0f9L95 )

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Terrible in what way? Because users will start pestering them? Or because their incompatible cores will break or become slower (I can't see why or how)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first one 🙂

}
}
builder_utils.CopyFile(archiveFile, targetArchivedCore)
}

return archiveFile, variantObjectFiles, nil
Expand Down