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 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
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
}
2 changes: 2 additions & 0 deletions constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ 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_ERROR_ARCHIVING_CORE_CACHE = "Error archiving built core (caching) in {0}: {1}"
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
11 changes: 9 additions & 2 deletions phases/core_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
package phases

import (
"os"
"path/filepath"

"github.com/arduino/arduino-builder/builder_utils"
Expand Down Expand Up @@ -124,10 +125,16 @@ 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 if os.IsNotExist(err) {
logger.Println(constants.LOG_LEVEL_INFO, constants.MSG_CORE_CACHE_UNAVAILABLE, ctx.ActualPlatform.PlatformId)
} else {
logger.Println(constants.LOG_LEVEL_INFO, constants.MSG_ERROR_ARCHIVING_CORE_CACHE, targetArchivedCore, err)
}
}
builder_utils.CopyFile(archiveFile, targetArchivedCore)
}

return archiveFile, variantObjectFiles, nil
Expand Down