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

Support Cabal 3.0 #30

Open
expipiplus1 opened this issue Apr 10, 2020 · 1 comment
Open

Support Cabal 3.0 #30

expipiplus1 opened this issue Apr 10, 2020 · 1 comment

Comments

@expipiplus1
Copy link

It would be really nice if there was support for a more recent cabal version!

@remexre
Copy link

remexre commented Jun 25, 2020

I have a patch for bumping the Cabal dependency to 3.2.0.0, but I don't have new-style builds working yet.

commit 3cc4ebbe0ddc7a74b349b9417e5e5388d9d2694f
Author: Nathan Ringo <[email protected]>
Date:   Wed Jun 24 20:24:45 2020 -0500

    Bumps to Cabal 3.2, not yet supported new-style builds.

diff --git a/.gitignore b/.gitignore
index b6e81f7..8e24af0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
 #####=== Haskell ===#####
 
 dist
+dist-newstyle
 cabal-dev
 *.o
 *.hi
diff --git a/src/Cabal/Haddock.hs b/src/Cabal/Haddock.hs
index 49567f7..6977563 100644
--- a/src/Cabal/Haddock.hs
+++ b/src/Cabal/Haddock.hs
@@ -80,7 +80,7 @@ import Distribution.Simple.Utils
          ( die', copyFileTo, warn, notice, intercalate, setupMessage
          , createDirectoryIfMissingVerbose, withTempFileEx, copyFileVerbose
          , withTempDirectoryEx
-         , findFileWithExtension, findFile
+         , findFileWithExtension, findFileEx
          , TempFileOptions(..), defaultTempFileOptions )
 import Distribution.Simple.Glob ( matchDirFileGlob )
 import Distribution.System (buildPlatform)
@@ -89,6 +89,7 @@ import Distribution.Text
 import Distribution.Types.UnqualComponentName
 import Distribution.Utils.NubList
          ( NubListR(), toNubListR, fromNubListR )
+import qualified Distribution.Utils.ShortText as ShortText
 
 import Distribution.Verbosity
 import Language.Haskell.Extension
@@ -299,18 +300,19 @@ fromPackageDescription pkg_descr =
                 argPackageName = Flag $ packageId $ pkg_descr,
                 -- argOutputDir = Dir $ "doc" </> "html" </> display (packageName pkg_descr),
                 argOutputDir = Dir $ display (packageName pkg_descr),
-                argPrologue = Flag $ if null desc then synopsis pkg_descr else desc,
+                argPrologue = Flag . ShortText.fromShortText $
+                  if ShortText.null desc then synopsis pkg_descr else desc,
                 argTitle = Flag $ showPkg ++ subtitle
              }
       where
         desc = PD.description pkg_descr
         showPkg = display (packageId pkg_descr)
-        subtitle | null (synopsis pkg_descr) = ""
-                 | otherwise                 = ": " ++ synopsis pkg_descr
+        subtitle | ShortText.null (synopsis pkg_descr) = ""
+                 | otherwise                 = ": " ++ ShortText.fromShortText (synopsis pkg_descr)
 
 ghcSharedOptions :: BuildInfo
                  -> NubListR String
-ghcSharedOptions = toNubListR . maybe [] id . lookup GHC . sharedOptions
+ghcSharedOptions = toNubListR . maybe [] id . lookup GHC . undefined . sharedOptions
 
 fromLibrary :: Verbosity
             -> FilePath
@@ -654,7 +656,7 @@ getExeSourceFiles :: Verbosity
                      -> IO [(ModuleName.ModuleName, FilePath)]
 getExeSourceFiles verbosity lbi exe clbi = do
     moduleFiles <- getSourceFiles verbosity searchpaths modules
-    srcMainPath <- findFile (hsSourceDirs bi) (modulePath exe)
+    srcMainPath <- findFileEx normal (hsSourceDirs bi) (modulePath exe)
     return ((ModuleName.main, srcMainPath) : moduleFiles)
   where
     bi          = buildInfo exe
diff --git a/standalone-haddock.cabal b/standalone-haddock.cabal
index 80fb166..fe27bd5 100644
--- a/standalone-haddock.cabal
+++ b/standalone-haddock.cabal
@@ -37,7 +37,7 @@ executable standalone-haddock
     Cabal.Simple
   build-depends:
     base >= 4.11 && < 5,
-    Cabal >= 2.4 && < 2.6,
+    Cabal >= 3.2 && < 3.3,
     filepath,
     directory,
     containers,

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

No branches or pull requests

2 participants