(zilch lang rust): remove lack-of-vfs workarounds

This commit is contained in:
puck 2024-11-27 17:32:13 +00:00
parent 59dc27b94c
commit e42315e67a
3 changed files with 29 additions and 20 deletions

View file

@ -5,7 +5,7 @@
(zilch nixpkgs) (zilch zexpr) (zilch semver)
json
(chicken process)
(chicken base) (chicken format) (chicken file)
(chicken base) (chicken format)
(chicken foreign)
(srfi 4) (srfi 128) (srfi 146) (srfi 152) (srfi 207)
(zilch lang rust registry) (zilch lang rust) (zilch lang rust cfg)
@ -334,25 +334,16 @@
(define package-links (and-cdr (assoc "links" package)))
(define package-edition (or (and-cdr (assoc "edition" package)) "2015"))
(define has-build (and (zexp? vfs) (file-exists? (string-append (zexp-unquote vfs) "/build.rs"))))
(unless (and vfs (vfs? vfs))
(set! vfs #f))
(define lib-target #f)
;; TODO(puck): lack-of-vfs workarounds
(when (or (assoc "lib" internals) (if vfs (vfs-file-ref vfs "src" "lib.rs") #t))
(when (or (assoc "lib" internals) (vfs-file-ref vfs "src" "lib.rs"))
(set! lib-target (cargo-target-from-toml (or (and-cdr (assoc "lib" internals)) #()) package-name 'lib package-edition)))
(define other-targets '())
(when (and vfs (vfs-file-ref vfs "src" "main.rs"))
(when (vfs-file-ref vfs "src" "main.rs")
(set! other-targets (cons (cargo-target-from-toml (vector (cons "name" package-name) (cons "path" "src/main.rs")) package-name 'bin package-edition) other-targets)))
(define build-file-path (and-cdr (assoc "build" package)))
(when
(or
(and has-build (not build-file-path))
(and vfs (vfs-file-ref vfs "" "build.rs")))
(when (vfs-file-ref vfs "" "build.rs")
(set! build-file-path "build.rs"))
(define build-script-target #f)
(when build-file-path