Skip to content

Commit 5b80b8a

Browse files
committed
Cover included build (buildSrc) in tar round-trip test
1 parent 34f8cd8 commit 5b80b8a

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

cmd/gradle-cache/main_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,14 +496,20 @@ func TestTarZstdRoundTrip(t *testing.T) {
496496
must(t, os.WriteFile(filepath.Join(gradleHome, "wrapper", "dists", "gradle-8.14.3-bin", "abc123", "gradle-8.14.3", "lib", "gradle-core.jar"), []byte("wrapper data"), 0o644))
497497

498498
// configuration-cache/ source (under .gradle/ inside project)
499-
gradleDir := filepath.Join(srcDir, "project", ".gradle")
499+
projectDir := filepath.Join(srcDir, "project")
500+
gradleDir := filepath.Join(projectDir, ".gradle")
500501
must(t, os.MkdirAll(filepath.Join(gradleDir, "configuration-cache"), 0o755))
501502
must(t, os.WriteFile(filepath.Join(gradleDir, "configuration-cache", "hash.bin"), []byte("config cache"), 0o644))
502503

504+
// included build (buildSrc) output directory
505+
must(t, os.MkdirAll(filepath.Join(projectDir, "buildSrc", "build", "libs"), 0o755))
506+
must(t, os.WriteFile(filepath.Join(projectDir, "buildSrc", "build", "libs", "buildSrc.jar"), []byte("buildsrc jar"), 0o644))
507+
503508
sources := []tarSource{
504509
{BaseDir: gradleHome, Path: "./caches"},
505510
{BaseDir: gradleHome, Path: "./wrapper"},
506511
{BaseDir: gradleDir, Path: "./configuration-cache"},
512+
{BaseDir: projectDir, Path: "./buildSrc/build"},
507513
}
508514

509515
// Create archive into a buffer.
@@ -524,6 +530,7 @@ func TestTarZstdRoundTrip(t *testing.T) {
524530
"wrapper/dists/gradle-8.14.3-bin/abc123/gradle-8.14.3/lib/gradle-core.jar",
525531
"wrapper/dists/gradle-8.14.3-bin/abc123/gradle-8.14.3-bin.zip.ok",
526532
"configuration-cache/hash.bin",
533+
"buildSrc/build/libs/buildSrc.jar",
527534
} {
528535
path := filepath.Join(dstDir, rel)
529536
if _, err := os.Stat(path); err != nil {

0 commit comments

Comments
 (0)