Skip to content

Instantly share code, notes, and snippets.

@mgsloan
Created July 2, 2015 08:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mgsloan/d886470da97e73ec8af2 to your computer and use it in GitHub Desktop.
Save mgsloan/d886470da97e73ec8af2 to your computer and use it in GitHub Desktop.
diff --git a/src/Stack/Build.hs b/src/Stack/Build.hs
index 9b00447..50b8d61 100644
--- a/src/Stack/Build.hs
+++ b/src/Stack/Build.hs
@@ -53,7 +53,7 @@ build :: M env m
=> (Set (Path Abs File) -> IO ()) -- ^ callback after discovering all local files
-> BuildOpts
-> m ()
-build setLocalFiles bopts = do
+build setLocalFiles bopts = errorWhenUnsupported bopts $ do
menv <- getMinimalEnvOverride
(mbp, locals, extraToBuild, sourceMap) <- loadSourceMap bopts
@@ -136,3 +136,13 @@ clean = do
forM_
(Map.keys (bcPackages bconfig))
(distDirFromDir >=> removeTreeIfExists)
+
+errorWhenUnsupported :: M env m => BuildOpts -> m () -> m ()
+errorWhenUnsupported bopts inner = do
+ useGHCJS <- asks (configUseGHCJS . getConfig)
+ if useGHCJS
+ then case boptsFinalAction bopts of
+ DoTests _ -> $logError "GHCJS doesn't support running tests (yet!)"
+ DoBenchmarks -> $logError "GHCJS doesn't support running benchmarks (yet!)"
+ DoNothing -> inner
+ else inner
diff --git a/src/Stack/Build/Execute.hs b/src/Stack/Build/Execute.hs
index 63136fe..dab1f21 100644
--- a/src/Stack/Build/Execute.hs
+++ b/src/Stack/Build/Execute.hs
@@ -45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment