on iko/ghcjs-patch-master help sign in
improve keepSource cleanup (#1080)
93ab431Richard Wallace
builder/comp-builder.nix+16−14
@@ -30,7 +30,7 @@ let self =
30 ( haskellLib.isTest componentId &&
30 ( haskellLib.isTest componentId &&
31 lib.any (x: x.identifier.name or "" == "cabal-doctest") package.setup-depends
31 lib.any (x: x.identifier.name or "" == "cabal-doctest") package.setup-depends
32 )
32 )
33−, allComponent # Used when `configureAllComponents` is set to get a suitable configuration.
33+, allComponent # Used when `configureAllComponents` is set to get a suitable configuration.
34
34
35, build-tools ? component.build-tools
35, build-tools ? component.build-tools
36, pkgconfig ? component.pkgconfig
36, pkgconfig ? component.pkgconfig
@@ -259,7 +259,7 @@ let
259 (lib.optionalString (cleanSrc.subDir != "") ''
259 (lib.optionalString (cleanSrc.subDir != "") ''
260 cd ${lib.removePrefix "/" cleanSrc.subDir}
260 cd ${lib.removePrefix "/" cleanSrc.subDir}
261 ''
261 ''
262− ) +
262+ ) +
263 (if cabalFile != null
263 (if cabalFile != null
264 then ''cat ${cabalFile} > ${package.identifier.name}.cabal''
264 then ''cat ${cabalFile} > ${package.identifier.name}.cabal''
265 else
265 else
@@ -485,19 +485,21 @@ let
485 # DB (probably empty unless this is a library component).
485 # DB (probably empty unless this is a library component).
486 # We also have to remove any refernces to $out to avoid
486 # We also have to remove any refernces to $out to avoid
487 # circular references.
487 # circular references.
488− if configureAllComponents
488+ lib.optionalString (configureAllComponents || keepSource) ''
489− then ''
490− mv dist dist-tmp-dir
489+ mv dist dist-tmp-dir
491− mkdir -p dist/build
490+ mkdir -p dist/build
491+ if [ -d dist-tmp-dir/build/${componentId.cname} ]; then
492 mv dist-tmp-dir/build/${componentId.cname}/autogen dist/build/
492 mv dist-tmp-dir/build/${componentId.cname}/autogen dist/build/
493+ else
494+ mv dist-tmp-dir/build/autogen dist/build/
495+ fi
493− mv dist-tmp-dir/package.conf.inplace dist/
496+ mv dist-tmp-dir/package.conf.inplace dist/
494− remove-references-to -t $out dist/build/autogen/*
497+ remove-references-to -t $out dist/build/autogen/*
495− rm -rf dist-tmp-dir
498+ rm -rf dist-tmp-dir
496− ''
499+ ''
497− else lib.optionalString keepSource ''
500+ ) + (lib.optionalString (keepSource && haskellLib.isLibrary componentId) ''
498− rm -rf dist
501+ remove-references-to -t $out ${name}.conf
499− ''
500− ) + (lib.optionalString (haskellLib.isTest componentId) ''
502+ '') + (lib.optionalString (haskellLib.isTest componentId) ''
501 echo The test ${package.identifier.name}.components.tests.${componentId.cname} was built. To run the test build ${package.identifier.name}.checks.${componentId.cname}.
503 echo The test ${package.identifier.name}.components.tests.${componentId.cname} was built. To run the test build ${package.identifier.name}.checks.${componentId.cname}.
502 '');
504 '');
503
505