fix artifacts names producer

This commit is contained in:
Loic Gelle 2017-06-22 14:30:01 -07:00
parent d311076075
commit dfb57d66c9
2 changed files with 10 additions and 6 deletions

View File

@ -10,6 +10,7 @@ import (
"path/filepath"
"runtime"
"io"
"fmt"
)
func compile(args []string) {
@ -80,7 +81,6 @@ func attachBitcodePathToObject(bcFile, objFile string) {
".os",
".So",
".po":
// Store bitcode path to temp file
var absBcPath, _= filepath.Abs(bcFile)
tmpContent := []byte(absBcPath+"\n")
@ -163,6 +163,7 @@ func execCompile(compilerExecName string, pr ParserResult) {
// Executes a command then returns true if there was an error
func execCmd(cmdExecName string, args []string) bool {
fmt.Println(args)
cmd := exec.Command(cmdExecName, args...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr

View File

@ -4,6 +4,7 @@ import(
"fmt"
"regexp"
"runtime"
"path"
"path/filepath"
"strings"
"crypto/sha256"
@ -214,7 +215,7 @@ func parse(argList []string) ParserResult {
}
}
fmt.Println(pr)
return pr
}
@ -222,16 +223,18 @@ func parse(argList []string) ParserResult {
func getArtifactNames(pr ParserResult, srcFileIndex int, hidden bool) (objBase string, bcBase string) {
if len(pr.InputFiles) == 1 && pr.IsCompileOnly && len(pr.OutputFilename) > 0 {
objBase = pr.OutputFilename
bcBase = fmt.Sprintf(".%s.bc", objBase)
dir, baseName := path.Split(objBase)
bcBaseName := fmt.Sprintf(".%s.bc", baseName)
bcBase = path.Join(dir, bcBaseName)
} else {
srcFile := pr.InputFiles[srcFileIndex]
var baseNameWithExt = filepath.Base(srcFile)
var dir, baseNameWithExt = path.Split(srcFile)
var baseName = strings.TrimSuffix(baseNameWithExt, filepath.Ext(baseNameWithExt))
bcBase = fmt.Sprintf(".%s.o.bc", baseName)
if hidden {
objBase = fmt.Sprintf(".%s.o", baseName)
objBase = path.Join(dir, fmt.Sprintf(".%s.o", baseName))
} else {
objBase = fmt.Sprintf("%s.o", baseName)
objBase = path.Join(dir, fmt.Sprintf("%s.o", baseName))
}
}
return