From cb82028a4887172591e9b38093fb1394392d137e Mon Sep 17 00:00:00 2001 From: Matteo Pologruto Date: Mon, 27 Feb 2023 12:07:16 +0100 Subject: [PATCH] Add hooks `hooks.savehex.presavehex` and `hooks.savehex.postsavehex` --- commands/compile/compile.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/commands/compile/compile.go b/commands/compile/compile.go index da794cec1f4..01eab8c10ca 100644 --- a/commands/compile/compile.go +++ b/commands/compile/compile.go @@ -260,6 +260,11 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream exportBinaries = false } if exportBinaries { + presaveHex := builder.RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.savehex.presavehex", Suffix: ".pattern"} + if err := presaveHex.Run(builderCtx); err != nil { + return r, err + } + var exportPath *paths.Path if exportDir := req.GetExportDir(); exportDir != "" { exportPath = paths.New(exportDir) @@ -293,6 +298,11 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream return r, &arduino.PermissionDeniedError{Message: tr("Error copying output file %s", buildFile), Cause: err} } } + + postsaveHex := builder.RecipeByPrefixSuffixRunner{Prefix: "recipe.hooks.savehex.postsavehex", Suffix: ".pattern"} + if err := postsaveHex.Run(builderCtx); err != nil { + return r, err + } } r.ExecutableSectionsSize = builderCtx.ExecutableSectionsSize.ToRPCExecutableSectionSizeArray()