From e65809b594ec983d1601352599779f59999d9dbf Mon Sep 17 00:00:00 2001 From: Adithya Kumar Date: Sat, 13 Aug 2022 02:40:06 +0530 Subject: [PATCH 1/2] Fix the revisions in cabal.project.user --- cabal.project.user | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cabal.project.user b/cabal.project.user index aa46cb3..9e092df 100644 --- a/cabal.project.user +++ b/cabal.project.user @@ -3,27 +3,27 @@ packages: . source-repository-package type: git location: https://github.com/composewell/streamly.git - tag: master + tag: 261a7e06fa1cdd8825b417d3ba250d60171e55e7 source-repository-package type: git location: https://github.com/composewell/streamly.git - tag: master + tag: 261a7e06fa1cdd8825b417d3ba250d60171e55e7 subdir: core source-repository-package type: git location: https://github.com/composewell/streamly-coreutils.git - tag: master + tag: 74cfc8e5a12e4acfd65f943e3787221d6cf356dc source-repository-package type: git location: https://github.com/composewell/streamly-shell.git - tag: master + tag: 1b3fea3239ebe47963955d81565b9d5e34567ab7 source-repository-package type: git location: https://github.com/composewell/streamly-process.git - tag: master + tag: e310c8a9c6e61515373a2f5f1fb82f6e15fe452b jobs: 1 From cee357fd41334f61d785e8c15cfa6a05d38bec44 Mon Sep 17 00:00:00 2001 From: Ranjeet Kumar Ranjan Date: Wed, 10 Aug 2022 16:06:27 +0530 Subject: [PATCH 2/2] Warn instead of failing when an unbuildable target is encountered --- bench-report.cabal | 1 + lib/BenchRunner.hs | 5 +++-- lib/BuildLib.hs | 26 +++++++++++++++++++------- lib/TestRunner.hs | 5 +++-- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/bench-report.cabal b/bench-report.cabal index a389abb..103472c 100644 --- a/bench-report.cabal +++ b/bench-report.cabal @@ -29,6 +29,7 @@ common compile-options -Wno-all-missed-specialisations default-extensions: TemplateHaskell , QuasiQuotes + , ScopedTypeVariables default-language: Haskell2010 library diff --git a/lib/BenchRunner.hs b/lib/BenchRunner.hs index 1e202ec..9d8babf 100644 --- a/lib/BenchRunner.hs +++ b/lib/BenchRunner.hs @@ -398,9 +398,10 @@ runMeasurements targets = do if commitCompare then runBenchesComparing targets else do - liftIO $ runBuild buildBench benchPackageName "bench" targets + buildableTargets <- + liftIO $ runBuild buildBench benchPackageName "bench" targets -- XXX What is target_exe_extra_args here? - runBenchTargets benchPackageName "b" targets + runBenchTargets benchPackageName "b" buildableTargets runReports :: [String] -> Context () runReports benchmarks = do diff --git a/lib/BuildLib.hs b/lib/BuildLib.hs index 109e457..fd9b4a1 100644 --- a/lib/BuildLib.hs +++ b/lib/BuildLib.hs @@ -27,14 +27,16 @@ module BuildLib -- Imports -------------------------------------------------------------------------------- +import Control.Exception (catch) import Control.Monad (unless) import Control.Monad.IO.Class (MonadIO(..)) import Control.Monad.Trans.Reader (ReaderT, asks) import Data.List (nub, sort, intercalate, isSuffixOf) import Data.Map (Map) -import Data.Maybe (mapMaybe) +import Data.Maybe (catMaybes, mapMaybe) import Streamly.Coreutils.Which (which) import Streamly.Internal.Unicode.String (str) +import Streamly.System.Process (ProcessFailure) import qualified Data.List as List import qualified Data.Map as Map @@ -258,9 +260,19 @@ getCabalExe = do getGhcVersion :: String -> IO String getGhcVersion ghc = liftIO $ toLastLine [str|#{ghc} --numeric-version|] -runBuild :: String -> String -> String -> [String] -> IO () -runBuild buildProg package componentPrefix components = do - let componentsWithContext = - map (\c -> [str|#{package}:#{componentPrefix}:#{c}|]) components - componentsWithContextStr = unwords componentsWithContext - toStdoutV [str|#{buildProg} #{componentsWithContextStr}|] +runBuild :: String -> String -> String -> [String] -> IO [String] +runBuild buildProg package componentPrefix components = + catMaybes <$> mapM action components + + where + + actionBuildTarget c = do + toStdoutV [str|#{buildProg} #{package}:#{componentPrefix}:#{c}|] + return (Just c) + + actionOnError c = do + print $ "Warning: Target does not exist:" ++ c + return Nothing + + action c = + catch (actionBuildTarget c) (\(_ :: ProcessFailure) -> actionOnError c) diff --git a/lib/TestRunner.hs b/lib/TestRunner.hs index cdf8df4..477f1ee 100644 --- a/lib/TestRunner.hs +++ b/lib/TestRunner.hs @@ -261,13 +261,14 @@ runMeasurements :: [String] -> Context () runMeasurements targets = do buildCmd <- getBuildCommand benchPackageName <- asks bconfig_BENCHMARK_PACKAGE_NAME - liftIO $ runBuild buildCmd benchPackageName "test" targets + buildableTargets <- + liftIO $ runBuild buildCmd benchPackageName "test" targets coverage <- asks bconfig_COVERAGE when coverage $ do buildDir <- asks bconfig_BUILD_DIR liftIO $ toStdout [str|mkdir -p #{buildDir}/hpc|] - runBenchTargets benchPackageName "t" targets + runBenchTargets benchPackageName "t" buildableTargets ------------------------------------------------------------------------------- -- Build and run targets