uuagc-cabal 1.0.0.1 → 1.0.0.2
raw patch · 3 files changed
+66/−3 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- README +36/−0
- src/Distribution/Simple/UUAGC/UUAGC.hs +28/−2
- uuagc-cabal.cabal +2/−1
+ README view
@@ -0,0 +1,36 @@+This is a plugin for the UUAG system.++To use UUAG in combination with Cabal, add a dependency on the packages:+uuagc -- installs the tool: uuagc+uuagc-cabal -- installs a cabal plugin that uses uuagc+Note that this package does not have a dependency on uuagc. You can use+this module without having uuagc installed.+(whether this is useful is a different question)++Then write a custom Setup.hs:++--+module Main where++import Distribution.Simple+import Distribution.Simple.UUAGC++compiler = "uuagc"+main = defaultMainWithHooks (uuagcUserHook' compiler)+--++Add extra-source-files: uuagc_options+The contents of this file are options per AG module, as specified+as follows. Write for each AG file:+* Two lines in a file uuagc_options in the root of the package:+ --+ file: "src-ag/Desugar.ag"+ options: module, pretty, catas, semfuns, signatures, genlinepragmas+ --+ The options depend on what you actually want to compile.+* Add an extra source file to the AG file in the cabal file:+ extra-source-files: src/MyProgram.ag+* Add the module to the modules list in the cabal file.+++Originally written by Juan Cardona (or one of his students).
src/Distribution/Simple/UUAGC/UUAGC.hs view
@@ -79,11 +79,14 @@ hooks = simpleUserHooks { hookedPreProcessors = ("ag", ag):("lag",ag):knownSuffixHandlers , buildHook = uuagcBuildHook uuagcPath , postBuild = uuagcPostBuild+ , sDistHook = uuagcSDistHook uuagcPath+ , postSDist = uuagcPostBuild } ag = uuagc' uuagcPath originalPreBuild = preBuild simpleUserHooks originalBuildHook = buildHook simpleUserHooks+originalSDistHook = sDistHook simpleUserHooks processContent :: Handle -> IO [String] processContent = liftM words . hGetContents@@ -215,6 +218,20 @@ ++ show fClass ++ " is not defined." +uuagcSDistHook :: String+ -> PackageDescription+ -> Maybe LocalBuildInfo+ -> UserHooks+ -> SDistFlags+ -> IO ()+uuagcSDistHook uuagcPath pd mbLbi uh df = do+ case mbLbi of+ Nothing -> warn normal "sdist: the local buildinfo was not present. Skipping AG initialization. Dist may fail."+ Just lbi -> commonHook uuagcPath pd lbi uh (sDistVerbosity df)+ originalSDistHook pd mbLbi uh df+++ uuagcBuildHook :: String -> PackageDescription@@ -223,6 +240,16 @@ -> BuildFlags -> IO () uuagcBuildHook uuagcPath pd lbi uh bf = do+ commonHook uuagcPath pd lbi uh (buildVerbosity bf)+ originalBuildHook pd lbi uh bf++commonHook :: String+ -> PackageDescription+ -> LocalBuildInfo+ -> UserHooks+ -> Flag Verbosity+ -> IO ()+commonHook uuagcPath pd lbi uh fl = do let lib = library pd exes = executables pd bis = map libBuildInfo (maybeToList lib) ++ map buildInfo exes@@ -230,14 +257,13 @@ options <- getAGFileOptions (bis >>= customFieldsBI) fileOptions <- forM options (\ opt -> let (notFound, opts) = getOptionsFromClass classes $ opt- in do case buildVerbosity bf of+ in do case fl of Flag v | v >= verbose -> putStrLn ("options for " ++ filename opt ++ ": " ++ show opts) _ -> return () forM_ notFound (hPutStrLn stderr) >> return (normalise . filename $ opt, opts)) writeFileOptions fileOptions let agflSP = map (id &&& dropFileName) $ nub $ getAGFileList options mapM_ (updateAGFile uuagcPath pd lbi) agflSP- originalBuildHook pd lbi uh bf uuagcPostBuild _ _ _ _ = do exists <- doesFileExist agClassesFile
uuagc-cabal.cabal view
@@ -1,7 +1,7 @@ cabal-version: >=1.6 build-type: Simple name: uuagc-cabal-version: 1.0.0.1+version: 1.0.0.2 license: BSD3 license-file: LICENSE maintainer: Arie Middelkoop <ariem@cs.uu.nl>@@ -14,6 +14,7 @@ author: Software Technology at Universiteit Utrecht bug-reports: hut-developers@cs.uu.nl tested-with: GHC >= 6.12+extra-source-files: README library build-depends: base >= 4, base < 5, Cabal >= 1.8.0.6, directory >= 1.0.1.1