func (s *IncludesFinderWithRegExp) Run(ctx *types.Context) error { source := *s.Source matches := INCLUDE_REGEXP.FindAllStringSubmatch(source, -1) includes := []string{} for _, match := range matches { includes = append(includes, strings.TrimSpace(match[1])) } if len(includes) == 0 { include := findIncludesForOldCompilers(source) if include != "" { includes = append(includes, include) } } ctx.IncludesJustFound = includes ctx.Includes = utils.AppendIfNotPresent(ctx.Includes, includes...) return nil }
func (s *GCCMinusMOutputParser) Run(ctx *types.Context) error { output := ctx.OutputGccMinusM rows := strings.Split(output, "\n") includes := make([]string, 0) if len(rows) > 2 { for _, row := range rows[2:] { if !strings.HasPrefix(row, " ") { row = strings.TrimSpace(row) if row != "" { row = strings.TrimSuffix(row, ":") row = strings.Replace(row, "\\ ", " ", -1) includes = append(includes, row) } } } } ctx.Includes = utils.AppendIfNotPresent(ctx.Includes, includes...) return nil }