Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn against unknown targets #26

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bench-report.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ common compile-options
-Wno-all-missed-specialisations
default-extensions: TemplateHaskell
, QuasiQuotes
, ScopedTypeVariables
default-language: Haskell2010

library
Expand Down
10 changes: 5 additions & 5 deletions cabal.project.user
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 3 additions & 2 deletions lib/BenchRunner.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 19 additions & 7 deletions lib/BuildLib.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
5 changes: 3 additions & 2 deletions lib/TestRunner.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down