zilch-cli-rust: improve behavior slightly
Change-Id: I6a6a69641ebf9fcf1e2d453a904db252a1cfe596
This commit is contained in:
parent
18f2887eba
commit
ae774da043
1 changed files with 5 additions and 21 deletions
|
|
@ -16,8 +16,6 @@ and output derivations for each target given on the command line (or all
|
||||||
executables in the crate, if unspecified)
|
executables in the crate, if unspecified)
|
||||||
|
|
||||||
-h, --help Print this help message.
|
-h, --help Print this help message.
|
||||||
-b, --build Build the store paths, rather than show their
|
|
||||||
derivations.
|
|
||||||
-j, --max-jobs COUNT The maximum amount of builds to run. Defaults
|
-j, --max-jobs COUNT The maximum amount of builds to run. Defaults
|
||||||
to the amount of cores.
|
to the amount of cores.
|
||||||
-v, --verbose Increase the verbosity configured in the Nix
|
-v, --verbose Increase the verbosity configured in the Nix
|
||||||
|
|
@ -41,7 +39,6 @@ executables in the crate, if unspecified)
|
||||||
(define-values (options args)
|
(define-values (options args)
|
||||||
(getopt
|
(getopt
|
||||||
'((help #f #\h)
|
'((help #f #\h)
|
||||||
(build #f #\b)
|
|
||||||
(max-jobs #t #\j)
|
(max-jobs #t #\j)
|
||||||
(verbose #f #\v)
|
(verbose #f #\v)
|
||||||
(print-build-logs #f #\L)
|
(print-build-logs #f #\L)
|
||||||
|
|
@ -108,7 +105,7 @@ executables in the crate, if unspecified)
|
||||||
|
|
||||||
(define (append-dir dirname vfs workspace)
|
(define (append-dir dirname vfs workspace)
|
||||||
(define-values (parsed-cargo new-workspace) (parse-cargo-toml vfs (call-with-input-file (string-append dirname "/Cargo.toml") (lambda (p) (read-string 999999 p))) workspace))
|
(define-values (parsed-cargo new-workspace) (parse-cargo-toml vfs (call-with-input-file (string-append dirname "/Cargo.toml") (lambda (p) (read-string 999999 p))) workspace))
|
||||||
(when (and (not workspace) new-workspace)
|
(when (and (not parsed-cargo) (and (not workspace) new-workspace))
|
||||||
(set-print-logs #t)
|
(set-print-logs #t)
|
||||||
(fprintf (current-error-port) "Replaced directory ~S contains a Cargo workspace. This is unsupported.\n" dirname)
|
(fprintf (current-error-port) "Replaced directory ~S contains a Cargo workspace. This is unsupported.\n" dirname)
|
||||||
(exit 1))
|
(exit 1))
|
||||||
|
|
@ -135,18 +132,6 @@ executables in the crate, if unspecified)
|
||||||
|
|
||||||
(define output (process-many-with-lockfile projects lockfile))
|
(define output (process-many-with-lockfile projects lockfile))
|
||||||
|
|
||||||
(define do-build (assoc 'build options))
|
|
||||||
|
|
||||||
(define (build-if-wanted path)
|
|
||||||
(store-path-materialize path)
|
|
||||||
(if do-build
|
|
||||||
(begin
|
|
||||||
(store-path-build path)
|
|
||||||
(store-path-realisation path))
|
|
||||||
(if (string=? (store-path-output path) "out")
|
|
||||||
(derivation-path (store-path-drv path))
|
|
||||||
(string-append (derivation-path (store-path-drv path)) "!" (store-path-output path)))))
|
|
||||||
|
|
||||||
(define build-script-overrides (mapping (make-default-comparator)))
|
(define build-script-overrides (mapping (make-default-comparator)))
|
||||||
(define build-script-dependency-overrides (mapping (make-default-comparator)))
|
(define build-script-dependency-overrides (mapping (make-default-comparator)))
|
||||||
(define rustc-overrides (mapping (make-default-comparator)))
|
(define rustc-overrides (mapping (make-default-comparator)))
|
||||||
|
|
@ -199,9 +184,8 @@ executables in the crate, if unspecified)
|
||||||
|
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (pkg)
|
(lambda (pkg)
|
||||||
(if (equal? 'bin (cargo-target-crate-type (resolved-package-cargo-target pkg)))
|
(unless (should-skip pkg)
|
||||||
(if (should-skip pkg)
|
(if (equal? 'bin (cargo-target-crate-type (resolved-package-cargo-target pkg)))
|
||||||
(printf "~A\t~A\t~A\tskipped\n" (cargo-crate-name (resolved-package-crate pkg)) (cargo-target-name (resolved-package-cargo-target pkg)) (cargo-target-crate-type (resolved-package-cargo-target pkg)))
|
(let ((built (build-package pkg build-script-env-overrides rustc-env-overrides))) (printf "~A\t~A\tbin\t~A\n" (cargo-crate-name (resolved-package-crate pkg)) (cargo-target-name (resolved-package-cargo-target pkg)) (store-path-realised built)))
|
||||||
(let ((built (build-package pkg build-script-env-overrides rustc-env-overrides))) (printf "~A\t~A\tbin\t~A\n" (cargo-crate-name (resolved-package-crate pkg)) (cargo-target-name (resolved-package-cargo-target pkg)) (build-if-wanted built))))
|
(printf "~A\t~A\t~A\tnot a binary\n" (cargo-crate-name (resolved-package-crate pkg)) (cargo-target-name (resolved-package-cargo-target pkg)) (cargo-target-crate-type (resolved-package-cargo-target pkg))))))
|
||||||
(printf "~A\t~A\t~A\tnot a binary\n" (cargo-crate-name (resolved-package-crate pkg)) (cargo-target-name (resolved-package-cargo-target pkg)) (cargo-target-crate-type (resolved-package-cargo-target pkg)))))
|
|
||||||
output)
|
output)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue