Skip to content

Commit

Permalink
do not create discovery dir for convert
Browse files Browse the repository at this point in the history
Signed-off-by: Emily McMullan <emcmulla@redhat.com>
  • Loading branch information
eemcmullan committed Sep 26, 2023
1 parent 085ca70 commit 6a079d4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func main() {
if err != nil {
fmt.Println(err)
}
_, err = conversion.ConvertWindupRulesetsToAnalyzer(rulesets, location, outputDir, flattenRulesets)
_, err = conversion.ConvertWindupRulesetsToAnalyzer(rulesets, location, outputDir, flattenRulesets, os.Args[1])
if err != nil {
log.Fatal(err)
}
Expand Down
12 changes: 7 additions & 5 deletions pkg/conversion/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ type analyzerRules struct {
relativePath string
}

func ConvertWindupRulesetsToAnalyzer(windups []windup.Ruleset, baseLocation, outputDir string, flattenRulesets bool) (map[string]*analyzerRules, error) {
// Write discovery rules
err := writeDiscoveryRules(outputDir)
if err != nil {
return nil, err
func ConvertWindupRulesetsToAnalyzer(windups []windup.Ruleset, baseLocation, outputDir string, flattenRulesets bool, cmd string) (map[string]*analyzerRules, error) {
if cmd != "convert" {
// Write discovery rules
err := writeDiscoveryRules(outputDir)
if err != nil {
return nil, err
}
}

outputRulesets := map[string]*analyzerRules{}
Expand Down
2 changes: 1 addition & 1 deletion pkg/execution/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func ExecuteRulesets(rulesets []windup.Ruleset, baseLocation, datadir string) (s
for _, ruleset := range rulesets {
sourceFiles = append(sourceFiles, ruleset.SourceFile)
}
conversion.ConvertWindupRulesetsToAnalyzer(rulesets, baseLocation, filepath.Join(dir, "rules"), true)
conversion.ConvertWindupRulesetsToAnalyzer(rulesets, baseLocation, filepath.Join(dir, "rules"), true, "")
// Template config file for analyzer
providerConfig := []provider.Config{
{
Expand Down

0 comments on commit 6a079d4

Please sign in to comment.