Skip to content

Commit

Permalink
checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
jortel committed Jun 28, 2023
1 parent bf23152 commit 2dffa00
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 11 deletions.
1 change: 1 addition & 0 deletions cmd/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ func (r *Analyzer) options(output string) (options command.Options, err error) {
if err != nil {
return
}
settings.Print()
return
}

Expand Down
35 changes: 24 additions & 11 deletions cmd/mode.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"github.com/konveyor/analyzer-lsp/provider"
"github.com/konveyor/tackle2-addon/repository"
"github.com/konveyor/tackle2-hub/api"
"os"
"path"
"strings"
)
Expand Down Expand Up @@ -42,11 +43,23 @@ func (r *Mode) Build(application *api.Application) (err error) {
return
}
err = r.Fetch()
} else {
if r.Artifact != "" {
bucket := addon.Bucket()
err = bucket.Get(r.Artifact, BinDir)
return
}
if r.Artifact != "" {
bucket := addon.Bucket()
err = bucket.Get(r.Artifact, BinDir)
return
}
if application.Binary != "" {
maven := repository.Maven{
M2Dir: M2Dir,
BinDir: BinDir,
Remote: repository.Remote{
Identities: application.Identities,
},
}
err = maven.FetchArtifact(application.Binary)
return
}
return
}
Expand All @@ -60,13 +73,13 @@ func (r *Mode) AddOptions(settings *Settings) (err error) {
settings.Mode(provider.SourceOnlyAnalysisMode)
}
if r.Binary {
if r.Artifact != "" {
bucket := addon.Bucket()
err = bucket.Get(r.Artifact, BinDir)
if err != nil {
return
}
settings.Location(path.Join(BinDir, path.Base(r.Artifact)))
dir, nErr := os.ReadDir(BinDir)
if nErr != nil {
err = nErr
return
}
if len(dir) > 0 {
settings.Location(path.Join(BinDir, dir[0].Name()))
}
} else {
settings.Location(r.appDir)
Expand Down
14 changes: 14 additions & 0 deletions cmd/settings.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package main

import (
"bufio"
"github.com/konveyor/analyzer-lsp/provider"
"gopkg.in/yaml.v3"
"io"
"os"
"strings"
)

const (
Expand Down Expand Up @@ -68,3 +70,15 @@ func (r *Settings) Mode(mode provider.AnalysisMode) {
}
}
}

//
// Print self to activity.
func (r *Settings) Print() {
b, _ := yaml.Marshal(r)
addon.Activity("Settings: %s", SETTINGS)
reader := strings.NewReader(string(b))
scanner := bufio.NewScanner(reader)
for scanner.Scan() {
addon.Activity("> %s", scanner.Text())
}
}

0 comments on commit 2dffa00

Please sign in to comment.