mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 13:28:12 -05:00
build-system/gnu: Support parallel builds and tests.
* guix/build/gnu-build-system.scm (build): Add `parallel-build?' parameter; honor it and $NIX_BUILD_CORES. (check): Add `parallel-tests?' parameter; likewise. * guix/build-system/gnu.scm (gnu-build): Add `parallel-build?' and `parallel-tests?' parameters. [builder]: Inherit them.
This commit is contained in:
parent
10c87717bd
commit
febaa88569
2 changed files with 17 additions and 4 deletions
|
@ -45,6 +45,7 @@ (define* (gnu-build store name source inputs
|
||||||
#:key (outputs '("out")) (configure-flags ''())
|
#:key (outputs '("out")) (configure-flags ''())
|
||||||
(make-flags ''())
|
(make-flags ''())
|
||||||
(patches ''()) (patch-flags ''("--batch" "-p1"))
|
(patches ''()) (patch-flags ''("--batch" "-p1"))
|
||||||
|
(parallel-build? #t) (parallel-tests? #t)
|
||||||
(phases '%standard-phases)
|
(phases '%standard-phases)
|
||||||
(system (%current-system))
|
(system (%current-system))
|
||||||
(modules '((guix build gnu-build-system)
|
(modules '((guix build gnu-build-system)
|
||||||
|
@ -63,7 +64,9 @@ (define builder
|
||||||
#:patch-flags ,patch-flags
|
#:patch-flags ,patch-flags
|
||||||
#:phases ,phases
|
#:phases ,phases
|
||||||
#:configure-flags ,configure-flags
|
#:configure-flags ,configure-flags
|
||||||
#:make-flags ,make-flags)))
|
#:make-flags ,make-flags
|
||||||
|
#:parallel-build? ,parallel-build?
|
||||||
|
#:parallel-tests? ,parallel-tests?)))
|
||||||
|
|
||||||
(build-expression->derivation store name system
|
(build-expression->derivation store name system
|
||||||
builder
|
builder
|
||||||
|
|
|
@ -87,13 +87,23 @@ (define* (configure #:key outputs (configure-flags '()) #:allow-other-keys)
|
||||||
(format #t "configure flags: ~s~%" flags)
|
(format #t "configure flags: ~s~%" flags)
|
||||||
(zero? (apply system* "./configure" flags))))
|
(zero? (apply system* "./configure" flags))))
|
||||||
|
|
||||||
(define* (build #:key (make-flags '()) #:allow-other-keys)
|
(define* (build #:key (make-flags '()) (parallel-build? #t)
|
||||||
(zero? (apply system* "make" make-flags)))
|
#:allow-other-keys)
|
||||||
|
(zero? (apply system* "make"
|
||||||
|
`(,@(if parallel-build?
|
||||||
|
`("-j" ,(getenv "NIX_BUILD_CORES"))
|
||||||
|
'())
|
||||||
|
,@make-flags))))
|
||||||
|
|
||||||
(define* (check #:key (make-flags '()) (tests? #t) (test-target "check")
|
(define* (check #:key (make-flags '()) (tests? #t) (test-target "check")
|
||||||
|
(parallel-tests? #t)
|
||||||
#:allow-other-keys)
|
#:allow-other-keys)
|
||||||
(if tests?
|
(if tests?
|
||||||
(zero? (apply system* "make" test-target make-flags))
|
(zero? (apply system* "make" test-target
|
||||||
|
`(,@(if parallel-tests?
|
||||||
|
`("-j" ,(getenv "NIX_BUILD_CORES"))
|
||||||
|
'())
|
||||||
|
,@make-flags)))
|
||||||
(begin
|
(begin
|
||||||
(format #t "test suite not run~%")
|
(format #t "test suite not run~%")
|
||||||
#t)))
|
#t)))
|
||||||
|
|
Loading…
Reference in a new issue