@@ -150,6 +150,7 @@ func TestIntegrationGradleBuildCycle(t *testing.T) {
150150 "--cache-key" , ctx .cacheKey ,
151151 "--commit" , commitSHA ,
152152 "--gradle-user-home" , ctx .gradleUserHome ,
153+ "--included-build" , "build-logic" ,
153154 )
154155 runCLI (t , binaryPath , ctx , saveArgs ... )
155156
@@ -164,10 +165,15 @@ func TestIntegrationGradleBuildCycle(t *testing.T) {
164165 "--ref" , commitSHA ,
165166 "--git-dir" , ctx .projectDir ,
166167 "--gradle-user-home" , ctx .gradleUserHome ,
168+ "--included-build" , "build-logic" ,
167169 )
168170 runCLI (t , binaryPath , ctx , restoreArgs ... )
169171
170172 t .Log ("Step 4: Verifying restore..." )
173+ buildLogicBuildDir := filepath .Join (ctx .projectDir , "build-logic" , "build" )
174+ if _ , err := os .Stat (buildLogicBuildDir ); err != nil {
175+ t .Fatal ("build-logic/build/ was NOT restored" )
176+ }
171177 verifyRestore (t , ctx )
172178}
173179
@@ -525,6 +531,7 @@ dependencies { implementation("com.google.guava:guava:33.4.0-jre") }
525531 "--cache-key" , ctx .cacheKey ,
526532 "--commit" , commitSHA ,
527533 "--gradle-user-home" , ctx .gradleUserHome ,
534+ "--included-build" , "build-logic" ,
528535 )
529536 runCLI (t , binaryPath , ctx , saveArgs ... )
530537
@@ -537,6 +544,7 @@ dependencies { implementation("com.google.guava:guava:33.4.0-jre") }
537544 "--ref" , commitSHA ,
538545 "--git-dir" , ctx .projectDir ,
539546 "--gradle-user-home" , ctx .gradleUserHome ,
547+ "--included-build" , "build-logic" ,
540548 )
541549 runCLI (t , binaryPath , ctx , restoreArgs ... )
542550
@@ -574,6 +582,7 @@ dependencies { implementation("com.google.guava:guava:33.4.0-jre") }
574582 "--branch" , "test-branch" ,
575583 "--gradle-user-home" , ctx .gradleUserHome ,
576584 "--project-dir" , ctx .projectDir ,
585+ "--included-build" , "build-logic" ,
577586 )
578587 runCLI (t , binaryPath , ctx , saveDeltaArgs ... )
579588
@@ -590,6 +599,7 @@ dependencies { implementation("com.google.guava:guava:33.4.0-jre") }
590599 "--branch" , "test-branch" ,
591600 "--gradle-user-home" , freshHome ,
592601 "--project-dir" , ctx .projectDir ,
602+ "--included-build" , "build-logic" ,
593603 )
594604 runCLI (t , binaryPath , ctx , freshRestoreDelta ... )
595605
@@ -618,6 +628,7 @@ dependencies { implementation("com.google.guava:guava:33.4.0-jre") }
618628 "--branch" , "test-branch" ,
619629 "--gradle-user-home" , ctx .gradleUserHome ,
620630 "--project-dir" , ctx .projectDir ,
631+ "--included-build" , "build-logic" ,
621632 )
622633 runCLI (t , binaryPath , ctx , fullRestoreDelta ... )
623634
@@ -832,22 +843,42 @@ func TestIntegrationDeltaConfigurationCache(t *testing.T) {
832843 }
833844
834845 for _ , tt := range []struct {
835- name string
836- fixture string
837- buildFile string
838- change string // appended to build file to invalidate CC
846+ name string
847+ fixture string
848+ mutate func (t * testing.T , projectDir string ) // invalidate CC
839849 }{
840850 {
841- name : "groovy-dsl" ,
842- fixture : "groovy-project" ,
843- buildFile : "build.gradle" ,
844- change : "\n // force CC invalidation\n " ,
851+ name : "groovy-dsl" ,
852+ fixture : "groovy-project" ,
853+ mutate : func (t * testing.T , projectDir string ) {
854+ appendToFile (t , filepath .Join (projectDir , "build.gradle" ), "\n // force CC invalidation\n " )
855+ },
845856 },
846857 {
847- name : "kotlin-dsl" ,
848- fixture : "gradle-project" ,
849- buildFile : "build.gradle.kts" ,
850- change : "\n // force CC invalidation\n " ,
858+ name : "kotlin-dsl" ,
859+ fixture : "gradle-project" ,
860+ mutate : func (t * testing.T , projectDir string ) {
861+ appendToFile (t , filepath .Join (projectDir , "build.gradle.kts" ), "\n // force CC invalidation\n " )
862+ },
863+ },
864+ {
865+ name : "included-build-plugin-change" ,
866+ fixture : "gradle-project" ,
867+ mutate : func (t * testing.T , projectDir string ) {
868+ must (t , os .WriteFile (
869+ filepath .Join (projectDir , "build-logic" , "src" , "main" , "java" , "com" , "example" , "IncludedPlugin.java" ),
870+ []byte (`package com.example;
871+
872+ import org.gradle.api.Plugin;
873+ import org.gradle.api.Project;
874+
875+ public class IncludedPlugin implements Plugin<Project> {
876+ @Override public void apply(Project project) {
877+ project.getLogger().lifecycle("IncludedPlugin applied (modified)");
878+ }
879+ }
880+ ` ), 0o644 ))
881+ },
851882 },
852883 } {
853884 tt := tt
@@ -867,6 +898,7 @@ func TestIntegrationDeltaConfigurationCache(t *testing.T) {
867898 "--cache-key" , ctx .cacheKey ,
868899 "--commit" , commitSHA ,
869900 "--gradle-user-home" , ctx .gradleUserHome ,
901+ "--included-build" , "build-logic" ,
870902 )
871903 runCLI (t , binaryPath , ctx , saveArgs ... )
872904
@@ -880,16 +912,12 @@ func TestIntegrationDeltaConfigurationCache(t *testing.T) {
880912 "--ref" , commitSHA ,
881913 "--git-dir" , ctx .projectDir ,
882914 "--gradle-user-home" , ctx .gradleUserHome ,
915+ "--included-build" , "build-logic" ,
883916 )
884917 runCLI (t , binaryPath , ctx , restoreArgs ... )
885918
886- // Modify build file to invalidate configuration cache.
887- buildFilePath := filepath .Join (ctx .projectDir , tt .buildFile )
888- f , err := os .OpenFile (buildFilePath , os .O_APPEND | os .O_WRONLY , 0o644 )
889- must (t , err )
890- _ , err = f .WriteString (tt .change )
891- must (t , err )
892- must (t , f .Close ())
919+ // Mutate the project to invalidate configuration cache.
920+ tt .mutate (t , ctx .projectDir )
893921
894922 output := gradleRun (t , ctx .projectDir , ctx .gradlew , ctx .gradleUserHome , "build" )
895923 if ! strings .Contains (output , "Calculating task graph" ) &&
@@ -905,6 +933,7 @@ func TestIntegrationDeltaConfigurationCache(t *testing.T) {
905933 "--branch" , "cc-test-branch" ,
906934 "--gradle-user-home" , ctx .gradleUserHome ,
907935 "--project-dir" , ctx .projectDir ,
936+ "--included-build" , "build-logic" ,
908937 )
909938 runCLI (t , binaryPath , ctx , saveDeltaArgs ... )
910939
@@ -919,6 +948,7 @@ func TestIntegrationDeltaConfigurationCache(t *testing.T) {
919948 "--branch" , "cc-test-branch" ,
920949 "--gradle-user-home" , ctx .gradleUserHome ,
921950 "--project-dir" , ctx .projectDir ,
951+ "--included-build" , "build-logic" ,
922952 )
923953 runCLI (t , binaryPath , ctx , restoreDeltaArgs ... )
924954
@@ -928,7 +958,7 @@ func TestIntegrationDeltaConfigurationCache(t *testing.T) {
928958 t .Fatalf ("configuration-cache dir not restored: %v" , err )
929959 }
930960
931- // ── Step 5: Verify CC hit with the modified build file ──────
961+ // ── Step 5: Verify CC hit after delta restore ──────── ──────
932962 t .Log ("Step 5: Verifying configuration cache hit..." )
933963 output = gradleRun (t , ctx .projectDir , ctx .gradlew , ctx .gradleUserHome , "build" )
934964
@@ -945,6 +975,15 @@ func TestIntegrationDeltaConfigurationCache(t *testing.T) {
945975 }
946976}
947977
978+ func appendToFile (t * testing.T , path , content string ) {
979+ t .Helper ()
980+ f , err := os .OpenFile (path , os .O_APPEND | os .O_WRONLY , 0o644 )
981+ must (t , err )
982+ _ , err = f .WriteString (content )
983+ must (t , err )
984+ must (t , f .Close ())
985+ }
986+
948987func extractLine (output , substr string ) string {
949988 for _ , line := range strings .Split (output , "\n " ) {
950989 if strings .Contains (strings .ToLower (line ), strings .ToLower (substr )) {
0 commit comments