generated from konveyor-ecosystem/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Emily McMullan <[email protected]>
- Loading branch information
1 parent
dcbb845
commit 84bd9e1
Showing
18 changed files
with
4,268 additions
and
113 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
package cmd | ||
|
||
import ( | ||
"bufio" | ||
"fmt" | ||
"io" | ||
"io/fs" | ||
"os" | ||
"slices" | ||
"sort" | ||
"strings" | ||
|
||
outputv1 "github.com/konveyor/analyzer-lsp/output/v1/konveyor" | ||
) | ||
|
||
var ( | ||
RootCommandName = "kantra" | ||
JavaBundlesLocation = "/jdtls/java-analyzer-bundle/java-analyzer-bundle.core/target/java-analyzer-bundle.core-1.0.0-SNAPSHOT.jar" | ||
JDTLSBinLocation = "/jdtls/bin/jdtls" | ||
RulesetsLocation = "rulesets/default/generated" | ||
JavaProviderImage = "quay.io/konveyor/java-external-provider" | ||
GenericProviderImage = "quay.io/konveyor/generic-external-provider" | ||
DotnetProviderImage = "quay.io/konveyor/dotnet-external-provider" | ||
) | ||
|
||
// provider config options | ||
const ( | ||
mavenSettingsFile = "mavenSettingsFile" | ||
lspServerPath = "lspServerPath" | ||
lspServerName = "lspServerName" | ||
workspaceFolders = "workspaceFolders" | ||
dependencyProviderPath = "dependencyProviderPath" | ||
) | ||
|
||
func walkRuleSets(root string, label string, labelsSlice *[]string) fs.WalkDirFunc { | ||
return func(path string, d fs.DirEntry, err error) error { | ||
if !d.IsDir() { | ||
*labelsSlice, err = readRuleFile(path, labelsSlice, label) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
return err | ||
} | ||
} | ||
|
||
func readRuleFile(filePath string, labelsSlice *[]string, label string) ([]string, error) { | ||
file, err := os.Open(filePath) | ||
if err != nil { | ||
return nil, err | ||
} | ||
defer file.Close() | ||
|
||
scanner := bufio.NewScanner(file) | ||
scanner.Split(bufio.ScanWords) | ||
|
||
for scanner.Scan() { | ||
// add source/target labels to slice | ||
label := getSourceOrTargetLabel(scanner.Text(), label) | ||
if len(label) > 0 && !slices.Contains(*labelsSlice, label) { | ||
*labelsSlice = append(*labelsSlice, label) | ||
} | ||
} | ||
if err := scanner.Err(); err != nil { | ||
return nil, err | ||
} | ||
return *labelsSlice, nil | ||
} | ||
|
||
func getSourceOrTargetLabel(text string, label string) string { | ||
if strings.Contains(text, label) { | ||
return text | ||
} | ||
return "" | ||
} | ||
|
||
func listOptionsFromLabels(sl []string, label string, out io.Writer) { | ||
var newSl []string | ||
l := label + "=" | ||
|
||
for _, label := range sl { | ||
newSt := strings.TrimPrefix(label, l) | ||
|
||
if newSt != label { | ||
newSt = strings.TrimSuffix(newSt, "+") | ||
newSt = strings.TrimSuffix(newSt, "-") | ||
|
||
if !slices.Contains(newSl, newSt) { | ||
newSl = append(newSl, newSt) | ||
|
||
} | ||
} | ||
} | ||
sort.Strings(newSl) | ||
|
||
if label == outputv1.SourceTechnologyLabel { | ||
fmt.Fprintln(out, "available source technologies:") | ||
} else { | ||
fmt.Fprintln(out, "available target technologies:") | ||
} | ||
for _, tech := range newSl { | ||
fmt.Fprintln(out, tech) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
## Test and Run Containerless Kantra | ||
|
||
### Clone the required packages: | ||
|
||
```sh | ||
git clone https://github.com/eemcmullan/containerless-kantra-deps.git | ||
``` | ||
|
||
## Move them to where kantra will look for packged binaries: | ||
|
||
```sh | ||
mv $HOME/containerless-kantra-deps $HOME/.kantra | ||
``` | ||
|
||
## Build the static report output parser: | ||
|
||
```sh | ||
cd $HOME/.kantra/static-report/analyzer-output-parser | ||
``` | ||
|
||
```sh | ||
go build -o analyzer-output-parser main.go | ||
``` | ||
|
||
### From kantra, run: | ||
|
||
```sh | ||
go run main.go analyze-bin --input <java-app> --output <output-dir> --rules <java-rules> | ||
``` |
Oops, something went wrong.