Skip to content
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

more flexible da flavour #215

Merged
merged 5 commits into from
Jun 3, 2020
Merged

more flexible da flavour #215

merged 5 commits into from
Jun 3, 2020

Conversation

garyverhaegen-da
Copy link
Contributor

This PR updates the CI.hs script to make the DAML-specific build more flexible. The motivation for this change is to set up a fully auditable CI process for the DAML repo, i.e. one in which we can specify (and track) exactly which commits were involved in creating the version of ghc-lib used by the DAML compiler.

@garyverhaegen-da
Copy link
Contributor Author

This should be reviewed in the context of digital-asset/daml#6188.

Copy link
Contributor

@cocreature cocreature left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

CI.hs Outdated Show resolved Hide resolved
CI.hs Outdated Show resolved Hide resolved
CI.hs Outdated Show resolved Hide resolved
@garyverhaegen-da garyverhaegen-da force-pushed the more-flexible-da-build branch from 9529115 to fa46eb7 Compare June 3, 2020 14:50
This PR updates the `CI.hs` script to make the DAML-specific build more
flexible. The motivation for this change is to set up a fully auditable
CI process for the DAML repo, i.e. one in which we can specify (and
track) exactly which commits were involved in creating the version of
ghc-lib used by the DAML compiler.
@garyverhaegen-da garyverhaegen-da force-pushed the more-flexible-da-build branch from fa46eb7 to a8f52c6 Compare June 3, 2020 14:54
Copy link
Contributor

@shayne-fletcher shayne-fletcher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We agree there's a better phrasing though that puts these DA properties on the GhcFlavor type's Da constructor. I appreciate that working out the optparse-applicative magic for this might be a challenge but one way or another we expect it can be achieved and if we can make it happen that would make this so much better 🥰 Please keep me posted!

CI.hs Outdated Show resolved Hide resolved
CI.hs Outdated
@@ -48,7 +51,7 @@ data StackOptions = StackOptions
, ghcOptions :: Maybe String -- If 'Just _', pass '--ghc-options="xxx"' to 'stack build' (for ghc verbose, try 'v3').
} deriving (Show)

data GhcFlavor = Ghc8101 | Ghc881 | Ghc882 | Ghc883 | DaGhc881 | GhcMaster String
data GhcFlavor = Ghc8101 | Ghc881 | Ghc882 | Ghc883 | Da | GhcMaster String
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally I'd like to see the DA specific parameters on the Da ctor as we do for the GhcMaster ctor. That String you see there is the commit SHA for GHC in the case of flavor GhcMaster XXX. Better we have one way of doing things so I'd rather see this mechanism extended if possible.

Copy link
Contributor

@shayne-fletcher shayne-fletcher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work.

CI.hs Outdated
| Ghc881
| Ghc882
| Ghc883
| Da { mergeBaseSha :: String
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't comment on style matters but I think this will fit on a single line eh?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with whatever style you prefer on this project. I've updated this one (though you need longer-than-80-chars lines for it to fit ;-) ); don't hesitate to point out others. In particular, I have no idea how the parseOptions function "should" be indented.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Consistency is the hobgoblin of little minds" 🤣

Ghc8101 -> "--ghc-flavor ghc-8.10.1"
Ghc881 -> "--ghc-flavor ghc-8.8.1"
Ghc882 -> "--ghc-flavor ghc-8.8.2"
Ghc883 -> "--ghc-flavor ghc-8.8.3"
Da -> "--ghc-flavor " <> daFlavor
Da { flavor } -> "--ghc-flavor " <> flavor
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good. That is the flag that gets pushed "downstream" into Ghclibgen. I like it.

"ghc-master" -> Right (GhcMaster current)
hash -> Right (GhcMaster hash)
parseDaOptions :: Opts.Parser GhcFlavor
parseDaOptions =
Opts.flag' Da ( Opts.long "da" <> Opts.help "Enables DA custom build." )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe da-ghc-flavor? Something to think about. I guess this has to be exclusive with respect to ghc-flavor. Does the parser enforce that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is my understanding of the documentation, and seems to be confirmed in usage:

$ stack runhaskell --package extra --package optparse-applicative CI.hs -- --da --ghc-flavor "ghc-8.8.1"
Invalid option `--ghc-flavor'

Usage: CI.hs (--da [--da-merge-base-sha ARG] [--da-patch ARG] 
               [--da-gen-flavor ARG] |
               --ghc-flavor ARG) [--stack-yaml ARG] [--resolver ARG] 
             [--verbosity ARG] [--cabal-verbose] [--ghc-options ARG]
  Build (and possibly upload) ghc-lib and ghc-lib-parser tarballs.
$ stack runhaskell --package extra --package optparse-applicative CI.hs -- --ghc-flavor "ghc-8.8.1" --da
Invalid option `--da'

Usage: CI.hs (--da [--da-merge-base-sha ARG] [--da-patch ARG] 
               [--da-gen-flavor ARG] |
               --ghc-flavor ARG) [--stack-yaml ARG] [--resolver ARG] 
             [--verbosity ARG] [--cabal-verbose] [--ghc-options ARG]
  Build (and possibly upload) ghc-lib and ghc-lib-parser tarballs.
$

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which makes me think maybe the other flags don't need the da prefix? 🤔 This may be veering close to bikeshedding territory though. Happy to go with whatever you prefer for all flag names.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If they don't need the da prefix, let's loose them as an elegance.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no "upload" facilities any more right? Can the help comment be updated accordingly please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh right.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropped da prefix from code and README, and removed the "upload" parenthesis from the help text.

@@ -197,12 +202,12 @@ buildDists
Ghc881 -> cmd "cd ghc && git fetch --tags && git checkout ghc-8.8.1-release"
Ghc882 -> cmd "cd ghc && git fetch --tags && git checkout ghc-8.8.2-release"
Ghc883 -> cmd "cd ghc && git fetch --tags && git checkout ghc-8.8.3-release"
Da -> do
cmd $ "cd ghc && git fetch --tags && git checkout " <> daMergeBaseSha
Da { mergeBaseSha, patches } -> do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly what I had in mind! 🎉

@garyverhaegen-da garyverhaegen-da merged commit d2eadb7 into master Jun 3, 2020
@garyverhaegen-da garyverhaegen-da deleted the more-flexible-da-build branch June 3, 2020 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants