Skip to content

Commit 62a6cf8

Browse files
lf-McTano
authored andcommitted
Fix HIE build ~ish
- Fixes relative paths (see haskell/haskell-ide-engine#161) so they are relative to the cabal file parent directory. - Adds an hie.yaml to fix a bunch of broken files HIE can't get flags for.
1 parent d8d58d7 commit 62a6cf8

File tree

5 files changed

+61
-11
lines changed

5 files changed

+61
-11
lines changed

Carnap-Server/Carnap-Server.cabal

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ library
9797
, persistent-sqlite
9898
, persistent-template >= 2.5 && < 2.9
9999
, template-haskell
100+
, th-utilities
100101
, shakespeare >= 2.0 && < 2.1
101102
, monad-control >= 0.3 && < 1.1
102103
, wai-extra >= 3.0 && < 3.1

Carnap-Server/Carnap-Server.nix

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
, monad-logger, mtl, pandoc, pandoc-types, persistent
88
, persistent-postgresql, persistent-sqlite, persistent-template
99
, random, resourcet, safe, shakespeare, split, stdenv, svg-builder
10-
, template-haskell, text, time, transformers, tz, tzdata
11-
, unordered-containers, vector, wai, wai-cors, wai-extra
10+
, template-haskell, text, th-utilities, time, transformers, tz
11+
, tzdata, unordered-containers, vector, wai, wai-cors, wai-extra
1212
, wai-logger, warp, yaml, yesod, yesod-auth, yesod-auth-oauth2
1313
, yesod-core, yesod-form, yesod-markdown, yesod-static, yesod-test
1414
}:
@@ -26,10 +26,10 @@ mkDerivation {
2626
file-embed filepath hashable http-conduit lens linear lucid
2727
monad-control monad-logger mtl pandoc pandoc-types persistent
2828
persistent-postgresql persistent-sqlite persistent-template random
29-
safe shakespeare split svg-builder template-haskell text time
30-
transformers tz tzdata unordered-containers vector wai wai-cors
31-
wai-extra wai-logger warp yaml yesod yesod-auth yesod-auth-oauth2
32-
yesod-core yesod-form yesod-markdown yesod-static
29+
safe shakespeare split svg-builder template-haskell text
30+
th-utilities time transformers tz tzdata unordered-containers
31+
vector wai wai-cors wai-extra wai-logger warp yaml yesod yesod-auth
32+
yesod-auth-oauth2 yesod-core yesod-form yesod-markdown yesod-static
3333
];
3434
executableHaskellDepends = [ base ];
3535
testHaskellDepends = [

Carnap-Server/Settings.hs

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ import Data.FileEmbed (embedFile)
1313
import Data.Yaml (decodeEither')
1414
import Database.Persist.Postgresql (PostgresConf)
1515
import Language.Haskell.TH.Syntax (Exp, Name, Q)
16+
import TH.RelativePaths (pathRelativeToCabalPackage)
1617
import Network.Wai.Handler.Warp (HostPreference)
17-
import Yesod.Default.Config2 (applyEnvValue, configSettingsYml)
18+
import Yesod.Default.Config2 (applyEnvValue)
1819
import Yesod.Default.Util (WidgetFileSettings, widgetFileNoReload,
1920
widgetFileReload)
2021

@@ -122,7 +123,7 @@ widgetFile = (if appReloadTemplates compileTimeAppSettings
122123

123124
-- | Raw bytes at compile time of @config/settings.yml@
124125
configSettingsYmlBS :: ByteString
125-
configSettingsYmlBS = $(embedFile configSettingsYml)
126+
configSettingsYmlBS = $(embedFile =<< pathRelativeToCabalPackage "config/settings.yml")
126127

127128
-- | @config/settings.yml@, parsed to a @Value@.
128129
configSettingsYmlValue :: Value

Carnap-Server/Settings/StaticFiles.hs

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
module Settings.StaticFiles where
22

3-
import Settings (appStaticDir, compileTimeAppSettings)
4-
import Yesod.Static (staticFiles)
3+
import Prelude
4+
import Settings (appStaticDir, compileTimeAppSettings)
5+
import TH.RelativePaths (pathRelativeToCabalPackage)
6+
import Yesod.Static (staticFiles)
57

68
-- This generates easy references to files in the static directory at compile time,
79
-- giving you compile-time verification that referenced files exist.
@@ -15,7 +17,8 @@ import Yesod.Static (staticFiles)
1517
-- If the identifier is not available, you may use:
1618
--
1719
-- StaticFile ["js", "script.js"] []
18-
staticFiles (appStaticDir compileTimeAppSettings)
20+
pathRelativeToCabalPackage (appStaticDir compileTimeAppSettings)
21+
>>= staticFiles
1922

2023
-- XXX:for whatever reason, recompiling with the below seems to get it to reload
2124
-- the static file cache. You an then switch back to compileTimeAppSettings

hie.yaml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
cradle:
2+
multi:
3+
# broken, some c preprocessor error
4+
- path: "./Carnap-Server/test"
5+
config:
6+
cradle:
7+
none:
8+
# broken, "failed to parse result of calling cabal"
9+
- path: "./Carnap/test"
10+
config:
11+
cradle:
12+
none:
13+
- path: "./Carnap/Setup.hs"
14+
config:
15+
cradle:
16+
none:
17+
# these two are not intended to be used with ghc anyway, they are for ghci
18+
- path: "./Carnap-Server/app/DevelMain.hs"
19+
config:
20+
cradle:
21+
none:
22+
- path: "./Carnap-Server/app/devel.hs"
23+
config:
24+
cradle:
25+
none:
26+
# not ignored by default
27+
- path: "./dist-ghcjs"
28+
config:
29+
cradle:
30+
none:
31+
# broken for now, I think it is unlikely this will work until we fix
32+
# Carnap-GHCJS dependencies preventing it building on ghc
33+
- path: "./Carnap-GHCJS"
34+
config:
35+
cradle:
36+
none:
37+
- path: "./Carnap-Server/app/main.hs"
38+
config:
39+
cradle:
40+
cabal:
41+
component: "exe:Carnap-Server"
42+
- path: "./"
43+
config:
44+
cradle:
45+
cabal:

0 commit comments

Comments
 (0)