build/cargo-build-system: Use bundled json instead of guile-json.

* guix/build/cargo-build-system.scm: Use (gnu build json) instead
of (json parser).
* guix/build-system/cargo.scm: Import (gnu build json) instead of
(json parser).

Signed-off-by: Danny Milosavljevic <dannym@scratchpost.org>
master
Robert Vollmert 2019-07-15 21:41:55 +02:00 committed by Danny Milosavljevic
parent 848862f029
commit 4fde0030d4
No known key found for this signature in database
GPG Key ID: E71A35542C30BAA5
2 changed files with 5 additions and 5 deletions

View File

@ -61,7 +61,7 @@ to NAME and VERSION."
(define %cargo-build-system-modules
;; Build-side modules imported by default.
`((guix build cargo-build-system)
(json parser)
(guix build json)
,@%cargo-utils-modules))
(define* (cargo-build store name inputs

View File

@ -20,6 +20,7 @@
(define-module (guix build cargo-build-system)
#:use-module ((guix build gnu-build-system) #:prefix gnu:)
#:use-module (guix build json)
#:use-module (guix build utils)
#:use-module (guix build cargo-utils)
#:use-module (ice-9 popen)
@ -27,7 +28,6 @@
#:use-module (ice-9 ftw)
#:use-module (ice-9 format)
#:use-module (ice-9 match)
#:use-module (json parser)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:export (%standard-phases
@ -42,15 +42,15 @@
(define (manifest-targets)
"Extract all targets from the Cargo.toml manifest"
(let* ((port (open-input-pipe "cargo read-manifest"))
(data (json->scm port))
(targets (hash-ref data "targets" '())))
(data (read-json port))
(targets (or (assoc-ref data "targets") '())))
(close-port port)
targets))
(define (has-executable-target?)
"Check if the current cargo project declares any binary targets."
(let* ((bin? (lambda (kind) (string=? kind "bin")))
(get-kinds (lambda (dep) (hash-ref dep "kind")))
(get-kinds (lambda (dep) (assoc-ref dep "kind")))
(bin-dep? (lambda (dep) (find bin? (get-kinds dep)))))
(find bin-dep? (manifest-targets))))