hpack 0.7.0 → 0.7.1
raw patch · 3 files changed
+26/−3 lines, 3 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Hpack.Config: instance Selector S1_0_19PackageConfig
+ Hpack.Config: packageBenchmarks :: Package -> [Section Executable]
- Hpack.Config: Package :: String -> String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> [String] -> [String] -> [String] -> Maybe String -> Maybe FilePath -> Maybe String -> [FilePath] -> [FilePath] -> Maybe SourceRepository -> Maybe (Section Library) -> [Section Executable] -> [Section Executable] -> Package
+ Hpack.Config: Package :: String -> String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> Maybe String -> [String] -> [String] -> [String] -> Maybe String -> Maybe FilePath -> Maybe String -> [FilePath] -> [FilePath] -> Maybe SourceRepository -> Maybe (Section Library) -> [Section Executable] -> [Section Executable] -> [Section Executable] -> Package
Files
- hpack.cabal +1/−1
- src/Hpack/Config.hs +10/−1
- src/Hpack/Run.hs +15/−1
hpack.cabal view
@@ -3,7 +3,7 @@ -- see: https://github.com/sol/hpack name: hpack-version: 0.7.0+version: 0.7.1 synopsis: An alternative format for Haskell packages category: Development homepage: https://github.com/sol/hpack#readme
src/Hpack/Config.hs view
@@ -50,7 +50,7 @@ import Hpack.Yaml package :: String -> String -> Package-package name version = Package name version Nothing Nothing Nothing Nothing Nothing Nothing [] [] [] Nothing Nothing Nothing [] [] Nothing Nothing [] []+package name version = Package name version Nothing Nothing Nothing Nothing Nothing Nothing [] [] [] Nothing Nothing Nothing [] [] Nothing Nothing [] [] [] section :: a -> Section a section a = Section a [] [] [] [] [] []@@ -146,6 +146,7 @@ , packageConfigLibrary :: Maybe (CaptureUnknownFields (Section LibrarySection)) , packageConfigExecutables :: Maybe (HashMap String (CaptureUnknownFields (Section ExecutableSection))) , packageConfigTests :: Maybe (HashMap String (CaptureUnknownFields (Section ExecutableSection)))+, packageConfigBenchmarks :: Maybe (HashMap String (CaptureUnknownFields (Section ExecutableSection))) } deriving (Eq, Show, Generic) instance HasFieldNames PackageConfig@@ -154,6 +155,7 @@ packageDependencies Package{..} = nub . sortBy (comparing (lexicographically . dependencyName)) $ (concatMap sectionDependencies packageExecutables) ++ (concatMap sectionDependencies packageTests)+ ++ (concatMap sectionDependencies packageBenchmarks) ++ maybe [] sectionDependencies packageLibrary instance FromJSON PackageConfig where@@ -238,6 +240,7 @@ , packageLibrary :: Maybe (Section Library) , packageExecutables :: [Section Executable] , packageTests :: [Section Executable]+, packageBenchmarks :: [Section Executable] } deriving (Eq, Show) data Library = Library {@@ -277,6 +280,7 @@ mLibrary <- mapM (toLibrary globalOptions) mLibrarySection executables <- toExecutables globalOptions (map (fmap captureUnknownFieldsValue) executableSections) tests <- toExecutables globalOptions (map (fmap captureUnknownFieldsValue) testsSections)+ benchmarks <- toExecutables globalOptions (map (fmap captureUnknownFieldsValue) benchmarkSections) name <- maybe (takeBaseName <$> getCurrentDirectory) return packageConfigName @@ -286,6 +290,7 @@ maybe [] sectionSourceDirs mLibrary ++ concatMap sectionSourceDirs executables ++ concatMap sectionSourceDirs tests+ ++ concatMap sectionSourceDirs benchmarks ) (extraSourceFilesWarnings, extraSourceFiles) <-@@ -315,6 +320,7 @@ , packageLibrary = mLibrary , packageExecutables = executables , packageTests = tests+ , packageBenchmarks = benchmarks } warnings =@@ -333,6 +339,9 @@ testsSections :: [(String, CaptureUnknownFields (Section ExecutableSection))] testsSections = toList packageConfigTests++ benchmarkSections :: [(String, CaptureUnknownFields (Section ExecutableSection))]+ benchmarkSections = toList packageConfigBenchmarks toList :: Maybe (HashMap String a) -> [(String, a)] toList = Map.toList . fromMaybe mempty
src/Hpack/Run.hs view
@@ -62,7 +62,13 @@ library = maybe [] (return . renderLibrary) packageLibrary stanzas :: [Element]- stanzas = extraSourceFiles : dataFiles : sourceRepository ++ library ++ renderExecutables packageExecutables ++ renderTests packageTests+ stanzas = extraSourceFiles+ : dataFiles+ : sourceRepository+ ++ library+ ++ renderExecutables packageExecutables+ ++ renderTests packageTests+ ++ renderBenchmarks packageBenchmarks padding name = replicate (alignment - length name - 2) ' ' @@ -150,6 +156,14 @@ renderTest :: Section Executable -> Element renderTest sect@(sectionData -> Executable{..}) = Stanza ("test-suite " ++ executableName)+ (Field "type" "exitcode-stdio-1.0" : renderExecutableSection sect)++renderBenchmarks :: [Section Executable] -> [Element]+renderBenchmarks = map renderBenchmark++renderBenchmark :: Section Executable -> Element+renderBenchmark sect@(sectionData -> Executable{..}) =+ Stanza ("benchmark " ++ executableName) (Field "type" "exitcode-stdio-1.0" : renderExecutableSection sect) renderExecutableSection :: Section Executable -> [Element]