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

Get the Kmett-verse off custom setups #3788

Closed
ezyang opened this issue Sep 6, 2016 · 18 comments
Closed

Get the Kmett-verse off custom setups #3788

ezyang opened this issue Sep 6, 2016 · 18 comments

Comments

@ezyang
Copy link
Contributor

ezyang commented Sep 6, 2016

@ekmett has many packages, even "low level" ones, which use custom setup scripts. Examples:

Grepping for generateBuildModule on Hackage will give you quite a parcel.

The boilerplate for these setup scripts is quite similar. This function is copy pasted quite a bit:

generateBuildModule :: Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()
generateBuildModule verbosity pkg lbi = do
  let dir = autogenModulesDir lbi
  createDirectoryIfMissingVerbose verbosity True dir
  withLibLBI pkg lbi $ \_ libcfg -> do
    withTestLBI pkg lbi $ \suite suitecfg -> do
      rewriteFile (dir </> "Build_" ++ testName suite ++ ".hs") $ unlines
        [ "module Build_" ++ testName suite ++ " where"
        , "deps :: [String]"
        , "deps = " ++ (show $ formatdeps (testDeps libcfg suitecfg))
        ]
  where
    formatdeps = map (formatone . snd)
    formatone p = case packageName p of
      PackageName n -> n ++ "-" ++ showVersion (packageVersion p)

testDeps :: ComponentLocalBuildInfo -> ComponentLocalBuildInfo -> [(InstalledPackageId, PackageId)]
testDeps xs ys = nub $ componentPackageDeps xs ++ componentPackageDeps ys

Any reason why Paths can't support this?

I've also seen it used for Haddock:

haddockOutputDir :: Package p => HaddockFlags -> p -> FilePath
haddockOutputDir flags pkg = destDir where
  baseDir = case haddockDistPref flags of
    NoFlag -> "."
    Flag x -> x
  destDir = baseDir </> "doc" </> "html" </> display (packageName pkg)

I don't know what kind of bug this is working around. Eek!

It would be great if the Kmett-verse could get off Custom scripts. It will take time, because they have big Cabal support windows. But the change starts here.

@ekmett
Copy link
Member

ekmett commented Sep 6, 2016

I also have a few scripts that copy an extra image or something into the haddock directory.

I think the lens script does so.

@23Skidoo
Copy link
Member

23Skidoo commented Sep 6, 2016

I also have a few scripts that copy an extra image or something into the haddock directory.

Don't we have extra-doc-files for that?

@ekmett
Copy link
Member

ekmett commented Sep 6, 2016

Since around 1.18 right? I've yet to be able to make the switch.

@phadej
Copy link
Collaborator

phadej commented Sep 6, 2016

@ezyang, the deps (and autogen_dir) variable is needed to drive doctests, see

I.e. if there would be declarative way to run doctests: profit.

@23Skidoo
Copy link
Member

23Skidoo commented Sep 6, 2016

@ekmett Yes, since 1.18: 49a2be9, 4502e90. Though it looks like we don't have a version check for it in D.PD.Check.

@ezyang ezyang added this to the 2.0 milestone Sep 8, 2016
@ezyang ezyang self-assigned this Sep 8, 2016
@23Skidoo
Copy link
Member

Though it looks like we don't have a version check for it in D.PD.Check.

Fixed in #3825.

@RyanGlScott
Copy link
Member

@phadej: Re the declarative way to run doctests: would #2327 give us this ability?

@phadej
Copy link
Collaborator

phadej commented Jan 11, 2017

@RyanGlScott, yes, AFAICS the doctests are the only reason Edward's packages use Custom setup.

@phadej
Copy link
Collaborator

phadej commented Jan 14, 2018

rescheduling for 3.0.

@osa1
Copy link

osa1 commented Aug 31, 2018

What's the next step here? Looking at the referenced tickets and PRs above, it seems like they're all closed/merged. Can we just go ahead and simplify custom setups of kmett packages?

@quasicomputational
Copy link
Contributor

Not likely. cabal doctest doesn't play well (or at all) with new-style commands; #4500 is the issue for getting doctest to work with new-build (or stack, for that matter) without hacks.

@ekmett
Copy link
Member

ekmett commented Aug 31, 2018

Can we just go ahead and simplify custom setups of kmett packages?

I won't be able to do so until I can expect all the users in my current support window are on a version of cabal with those patches integrated. Even that clock really can't start until after, as noted, the problems with cabal doctesting new-builds is resolved. =/

@hvr
Copy link
Member

hvr commented Aug 31, 2018

@ekmett well, do your users actually need to be able to invoke the doctest-testsuite with legacy cabal versions? It's quite possible that we can implement this in a similar way to the custom-setup which is ignored by cabal versions not gnostic to it.

@ekmett
Copy link
Member

ekmett commented Sep 4, 2018

@hvr That might work.

@23Skidoo 23Skidoo modified the milestones: 3.0, 3.0.1.0 Oct 16, 2019
@phadej phadej modified the milestones: 3.0.1.0, 3.2 Nov 27, 2019
@phadej phadej added this to the 3.4 milestone Nov 27, 2019
@phadej phadej removed this from the Considered for 3.4 milestone May 14, 2020
@RyanGlScott
Copy link
Member

Using cabal-docspec, we've managed to remove the use of custom Setup scripts for most repos in the Kmettiverse. I'm not sure if that's enough to warrant closing this issue—your call.

@ekmett
Copy link
Member

ekmett commented Feb 21, 2021

I'm willing to declare intent to move the rest to cabal-docspec.

@ulysses4ever
Copy link
Collaborator

I built an intersection of two lists

  1. Hackage grep result for generateBuildModule (as suggested above, this is a good evidence of a Edward's work)

  2. List of packages where Edward is listed as a maintainer

Here's the result with comments:

  • hash (last uploaded 2013)
  • parsec-parsers (last uploaded 2013)
  • sparse (last uploaded 2015)
  • structures (last uploaded 2014)
  • tables (last uploaded 2015)

So, these all look kinda dated. I propose we close this issue as completed (thanks to maintainers of respective packages, mostly Ryan).

@Mikolaj
Copy link
Member

Mikolaj commented Jul 11, 2022

Well done. Thank you. Closing.

@Mikolaj Mikolaj closed this as completed Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants