zilch-cli-rust: filter out target directories

This commit is contained in:
puck 2025-03-02 22:12:30 +00:00
parent 0ffa327f9b
commit cb046ea859

View file

@ -79,7 +79,13 @@ executables in the crate, if unspecified)
(define crate-dir (let ((m (assoc 'crate-dir options))) (if m (cdr m) (current-directory))))
(define root-vfs (vfs-from-directory crate-dir))
(define (remove-target-dir vfs)
(vfs-dir-filter-all
(lambda (dirname)
(not (string=? dirname "target")))
vfs))
(define root-vfs (remove-target-dir (vfs-from-directory crate-dir)))
(define-values (cargo-toml cargo-workspace) (parse-cargo-toml root-vfs (read-file (string-append crate-dir "/Cargo.toml")) #f))
(define projects '())
@ -94,7 +100,7 @@ executables in the crate, if unspecified)
(let*
((root (if (and (pair? path) (eq? (car path) 'workspace)) crate-dir dirname))
(new-path (string-append root "/" (if (pair? path) (cdr path) path))))
(append-dir new-path (vfs-from-directory new-path) workspace))))
(append-dir new-path (remove-target-dir (vfs-from-directory new-path)) workspace))))
(for-each check-dep (cargo-crate-dependencies crate))
(for-each check-dep (cargo-crate-build-dependencies crate)))
@ -122,7 +128,7 @@ executables in the crate, if unspecified)
(for-each
(lambda (kv)
(when (eq? (car kv) 'replace)
(append-dir (cdr kv) (vfs-from-directory (cdr kv)) #f)))
(append-dir (cdr kv) (remove-target-dir (vfs-from-directory (cdr kv))) #f)))
options)
(define lockfile (parse-lockfile (read-file (string-append crate-dir "/Cargo.lock"))))