MCPcopy Create free account
hub / github.com/XmirrorSecurity/OpenSCA-cli / main

Function main

example/java/main.go:34–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32}
33
34func main() {
35
36 projectDir := "../../test/java/9"
37
38 // find pom files
39 var poms []*java.Pom
40 filepath.WalkDir(projectDir, func(path string, d fs.DirEntry, err error) error {
41 if !strings.HasSuffix(path, "pom.xml") {
42 return nil
43 }
44 pomfile := model.NewFile(path, strings.TrimPrefix(path, projectDir))
45 pomfile.OpenReader(func(reader io.Reader) {
46 pom := java.ReadPom(reader)
47 pom.File = pomfile
48 poms = append(poms, pom)
49 })
50 return nil
51 })
52
53 // pure static parse pom
54 java.ParsePoms(context.TODO(), poms, nil, func(pom *java.Pom, root *model.DepGraph) {
55
56 logs.Infof("file %s dep track:", pom.File.Relpath())
57 root.ForEachNode(func(p, n *model.DepGraph) bool {
58 logs.Info(n.Expand.(*java.Pom).PomDependency.ImportPathStack())
59 return true
60 })
61
62 root.Build(false, model.Lan_Java)
63 logs.Infof("file %s dep tree:\n%s", pom.File.Relpath(), root.Tree(false, false))
64
65 })
66}

Callers

nothing calls this directly

Calls 11

OpenReaderMethod · 0.95
NewFileFunction · 0.92
ReadPomFunction · 0.92
ParsePomsFunction · 0.92
InfofFunction · 0.92
InfoFunction · 0.92
RelpathMethod · 0.80
ForEachNodeMethod · 0.80
ImportPathStackMethod · 0.80
BuildMethod · 0.80
TreeMethod · 0.80

Tested by

no test coverage detected