Skip to content

Commit

Permalink
fix shim build
Browse files Browse the repository at this point in the history
  • Loading branch information
Frank Martinez committed Nov 21, 2019
1 parent 87fbd73 commit 0bcd77d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions api/shim.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ func (sb *ShimBuilder) Build(project common.AppProject) error {
}

if !built {
fmt.Println("Using go build to build shim...")

err := simpleGoBuild(project)
if err != nil {
return err
Expand Down Expand Up @@ -124,7 +126,7 @@ func prepareShim(project common.AppProject, shim string) (bool, error) {
makefilePath := filepath.Join(shimFilePath, dirShim, fileMakefile)

if _, err := os.Stat(goBuildFilePath); err == nil {
fmt.Println("This trigger makes use of a go build file...")
fmt.Println("Using build.go to build shim......")

err = util.CopyFile(goBuildFilePath, filepath.Join(project.SrcDir(), fileBuildGo))
if err != nil {
Expand All @@ -136,15 +138,21 @@ func prepareShim(project common.AppProject, shim string) (bool, error) {
if err != nil {
return false, err
}

return true, nil
} else if _, err := os.Stat(makefilePath); err == nil {
//look for Makefile and execute it
fmt.Println("Make File:", makefilePath)
fmt.Println("Using make file to build shim...")

err = util.CopyFile(makefilePath, filepath.Join(project.SrcDir(), fileMakefile))
if err != nil {
return false, err
}

if Verbose() {
fmt.Println("Make File:", makefilePath)
}

// Execute make
cmd := exec.Command("make", "-C", project.SrcDir())
cmd.Stdout = os.Stdout
Expand All @@ -155,6 +163,8 @@ func prepareShim(project common.AppProject, shim string) (bool, error) {
if err != nil {
return false, err
}

return true, nil
} else {
return false, nil
}
Expand Down

0 comments on commit 0bcd77d

Please sign in to comment.