Prior to this commit the configure command fails on Cabal 1.18 with the
following error:
Setup.hs:91:5:
`libraryConfig' is not a (visible) constructor field name
Setup.hs:92:5:
`compBuildOrder' is not a (visible) constructor field name
Setup.hs:93:5:
`executableConfigs' is not a (visible) constructor field name
Setup.hs:93:57: Not in scope: `executableConfigs'
This commit removes `filterLBI` in Setup.hs that called functions that have been
removed from Cabal. Deleting this function shouldn't affect compilation since it
seems to be unused anyway: `filterLBI`, was added in commit 14e32ad on Thu Mar
21 2013 and the only reference to it was removed on Sun Jul 28 in commit
0a6bd8bd96.
After this change elm compiles for me on Cabal 1.18.0 and 1.16.0.
Switch from using --output-directory for all generated files, to using
--cache-dir for .elmo and .elmi files and using --build-dir for .html
and .js files.
See: 14e32add30
for discussion on first attempt
Changed Librarys.hs and LoadLibraries.hs from TemplateHaskell to usafeIO.
Avoids needing to touch LoadLibraries after we change docs.json (as the file is loaded at runtime).
Also removes need for using CPP
Drawback of using unsafeIO is fairly well known/understood + this is a classic use-case.
Added error handling to LoadLibraries.hs
Setup.hs now uses "runProcess" instead of "system" to invoke elm compiler.
This allows us to set the environment variable "Elm_datadir" which is picked up by LoadLibraries and makes sure we get the just-built version in dist/data.
Also explicitly sets the RTS file to make sure we're not using one (as we're currently building it!)
Also change the folder the compiled JavaScript ends up in to dist/js. Writing to the source tree, then deleting isn't very nice + this should make it easier to find elm compilation errors. cabal clean handles the file deletion, too.
I think this fixes all the defects of the first version:
1. CPP is not needed
2. touch is not needed
3. building elm-runtime.js uses dist/data/docs.json
4. running elm after install uses the installed elm-runtime.js and docs.json
5. LoadLibraries.hs is simpler. Doesn't use CPP or TemplateHaskell. Has error handling and a decent error message
6. cabal clean && cabal install builds everything with the right data in the right order
(tested on ghc 7.4.1)
See: https://github.com/evancz/Elm/issues/120
Add build-hook to Setup.hs so that elm-doc gets build and executed before library or elm exec gets built.
Add preprocessor to Elm.cabal so LoadLibraries.hs can load docs.json from the build folder instead of installed folder
Add touch to Setup.hs otherwise LoadLibraries.hs doesn't get recompiled. This is non-portable, but I can't find a portable way (see Setup.hs for details)
cabal clean && cabal install now works
(tested on ghc 7.4.1)
I am splitting the elm package up into several packages, elm itself
which exports the Language.Elm* modules and builds the compiler
executable, elm-server which contains the standalone, Happstack-based
Elm server and elm-yesod, which provides the generateWidget function
for using Elm together with Yesod.