haskell / haskell/cabal

Add validation for valid fields in script metadata blocks

Open
#8,024 11 comments 2 reactions 0 assignees View on GitHub
cabal-install: cmd/run re: scripts type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

The `{- cabal: ... -}` and `{- project: ... -}` (with #7997) blocks of a script parse of full the full `executable` grammar and `cabal.project` grammar respectively, regardless of whether such fields make sense. Also many fields are broken because using fake-package (see #6977) means that the directory the script project file is relative to is not the same as the directory the script is actually in.

Script specific validation should be added for these blocks.

Executable fields that should warn:
- `main-is` this will be overridden to be the script
- `scope` is meaningless for a script, but I don't think it actually breaks anything if set
- `install-includes:` install is not supported for scripts

Executable fields that don't work as expected with relative paths because of fake-package:
- `other-modules`
- `hs-source-dirs:`
- `includes:`
- `include-dirs:`
- `c-sources:`
- `cxx-sources:`
- `asm-sources:`
- `cmm-sources:`
- `js-sources:`
- `extra-lib-dirs: `
- `extra-framework-dirs:`

Project fields that should warn:
- `run-tests: ` scripts can't specify tests
- `write-ghc-environment-files:` gets put in/is relative to wrong directory because of fake-package

Project fields that don't work as expected with relative paths because of fake-package:
- `packages:`
- `optional-packages:`
- `extra-prog-path:`
- `extra-include-dirs:`
- `extra-lib-dirs:`
- `extra-framework-dirs:`
- `remote-repo-cache:`
- `logs-dir:`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.