on iko/ghcjs-patch-master help sign in
Support for source-repo only cabal.project file (#1236)

It is handy to be able to make a `cabal.project` file with only a `source-repository-package` inside it. Currently we assume if there are no local `.cabal` files it is an error. This change allows it, but only if we have found a `source-repository-package` in the `cabal.project`.

commitafee42b151b15219d6a446da51fffa90fbe85a1f authorHamish Mackenzie <Hamish.Mackenzie@iohk.io> dateTue 14 Sep 2021, 16:40 (5 years ago) parentae5ff85
1 file changed+6−2
lib/call-cabal-project-to-nix.nix+6−2
lib/call-cabal-project-to-nix.nix+6−2
@@ -458,9 +458,13 @@ let
458458 # repo yet. We fail early and provide a useful error
459459 # message to prevent headaches (#290).
460460 if [ -z "$(ls -A ${maybeCleanedSource})" ]; then
461− echo "cleaned source is empty. Did you forget to 'git add -A'?"; exit 1;
461+ echo "cleaned source is empty. Did you forget to 'git add -A'?"
462+ ${pkgs.lib.optionalString (__length fixedProject.sourceRepos == 0) ''
463+ exit 1
464+ ''}
465+ else
466+ cp -r ${maybeCleanedSource}/* .
462467 fi
463− cp -r ${maybeCleanedSource}/* .
464468 chmod +w -R .
465469 # Decide what to do for each `package.yaml` file.
466470 for hpackFile in $(find . -name package.yaml); do (