Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

updated doctest to use exact dependencies. removed upper bounds, new …

…build system, updated notification style
  • Loading branch information...
commit 5c4b6a2f979d5f2a98ef2aa442e815e1c3e68e20 1 parent 9555300
@ekmett authored
View
12 .gitignore
@@ -1,5 +1,13 @@
dist
-TAGS
-tags
docs
wiki
+TAGS
+tags
+wip
+.DS_Store
+.*.swp
+.*.swo
+*.o
+*.hi
+*~
+*#
View
12 .travis.yml
@@ -1,8 +1,8 @@
language: haskell
-# Use this when hackage is down.
-# before_install:
-# - mkdir -p ~/.cabal
-# - cp config ~/.cabal/config
-# - cabal update
notifications:
- irc: "irc.freenode.org#haskell-lens"
+ irc:
+ channels:
+ - "irc.freenode.org#haskell-lens"
+ skip_join: true
+ template:
+ - "\x0313machines\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}"
View
45 Setup.lhs
@@ -1,7 +1,44 @@
#!/usr/bin/runhaskell
-> module Main (main) where
+\begin{code}
+{-# OPTIONS_GHC -Wall #-}
+module Main (main) where
-> import Distribution.Simple
+import Data.List ( nub )
+import Data.Version ( showVersion )
+import Distribution.Package ( PackageName(PackageName), PackageId, InstalledPackageId, packageVersion, packageName )
+import Distribution.PackageDescription ( PackageDescription(), TestSuite(..) )
+import Distribution.Simple ( defaultMainWithHooks, UserHooks(..), simpleUserHooks )
+import Distribution.Simple.Utils ( rewriteFile, createDirectoryIfMissingVerbose )
+import Distribution.Simple.BuildPaths ( autogenModulesDir )
+import Distribution.Simple.Setup ( BuildFlags(buildVerbosity), fromFlag )
+import Distribution.Simple.LocalBuildInfo ( withLibLBI, withTestLBI, LocalBuildInfo(), ComponentLocalBuildInfo(componentPackageDeps) )
+import Distribution.Verbosity ( Verbosity )
+import System.FilePath ( (</>) )
-> main :: IO ()
-> main = defaultMain
+main :: IO ()
+main = defaultMainWithHooks simpleUserHooks
+ { buildHook = \pkg lbi hooks flags -> do
+ generateBuildModule (fromFlag (buildVerbosity flags)) pkg lbi
+ buildHook simpleUserHooks pkg lbi hooks flags
+ }
+
+generateBuildModule :: Verbosity -> PackageDescription -> LocalBuildInfo -> IO ()
+generateBuildModule verbosity pkg lbi = do
+ let dir = autogenModulesDir lbi
+ createDirectoryIfMissingVerbose verbosity True dir
+ withLibLBI pkg lbi $ \_ libcfg -> do
+ withTestLBI pkg lbi $ \suite suitecfg -> do
+ rewriteFile (dir </> "Build_" ++ testName suite ++ ".hs") $ unlines
+ [ "module Build_" ++ testName suite ++ " where"
+ , "deps :: [String]"
+ , "deps = " ++ (show $ formatdeps (testDeps libcfg suitecfg))
+ ]
+ where
+ formatdeps = map (formatone . snd)
+ formatone p = case packageName p of
+ PackageName n -> n ++ "-" ++ showVersion (packageVersion p)
+
+testDeps :: ComponentLocalBuildInfo -> ComponentLocalBuildInfo -> [(InstalledPackageId, PackageId)]
+testDeps xs ys = nub $ componentPackageDeps xs ++ componentPackageDeps ys
+
+\end{code}
View
15 machines.cabal
@@ -1,6 +1,6 @@
name: machines
category: Control, Enumerator
-version: 0.2.1.3
+version: 0.2.2
license: BSD3
cabal-version: >= 1.10
license-file: LICENSE
@@ -12,7 +12,7 @@ bug-reports: http://github.com/ekmett/machines/issues
copyright: Copyright (C) 2012 Edward A. Kmett
synopsis: Networked stream transducers
description: Networked stream transducers
-build-type: Simple
+build-type: Custom
tested-with: GHC == 7.4.1
extra-source-files:
.travis.yml
@@ -30,12 +30,12 @@ source-repository head
library
build-depends:
base == 4.*,
- comonad == 3.0.*,
+ comonad >= 3,
containers >= 0.3 && < 0.6,
- free >= 3.1.1 && < 3.4,
- pointed == 3.0.*,
- profunctors >= 3.0 && < 3.2,
- semigroups >= 0.8.3 && < 0.9,
+ free >= 3.1.1,
+ pointed >= 3,
+ profunctors >= 3,
+ semigroups >= 0.8.3,
transformers == 0.3.*,
mtl >= 2.1.1 && < 2.2
@@ -67,6 +67,7 @@ library
test-suite doctests
type: exitcode-stdio-1.0
main-is: doctests.hs
+ default-language: Haskell2010
build-depends:
base == 4.*,
directory >= 1.0 && < 1.3,
View
10 tests/doctests.hs
@@ -1,11 +1,12 @@
module Main where
-import Test.DocTest
-import System.Directory
-import System.FilePath
+import Build_doctests (deps)
import Control.Applicative
import Control.Monad
import Data.List
+import System.Directory
+import System.FilePath
+import Test.DocTest
main :: IO ()
main = getSources >>= \sources -> doctest $
@@ -13,7 +14,8 @@ main = getSources >>= \sources -> doctest $
: "-idist/build/autogen"
: "-optP-include"
: "-optPdist/build/autogen/cabal_macros.h"
- : sources
+ : "-hide-all-packages"
+ : map ("-package="++) deps ++ sources
getSources :: IO [FilePath]
getSources = filter (isSuffixOf ".hs") <$> go "src"
Please sign in to comment.
Something went wrong with that request. Please try again.