@@ -507,14 +507,68 @@ $ boot load-hoplon h/hoplon
507
507
508
508
### Staging Directories And Temporary Files
509
509
510
- Boot provides filesystem access that is managed by the boot build process.
511
-
512
- * Tasks create managed staging directories with the ` mkoutdir! ` function.
513
- * Tasks emit files and artifacts into these staging directories.
514
- * Staging directories are automatically added to the list of source paths when
515
- they're created so that other tasks may further process the files in them.
516
- * Boot empties all staging directories before each build iteration to ensure
517
- that no stale files remain.
510
+ The Java/Clojure build process is pretty much wedded to files in the filesystem.
511
+ This adds incidental complexity to the build process and causes undesired
512
+ coupling between tasks and between tasks and the project environment. Boot
513
+ provides facilities to mitigate the issues with managing the files created
514
+ during the build process. This allows tasks to be more general and easily
515
+ composed, and eliminates configuration boilerplate in the project environment.
516
+
517
+ * Tasks produce files which may be further processed by other tasks or emitted
518
+ into the final output directory as artifacts. Using Boot's file management
519
+ facilities eliminates the need for the task itself to know which is the case
520
+ during a particular build.
521
+
522
+ * Boot's file management facilities eliminate the coupling between tasks and the
523
+ filesystem, improving the ability to compose these tasks.
524
+
525
+ * Boot manages these files in such a way as to never accumulate stale or garbage
526
+ files, so there is no need for a "clean" task. This greatly simplifies the
527
+ state model for the build process, making it easier to understand what's going
528
+ on during the build and the interactions between tasks.
529
+
530
+ The Boot build process deals with six types of directories–three that are
531
+ specified in the project's Boot environment (in the ` build.boot ` file) and three
532
+ types that are created by tasks during the build process and managed by Boot:
533
+
534
+ * ** Project output directory.** This is specified in the ` :out-path ` key of
535
+ the project Boot environment. This is where the final artifacts produced by
536
+ the entire build process are placed. This directory is kept organized and
537
+ free of stale artifacts by Boot, automatically.
538
+
539
+ * ** Project source directories.** These are specified in the ` :src-paths ` key
540
+ of the Boot environment for the project. Files in these directories are
541
+ strictly input files that will be processed by tasks to produce artifacts
542
+ but are not emitted into the output directory themselves.
543
+
544
+ * ** Resource directories.** These are specified using the ` add-sync! ` function
545
+ in the ` build.boot ` file. The contents of these directories are overlayed on
546
+ some other directory (usually the ` :out-path ` dir, but it could be any
547
+ directory) after each build cycle.
548
+
549
+ * ** Temporary directories.** Temp directories are created by tasks via the
550
+ ` mktmp! ` function. These directories are automatically deleted by Boot the
551
+ next time it's run. Tasks can use these directories for storing intermediate
552
+ files that will not be used as input for other tasks (intermediate JavaScript
553
+ namespaces created by the Google Closure compiler, for instance).
554
+
555
+ * ** Staging directories.** These directories are created by tasks via the
556
+ ` mkoutdir! ` function. Tasks emit artifacts exclusively into these staging
557
+ directories. These directories are deleted automatically by boot the same as
558
+ the temporary directories described above. They are cleaned automatically by
559
+ Boot at the start of each build cycle. Staging directories are also in the
560
+ build classpath so they can be used as input for other tasks (or not) as
561
+ required. Files in staging directories at the end of the build cycle which
562
+ have not been consumed by another task (see below) will be synced to the
563
+ output directory after all tasks in the cycle have been run.
564
+
565
+ * ** Intermediate source directories.** These directories are created by tasks
566
+ via the ` mksrcdir! ` function. These directories are like staging directories
567
+ except that they are not automatically cleaned by Boot at the start of each
568
+ build cycle and files in them are not synced to the output directory after
569
+ the build.
570
+
571
+ ![ boot filesystem flow] [ 7 ]
518
572
519
573
## Dependency
520
574
@@ -534,6 +588,7 @@ Distributed under the Eclipse Public License, the same as Clojure.
534
588
[ 4 ] : https://github.com/technomancy/leiningen
535
589
[ 5 ] : https://github.com/tailrecursion/boot.core/blob/master/src/tailrecursion/boot/core/task.clj
536
590
[ 6 ] : https://github.com/tailrecursion/hoplon/blob/master/src/tailrecursion/hoplon/boot.clj
591
+ [ 7 ] : https://raw.github.com/tailrecursion/boot/master/img/files.gif
537
592
538
593
[ 10 ] : https://github.com/mmcgrana/ring
539
594
[ 20 ] : https://github.com/tailrecursion/boot.task
0 commit comments