From d034e63d736f1e2084a2a2c1c647f56666c735c8 Mon Sep 17 00:00:00 2001 From: Eli Barzilay Date: Fri, 28 Nov 2003 23:18:43 +0000 Subject: [PATCH] Made dep files contain special plthome-relative entries so a plt tree can be easily relocated. original commit: 4c2b0ff850bdd313ee782a644818f321b525c387 --- collects/mzlib/cm.ss | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/collects/mzlib/cm.ss b/collects/mzlib/cm.ss index 7e42e66..241b491 100644 --- a/collects/mzlib/cm.ss +++ b/collects/mzlib/cm.ss @@ -1,5 +1,6 @@ (module cm mzscheme - (require (lib "moddep.ss" "syntax")) + (require (lib "moddep.ss" "syntax") + (lib "plthome.ss" "setup")) (provide make-compilation-manager-load/use-compiled-handler managed-compile-zo @@ -18,20 +19,18 @@ (define (get-deps code path) (let-values ([(imports fs-imports) (module-compiled-imports code)]) - (map (lambda (x) + (map (lambda (x) (resolve-module-path-index x path)) ;; Filter symbols: (let loop ([l (append imports fs-imports)]) (cond [(null? l) null] - [(symbol? (car l))(loop (cdr l))] + [(symbol? (car l)) (loop (cdr l))] [else (cons (car l) (loop (cdr l)))]))))) - - (define re:suffix (regexp "\\..?.?.?$")) (define (get-compilation-dir+name path) (let-values (((base name-suffix must-be-dir?) (split-path path))) - (let ((name (regexp-replace re:suffix name-suffix ""))) + (let ((name (regexp-replace #rx"\\..?.?.?$" name-suffix ""))) (values (cond ((eq? 'relative base) (build-path "compiled")) @@ -41,23 +40,25 @@ (define (get-compilation-path path) (let-values ([(dir name) (get-compilation-dir+name path)]) (build-path dir name))) - + (define (get-code-dir path) (let-values (((base name-suffix must-be-dir?) (split-path path))) (cond ((eq? 'relative base) (build-path "compiled")) (else (build-path base "compiled"))))) - + (define (write-deps code path external-deps) (let ((dep-path (string-append (get-compilation-path path) ".dep")) (deps (get-deps code path))) (let ((op (open-output-file dep-path 'replace))) - (write (cons (version) - (append deps - (map (lambda (x) (cons 'ext x)) external-deps))) + (write (cons (version) + (append (map plthome-ify deps) + (map (lambda (x) (plthome-ify (cons 'ext x))) + external-deps))) op) + (newline op) (close-output-port op)))) - + (define (touch path) (close-output-port (open-output-file path 'append))) @@ -67,7 +68,7 @@ (let ([fail-path (string-append (get-compilation-path path) ".fail")]) (close-output-port (open-output-file fail-path 'truncate/replace))) ((trace) (format "~afailure" (indent)))) - + (define (compile-zo path) ((trace) (format "~acompiling: ~a" (indent) path)) (parameterize ([indent (string-append " " (indent))]) @@ -193,7 +194,7 @@ (when (> t path-zo-time) ((trace) (format "~anewer: ~a (~a > ~a)..." (indent) d t path-zo-time))) (> t path-zo-time))) - (cdr deps)) + (map un-plthome-ify (cdr deps))) (compile-zo path)))))) (let ((stamp (get-compiled-time path #t))) (hash-table-put! up-to-date path stamp)