-
Notifications
You must be signed in to change notification settings - Fork 848
Component based builds #5427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Component based builds #5427
Conversation
7aa1f1a
to
b50005a
Compare
@theobat I didn't do a thorough review but the diff looks to be quite small - is it already able to do something or it's still very early WIP? Do you want to discuss some details of it? |
It's a work in progress, I'll ping when I feel it's ready. At this point I'm still in a very exploratory phase. I'm documenting what I understand as I understand it. I'm focusing on the ConstructPlan phase and work around the M monad in there (which I feel is a very badly named for such a central stuff in there, same for the W datatype which I renamed). |
Great, I agree that M and W are not best names but those were added way before I started working on this project so unfortunately can't give any extra comments. I suppose switching to something better would be a clear improvement. |
Also if anything substantial or any interrogation arise, I'll raise it here or in the issue so that we can discuss it before implementing it :) I'll probably have more questions but not right now. |
So I've stumbled upon something of interest while refactoring 'ConstructPlan'. There is the idea that we can build everything "in one pass" currently in stack (as stated here in the Task object for instance). I suppose this means building all components of a package at once such as a library an executable and tests. The direction taken by using NamedComponents as the build unit will prevent this as-is, is that within the scope of changes expected by the initial issue ? Or is there something to discuss here ? Should be "reunite" the NamedComponents into a single task after the plan is constructed or is that pointless/dangerous ? The thing is, if we actually want that, the Task datatype is going to be a bit redundant (every task has a TaskType, which itself can be a LocalPackage or a Package. In LocalPackage we can have a Set of NamedComponents to build. Following the current design of Component addressed maps, this will only be a single thing then ? |
Yes, "building at once" is one of the things which obviously need to be touched when introducing component-based builds. I suppose that building multiple things in 1 go could save some time. My idea about this was to use only components as build graph vertices as a 1st attempt an check out if it's possible to do "component grouping" as an extra optimization step. As for data type restructuring I don't see any problem with changing any of them if it's necessary. |
I have a few questions for you @qrilka,
| HasLibraries !(Set Text) -- ^ the foreign library names, sub libraries get built automatically without explicit component name passing Is this something we want to keep ? I don't see where this materialize, but maybe that's an "after plan is constructed" thing ?
-- | Necessary to enable component base Builds.
data SingleOrAllComponent
= SingleComponent !NamedComponent
| AllComponent !(Set NamedComponent)
-- ^ Nothing was specified so we infer that we should build possible
-- target (including sub-libraries).
| AllComponentUnresolved
-- ^ This needs to be here for very peculiar cases where we don't know
-- how to gather the list of dependencies (TO BE REFINED later).
data ResolveResult = ResolveResult
{ rrName :: !PackageName
, rrRaw :: !RawInput
, rrComponent :: !SingleOrAllComponent
-- ^ Was a concrete component specified?
-- Otherwise explicitely list all the components to build.
-- This is part of the Component Based builds initiative.
-- Implicit naming is not possible if we want to resolve circular deps & all.
-- (see https://github.com/commercialhaskell/stack/issues/4745)
, rrAddedDep :: !(Maybe PackageLocationImmutable)
-- ^ Only if we're adding this as a dependency
, rrPackageType :: !PackageType
-- ^ Is it a dependency or a project package ?
} But I have a few situations where I don't know how to gather all the components to build: Target.hs line 352 These all seem like situations where we don't have the cabal file at hand, but I didn't fully understand yet.
-- TODO look up in the package index and see if there's a
-- recommendation available
-- ....
Just (PIOnlyInstalled loc installed) -> do
-- FIXME Slightly hacky, no flags since
-- they likely won't affect executable
-- names. This code does not feel right. Can I do something about it or is it too much out of the scope of the component based builds ? |
|
I'm closing this because my branch has gone a bit wild: I mixed docs, refactorings and actual drastic changes. Besides I took a bad design decision by changing all the Map PackageName to maps with named components, it's not required. Even worse, I missed the whole changes required to the Execute module (which probably are the most importants). I'll reopen a new pull request which, will only change docs, add comments and perhaps add very simple rafactorings. In this new pull request I'll detail the core changes I envision for component based builds with bullet points so that everything is clearer before I start actual coding (I wanted to do this here initially, but I've had a few moments of false sense of understanding, which led to this closing initiative). |
I'm glad that you'e still continuing this effort @theobat |
Component based builds
This is a work in progress following #4745.