raco setup: clean collections before compiling any

In case a collection "a" is composed from two places, and in
case the first place has a bytecode file for "x.rkt" while
only the second place has the source of "x.rkt" (probably it
was recently moved), then `raco setup` should delete the
sourceless bytecode so that any dependency on "x.rkt" will
reference the right version.
This commit is contained in:
Matthew Flatt 2015-07-29 13:22:34 -06:00
parent 2602ff530d
commit 9a7d046062

View File

@ -899,9 +899,11 @@
[compile-notify-handler doing-path])
(thunk)))))
(define (clean-cc cc dir info)
(define (clean-cc cc)
;; Clean up bad .zos:
(unless (assume-virtual-sources? cc)
(define dir (cc-path cc))
(define info (cc-info cc))
(define roots
;; If there's more than one relative root, then there will
;; be multiple ways to get to a ".zo" file, and our strategy
@ -994,7 +996,6 @@
(lambda ()
(define dir (cc-path cc))
(define info (cc-info cc))
(clean-cc cc dir info)
(compile-directory-zos dir info
#:omit-root (cc-omit-root cc)
#:managed-compile-zo caching-managed-compile-zo
@ -1039,16 +1040,14 @@
(move-to 'end (list #rx"<pkgs>/drracket")
(sort-collections-tree
(collection-tree-map top-level-plt-collects)))))
(iterate-cct (lambda (cc)
(define dir (cc-path cc))
(define info (cc-info cc))
(clean-cc cc dir info))
cct)
(iterate-cct clean-cc cct)
(parallel-compile (parallel-workers) setup-fprintf handle-error cct)
(for/fold ([gcs 0]) ([cc planet-dirs-to-compile])
(compile-cc cc gcs)))))
(with-specified-mode
(lambda ()
(for ([cc ccs-to-compile])
(clean-cc cc))
(for/fold ([gcs 0]) ([cc ccs-to-compile])
(compile-cc cc gcs))))))