raco setup: don't completely ignore a collection without compilation

A collection's "info.rkt" might have `(define compile-omit-paths
'all)` but also other setup actions, so don't completely ignore
a collection directory just because there's nothing to compile.
This commit is contained in:
Matthew Flatt 2015-12-17 07:55:39 -07:00
parent ad1fe0c529
commit 074202bdd2

View File

@ -293,18 +293,16 @@
(setup-printf "WARNING" (setup-printf "WARNING"
"ignoring `compile-subcollections' entry in info ~a" "ignoring `compile-subcollections' entry in info ~a"
path-name)) path-name))
;; this check is also done in compiler/compiler, in compile-directory (make-cc collection path
(and (not (eq? 'all (omitted-paths path getinfo omit-root))) (if name
(make-cc collection path (format "~a (~a)" path-name name)
(if name path-name)
(format "~a (~a)" path-name name) info
path-name) parent
info omit-root
parent info-root info-path info-path-mode
omit-root shadowing-policy
info-root info-path info-path-mode main?))
shadowing-policy
main?)))
(define ((warning-handler v) exn) (define ((warning-handler v) exn)
(setup-printf "WARNING" "~a" (exn->string exn)) (setup-printf "WARNING" "~a" (exn->string exn))
@ -525,11 +523,14 @@
;; note: omit can be 'all, if this happens then this collection ;; note: omit can be 'all, if this happens then this collection
;; should not have been included, but we might jump in if a ;; should not have been included, but we might jump in if a
;; command-line argument specified a coll/subcoll ;; command-line argument specified a coll/subcoll
(define omit (append (define omit (let ([omit (omitted-paths ccp getinfo (cc-omit-root cc))])
(if make-docs? (if (eq? omit 'all)
null 'all
(list (string->path "scribblings"))) (append
(omitted-paths ccp getinfo (cc-omit-root cc)))) (if make-docs?
null
(list (string->path "scribblings")))
omit))))
(define-values [dirs files] (define-values [dirs files]
(if (eq? 'all omit) (if (eq? 'all omit)
(values null null) (values null null)
@ -542,12 +543,13 @@
(define srcs (define srcs
(append (append
(filter has-module-suffix? files) (filter has-module-suffix? files)
(if make-docs? (if (and make-docs?
(filter (lambda (p) (not (member p omit))) (not (eq? omit 'all)))
(map (lambda (s) (if (string? s) (string->path s) s)) (filter (lambda (p) (not (member p omit)))
(map car (call-info info 'scribblings (map (lambda (s) (if (string? s) (string->path s) s))
(lambda () null) (lambda (x) #f))))) (map car (call-info info 'scribblings
null) (lambda () null) (lambda (x) #f)))))
null)
(map (lambda (s) (if (string? s) (string->path s) s)) (map (lambda (s) (if (string? s) (string->path s) s))
(call-info info 'compile-include-files (lambda () null) void)))) (call-info info 'compile-include-files (lambda () null) void))))
(list cc srcs children-ccs)) (list cc srcs children-ccs))
@ -663,9 +665,9 @@
;; let `collection-path' complain about the name, if that's the problem: ;; let `collection-path' complain about the name, if that's the problem:
(with-handlers ([exn? (compose1 raise-user-error exn-message)]) (with-handlers ([exn? (compose1 raise-user-error exn-message)])
(apply collection-path elems)) (apply collection-path elems))
;; otherwise, it's probably a collection with nothing to compile ;; otherwise, it's probably a collection with nothing to compile;
;; spell the name ;; spell the name
(setup-printf "WARNING" (setup-printf "warning"
"nothing to compile in a given collection path: \"~a\"" "nothing to compile in a given collection path: \"~a\""
(string-join sc "/"))) (string-join sc "/")))
ccs) ccs)