@@ -77,6 +77,8 @@ public class BuildRequest {
7777
7878 private final List <ImageReference > tags ;
7979
80+ private final Cache buildWorkspace ;
81+
8082 private final Cache buildCache ;
8183
8284 private final Cache launchCache ;
@@ -102,6 +104,7 @@ public class BuildRequest {
102104 this .bindings = Collections .emptyList ();
103105 this .network = null ;
104106 this .tags = Collections .emptyList ();
107+ this .buildWorkspace = null ;
105108 this .buildCache = null ;
106109 this .launchCache = null ;
107110 this .createdDate = null ;
@@ -111,8 +114,8 @@ public class BuildRequest {
111114 BuildRequest (ImageReference name , Function <Owner , TarArchive > applicationContent , ImageReference builder ,
112115 ImageReference runImage , Creator creator , Map <String , String > env , boolean cleanCache ,
113116 boolean verboseLogging , PullPolicy pullPolicy , boolean publish , List <BuildpackReference > buildpacks ,
114- List <Binding > bindings , String network , List <ImageReference > tags , Cache buildCache , Cache launchCache ,
115- Instant createdDate , String applicationDirectory ) {
117+ List <Binding > bindings , String network , List <ImageReference > tags , Cache buildWorkspace , Cache buildCache ,
118+ Cache launchCache , Instant createdDate , String applicationDirectory ) {
116119 this .name = name ;
117120 this .applicationContent = applicationContent ;
118121 this .builder = builder ;
@@ -127,6 +130,7 @@ public class BuildRequest {
127130 this .bindings = bindings ;
128131 this .network = network ;
129132 this .tags = tags ;
133+ this .buildWorkspace = buildWorkspace ;
130134 this .buildCache = buildCache ;
131135 this .launchCache = launchCache ;
132136 this .createdDate = createdDate ;
@@ -142,8 +146,8 @@ public BuildRequest withBuilder(ImageReference builder) {
142146 Assert .notNull (builder , "Builder must not be null" );
143147 return new BuildRequest (this .name , this .applicationContent , builder .inTaggedOrDigestForm (), this .runImage ,
144148 this .creator , this .env , this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish ,
145- this .buildpacks , this .bindings , this .network , this .tags , this .buildCache , this .launchCache ,
146- this .createdDate , this .applicationDirectory );
149+ this .buildpacks , this .bindings , this .network , this .tags , this .buildWorkspace , this .buildCache ,
150+ this .launchCache , this . createdDate , this .applicationDirectory );
147151 }
148152
149153 /**
@@ -154,8 +158,8 @@ public BuildRequest withBuilder(ImageReference builder) {
154158 public BuildRequest withRunImage (ImageReference runImageName ) {
155159 return new BuildRequest (this .name , this .applicationContent , this .builder , runImageName .inTaggedOrDigestForm (),
156160 this .creator , this .env , this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish ,
157- this .buildpacks , this .bindings , this .network , this .tags , this .buildCache , this .launchCache ,
158- this .createdDate , this .applicationDirectory );
161+ this .buildpacks , this .bindings , this .network , this .tags , this .buildWorkspace , this .buildCache ,
162+ this .launchCache , this . createdDate , this .applicationDirectory );
159163 }
160164
161165 /**
@@ -167,7 +171,7 @@ public BuildRequest withCreator(Creator creator) {
167171 Assert .notNull (creator , "Creator must not be null" );
168172 return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , creator , this .env ,
169173 this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings ,
170- this .network , this .tags , this .buildCache , this .launchCache , this .createdDate ,
174+ this .network , this .tags , this .buildWorkspace , this . buildCache , this .launchCache , this .createdDate ,
171175 this .applicationDirectory );
172176 }
173177
@@ -184,8 +188,8 @@ public BuildRequest withEnv(String name, String value) {
184188 env .put (name , value );
185189 return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator ,
186190 Collections .unmodifiableMap (env ), this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish ,
187- this .buildpacks , this .bindings , this .network , this .tags , this .buildCache , this .launchCache ,
188- this .createdDate , this .applicationDirectory );
191+ this .buildpacks , this .bindings , this .network , this .tags , this .buildWorkspace , this .buildCache ,
192+ this .launchCache , this . createdDate , this .applicationDirectory );
189193 }
190194
191195 /**
@@ -199,8 +203,8 @@ public BuildRequest withEnv(Map<String, String> env) {
199203 updatedEnv .putAll (env );
200204 return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator ,
201205 Collections .unmodifiableMap (updatedEnv ), this .cleanCache , this .verboseLogging , this .pullPolicy ,
202- this .publish , this .buildpacks , this .bindings , this .network , this .tags , this .buildCache ,
203- this .launchCache , this .createdDate , this .applicationDirectory );
206+ this .publish , this .buildpacks , this .bindings , this .network , this .tags , this .buildWorkspace ,
207+ this .buildCache , this . launchCache , this .createdDate , this .applicationDirectory );
204208 }
205209
206210 /**
@@ -211,7 +215,7 @@ public BuildRequest withEnv(Map<String, String> env) {
211215 public BuildRequest withCleanCache (boolean cleanCache ) {
212216 return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
213217 cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings ,
214- this .network , this .tags , this .buildCache , this .launchCache , this .createdDate ,
218+ this .network , this .tags , this .buildWorkspace , this . buildCache , this .launchCache , this .createdDate ,
215219 this .applicationDirectory );
216220 }
217221
@@ -223,7 +227,7 @@ public BuildRequest withCleanCache(boolean cleanCache) {
223227 public BuildRequest withVerboseLogging (boolean verboseLogging ) {
224228 return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
225229 this .cleanCache , verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings ,
226- this .network , this .tags , this .buildCache , this .launchCache , this .createdDate ,
230+ this .network , this .tags , this .buildWorkspace , this . buildCache , this .launchCache , this .createdDate ,
227231 this .applicationDirectory );
228232 }
229233
@@ -235,7 +239,7 @@ public BuildRequest withVerboseLogging(boolean verboseLogging) {
235239 public BuildRequest withPullPolicy (PullPolicy pullPolicy ) {
236240 return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
237241 this .cleanCache , this .verboseLogging , pullPolicy , this .publish , this .buildpacks , this .bindings ,
238- this .network , this .tags , this .buildCache , this .launchCache , this .createdDate ,
242+ this .network , this .tags , this .buildWorkspace , this . buildCache , this .launchCache , this .createdDate ,
239243 this .applicationDirectory );
240244 }
241245
@@ -247,7 +251,7 @@ public BuildRequest withPullPolicy(PullPolicy pullPolicy) {
247251 public BuildRequest withPublish (boolean publish ) {
248252 return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
249253 this .cleanCache , this .verboseLogging , this .pullPolicy , publish , this .buildpacks , this .bindings ,
250- this .network , this .tags , this .buildCache , this .launchCache , this .createdDate ,
254+ this .network , this .tags , this .buildWorkspace , this . buildCache , this .launchCache , this .createdDate ,
251255 this .applicationDirectory );
252256 }
253257
@@ -272,7 +276,7 @@ public BuildRequest withBuildpacks(List<BuildpackReference> buildpacks) {
272276 Assert .notNull (buildpacks , "Buildpacks must not be null" );
273277 return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
274278 this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , buildpacks , this .bindings ,
275- this .network , this .tags , this .buildCache , this .launchCache , this .createdDate ,
279+ this .network , this .tags , this .buildWorkspace , this . buildCache , this .launchCache , this .createdDate ,
276280 this .applicationDirectory );
277281 }
278282
@@ -297,7 +301,7 @@ public BuildRequest withBindings(List<Binding> bindings) {
297301 Assert .notNull (bindings , "Bindings must not be null" );
298302 return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
299303 this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , bindings ,
300- this .network , this .tags , this .buildCache , this .launchCache , this .createdDate ,
304+ this .network , this .tags , this .buildWorkspace , this . buildCache , this .launchCache , this .createdDate ,
301305 this .applicationDirectory );
302306 }
303307
@@ -310,7 +314,8 @@ public BuildRequest withBindings(List<Binding> bindings) {
310314 public BuildRequest withNetwork (String network ) {
311315 return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
312316 this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings ,
313- network , this .tags , this .buildCache , this .launchCache , this .createdDate , this .applicationDirectory );
317+ network , this .tags , this .buildWorkspace , this .buildCache , this .launchCache , this .createdDate ,
318+ this .applicationDirectory );
314319 }
315320
316321 /**
@@ -332,7 +337,21 @@ public BuildRequest withTags(List<ImageReference> tags) {
332337 Assert .notNull (tags , "Tags must not be null" );
333338 return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
334339 this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings ,
335- this .network , tags , this .buildCache , this .launchCache , this .createdDate , this .applicationDirectory );
340+ this .network , tags , this .buildWorkspace , this .buildCache , this .launchCache , this .createdDate ,
341+ this .applicationDirectory );
342+ }
343+
344+ /**
345+ * Return a new {@link BuildRequest} with an updated build workspace.
346+ * @param buildWorkspace the build workspace
347+ * @return an updated build request
348+ */
349+ public BuildRequest withBuildWorkspace (Cache buildWorkspace ) {
350+ Assert .notNull (buildWorkspace , "BuildWorkspace must not be null" );
351+ return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
352+ this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings ,
353+ this .network , this .tags , buildWorkspace , this .buildCache , this .launchCache , this .createdDate ,
354+ this .applicationDirectory );
336355 }
337356
338357 /**
@@ -344,7 +363,8 @@ public BuildRequest withBuildCache(Cache buildCache) {
344363 Assert .notNull (buildCache , "BuildCache must not be null" );
345364 return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
346365 this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings ,
347- this .network , this .tags , buildCache , this .launchCache , this .createdDate , this .applicationDirectory );
366+ this .network , this .tags , this .buildWorkspace , buildCache , this .launchCache , this .createdDate ,
367+ this .applicationDirectory );
348368 }
349369
350370 /**
@@ -356,7 +376,8 @@ public BuildRequest withLaunchCache(Cache launchCache) {
356376 Assert .notNull (launchCache , "LaunchCache must not be null" );
357377 return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
358378 this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings ,
359- this .network , this .tags , this .buildCache , launchCache , this .createdDate , this .applicationDirectory );
379+ this .network , this .tags , this .buildWorkspace , this .buildCache , launchCache , this .createdDate ,
380+ this .applicationDirectory );
360381 }
361382
362383 /**
@@ -368,8 +389,8 @@ public BuildRequest withCreatedDate(String createdDate) {
368389 Assert .notNull (createdDate , "CreatedDate must not be null" );
369390 return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
370391 this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings ,
371- this .network , this .tags , this .buildCache , this .launchCache , parseCreatedDate ( createdDate ) ,
372- this .applicationDirectory );
392+ this .network , this .tags , this .buildWorkspace , this .buildCache , this . launchCache ,
393+ parseCreatedDate ( createdDate ), this .applicationDirectory );
373394 }
374395
375396 private Instant parseCreatedDate (String createdDate ) {
@@ -393,7 +414,8 @@ public BuildRequest withApplicationDirectory(String applicationDirectory) {
393414 Assert .notNull (applicationDirectory , "ApplicationDirectory must not be null" );
394415 return new BuildRequest (this .name , this .applicationContent , this .builder , this .runImage , this .creator , this .env ,
395416 this .cleanCache , this .verboseLogging , this .pullPolicy , this .publish , this .buildpacks , this .bindings ,
396- this .network , this .tags , this .buildCache , this .launchCache , this .createdDate , applicationDirectory );
417+ this .network , this .tags , this .buildWorkspace , this .buildCache , this .launchCache , this .createdDate ,
418+ applicationDirectory );
397419 }
398420
399421 /**
@@ -513,6 +535,10 @@ public List<ImageReference> getTags() {
513535 return this .tags ;
514536 }
515537
538+ public Cache getBuildWorkspace () {
539+ return this .buildWorkspace ;
540+ }
541+
516542 /**
517543 * Return the custom build cache that should be used by the lifecycle.
518544 * @return the build cache
0 commit comments