Configure autolocking per build context
Currently (pkg enabled) will mean that a build context will default to package management via autolocking if there is no lock file for that context. We should give users finer control by being able to specify autolocking per build context in the workspace file.
Thanks for getting the issue hoping to track this! The semantics we've discussed are
(pkg [enabled|disabled])in the top-level applies to all contexts, but with the weakest precedence(pkg [enabled|disabled])within acontextstanza would take precedence over the top-level setting
This would follow the precedent of fields like profile and env, which exist both as top-level stanzas in the dune-workspace and as fields in the context stanza.
The dual state of pkg might not make sense in the (context) stanza given that the other options like (switch) exist. Maybe at that point it should be (pkg). Whether or not autolocking happens is up to (pkg) plus the declaration of a lock file in the context stanza.
Users would then just be configuring their build contexts. Using package management in a build context would require configuring it as such.
The dual state of pkg might not make sense in the (context) stanza given that the other options like (switch) exist
Could you elaborate?
The dual state of pkg might not make sense in the (context) stanza given that the other options like (switch) exist
Could you elaborate?
; 1.
; Auto-locking?
(context
(name default)
(pkg enabled))
; 2.
; Default to global/current switch?
(context
(name default)
(pkg disabled))
; 3.
; Uses switch foo
(context
(name default)
(switch foo))
; 4.
; Default behaviour, uses global/current switch
(context
(name default))
; 5.
; use the lock file
(context
(name default)
(lock_dir foobar.lock)
(pkg enabled))
What are we expecting to happen in these 5 cases? Seems like we only need a (pkg) which would turn 5 cases into 4:
; 1.
; Auto-locking
(context
(name default)
(pkg))
; 2.
; Uses switch foo
(context
(name default)
(switch foo))
; 3.
; Default behaviour, uses global/current switch
(context
(name default))
; 4.
; use the lock file
(context
(name default)
(lock_dir foobar.lock))
Small correction: the syntax to use an existing switch is (context (opam (switch ...))) according to the documentation.
(We should probably make opam and pkg conflict in such cases)