Revert "soong_zip: support globs in -f and -D arguments"
This reverts commit 08e28abc4e
.
Reason for revert: inserts extra ../../ entries in the zip file.
Bug: 116737386
Change-Id: I048f94889a66fe618058e37a5827d0cf6b1a6b68
This commit is contained in:
@@ -103,10 +103,10 @@ var buildAAR = pctx.AndroidStaticRule("buildAAR",
|
|||||||
`cp ${manifest} ${outDir}/AndroidManifest.xml && ` +
|
`cp ${manifest} ${outDir}/AndroidManifest.xml && ` +
|
||||||
`cp ${classesJar} ${outDir}/classes.jar && ` +
|
`cp ${classesJar} ${outDir}/classes.jar && ` +
|
||||||
`cp ${rTxt} ${outDir}/R.txt && ` +
|
`cp ${rTxt} ${outDir}/R.txt && ` +
|
||||||
`${config.SoongZipCmd} -jar -o $out -C ${outDir} -D ${outDir}`,
|
`${config.SoongZipCmd} -jar -o $out -C ${outDir} -D ${outDir} ${resArgs}`,
|
||||||
CommandDeps: []string{"${config.SoongZipCmd}"},
|
CommandDeps: []string{"${config.SoongZipCmd}"},
|
||||||
},
|
},
|
||||||
"manifest", "classesJar", "rTxt", "outDir")
|
"manifest", "classesJar", "rTxt", "resArgs", "outDir")
|
||||||
|
|
||||||
func BuildAAR(ctx android.ModuleContext, outputFile android.WritablePath,
|
func BuildAAR(ctx android.ModuleContext, outputFile android.WritablePath,
|
||||||
classesJar, manifest, rTxt android.Path, res android.Paths) {
|
classesJar, manifest, rTxt android.Path, res android.Paths) {
|
||||||
|
@@ -321,7 +321,7 @@ func TransformResourcesToJar(ctx android.ModuleContext, outputFile android.Writa
|
|||||||
Output: outputFile,
|
Output: outputFile,
|
||||||
Implicits: deps,
|
Implicits: deps,
|
||||||
Args: map[string]string{
|
Args: map[string]string{
|
||||||
"jarArgs": strings.Join(proptools.NinjaAndShellEscape(jarArgs), " "),
|
"jarArgs": strings.Join(proptools.NinjaEscape(jarArgs), " "),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@@ -20,8 +20,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
|
|
||||||
"github.com/google/blueprint/pathtools"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var resourceExcludes = []string{
|
var resourceExcludes = []string{
|
||||||
@@ -66,7 +64,7 @@ func ResourceDirsToJarArgs(ctx android.ModuleContext,
|
|||||||
if !strings.HasPrefix(path, dir.String()) {
|
if !strings.HasPrefix(path, dir.String()) {
|
||||||
panic(fmt.Errorf("path %q does not start with %q", path, dir))
|
panic(fmt.Errorf("path %q does not start with %q", path, dir))
|
||||||
}
|
}
|
||||||
args = append(args, "-f", pathtools.MatchEscape(path))
|
args = append(args, "-f", path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -109,7 +107,7 @@ func resourceFilesToJarArgs(ctx android.ModuleContext,
|
|||||||
if i == 0 || dir != lastDir {
|
if i == 0 || dir != lastDir {
|
||||||
args = append(args, "-C", dir)
|
args = append(args, "-C", dir)
|
||||||
}
|
}
|
||||||
args = append(args, "-f", pathtools.MatchEscape(path))
|
args = append(args, "-f", path)
|
||||||
lastDir = dir
|
lastDir = dir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -199,11 +199,6 @@ func main() {
|
|||||||
|
|
||||||
flags.Parse(expandedArgs[1:])
|
flags.Parse(expandedArgs[1:])
|
||||||
|
|
||||||
if flags.NArg() > 0 {
|
|
||||||
fmt.Fprintf(os.Stderr, "unexpected arguments %s\n", strings.Join(flags.Args(), " "))
|
|
||||||
usage()
|
|
||||||
}
|
|
||||||
|
|
||||||
err := zip.Run(zip.ZipArgs{
|
err := zip.Run(zip.ZipArgs{
|
||||||
FileArgs: fArgs,
|
FileArgs: fArgs,
|
||||||
OutputFilePath: *out,
|
OutputFilePath: *out,
|
||||||
|
15
zip/zip.go
15
zip/zip.go
@@ -224,20 +224,9 @@ func Run(args ZipArgs) (err error) {
|
|||||||
noCompression := args.CompressionLevel == 0
|
noCompression := args.CompressionLevel == 0
|
||||||
|
|
||||||
for _, fa := range args.FileArgs {
|
for _, fa := range args.FileArgs {
|
||||||
var srcs []string
|
srcs := fa.SourceFiles
|
||||||
for _, s := range fa.SourceFiles {
|
|
||||||
globbed, _, err := pathtools.Glob(s, nil, pathtools.DontFollowSymlinks)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
srcs = append(srcs, globbed...)
|
|
||||||
}
|
|
||||||
if fa.GlobDir != "" {
|
if fa.GlobDir != "" {
|
||||||
globbed, _, err := pathtools.Glob(filepath.Join(fa.GlobDir, "**/*"), nil, pathtools.DontFollowSymlinks)
|
srcs = append(srcs, recursiveGlobFiles(fa.GlobDir)...)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
srcs = append(srcs, globbed...)
|
|
||||||
}
|
}
|
||||||
for _, src := range srcs {
|
for _, src := range srcs {
|
||||||
err := fillPathPairs(fa, src, &pathMappings, args.NonDeflatedFiles, noCompression)
|
err := fillPathPairs(fa, src, &pathMappings, args.NonDeflatedFiles, noCompression)
|
||||||
|
Reference in New Issue
Block a user