From c8b04820d0aabeabf71e99a0d0b346e71da914dd Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Tue, 16 Nov 2021 14:52:56 +0100 Subject: [PATCH 1/8] Clean up some useless constants --- legacy/builder/builder.go | 28 +++++++++++------------ legacy/builder/constants/constants.go | 25 -------------------- legacy/builder/test/recipe_runner_test.go | 11 +-------- 3 files changed, 15 insertions(+), 49 deletions(-) diff --git a/legacy/builder/builder.go b/legacy/builder/builder.go index d030fdbd384..d9d174b9abb 100644 --- a/legacy/builder/builder.go +++ b/legacy/builder/builder.go @@ -55,7 +55,7 @@ func (s *Builder) Run(ctx *types.Context) error { &WarnAboutPlatformRewrites{}, - &RecipeByPrefixSuffixRunner{Prefix: constants.HOOKS_PREBUILD, Suffix: constants.HOOKS_PATTERN_SUFFIX}, + &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.prebuild", Suffix: ".pattern"}, &ContainerMergeCopySketchFiles{}, @@ -68,33 +68,33 @@ func (s *Builder) Run(ctx *types.Context) error { &PreprocessSketch{}, utils.LogIfVerbose(constants.LOG_LEVEL_INFO, tr("Compiling sketch...")), - &RecipeByPrefixSuffixRunner{Prefix: constants.HOOKS_SKETCH_PREBUILD, Suffix: constants.HOOKS_PATTERN_SUFFIX}, + &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.sketch.prebuild", Suffix: ".pattern"}, &phases.SketchBuilder{}, - &RecipeByPrefixSuffixRunner{Prefix: constants.HOOKS_SKETCH_POSTBUILD, Suffix: constants.HOOKS_PATTERN_SUFFIX}, + &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.sketch.postbuild", Suffix: ".pattern"}, utils.LogIfVerbose(constants.LOG_LEVEL_INFO, tr("Compiling libraries...")), - &RecipeByPrefixSuffixRunner{Prefix: constants.HOOKS_LIBRARIES_PREBUILD, Suffix: constants.HOOKS_PATTERN_SUFFIX}, + &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.libraries.prebuild", Suffix: ".pattern"}, &UnusedCompiledLibrariesRemover{}, &phases.LibrariesBuilder{}, - &RecipeByPrefixSuffixRunner{Prefix: constants.HOOKS_LIBRARIES_POSTBUILD, Suffix: constants.HOOKS_PATTERN_SUFFIX}, + &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.libraries.postbuild", Suffix: ".pattern"}, utils.LogIfVerbose(constants.LOG_LEVEL_INFO, tr("Compiling core...")), - &RecipeByPrefixSuffixRunner{Prefix: constants.HOOKS_CORE_PREBUILD, Suffix: constants.HOOKS_PATTERN_SUFFIX}, + &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.core.prebuild", Suffix: ".pattern"}, &phases.CoreBuilder{}, - &RecipeByPrefixSuffixRunner{Prefix: constants.HOOKS_CORE_POSTBUILD, Suffix: constants.HOOKS_PATTERN_SUFFIX}, + &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.core.postbuild", Suffix: ".pattern"}, utils.LogIfVerbose(constants.LOG_LEVEL_INFO, tr("Linking everything together...")), - &RecipeByPrefixSuffixRunner{Prefix: constants.HOOKS_LINKING_PRELINK, Suffix: constants.HOOKS_PATTERN_SUFFIX}, + &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.linking.prelink", Suffix: ".pattern"}, &phases.Linker{}, - &RecipeByPrefixSuffixRunner{Prefix: constants.HOOKS_LINKING_POSTLINK, Suffix: constants.HOOKS_PATTERN_SUFFIX}, + &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.linking.postlink", Suffix: ".pattern"}, - &RecipeByPrefixSuffixRunner{Prefix: constants.HOOKS_OBJCOPY_PREOBJCOPY, Suffix: constants.HOOKS_PATTERN_SUFFIX}, - &RecipeByPrefixSuffixRunner{Prefix: "recipe.objcopy.", Suffix: constants.HOOKS_PATTERN_SUFFIX}, - &RecipeByPrefixSuffixRunner{Prefix: constants.HOOKS_OBJCOPY_POSTOBJCOPY, Suffix: constants.HOOKS_PATTERN_SUFFIX}, + &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.objcopy.preobjcopy", Suffix: ".pattern"}, + &RecipeByPrefixSuffixRunner{Prefix: "recipe.objcopy.", Suffix: ".pattern"}, + &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.objcopy.postobjcopy", Suffix: ".pattern"}, &MergeSketchWithBootloader{}, - &RecipeByPrefixSuffixRunner{Prefix: constants.HOOKS_POSTBUILD, Suffix: constants.HOOKS_PATTERN_SUFFIX}, + &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.postbuild", Suffix: ".pattern"}, } mainErr := runCommands(ctx, commands) @@ -149,7 +149,7 @@ func (s *Preprocess) Run(ctx *types.Context) error { &ContainerBuildOptions{}, - &RecipeByPrefixSuffixRunner{Prefix: constants.HOOKS_PREBUILD, Suffix: constants.HOOKS_PATTERN_SUFFIX}, + &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.prebuild", Suffix: ".pattern"}, &ContainerMergeCopySketchFiles{}, diff --git a/legacy/builder/constants/constants.go b/legacy/builder/constants/constants.go index 78cf577ade9..4bd03d31aac 100644 --- a/legacy/builder/constants/constants.go +++ b/legacy/builder/constants/constants.go @@ -47,31 +47,6 @@ const FOLDER_CORE = "core" const FOLDER_PREPROC = "preproc" const FOLDER_SKETCH = "sketch" const FOLDER_TOOLS = "tools" -const hooks_core = hooks + ".core" -const HOOKS_CORE_POSTBUILD = hooks_core + hooks_postbuild_suffix -const HOOKS_CORE_PREBUILD = hooks_core + hooks_prebuild_suffix -const hooks_libraries = hooks + ".libraries" -const HOOKS_LIBRARIES_POSTBUILD = hooks_libraries + hooks_postbuild_suffix -const HOOKS_LIBRARIES_PREBUILD = hooks_libraries + hooks_prebuild_suffix -const hooks_linking = hooks + ".linking" -const HOOKS_LINKING_POSTLINK = hooks_linking + hooks_postlink_suffix -const HOOKS_LINKING_PRELINK = hooks_linking + hooks_prelink_suffix -const hooks_objcopy = hooks + ".objcopy" -const HOOKS_OBJCOPY_POSTOBJCOPY = hooks_objcopy + hooks_postobjcopy_suffix -const HOOKS_OBJCOPY_PREOBJCOPY = hooks_objcopy + hooks_preobjcopy_suffix -const HOOKS_PATTERN_SUFFIX = ".pattern" -const HOOKS_POSTBUILD = hooks + hooks_postbuild_suffix -const hooks_postbuild_suffix = ".postbuild" -const hooks_postlink_suffix = ".postlink" -const hooks_postobjcopy_suffix = ".postobjcopy" -const HOOKS_PREBUILD = hooks + hooks_prebuild_suffix -const hooks_prebuild_suffix = ".prebuild" -const hooks_prelink_suffix = ".prelink" -const hooks_preobjcopy_suffix = ".preobjcopy" -const hooks = "recipe.hooks" -const hooks_sketch = hooks + ".sketch" -const HOOKS_SKETCH_POSTBUILD = hooks_sketch + hooks_postbuild_suffix -const HOOKS_SKETCH_PREBUILD = hooks_sketch + hooks_prebuild_suffix const LIBRARY_ALL_ARCHS = "*" const LIBRARY_EMAIL = "email" const LIBRARY_FOLDER_ARCH = "arch" diff --git a/legacy/builder/test/recipe_runner_test.go b/legacy/builder/test/recipe_runner_test.go index d95dba9020f..6fb90bf7e68 100644 --- a/legacy/builder/test/recipe_runner_test.go +++ b/legacy/builder/test/recipe_runner_test.go @@ -19,10 +19,8 @@ import ( "testing" "github.com/arduino/arduino-cli/legacy/builder" - "github.com/arduino/arduino-cli/legacy/builder/constants" "github.com/arduino/arduino-cli/legacy/builder/types" "github.com/arduino/go-properties-orderedmap" - "github.com/stretchr/testify/require" ) // TODO @@ -38,7 +36,7 @@ func TestRecipeRunner(t *testing.T) { commands := []types.Command{ &builder.AddAdditionalEntriesToContext{}, - &builder.RecipeByPrefixSuffixRunner{Prefix: constants.HOOKS_PREBUILD, Suffix: constants.HOOKS_PATTERN_SUFFIX}, + &builder.RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.prebuild", Suffix: ".pattern"}, } for _, command := range commands { @@ -46,10 +44,3 @@ func TestRecipeRunner(t *testing.T) { NoError(t, err) } } - -func TestRecipesComposition(t *testing.T) { - require.Equal(t, "recipe.hooks.core.postbuild", constants.HOOKS_CORE_POSTBUILD) - require.Equal(t, "recipe.hooks.postbuild", constants.HOOKS_POSTBUILD) - require.Equal(t, "recipe.hooks.linking.prelink", constants.HOOKS_LINKING_PRELINK) - require.Equal(t, "recipe.hooks.objcopy.preobjcopy", constants.HOOKS_OBJCOPY_PREOBJCOPY) -} From c33e2a22f834f3c3141fc730c98ea3218ea42530 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Tue, 16 Nov 2021 14:53:55 +0100 Subject: [PATCH 2/8] made legacy/builder.go independent from legacy/constants --- legacy/builder/builder.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/legacy/builder/builder.go b/legacy/builder/builder.go index d9d174b9abb..d72e736387e 100644 --- a/legacy/builder/builder.go +++ b/legacy/builder/builder.go @@ -24,7 +24,6 @@ import ( "github.com/arduino/arduino-cli/arduino/sketch" "github.com/arduino/arduino-cli/i18n" "github.com/arduino/arduino-cli/legacy/builder/builder_utils" - "github.com/arduino/arduino-cli/legacy/builder/constants" "github.com/arduino/arduino-cli/legacy/builder/phases" "github.com/arduino/arduino-cli/legacy/builder/types" "github.com/arduino/arduino-cli/legacy/builder/utils" @@ -59,31 +58,31 @@ func (s *Builder) Run(ctx *types.Context) error { &ContainerMergeCopySketchFiles{}, - utils.LogIfVerbose(constants.LOG_LEVEL_INFO, tr("Detecting libraries used...")), + utils.LogIfVerbose("info", tr("Detecting libraries used...")), &ContainerFindIncludes{}, &WarnAboutArchIncompatibleLibraries{}, - utils.LogIfVerbose(constants.LOG_LEVEL_INFO, tr("Generating function prototypes...")), + utils.LogIfVerbose("info", tr("Generating function prototypes...")), &PreprocessSketch{}, - utils.LogIfVerbose(constants.LOG_LEVEL_INFO, tr("Compiling sketch...")), + utils.LogIfVerbose("info", tr("Compiling sketch...")), &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.sketch.prebuild", Suffix: ".pattern"}, &phases.SketchBuilder{}, &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.sketch.postbuild", Suffix: ".pattern"}, - utils.LogIfVerbose(constants.LOG_LEVEL_INFO, tr("Compiling libraries...")), + utils.LogIfVerbose("info", tr("Compiling libraries...")), &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.libraries.prebuild", Suffix: ".pattern"}, &UnusedCompiledLibrariesRemover{}, &phases.LibrariesBuilder{}, &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.libraries.postbuild", Suffix: ".pattern"}, - utils.LogIfVerbose(constants.LOG_LEVEL_INFO, tr("Compiling core...")), + utils.LogIfVerbose("info", tr("Compiling core...")), &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.core.prebuild", Suffix: ".pattern"}, &phases.CoreBuilder{}, &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.core.postbuild", Suffix: ".pattern"}, - utils.LogIfVerbose(constants.LOG_LEVEL_INFO, tr("Linking everything together...")), + utils.LogIfVerbose("info", tr("Linking everything together...")), &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.linking.prelink", Suffix: ".pattern"}, &phases.Linker{}, &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.linking.postlink", Suffix: ".pattern"}, @@ -203,7 +202,7 @@ func runCommands(ctx *types.Context, commands []types.Command) error { func PrintRingNameIfDebug(ctx *types.Context, command types.Command) { if ctx.DebugLevel >= 10 { - ctx.GetLogger().Fprintln(os.Stdout, constants.LOG_LEVEL_DEBUG, "Ts: {0} - Running: {1}", strconv.FormatInt(time.Now().Unix(), 10), reflect.Indirect(reflect.ValueOf(command)).Type().Name()) + ctx.GetLogger().Fprintln(os.Stdout, "debug", "Ts: {0} - Running: {1}", strconv.FormatInt(time.Now().Unix(), 10), reflect.Indirect(reflect.ValueOf(command)).Type().Name()) } } From 602008a5cec4bd53915004b2d14d6628ee0a5982 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Tue, 16 Nov 2021 15:06:46 +0100 Subject: [PATCH 3/8] Now 'compile --only-compilation-database' will run all pre-* hooks Some platforms make sketch preparation see #1547 Fix #1547 --- legacy/builder/builder.go | 14 +++++++------- legacy/builder/recipe_runner.go | 7 ++++--- test/test_compile_part_4.py | 16 ++++++++++++++++ 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/legacy/builder/builder.go b/legacy/builder/builder.go index d72e736387e..07606162104 100644 --- a/legacy/builder/builder.go +++ b/legacy/builder/builder.go @@ -69,31 +69,31 @@ func (s *Builder) Run(ctx *types.Context) error { utils.LogIfVerbose("info", tr("Compiling sketch...")), &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.sketch.prebuild", Suffix: ".pattern"}, &phases.SketchBuilder{}, - &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.sketch.postbuild", Suffix: ".pattern"}, + &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.sketch.postbuild", Suffix: ".pattern", SkipIfOnlyUpdatingCompilationDatabase: true}, utils.LogIfVerbose("info", tr("Compiling libraries...")), &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.libraries.prebuild", Suffix: ".pattern"}, &UnusedCompiledLibrariesRemover{}, &phases.LibrariesBuilder{}, - &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.libraries.postbuild", Suffix: ".pattern"}, + &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.libraries.postbuild", Suffix: ".pattern", SkipIfOnlyUpdatingCompilationDatabase: true}, utils.LogIfVerbose("info", tr("Compiling core...")), &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.core.prebuild", Suffix: ".pattern"}, &phases.CoreBuilder{}, - &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.core.postbuild", Suffix: ".pattern"}, + &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.core.postbuild", Suffix: ".pattern", SkipIfOnlyUpdatingCompilationDatabase: true}, utils.LogIfVerbose("info", tr("Linking everything together...")), &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.linking.prelink", Suffix: ".pattern"}, &phases.Linker{}, - &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.linking.postlink", Suffix: ".pattern"}, + &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.linking.postlink", Suffix: ".pattern", SkipIfOnlyUpdatingCompilationDatabase: true}, &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.objcopy.preobjcopy", Suffix: ".pattern"}, - &RecipeByPrefixSuffixRunner{Prefix: "recipe.objcopy.", Suffix: ".pattern"}, - &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.objcopy.postobjcopy", Suffix: ".pattern"}, + &RecipeByPrefixSuffixRunner{Prefix: "recipe.objcopy.", Suffix: ".pattern", SkipIfOnlyUpdatingCompilationDatabase: true}, + &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.objcopy.postobjcopy", Suffix: ".pattern", SkipIfOnlyUpdatingCompilationDatabase: true}, &MergeSketchWithBootloader{}, - &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.postbuild", Suffix: ".pattern"}, + &RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.postbuild", Suffix: ".pattern", SkipIfOnlyUpdatingCompilationDatabase: true}, } mainErr := runCommands(ctx, commands) diff --git a/legacy/builder/recipe_runner.go b/legacy/builder/recipe_runner.go index df1865860e3..a9ce71de39e 100644 --- a/legacy/builder/recipe_runner.go +++ b/legacy/builder/recipe_runner.go @@ -29,8 +29,9 @@ import ( ) type RecipeByPrefixSuffixRunner struct { - Prefix string - Suffix string + Prefix string + Suffix string + SkipIfOnlyUpdatingCompilationDatabase bool } func (s *RecipeByPrefixSuffixRunner) Run(ctx *types.Context) error { @@ -53,7 +54,7 @@ func (s *RecipeByPrefixSuffixRunner) Run(ctx *types.Context) error { return errors.WithStack(err) } - if ctx.OnlyUpdateCompilationDatabase { + if ctx.OnlyUpdateCompilationDatabase && s.SkipIfOnlyUpdatingCompilationDatabase { if ctx.Verbose { ctx.GetLogger().Println("info", tr("Skipping: {0}"), strings.Join(command.Args, " ")) } diff --git a/test/test_compile_part_4.py b/test/test_compile_part_4.py index a985632941f..11083d72fbc 100644 --- a/test/test_compile_part_4.py +++ b/test/test_compile_part_4.py @@ -292,6 +292,22 @@ def test_compile_with_esp8266_bundled_libraries(run_command, data_dir, copy_sket assert "\n".join(expected_output) not in res.stdout +def test_generate_compile_commands_json_with_esp32(run_command, data_dir, copy_sketch): + # https://github.com/arduino/arduino-cli/issues/1547 + assert run_command(["update"]) + + # Update index with esp32 core and install it + url = "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json" + assert run_command(["core", "update-index", f"--additional-urls={url}"]) + assert run_command(["core", "install", "esp32:esp32", f"--additional-urls={url}"]) + + # Install a library with the same name as one bundled with the core + assert run_command(["lib", "install", "SD"]) + + sketch_path = copy_sketch("sketch_simple") + assert run_command(["compile", "-b", "esp32:esp32:featheresp32", "--only-compilation-database", sketch_path]) + + def test_compile_sketch_with_tpp_file_include(run_command, copy_sketch): assert run_command(["update"]) From bc4f7aa468b26ae0593f2a60c25a827401694fd4 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Tue, 16 Nov 2021 15:25:35 +0100 Subject: [PATCH 4/8] Updated docs --- cli/compile/compile.go | 2 +- docs/platform-specification.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cli/compile/compile.go b/cli/compile/compile.go index ead85347530..57fdf0006ce 100644 --- a/cli/compile/compile.go +++ b/cli/compile/compile.go @@ -112,7 +112,7 @@ func NewCommand() *cobra.Command { command.RegisterFlagCompletionFunc("programmer", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { return arguments.GetInstalledProgrammers(), cobra.ShellCompDirectiveDefault }) - command.Flags().BoolVar(&compilationDatabaseOnly, "only-compilation-database", false, tr("Just produce the compilation database, without actually compiling.")) + command.Flags().BoolVar(&compilationDatabaseOnly, "only-compilation-database", false, tr("Just produce the compilation database, without actually compiling. All build commands are skipped except all the pre-* hooks.")) command.Flags().BoolVar(&clean, "clean", false, tr("Optional, cleanup the build folder and do not use any cached build.")) // We must use the following syntax for this flag since it's also bound to settings. // This must be done because the value is set when the binding is accessed from viper. Accessing from cobra would only diff --git a/docs/platform-specification.md b/docs/platform-specification.md index 29ff82c6fe8..401b9958db7 100644 --- a/docs/platform-specification.md +++ b/docs/platform-specification.md @@ -399,6 +399,10 @@ recipe.hooks.sketch.prebuild.02.pattern=echo 2 recipe.hooks.sketch.prebuild.11.pattern=echo 11 ``` +Note: all the `pre*` hooks are executed also to produce the "compilation database" (it's a json file with the list of +commands to run to compile the sketch), instead all the `post*` hooks and all compile commands will be skipped. See the +[`arduino-cli compile`](commands/arduino-cli_compile.md) command for more info. + ## Global platform.txt Properties defined in a platform.txt created in the **hardware** subfolder of the Arduino IDE installation folder will From b24e93c097f386224d4a67a040a8eddeeac2b64c Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Tue, 16 Nov 2021 17:00:19 +0100 Subject: [PATCH 5/8] Update cli/compile/compile.go Co-authored-by: per1234 --- cli/compile/compile.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/compile/compile.go b/cli/compile/compile.go index 57fdf0006ce..493cd80d39f 100644 --- a/cli/compile/compile.go +++ b/cli/compile/compile.go @@ -112,7 +112,7 @@ func NewCommand() *cobra.Command { command.RegisterFlagCompletionFunc("programmer", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { return arguments.GetInstalledProgrammers(), cobra.ShellCompDirectiveDefault }) - command.Flags().BoolVar(&compilationDatabaseOnly, "only-compilation-database", false, tr("Just produce the compilation database, without actually compiling. All build commands are skipped except all the pre-* hooks.")) + command.Flags().BoolVar(&compilationDatabaseOnly, "only-compilation-database", false, tr("Just produce the compilation database, without actually compiling. All build commands are skipped except pre* hooks.")) command.Flags().BoolVar(&clean, "clean", false, tr("Optional, cleanup the build folder and do not use any cached build.")) // We must use the following syntax for this flag since it's also bound to settings. // This must be done because the value is set when the binding is accessed from viper. Accessing from cobra would only From 668eaf3de6647bb60f71e5ed4aadc1c4315940d1 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Tue, 16 Nov 2021 17:01:10 +0100 Subject: [PATCH 6/8] Update docs/platform-specification.md Co-authored-by: per1234 --- docs/platform-specification.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/platform-specification.md b/docs/platform-specification.md index 401b9958db7..56a3878e77e 100644 --- a/docs/platform-specification.md +++ b/docs/platform-specification.md @@ -399,9 +399,9 @@ recipe.hooks.sketch.prebuild.02.pattern=echo 2 recipe.hooks.sketch.prebuild.11.pattern=echo 11 ``` -Note: all the `pre*` hooks are executed also to produce the "compilation database" (it's a json file with the list of -commands to run to compile the sketch), instead all the `post*` hooks and all compile commands will be skipped. See the -[`arduino-cli compile`](commands/arduino-cli_compile.md) command for more info. +Note: all the `pre*` hooks are executed while producing the "compilation database" (a JSON file with the list of +commands to run to compile the sketch), but the `post*` hooks and all compile commands are skipped. See the +[`arduino-cli compile`](commands/arduino-cli_compile.md) command reference for more info. ## Global platform.txt From 79fdbd999dfc867f99332b5a6d86345ba2714b86 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Tue, 16 Nov 2021 17:01:22 +0100 Subject: [PATCH 7/8] Update test/test_compile_part_4.py Co-authored-by: per1234 --- test/test_compile_part_4.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/test_compile_part_4.py b/test/test_compile_part_4.py index 11083d72fbc..9dd0184f000 100644 --- a/test/test_compile_part_4.py +++ b/test/test_compile_part_4.py @@ -301,9 +301,6 @@ def test_generate_compile_commands_json_with_esp32(run_command, data_dir, copy_s assert run_command(["core", "update-index", f"--additional-urls={url}"]) assert run_command(["core", "install", "esp32:esp32", f"--additional-urls={url}"]) - # Install a library with the same name as one bundled with the core - assert run_command(["lib", "install", "SD"]) - sketch_path = copy_sketch("sketch_simple") assert run_command(["compile", "-b", "esp32:esp32:featheresp32", "--only-compilation-database", sketch_path]) From 6c3b8be0e30ead742649d971628b5da4340263f3 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Tue, 16 Nov 2021 17:01:31 +0100 Subject: [PATCH 8/8] Update test/test_compile_part_4.py Co-authored-by: per1234 --- test/test_compile_part_4.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_compile_part_4.py b/test/test_compile_part_4.py index 9dd0184f000..8eeaa76e929 100644 --- a/test/test_compile_part_4.py +++ b/test/test_compile_part_4.py @@ -299,7 +299,7 @@ def test_generate_compile_commands_json_with_esp32(run_command, data_dir, copy_s # Update index with esp32 core and install it url = "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json" assert run_command(["core", "update-index", f"--additional-urls={url}"]) - assert run_command(["core", "install", "esp32:esp32", f"--additional-urls={url}"]) + assert run_command(["core", "install", "esp32:esp32@2.0.1", f"--additional-urls={url}"]) sketch_path = copy_sketch("sketch_simple") assert run_command(["compile", "-b", "esp32:esp32:featheresp32", "--only-compilation-database", sketch_path])