From c750434b2da701d19773471c2f981bdb8499497b Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 28 Aug 2019 19:27:12 +0200 Subject: [PATCH 1/2] Compare properites maps "without ordering" while looking for changes in build options This is accomplished by updating go-properties-orderedmap with this fix: https://github.com/arduino/go-properties-orderedmap/commit/05018b28ff6c9492102947be131fd396d74c772e --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index bb1bd25beda..7629cef0d79 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( bou.ke/monkey v1.0.1 github.com/arduino/board-discovery v0.0.0-20180823133458-1ba29327fb0c github.com/arduino/go-paths-helper v0.0.0-20190214132331-c3c98d1bf2e1 - github.com/arduino/go-properties-orderedmap v0.0.0-20181003091528-89278049acd3 + github.com/arduino/go-properties-orderedmap v0.0.0-20190828172252-05018b28ff6c github.com/arduino/go-timeutils v0.0.0-20171220113728-d1dd9e313b1b github.com/arduino/go-win32-utils v0.0.0-20180330194947-ed041402e83b github.com/cmaglie/pb v1.0.27 diff --git a/go.sum b/go.sum index b3c9320a621..240d42c3b0f 100644 --- a/go.sum +++ b/go.sum @@ -8,6 +8,8 @@ github.com/arduino/go-paths-helper v0.0.0-20190214132331-c3c98d1bf2e1 h1:S0NpDSq github.com/arduino/go-paths-helper v0.0.0-20190214132331-c3c98d1bf2e1/go.mod h1:OGL+FS3aTrS01YsBAJJhkGuxtEGsFRSgZYo8b3vefdc= github.com/arduino/go-properties-orderedmap v0.0.0-20181003091528-89278049acd3 h1:aWZoiBr2fCXtZzY4e/TOyQHEFyFpsF9eph7rEDZRv0Y= github.com/arduino/go-properties-orderedmap v0.0.0-20181003091528-89278049acd3/go.mod h1:kiSuHm7yz3chiy8rb2MphC7ECn3MlkQFAIe4SXmQg6o= +github.com/arduino/go-properties-orderedmap v0.0.0-20190828172252-05018b28ff6c h1:4z4PJqNH8WGXtm9ix2muUOAP7gxTGBOdQTuKEDyCnsA= +github.com/arduino/go-properties-orderedmap v0.0.0-20190828172252-05018b28ff6c/go.mod h1:kiSuHm7yz3chiy8rb2MphC7ECn3MlkQFAIe4SXmQg6o= github.com/arduino/go-timeutils v0.0.0-20171220113728-d1dd9e313b1b h1:9hDi4F2st6dbLC3y4i02zFT5quS4X6iioWifGlVwfy4= github.com/arduino/go-timeutils v0.0.0-20171220113728-d1dd9e313b1b/go.mod h1:uwGy5PpN4lqW97FiLnbcx+xx8jly5YuPMJWfVwwjJiQ= github.com/arduino/go-win32-utils v0.0.0-20180330194947-ed041402e83b h1:3PjgYG5gVPA7cipp7vIR2lF96KkEJIFBJ+ANnuv6J20= From fffa451acd60da9341df523c79e10e429c21de22 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 28 Aug 2019 19:31:34 +0200 Subject: [PATCH 2/2] Slightly simplify utils.compileFileWithRecipe This commit should be equivalent, no semantic changes just simplified the notation. --- legacy/builder/builder_utils/utils.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/legacy/builder/builder_utils/utils.go b/legacy/builder/builder_utils/utils.go index e2ba0650189..337b82be780 100644 --- a/legacy/builder/builder_utils/utils.go +++ b/legacy/builder/builder_utils/utils.go @@ -237,28 +237,29 @@ func compileFileWithRecipe(ctx *types.Context, sourcePath *paths.Path, source *p if err != nil { return nil, i18n.WrapError(err) } - properties.Set(constants.BUILD_PROPERTIES_OBJECT_FILE, buildPath.JoinPath(relativeSource).String()+".o") + depsFile := buildPath.Join(relativeSource.String() + ".d") + objectFile := buildPath.Join(relativeSource.String() + ".o") - err = properties.GetPath(constants.BUILD_PROPERTIES_OBJECT_FILE).Parent().MkdirAll() + properties.SetPath(constants.BUILD_PROPERTIES_OBJECT_FILE, objectFile) + err = objectFile.Parent().MkdirAll() if err != nil { return nil, i18n.WrapError(err) } - objIsUpToDate, err := ObjFileIsUpToDate(ctx, properties.GetPath(constants.BUILD_PROPERTIES_SOURCE_FILE), properties.GetPath(constants.BUILD_PROPERTIES_OBJECT_FILE), buildPath.Join(relativeSource.String()+".d")) + objIsUpToDate, err := ObjFileIsUpToDate(ctx, source, objectFile, depsFile) if err != nil { return nil, i18n.WrapError(err) } - if !objIsUpToDate { _, _, err = ExecRecipe(ctx, properties, recipe, false /* stdout */, utils.ShowIfVerbose /* stderr */, utils.Show) if err != nil { return nil, i18n.WrapError(err) } } else if ctx.Verbose { - logger.Println(constants.LOG_LEVEL_INFO, constants.MSG_USING_PREVIOUS_COMPILED_FILE, properties.Get(constants.BUILD_PROPERTIES_OBJECT_FILE)) + logger.Println(constants.LOG_LEVEL_INFO, constants.MSG_USING_PREVIOUS_COMPILED_FILE, objectFile) } - return properties.GetPath(constants.BUILD_PROPERTIES_OBJECT_FILE), nil + return objectFile, nil } func ObjFileIsUpToDate(ctx *types.Context, sourceFile, objectFile, dependencyFile *paths.Path) (bool, error) {