-
Notifications
You must be signed in to change notification settings - Fork 725
Description
Currently one could depend on scope: private executables in the other packages.
For example the setup as https://gist.github.com/phadej/0a299e255f00031625da8de4ed190e34
foo.cabal
cabal-version: 2.2
name: foo
version: 0
library
default-language: Haskell2010
build-tool-depends: foo:foo -any
exposed-modules: Foo
build-depends:
, base
, process
, template-haskell
executable foo
default-language: Haskell2010
scope: private
main-is: FooExe.hs
build-depends: basebar.cabal
cabal-version: 2.2
name: bar
version: 0
library
default-language: Haskell2010
build-tool-depends: foo:foo -any
exposed-modules: Bar
build-depends:
, base
, process
, template-haskellThe following works (at least in local project, see #6339)
I can see a three way distinction in scope:
- executables meant to be run by user.
- executables not run by user, but which users or developers are aware of
- executables internal to the package
The first group is clear, those include cabal, pandoc etc. I.e. executables you want to be in your PATH.
Third group is clear too. For whatever reason an executable my-pkg-helper should stay as an implementation detail.
The second group is however tricky. Sometimes you want happy to be in your PATH, but most often it's handled by cabal for you. If we had run-tool-depends (we should, see #5411). Then in a single package we could have
executable my-compiler
run-tool-depends: my-compiler-linker
executable my-compiler-linkerThen when user installs only a single executable cabal v2-install my-compiler:my-compiler (the syntax not supported atm, #6369), cabal-install would
- solve that also
my-compiler-linkeris needed - build
my-compiler-linkerand install it "privately" into the store - build
my-compilertelling it somehow (via new fields inPaths_pkgnamehs or via CPP directives?) where themy-compiler-linkis - install
my-compilerintoinstalldir, thus making it available to user
Note: my-compiler-linker is built, and is in store; but isn't directly available to the user.
Yet, if developer of my-compiler decides to keep existence of my-compiler-linker private, it can do that by adding scope:private. Then
$ cabal v2-install my-compilerwon't install my-compiler-linker into installdir, neither other packages may use it for built-tool-depends nor run-tool-depends.
Given above rationale, I suggest that scope: private executables would be only the 3rd group, i.e. the example I started with SHOULD NOT work, i.e. already in the solver we'd refuse to proceed. This however require run-tool-depends.
cc @Ericson2314, @luite, @nomeata, @harpocrates who I think are interested in this to be resolved in a way or another. Also @fgaz and @GrayJay as this is related to multi-libs and solver.