@@ -303,6 +303,118 @@ def make_distrib(tag: str, base: str, source_tag: str, no_cache: bool = False) -
303
303
return Image .build (tag = tag , dockerfile_string = dockerfile , no_cache = no_cache )
304
304
305
305
306
+ def build_all (
307
+ tag : str ,
308
+ base : str ,
309
+ copy_path : os .PathLike | None ,
310
+ archive_url : str | None ,
311
+ directory : os .PathLike ,
312
+ build_type : str ,
313
+ no_cuda : bool ,
314
+ no_cache : bool = False ,
315
+ ) -> dict [str , Image ]:
316
+ """
317
+ Fully compiles and builds a Git repo with cmake.
318
+
319
+ Parameters
320
+ ----------
321
+ tag : str
322
+ The image tag prefix.
323
+ base : str
324
+ The base image tag.
325
+ copy_path : str
326
+ The path to a directory to copy to an image.
327
+ archive_url : str or None
328
+ The URL of the Git archive to install on an image. No archive will be installed
329
+ if `copy_dir` is given.
330
+ directory : str
331
+ The path to place the contents of the Git archive or copied directory to.
332
+ build_type : str
333
+ The CMake build type. See
334
+ `here <https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html>`_
335
+ for possible values.
336
+ no_cuda : bool
337
+ If True, build without CUDA.
338
+ no_cache : bool, optional
339
+ Run Docker build with no cache if True. Defaults to False.
340
+
341
+ Returns
342
+ -------
343
+ dict[str, Image]
344
+ A dict of images produced by this process.
345
+ """
346
+
347
+ prefixed_tag : str = prefix_image_tag (tag )
348
+ prefixed_base_tag : str = prefix_image_tag (base )
349
+
350
+ images : dict [str , Image ] = {}
351
+
352
+ # If the user has indicated a path to copy, the code should copy that.
353
+ # Otherwise, the code should fetch a git repository.
354
+ is_insert = copy_path is not None
355
+
356
+ initial_tag : str = ""
357
+ if is_insert :
358
+ assert isinstance (copy_path , str )
359
+ path_absolute = os .path .abspath (copy_path )
360
+ if os .path .isdir (copy_path ):
361
+ top_dir = os .path .basename (path_absolute )
362
+ else :
363
+ top_dir = os .path .basename (os .path .dirname (path_absolute ))
364
+
365
+ insert_tag = f"{ prefixed_tag } -file-{ top_dir } "
366
+ insert_image = copy_dir (
367
+ base = prefixed_base_tag ,
368
+ tag = insert_tag ,
369
+ directory = directory ,
370
+ target_path = copy_path ,
371
+ no_cache = no_cache ,
372
+ )
373
+ images [insert_tag ] = insert_image
374
+ initial_tag = insert_tag
375
+ else :
376
+ git_repo_tag = f"{ prefixed_tag } -git-repo"
377
+ assert archive_url is not None
378
+
379
+ git_repo_image = get_archive (
380
+ base = prefixed_base_tag ,
381
+ tag = git_repo_tag ,
382
+ archive_url = archive_url ,
383
+ directory = directory ,
384
+ no_cache = no_cache ,
385
+ )
386
+ images [git_repo_tag ] = git_repo_image
387
+ initial_tag = git_repo_tag
388
+
389
+ configure_tag = f"{ prefixed_tag } -configured"
390
+ configure_image = configure_cmake (
391
+ tag = configure_tag ,
392
+ base = initial_tag ,
393
+ build_type = build_type ,
394
+ no_cuda = no_cuda ,
395
+ no_cache = no_cache ,
396
+ )
397
+ images [configure_tag ] = configure_image
398
+
399
+ build_tag = f"{ prefixed_tag } -built"
400
+ build_image = compile_cmake (
401
+ tag = build_tag ,
402
+ base = configure_tag ,
403
+ no_cache = no_cache ,
404
+ )
405
+ images [build_tag ] = build_image
406
+
407
+ install_tag = f"{ prefixed_tag } -installed"
408
+ install_image = cmake_install (
409
+ tag = install_tag ,
410
+ base = build_tag ,
411
+ no_cache = no_cache ,
412
+ )
413
+ images [install_tag ] = install_image
414
+
415
+ return images
416
+
417
+
306
418
def test (
307
419
tag : str ,
308
420
output_xml : os .PathLike [str ] | str ,
0 commit comments