Move response file handling to a separate package
sbox is going to need to read and write response files, move ReadRspFile to its own package. Test: response_test.go Change-Id: Iecb5486b4aaeb2531828743ad8ef784df675e18e
This commit is contained in:
@@ -24,7 +24,6 @@ package main
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"runtime"
|
||||
"runtime/pprof"
|
||||
@@ -32,6 +31,7 @@ import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"android/soong/response"
|
||||
"android/soong/zip"
|
||||
)
|
||||
|
||||
@@ -125,12 +125,18 @@ func main() {
|
||||
var expandedArgs []string
|
||||
for _, arg := range os.Args {
|
||||
if strings.HasPrefix(arg, "@") {
|
||||
bytes, err := ioutil.ReadFile(strings.TrimPrefix(arg, "@"))
|
||||
f, err := os.Open(strings.TrimPrefix(arg, "@"))
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
respArgs, err := response.ReadRspFile(f)
|
||||
f.Close()
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
respArgs := zip.ReadRespFile(bytes)
|
||||
expandedArgs = append(expandedArgs, respArgs...)
|
||||
} else {
|
||||
expandedArgs = append(expandedArgs, arg)
|
||||
|
Reference in New Issue
Block a user