Skip to content

Commit

Permalink
Add 9.6 compatibility layer to cabalscan
Browse files Browse the repository at this point in the history
  • Loading branch information
avdv committed Jan 2, 2024
1 parent a471206 commit 8ddea83
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
47 changes: 47 additions & 0 deletions cabalscan/src/Cabal/Cabal_9_6.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{-#LANGUAGE CPP #-}

#if __GLASGOW_HASKELL__ == 906

module Cabal.Cabal_9_6(module Cabal, depLibraries, hsSourceDirs)

where

import Distribution.Compiler as Cabal (CompilerFlavor(GHC), perCompilerFlavorToList, unknownCompilerInfo, CompilerId(CompilerId), AbiTag(NoAbiTag))
import Distribution.ModuleName as Cabal (toFilePath, components)
import Distribution.Package as Cabal ()
import Distribution.PackageDescription as Cabal (allLibraries, executables, testSuites, benchmarks, package, dataFiles, Library, libName, exposedModules, libBuildInfo, Executable, exeName, buildInfo, modulePath, TestSuite, testName, testBuildInfo, TestSuiteInterface(TestSuiteExeV10), testInterface, Benchmark, benchmarkName, benchmarkBuildInfo, BenchmarkInterface(BenchmarkExeV10), benchmarkInterface, BuildInfo, buildable, otherModules, extraLibs)
import Distribution.PackageDescription.Configuration as Cabal (finalizePD)
import Distribution.Simple.PackageDescription as Cabal (readGenericPackageDescription)
import Distribution.Types.BuildInfo as Cabal (buildToolDepends, targetBuildDepends, defaultExtensions, cppOptions, ldOptions, options)
import Distribution.Types.ComponentRequestedSpec as Cabal (ComponentRequestedSpec(ComponentRequestedSpec), testsRequested, benchmarksRequested)
import Distribution.Types.Dependency as Cabal (Dependency, depPkgName)
import Distribution.Types.ExeDependency as Cabal (ExeDependency(ExeDependency))
import Distribution.Types.Library as Cabal (libVisibility)
import Distribution.Types.LibraryName as Cabal (LibraryName(LSubLibName))
import Distribution.Types.LibraryVisibility as Cabal (LibraryVisibility(LibraryVisibilityPrivate))
import Distribution.Types.PackageDescription as Cabal (PackageDescription)
import Distribution.Types.PackageId as Cabal (PackageIdentifier, pkgName, pkgVersion)
import Distribution.Types.PackageName as Cabal (PackageName, unPackageName)
import Distribution.Types.UnqualComponentName as Cabal (unUnqualComponentName)
import Distribution.Types.Version as Cabal (mkVersion)
import Distribution.Pretty as Cabal (prettyShow)
import Distribution.System as Cabal (Platform(Platform), buildArch, buildOS)
import Distribution.Verbosity as Cabal (silent)

import qualified Distribution.Types.Dependency as C (depLibraries)
import qualified Distribution.Compat.NonEmptySet as C (toSet)
import Data.Set.Internal (Set)
import qualified Distribution.PackageDescription as C (hsSourceDirs)
import qualified Distribution.Utils.Path as C (getSymbolicPath)

depLibraries :: Cabal.Dependency -> Set Cabal.LibraryName
depLibraries = C.toSet . C.depLibraries

hsSourceDirs :: Cabal.BuildInfo -> [FilePath]
hsSourceDirs = map C.getSymbolicPath . C.hsSourceDirs

#else

module Cabal.Cabal_9_6 where

#endif
6 changes: 5 additions & 1 deletion cabalscan/src/CabalScan/RuleGenerator.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,14 @@ import qualified Cabal.Cabal_9_0 as Cabal

import qualified Cabal.Cabal_9_2 as Cabal

#else
#elif __GLASGOW_HASKELL__ == 904

import qualified Cabal.Cabal_9_4 as Cabal

#else

import qualified Cabal.Cabal_9_6 as Cabal

#endif

generateRulesForCabalFile :: FilePath -> IO [RuleInfo]
Expand Down

0 comments on commit 8ddea83

Please sign in to comment.