-
Notifications
You must be signed in to change notification settings - Fork 207
add possibility to run install.hs
from cabal
#1221
Conversation
also fixes #1218. Tests have been successful |
Currently, |
install.hs
from cabalinstall.hs
from cabal
This PR is now ready. I have done a lot of tests on archlinux and fedora. |
There seem to be a lot of problems on windows. The script is not executable on windows. |
It seems the cabal script feature doesn't work in windows as-is.
But it is not a "script" anymore, right? Dont know if we lose anything tough (it is even shorter if you add it to The error i've got with # cabal v2-run install.hs --project-file install/shake.project help
Resolving dependencies...
Build profile: -w ghc-8.6.5 -O1
In order, the following will be built (use -v for more details):
- fake-package-0 (exe:script) (configuration changed)
Configuring executable 'script' for fake-package-0..
Preprocessing executable 'script' for fake-package-0..
Building executable 'script' for fake-package-0..
[1 of 1] Compiling Main ( Main.hs, path\to\haskell-ide-engine\dist-newstyle\build\x86_64-windows\ghc-8.6.5\fake-package-0\x\script\build\script\script-tmp\Main.o )
Main.hs:1:1: error:
Could not load module `Prelude'
It is a member of the hidden package `base-4.12.0.0'.
Perhaps you need to add `base' to the build-depends in your .cabal file.
it is a hidden module in the package `hackage-security-0.5.3.0'
Use -v to see a list of the files searched for.
|
1 | {- cabal:
| ^
Main.hs:12:1: error:
Could not load module `HieInstall'
It is a member of the hidden package `hie-install-0.8.0.0'.
Perhaps you need to add `hie-install' to the build-depends in your .cabal file.
Use -v to see a list of the files searched for.
|
12 | import HieInstall (defaultMain)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
Although we would add |
I've uploaded the branch with my tests: /~https://github.com/power-fungus/haskell-ide-engine/compare/install-via-cabal...jneira:install-via-cabal |
Another option is only add the executable stanza and inform windows users that their command would be However, i think it would be desirable that the command would be the same for all systems. |
Opened a ticket upstream: haskell/cabal#6122 |
Adding hie-install to Since cabal-new-install does not work on windows with version |
@fendor ok, we can wait to full cabal support having an alternative for windows |
@jneira I appreciate your review. I like the idea of the the commit you proposed. You added an executable to The CI build shows that the script works fine on windows when run with I will do a bit more experiments in the next few days and integrate the |
@power-fungus Yeah it would work even without any header cause it only has to be a simple haskell module with |
With cabal built from 2.4 branch the script works |
So, stack works for windows right? |
https://dev.azure.com/haskell-ide-engine/haskell-ide-engine-power-fungus/_build/results?buildId=103 shows the error on cabal on windows |
This PR is looking great, I think. We should wait for the next release, and merge it after it, so we can do some dog fooding. |
Let me rebase this and add ci integration and this is ready to merge |
additionally provide mechanism for detecting if run from stack or cabal.
now, tests should work on windows
closes #1179, for good!
I spoke with @hvr, who hinted at the possibility that
install.hs
could be run viacabal new-run install.hs
and I got this working.(planned) Features:
install.hs
can be executed viacabal
:cabal new-run install.hs --project-file shake.project <target>
build
andhie-*
will use the same build-systemTradeoffs and limitations:
shake.project
is needed for similar reasonsshake.yaml
is required.install/
is required./install.hs
as an executable is only possible for eitherstack
orcabal
--project-file shake.project
is required and cannot be defined inside the script-comments. @hvr said that this could maybe be changed in the future.Plan:
install.hs
executable viacabal new-run
via a comment at the beginninginstall.hs
logic into own cabal-packagehie-*
,build
) use the same build-system as theinstall.hs
has been called with