Add a --symlinks argument to soong_zip
Add a --symlinks argument that defaults to true to soong_zip. Passing --symlinks=false will cause it to follow symlinks instead of storing them in the zip file. Relands I4deb98daa9d4ba9f94e3d7670c117fe00381d2ba with tests. Bug: 112843624 Test: glob_test.go Test: zip_test.go Test: m checkbuild Change-Id: I0eff9c1f2dba79e873fda381ff585df55d5aaaad
This commit is contained in:
@@ -105,6 +105,7 @@ func TestZip(t *testing.T) {
|
||||
nonDeflatedFiles map[string]bool
|
||||
dirEntries bool
|
||||
manifest string
|
||||
storeSymlinks bool
|
||||
|
||||
files []zip.FileHeader
|
||||
err error
|
||||
@@ -135,6 +136,7 @@ func TestZip(t *testing.T) {
|
||||
SourcePrefixToStrip("a").
|
||||
File("a/**/*"),
|
||||
compressionLevel: 9,
|
||||
storeSymlinks: true,
|
||||
|
||||
files: []zip.FileHeader{
|
||||
fh("a/a", fileA, zip.Deflate),
|
||||
@@ -149,6 +151,7 @@ func TestZip(t *testing.T) {
|
||||
SourcePrefixToStrip("a").
|
||||
Dir("a"),
|
||||
compressionLevel: 9,
|
||||
storeSymlinks: true,
|
||||
|
||||
files: []zip.FileHeader{
|
||||
fh("a/a", fileA, zip.Deflate),
|
||||
@@ -179,6 +182,7 @@ func TestZip(t *testing.T) {
|
||||
File("a/a/c").
|
||||
File("a/a/d"),
|
||||
compressionLevel: 9,
|
||||
storeSymlinks: true,
|
||||
|
||||
files: []zip.FileHeader{
|
||||
fh("a/a/a", fileA, zip.Deflate),
|
||||
@@ -187,6 +191,23 @@ func TestZip(t *testing.T) {
|
||||
fhLink("a/a/d", "b"),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "follow symlinks",
|
||||
args: fileArgsBuilder().
|
||||
File("a/a/a").
|
||||
File("a/a/b").
|
||||
File("a/a/c").
|
||||
File("a/a/d"),
|
||||
compressionLevel: 9,
|
||||
storeSymlinks: false,
|
||||
|
||||
files: []zip.FileHeader{
|
||||
fh("a/a/a", fileA, zip.Deflate),
|
||||
fh("a/a/b", fileB, zip.Deflate),
|
||||
fh("a/a/c", fileC, zip.Deflate),
|
||||
fh("a/a/d", fileB, zip.Deflate),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "list",
|
||||
args: fileArgsBuilder().
|
||||
@@ -359,6 +380,7 @@ func TestZip(t *testing.T) {
|
||||
args.AddDirectoryEntriesToZip = test.dirEntries
|
||||
args.NonDeflatedFiles = test.nonDeflatedFiles
|
||||
args.ManifestSourcePath = test.manifest
|
||||
args.StoreSymlinks = test.storeSymlinks
|
||||
args.Filesystem = mockFs
|
||||
|
||||
buf := &bytes.Buffer{}
|
||||
|
Reference in New Issue
Block a user