compile-directory-zos: improvements for skip-path[s] and info

This commit is contained in:
Matthew Flatt 2020-08-23 19:25:21 -06:00
parent b1aee01b8c
commit b164f16681
2 changed files with 22 additions and 7 deletions

View File

@ -91,9 +91,10 @@ compiled, as are all such files within subdirectories; the set of such suffixes
is extensible globally as described in @racket[get-module-suffixes], and
@racket[compile-collection-zos] recognizes suffixes from the @racket['libs] group. However,
any file or directory whose path starts with @racket[skip-path] or an element of @racket[skip-paths] is
skipped. (``Starts with'' means that the simplified path @racket[_p]'s
byte-string form after @racket[(simplify-path _p #f)]starts with the
byte-string form of @racket[(simplify-path skip-path #f)].)
skipped. (``Starts with'' means that the simplified complete path @racket[_p]'s
byte-string form after @racket[(simplify-path _p #f)] starts with the
byte-string form of @racket[(simplify-path skip-path #f)]; not that each
@racket[skip-path] should normally be a complete path.)
The collection compiler reads the collection's @filepath{info.rkt} file
(see @secref["info.rkt"]) to obtain further instructions for compiling the
@ -139,7 +140,8 @@ collection. The following fields are used:
]
@history[#:changed "6.3" @elem{Added support for @racket[compile-include-files].}]}
@history[#:changed "6.3" @elem{Added support for @racket[compile-include-files].}
#:changed "7.8.0.8" @elem{Changed ``starts with'' for @racket[skip-path] to include an exact match.}]}
@defproc[(compile-directory-zos [path path-string?]
@ -156,7 +158,13 @@ collection. The following fields are used:
Like @racket[compile-collection-zos], but compiles the given directory
rather than a collection. The @racket[info] function behaves like the
result of @racket[get-info] to supply @filepath{info.rkt} fields,
instead of using an @filepath{info.rkt} file (if any) in the directory.}
instead of using an @filepath{info.rkt} file (if any) in the directory.
@history[#:changed "7.8.0.8" @elem{Changed @racket[info] handling to use @racket[info]
for @racket['compile-omit-paths], ignoring
any @filepath{info.rkt} files in parent and
child directories.}]}
@; ----------------------------------------------------------------------

View File

@ -99,7 +99,14 @@
#:skip-paths orig-skip-paths
#:skip-doc-sources? skip-docs?)
(define info* (or info (lambda (key mk-default) (mk-default))))
(define omit-paths (omitted-paths dir c-get-info/full omit-root))
(define omit-paths (omitted-paths dir
(if info
(let ([dir (path->complete-path dir)])
(lambda (for-dir)
(and (equal? dir for-dir)
info)))
c-get-info/full)
omit-root))
(define skip-paths (for/list ([p (in-list (if orig-skip-path
(cons orig-skip-path orig-skip-paths)
orig-skip-paths))])
@ -122,7 +129,7 @@
[b (path->bytes simp-path)])
(for/or ([skip-path (in-list skip-paths)])
(let ([len (bytes-length skip-path)])
(and ((bytes-length b) . > . len)
(and ((bytes-length b) . >= . len)
(bytes=? (subbytes b 0 len) skip-path)
(let-values ([(base name dir?) (split-path simp-path)])
(or (and (path? base)