@@ -41,14 +41,8 @@ import (
4141 "github.com/arduino/go-properties-map"
4242)
4343
44- type GCCPreprocRunner struct {
45- SourceFilePath string
46- TargetFileName string
47- Includes []string
48- }
49-
50- func (s * GCCPreprocRunner ) Run (ctx * types.Context ) error {
51- properties , targetFilePath , err := prepareGCCPreprocRecipeProperties (ctx , s .SourceFilePath , s .TargetFileName , s .Includes )
44+ func GCCPreprocRunner (ctx * types.Context , sourceFilePath string , targetFilePath string , includes []string ) error {
45+ properties , targetFilePath , err := prepareGCCPreprocRecipeProperties (ctx , sourceFilePath , targetFilePath , includes )
5246 if err != nil {
5347 return i18n .WrapError (err )
5448 }
@@ -70,16 +64,10 @@ func (s *GCCPreprocRunner) Run(ctx *types.Context) error {
7064 return nil
7165}
7266
73- type GCCPreprocRunnerForDiscoveringIncludes struct {
74- SourceFilePath string
75- TargetFilePath string
76- Includes []string
77- }
78-
79- func (s * GCCPreprocRunnerForDiscoveringIncludes ) Run (ctx * types.Context ) error {
80- properties , _ , err := prepareGCCPreprocRecipeProperties (ctx , s .SourceFilePath , s .TargetFilePath , s .Includes )
67+ func GCCPreprocRunnerForDiscoveringIncludes (ctx * types.Context , sourceFilePath string , targetFilePath string , includes []string ) (string , error ) {
68+ properties , _ , err := prepareGCCPreprocRecipeProperties (ctx , sourceFilePath , targetFilePath , includes )
8169 if err != nil {
82- return i18n .WrapError (err )
70+ return "" , i18n .WrapError (err )
8371 }
8472
8573 verbose := ctx .Verbose
@@ -92,12 +80,10 @@ func (s *GCCPreprocRunnerForDiscoveringIncludes) Run(ctx *types.Context) error {
9280
9381 stderr , err := builder_utils .ExecRecipeCollectStdErr (properties , constants .RECIPE_PREPROC_MACROS , true , verbose , false , logger )
9482 if err != nil {
95- return i18n .WrapError (err )
83+ return "" , i18n .WrapError (err )
9684 }
9785
98- ctx .SourceGccMinusE = string (stderr )
99-
100- return nil
86+ return string (stderr ), nil
10187}
10288
10389func prepareGCCPreprocRecipeProperties (ctx * types.Context , sourceFilePath string , targetFilePath string , includes []string ) (properties.Map , string , error ) {
0 commit comments