compile-directory-zos: improvements for skip-path[s]
and info
This commit is contained in:
parent
b1aee01b8c
commit
b164f16681
|
@ -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
|
is extensible globally as described in @racket[get-module-suffixes], and
|
||||||
@racket[compile-collection-zos] recognizes suffixes from the @racket['libs] group. However,
|
@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
|
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
|
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 after @racket[(simplify-path _p #f)] starts with the
|
||||||
byte-string form of @racket[(simplify-path skip-path #f)].)
|
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
|
The collection compiler reads the collection's @filepath{info.rkt} file
|
||||||
(see @secref["info.rkt"]) to obtain further instructions for compiling the
|
(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?]
|
@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
|
Like @racket[compile-collection-zos], but compiles the given directory
|
||||||
rather than a collection. The @racket[info] function behaves like the
|
rather than a collection. The @racket[info] function behaves like the
|
||||||
result of @racket[get-info] to supply @filepath{info.rkt} fields,
|
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.}]}
|
||||||
|
|
||||||
|
|
||||||
@; ----------------------------------------------------------------------
|
@; ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,14 @@
|
||||||
#:skip-paths orig-skip-paths
|
#:skip-paths orig-skip-paths
|
||||||
#:skip-doc-sources? skip-docs?)
|
#:skip-doc-sources? skip-docs?)
|
||||||
(define info* (or info (lambda (key mk-default) (mk-default))))
|
(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
|
(define skip-paths (for/list ([p (in-list (if orig-skip-path
|
||||||
(cons orig-skip-path orig-skip-paths)
|
(cons orig-skip-path orig-skip-paths)
|
||||||
orig-skip-paths))])
|
orig-skip-paths))])
|
||||||
|
@ -122,7 +129,7 @@
|
||||||
[b (path->bytes simp-path)])
|
[b (path->bytes simp-path)])
|
||||||
(for/or ([skip-path (in-list skip-paths)])
|
(for/or ([skip-path (in-list skip-paths)])
|
||||||
(let ([len (bytes-length skip-path)])
|
(let ([len (bytes-length skip-path)])
|
||||||
(and ((bytes-length b) . > . len)
|
(and ((bytes-length b) . >= . len)
|
||||||
(bytes=? (subbytes b 0 len) skip-path)
|
(bytes=? (subbytes b 0 len) skip-path)
|
||||||
(let-values ([(base name dir?) (split-path simp-path)])
|
(let-values ([(base name dir?) (split-path simp-path)])
|
||||||
(or (and (path? base)
|
(or (and (path? base)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user