func (s *IncludesFinderWithGCC) Run(context map[string]interface{}) error { buildProperties := make(props.PropertiesMap) if p, ok := context[constants.CTX_BUILD_PROPERTIES]; ok { buildProperties = p.(props.PropertiesMap).Clone() } verbose := context[constants.CTX_VERBOSE].(bool) logger := context[constants.CTX_LOGGER].(i18n.Logger) includesParams := constants.EMPTY_STRING if utils.MapHas(context, constants.CTX_INCLUDE_FOLDERS) { includes := context[constants.CTX_INCLUDE_FOLDERS].([]string) includes = utils.Map(includes, utils.WrapWithHyphenI) includesParams = strings.Join(includes, " ") } properties := buildProperties.Clone() properties[constants.BUILD_PROPERTIES_SOURCE_FILE] = s.SourceFile properties[constants.BUILD_PROPERTIES_INCLUDES] = includesParams builder_utils.RemoveHyphenMDDFlagFromGCCCommandLine(properties) output, err := builder_utils.ExecRecipe(properties, constants.RECIPE_PREPROC_INCLUDES, true, verbose, false, logger) if err != nil { return utils.WrapError(err) } context[constants.CTX_GCC_MINUS_M_OUTPUT] = string(output) return nil }
func (s *IncludesFinderWithGCC) Run(context map[string]interface{}) error { buildProperties := utils.GetMapStringStringOrDefault(context, constants.CTX_BUILD_PROPERTIES) sketch := context[constants.CTX_SKETCH].(*types.Sketch) sketchBuildPath := context[constants.CTX_SKETCH_BUILD_PATH].(string) verbose := context[constants.CTX_VERBOSE].(bool) logger := context[constants.CTX_LOGGER].(i18n.Logger) includesParams := "" if utils.MapHas(context, constants.CTX_INCLUDE_FOLDERS) { includes := context[constants.CTX_INCLUDE_FOLDERS].([]string) includes = utils.Map(includes, utils.WrapWithHyphenI) includesParams = strings.Join(includes, " ") } properties := utils.MergeMapsOfStrings(make(map[string]string), buildProperties) properties[constants.BUILD_PROPERTIES_SOURCE_FILE] = filepath.Join(sketchBuildPath, filepath.Base(sketch.MainFile.Name)+".cpp") properties[constants.BUILD_PROPERTIES_INCLUDES] = includesParams builder_utils.RemoveHyphenMDDFlagFromGCCCommandLine(properties) output, err := builder_utils.ExecRecipe(properties, constants.RECIPE_PREPROC_INCLUDES, true, verbose, false, logger) if err != nil { return utils.WrapError(err) } context[constants.CTX_GCC_MINUS_M_OUTPUT] = string(output) return nil }
func prepareGCCPreprocRecipeProperties(context map[string]interface{}, sourceFilePath string, targetFilePath string) (props.PropertiesMap, string, error) { if targetFilePath != utils.NULLFile() { preprocPath := context[constants.CTX_PREPROC_PATH].(string) err := utils.EnsureFolderExists(preprocPath) if err != nil { return nil, "", utils.WrapError(err) } targetFilePath = filepath.Join(preprocPath, targetFilePath) } properties := make(props.PropertiesMap) if p, ok := context[constants.CTX_BUILD_PROPERTIES]; ok { properties = p.(props.PropertiesMap).Clone() } properties[constants.BUILD_PROPERTIES_SOURCE_FILE] = sourceFilePath properties[constants.BUILD_PROPERTIES_PREPROCESSED_FILE_PATH] = targetFilePath includes := context[constants.CTX_INCLUDE_FOLDERS].([]string) includes = utils.Map(includes, utils.WrapWithHyphenI) properties[constants.BUILD_PROPERTIES_INCLUDES] = strings.Join(includes, constants.SPACE) builder_utils.RemoveHyphenMDDFlagFromGCCCommandLine(properties) return properties, targetFilePath, nil }
func prepareGCCPreprocRecipeProperties(ctx *types.Context, sourceFilePath string, targetFilePath string, includes []string) (properties.Map, string, error) { if targetFilePath != utils.NULLFile() { preprocPath := ctx.PreprocPath err := utils.EnsureFolderExists(preprocPath) if err != nil { return nil, "", i18n.WrapError(err) } targetFilePath = filepath.Join(preprocPath, targetFilePath) } properties := ctx.BuildProperties.Clone() properties[constants.BUILD_PROPERTIES_SOURCE_FILE] = sourceFilePath properties[constants.BUILD_PROPERTIES_PREPROCESSED_FILE_PATH] = targetFilePath includes = utils.Map(includes, utils.WrapWithHyphenI) properties[constants.BUILD_PROPERTIES_INCLUDES] = strings.Join(includes, constants.SPACE) builder_utils.RemoveHyphenMDDFlagFromGCCCommandLine(properties) return properties, targetFilePath, nil }
func prepareGCCPreprocRecipeProperties(context map[string]interface{}, sourceFilePath string, targetFileName string) (map[string]string, string, error) { preprocPath := context[constants.CTX_PREPROC_PATH].(string) err := utils.EnsureFolderExists(preprocPath) if err != nil { return nil, "", utils.WrapError(err) } targetFilePath := filepath.Join(preprocPath, targetFileName) buildProperties := utils.GetMapStringStringOrDefault(context, constants.CTX_BUILD_PROPERTIES) properties := utils.MergeMapsOfStrings(make(map[string]string), buildProperties) properties[constants.BUILD_PROPERTIES_SOURCE_FILE] = sourceFilePath properties[constants.BUILD_PROPERTIES_PREPROCESSED_FILE_PATH] = targetFilePath includes := context[constants.CTX_INCLUDE_FOLDERS].([]string) includes = utils.Map(includes, utils.WrapWithHyphenI) properties[constants.BUILD_PROPERTIES_INCLUDES] = strings.Join(includes, constants.SPACE) builder_utils.RemoveHyphenMDDFlagFromGCCCommandLine(properties) return properties, targetFilePath, nil }