diff options
author | Yuchen Pei <hi@ypei.me> | 2022-06-08 23:53:08 +1000 |
---|---|---|
committer | Yuchen Pei <hi@ypei.me> | 2022-06-08 23:53:08 +1000 |
commit | f7a7705332075449326a12816169aefa3acd1d00 (patch) | |
tree | ac912d2fe45029f3ab6479597f070c48800ad054 | |
parent | 0e9df088226d80669dd0882ed743bca871dce61c (diff) |
- removing version constraints in cabal file so that build works with
ghc-9.2.2 + cabal-3.6.2.0
- fixing a do block indentation
- fixing a small poblem with ciSourceDirs because Cabal 3.6.2.0 has
hsSourceDirs :: BuildInfo -> [SymbolicPath PackageDir SourceDir]
instead of
BuildInfo -> [ FilePath ]
-rw-r--r-- | cabal-helper.cabal | 10 | ||||
-rw-r--r-- | src/CabalHelper/Runtime/HelperMain.hs | 122 |
2 files changed, 66 insertions, 66 deletions
diff --git a/cabal-helper.cabal b/cabal-helper.cabal index 81ebcd0..48527c9 100644 --- a/cabal-helper.cabal +++ b/cabal-helper.cabal @@ -93,13 +93,11 @@ common extensions common build-deps build-depends: base < 5 && >= 4.9.1.0 - , Cabal < 3.5 && >= 3.0 - || < 2.5 && >= 2.0 - || < 1.26 && >= 1.24.2.0 + , Cabal , cabal-plan < 0.8 && >= 0.5.0.0 , clock < 0.9 && >= 0.7.2 , containers < 1 && >= 0.5.7.1 - , bytestring < 0.11 && >= 0.10.8.1 + , bytestring , directory < 1.4 && >= 1.3.0.0 , filepath < 1.5 && >= 1.4.1.1 , mtl < 2.3 && >= 2.0 @@ -107,9 +105,9 @@ common build-deps , semigroupoids < 5.4 && >= 5.2 , SHA < 1.7 && >= 1.6.4.4 , text < 1.3 && >= 1.0.0.0 - , template-haskell < 2.17 && >= 2.11.1.0 + , template-haskell , temporary < 1.4 && >= 1.2.1 - , time < 1.10 && >= 1.6.0.1 + , time , transformers < 0.6 && >= 0.5.2.0 , utf8-string < 1.1 && >= 1.0.1.1 if os(windows) diff --git a/src/CabalHelper/Runtime/HelperMain.hs b/src/CabalHelper/Runtime/HelperMain.hs index 983223b..3758181 100644 --- a/src/CabalHelper/Runtime/HelperMain.hs +++ b/src/CabalHelper/Runtime/HelperMain.hs @@ -24,6 +24,7 @@ module CabalHelper.Runtime.HelperMain (helper_main) where import Distribution.Simple.Utils (cabalVersion) import Distribution.Simple.Configure +import Distribution.Utils.Path import Distribution.Package ( PackageIdentifier , PackageId @@ -278,68 +279,68 @@ helper_main args = do let cmds = collectCmdOptions args' flip mapM cmds $$ \x -> do - case x of - "version":[] -> - return $ Just $ ChResponseVersion ("Cabal", toDataVersion cabalVersion) - - "package-id":[] -> - return $ Just $ ChResponseVersion $ (,) - (display (packageName gpd)) - (toDataVersion (packageVersion gpd)) - - "flags":[] -> do - return $ Just $ ChResponseFlags $ sort $ - map (flagName' &&& flagDefault) $ genPackageFlags gpd - - "config-flags":[] -> do - return $ Just $ ChResponseFlags $ sort $ - map (first unFlagName) - $ unFlagAssignment - $ configConfigurationsFlags - $ configFlags lbi - - "non-default-config-flags":[] -> do - let flagDefinitons = genPackageFlags gpd - flagAssgnments = + case x of + "version":[] -> + return $ Just $ ChResponseVersion ("Cabal", toDataVersion cabalVersion) + + "package-id":[] -> + return $ Just $ ChResponseVersion $ (,) + (display (packageName gpd)) + (toDataVersion (packageVersion gpd)) + + "flags":[] -> do + return $ Just $ ChResponseFlags $ sort $ + map (flagName' &&& flagDefault) $ genPackageFlags gpd + + "config-flags":[] -> do + return $ Just $ ChResponseFlags $ sort $ + map (first unFlagName) + $ unFlagAssignment + $ configConfigurationsFlags + $ configFlags lbi + + "non-default-config-flags":[] -> do + let flagDefinitons = genPackageFlags gpd + flagAssgnments = #if CH_MIN_VERSION_Cabal(2,2,0) - unFlagAssignment $ configConfigurationsFlags + unFlagAssignment $ configConfigurationsFlags #else - configConfigurationsFlags + configConfigurationsFlags #endif - $ configFlags lbi - nonDefaultFlags = - [ (flag_name, val) - | flag <- flagDefinitons - , let flag_name' = unFlagName $ flagName flag - , let def_val = flagDefault flag - , (unFlagName -> flag_name, val) <- flagAssgnments - , flag_name == flag_name' - , val /= def_val - ] - return $ Just $ ChResponseFlags $ sort nonDefaultFlags - - "write-autogen-files":[] -> do - initialBuildStepsForAllComponents distdir pd lbi v - return Nothing - - "compiler-id":[] -> do - let CompilerId comp ver = compilerId $ compiler lbi - return $ Just $ ChResponseVersion $ (,) (show comp) (toDataVersion ver) - - "component-info":[] -> do - res <- componentsInfo lvd pt - return $ Just $ ChResponseComponentsInfo res - - "print-lbi":flags -> - case flags of - ["--human"] -> print lbi >> return Nothing - _ -> return $ Just $ ChResponseLbi $ show lbi - - cmd:_ | not (cmd `elem` commands) -> - errMsg ("Unknown command: " ++ cmd) >> usage >> exitFailure - _ -> - errMsg "Invalid usage!" >> usage >> exitFailure - + $ configFlags lbi + nonDefaultFlags = + [ (flag_name, val) + | flag <- flagDefinitons + , let flag_name' = unFlagName $ flagName flag + , let def_val = flagDefault flag + , (unFlagName -> flag_name, val) <- flagAssgnments + , flag_name == flag_name' + , val /= def_val + ] + return $ Just $ ChResponseFlags $ sort nonDefaultFlags + + "write-autogen-files":[] -> do + initialBuildStepsForAllComponents distdir pd lbi v + return Nothing + + "compiler-id":[] -> do + let CompilerId comp ver = compilerId $ compiler lbi + return $ Just $ ChResponseVersion $ (,) (show comp) (toDataVersion ver) + + "component-info":[] -> do + res <- componentsInfo lvd pt + return $ Just $ ChResponseComponentsInfo res + + "print-lbi":flags -> + case flags of + ["--human"] -> print lbi >> return Nothing + _ -> return $ Just $ ChResponseLbi $ show lbi + + cmd:_ | not (cmd `elem` commands) -> + errMsg ("Unknown command: " ++ cmd) >> usage >> exitFailure + _ -> + errMsg "Invalid usage!" >> usage >> exitFailure + type ProjectType = String -- either "v1" or "v2" componentsInfo @@ -371,7 +372,8 @@ componentsInfo lvd@(lbi, v, distdir) pt = do $ ChComponentInfo <$> ZipList comp_name <*> ZipList (map snd ciGhcOptions) - <*> ZipList (map snd ciSourceDirs) + <*> ZipList (map (map getSymbolicPath . snd) + ciSourceDirs) <*> ZipList (map snd ciEntrypoints) return uiComponents |