From 740aecf814f8113879fd47a79a7ab9588adbf10a Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 17 Jul 2020 12:25:28 +0200 Subject: [PATCH 1/2] Revert "Add macro -DARDUINO_LIB_DISCOVERY_PHASE during lib discovery phase (#633)" This reverts commit 985b2c99c8a4f1902b5226e5ac84a99e731e7524. --- legacy/builder/gcc_preproc_runner.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/legacy/builder/gcc_preproc_runner.go b/legacy/builder/gcc_preproc_runner.go index 4f425737552..fa33bd909fe 100644 --- a/legacy/builder/gcc_preproc_runner.go +++ b/legacy/builder/gcc_preproc_runner.go @@ -77,8 +77,6 @@ func prepareGCCPreprocRecipeProperties(ctx *types.Context, sourceFilePath *paths // to create a /dev/null.d dependency file, which won't work. cmd.Args = utils.Filter(cmd.Args, func(a string) bool { return a != "-MMD" }) - cmd.Args = append(cmd.Args, "-DARDUINO_LIB_DISCOVERY_PHASE") - return cmd, nil } From e0e367bfdc430339ade499b16ab55bb677c62fe0 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Fri, 17 Jul 2020 14:58:26 +0200 Subject: [PATCH 2/2] Set {build.library_discovery_phase} to 1 during lib discovery Previously we used to add `-DARDUINO_LIB_DISCOVERY_PHASE` to the gcc command line but this produced some incompatiblity with compilers using non-standard `-d` flag instead of `-D`: https://github.com/arduino/arduino-cli/pull/633#issuecomment-659529026 --- legacy/builder/gcc_preproc_runner.go | 1 + legacy/builder/setup_build_properties.go | 1 + 2 files changed, 2 insertions(+) diff --git a/legacy/builder/gcc_preproc_runner.go b/legacy/builder/gcc_preproc_runner.go index fa33bd909fe..e831108561e 100644 --- a/legacy/builder/gcc_preproc_runner.go +++ b/legacy/builder/gcc_preproc_runner.go @@ -57,6 +57,7 @@ func GCCPreprocRunnerForDiscoveringIncludes(ctx *types.Context, sourceFilePath * func prepareGCCPreprocRecipeProperties(ctx *types.Context, sourceFilePath *paths.Path, targetFilePath *paths.Path, includes paths.PathList) (*exec.Cmd, error) { properties := ctx.BuildProperties.Clone() + properties.Set("build.library_discovery_phase", "1") properties.SetPath(constants.BUILD_PROPERTIES_SOURCE_FILE, sourceFilePath) properties.SetPath(constants.BUILD_PROPERTIES_PREPROCESSED_FILE_PATH, targetFilePath) diff --git a/legacy/builder/setup_build_properties.go b/legacy/builder/setup_build_properties.go index b8ebd9b5e83..1579180ceba 100644 --- a/legacy/builder/setup_build_properties.go +++ b/legacy/builder/setup_build_properties.go @@ -67,6 +67,7 @@ func (s *SetupBuildProperties) Run(ctx *types.Context) error { buildProperties.Set("build.fqbn", ctx.FQBN.String()) buildProperties.Set("ide_version", ctx.ArduinoAPIVersion) buildProperties.Set("runtime.os", properties.GetOSSuffix()) + buildProperties.Set("build.library_discovery_phase", "0") if ctx.OptimizeForDebug { if buildProperties.ContainsKey("compiler.optimization_flags.debug") {