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

View File

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