From f2189de2797e391124ead51eada6d57b2929c88f Mon Sep 17 00:00:00 2001 From: Daniel Gröber Date: Sat, 9 Feb 2019 19:46:44 +0100 Subject: Shortcut helper compilation when Cabal version is already available This is mostly an optimization for Nix which already sets up the environment correctly, so we should reward its users :) --- src/CabalHelper/Compiletime/Cabal.hs | 7 +++++-- src/CabalHelper/Compiletime/Data.hs | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src/CabalHelper/Compiletime') diff --git a/src/CabalHelper/Compiletime/Cabal.hs b/src/CabalHelper/Compiletime/Cabal.hs index a61b6f6..6477b85 100644 --- a/src/CabalHelper/Compiletime/Cabal.hs +++ b/src/CabalHelper/Compiletime/Cabal.hs @@ -20,7 +20,7 @@ Description : Cabal library source unpacking License : GPL-3 -} -{-# LANGUAGE DeriveFunctor #-} +{-# LANGUAGE DeriveFunctor, CPP #-} module CabalHelper.Compiletime.Cabal where @@ -36,7 +36,7 @@ import System.FilePath import CabalHelper.Compiletime.Types import CabalHelper.Compiletime.Process -import CabalHelper.Shared.Common (trim, replace) +import CabalHelper.Shared.Common (trim, replace, parseVer) type UnpackedCabalVersion = CabalVersion' (CommitId, CabalSourceDir) type ResolvedCabalVersion = CabalVersion' CommitId @@ -215,3 +215,6 @@ findCabalFile pkgdir = do if takeFileName p == takeExtension p then "" -- just ".cabal" is not a valid cabal file else takeExtension p + +bultinCabalVersion :: Version +bultinCabalVersion = parseVer VERSION_Cabal diff --git a/src/CabalHelper/Compiletime/Data.hs b/src/CabalHelper/Compiletime/Data.hs index 07cf2d2..14793c5 100644 --- a/src/CabalHelper/Compiletime/Data.hs +++ b/src/CabalHelper/Compiletime/Data.hs @@ -85,6 +85,7 @@ runtimeSources :: (String, [(FilePath, FilePath)]) runtimeSources = $( let files = map (\f -> (f, ("src/CabalHelper" f))) $ sort $ [ ("Runtime/Main.hs") + , ("Runtime/HelperMain.hs") , ("Runtime/Compat.hs") , ("Shared/Common.hs") , ("Shared/InterfaceTypes.hs") -- cgit v1.2.3