Skip to content

Commit

Permalink
Fix rebase issues
Browse files Browse the repository at this point in the history
  • Loading branch information
knothed committed Aug 25, 2021
1 parent 0633fc9 commit 08a53f2
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 33 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# This GitHub workflow config has been generated by a script via
#
# haskell-ci 'github' 'happy.cabal'
# haskell-ci 'github' 'cabal.project'
#
# To regenerate the script (for example after adjusting tested-with) run
#
# haskell-ci regenerate
#
# For more information, see https://github.com/haskell-CI/haskell-ci
#
# version: 0.13.20210606
# version: 0.13.20210621
#
# REGENDATA ("0.13.20210606",["github","happy.cabal"])
# REGENDATA ("0.13.20210621",["github","cabal.project"])
#
name: Haskell-CI
on:
Expand Down Expand Up @@ -286,6 +286,9 @@ jobs:
${CABAL} -vnormal check
cd ${PKGDIR_happy} || false
${CABAL} -vnormal check
- name: haddock
run: |
$CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
- name: unconstrained build
run: |
rm -f cabal.project.local
Expand Down
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
ENV = .local.env
HC ?= ghc
CABAL ?= cabal

EXECUTABLE = "happy"
PACKAGES = ["happy", "happy-cli", "happy-grammar", "happy-frontend", "happy-tabular", "happy-backend", "happy-test"]
BOOTSTRAPPING = True

sdist-test ::
rm -f ${ENV}
cabal v2-install --lib happy-test --package-env ${ENV}
ghc -package-env ${ENV} -e 'Happy.Test.SDist.sdist_test "$(shell pwd)" ${EXECUTABLE} ${PACKAGES} ${BOOTSTRAPPING}'
rm -f ${ENV}
$(CABAL) v2-install --lib happy-test --package-env ${ENV}
$(HC) -package-env ${ENV} -e 'Happy.Test.SDist.sdist_test "${CABAL}" "$(shell pwd)" ${EXECUTABLE} ${PACKAGES} ${BOOTSTRAPPING}'
rm -f ${ENV}
16 changes: 15 additions & 1 deletion packages/frontend/happy-frontend.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ Description:
These .y- and .ly-files work similar to yacc's .y-files, but
have some Haskell-specific features.

tested-with:
GHC == 7.0.4
GHC == 7.4.2
GHC == 7.6.3
GHC == 7.8.4
GHC == 7.10.3
GHC == 8.0.2
GHC == 8.2.2
GHC == 8.4.4
GHC == 8.6.5
GHC == 8.8.4
GHC == 8.10.4
GHC == 9.0.1

flag bootstrap
description: Optimize the implementation of happy using a pre-built happy
manual: True
Expand Down Expand Up @@ -64,4 +78,4 @@ library
else
other-modules:
Happy.Frontend.ParseMonad.Oracle
Happy.Frontend.Parser.Oracle
Happy.Frontend.Parser.Oracle
16 changes: 15 additions & 1 deletion packages/grammar/happy-grammar.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ Description:
Happy-Grammar exposes the cross-package Grammar datatype,
which represents a grammar as can be parsed and processed by happy.

tested-with:
GHC == 7.0.4
GHC == 7.4.2
GHC == 7.6.3
GHC == 7.8.4
GHC == 7.10.3
GHC == 8.0.2
GHC == 8.2.2
GHC == 8.4.4
GHC == 8.6.5
GHC == 8.8.4
GHC == 8.10.4
GHC == 9.0.1

library
hs-source-dirs: src

Expand All @@ -29,4 +43,4 @@ library
default-language: Haskell98
default-extensions: CPP, MagicHash, FlexibleContexts
ghc-options: -Wall
other-modules:
other-modules:
3 changes: 2 additions & 1 deletion packages/happy/tests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ main = do
(if supportsParsingAttributeGrammars then attributeGrammarTestFiles else [])
let setup = TestSetup {
happyExec = "happy",
haskellCompilerExec = "ghc",
defaultTests = tests,
customTests = [],
customDataDir = dir,
allArguments = map ("--strict " ++) ["", "-a", "-g", "-ag", "-gc", "-agc"],
stopOnFailure = True
}
test setup
test setup
16 changes: 15 additions & 1 deletion packages/test/happy-test.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ Description:
Happy-Test hosts various test grammars and allows
to customize and execute the happy test suite.

tested-with:
GHC == 7.0.4
GHC == 7.4.2
GHC == 7.6.3
GHC == 7.8.4
GHC == 7.10.3
GHC == 8.0.2
GHC == 8.2.2
GHC == 8.4.4
GHC == 8.6.5
GHC == 8.8.4
GHC == 8.10.4
GHC == 9.0.1

data-dir: data

data-files:
Expand Down Expand Up @@ -62,4 +76,4 @@ library
default-extensions: CPP
ghc-options: -Wall
other-modules: Happy.Test.Shell,
Paths_happy_test
Paths_happy_test
47 changes: 24 additions & 23 deletions packages/test/src/Happy/Test/SDist.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE NamedFieldPuns #-}
module Happy.Test.SDist(sdist_test) where

import Happy.Test.Shell
Expand All @@ -18,19 +19,19 @@ import Control.Monad.IO.Class
-- * name of the main executable (which also provides a test suite)
-- * names of all required local packages (including the main executable)
-- * perform bootstrapping-testing? if true, first build without bootstrap, and then use the generated binary for bootstrapping.
sdist_test :: String -> String -> [String] -> Bool -> IO ()
sdist_test a b c d = do
success <- runShell $ sdist_test' a b c d
sdist_test :: String -> String -> String -> [String] -> Bool -> IO ()
sdist_test cabal projectDir executable localPackages bootstrapping = do
success <- runShell $ sdist_test' cabal projectDir executable localPackages bootstrapping
if success
then putStrLn "Success! The tarballs inside dist-newstyle/sdist are now ready for distribution." >> exitSuccess
else putStrLn "Failure." >> exitFailure

sdist_test' :: String -> String -> [String] -> Bool -> Shell
sdist_test' projectDir executable localPackages bootstrapping = do
sdist_test' :: String -> String -> String -> [String] -> Bool -> Shell
sdist_test' cabal projectDir executable localPackages bootstrapping = do
let sdistDir = joinPath [projectDir, "dist-newstyle", "sdist"]

-- `cabal sdist all` -> returns `package-name-VERSION` for each package-name
fullNames <- cabalSdistAll localPackages sdistDir
fullNames <- cabalSdistAll cabal localPackages sdistDir

liftIO . putStrLn $ "packages: " ++ show (zip localPackages fullNames)

Expand Down Expand Up @@ -60,35 +61,35 @@ sdist_test' projectDir executable localPackages bootstrapping = do
liftIO . putStrLn $ "Umbrella dir (" ++ umbrellaDir ++ ") generated successfully."

if bootstrapping
then testWithBootstrapping umbrellaDir executable
else testWithoutBootstrapping umbrellaDir executable
then testWithBootstrapping cabal umbrellaDir executable
else testWithoutBootstrapping cabal umbrellaDir executable

return ()

testWithoutBootstrapping :: FilePath -> String -> Shell
testWithoutBootstrapping dir executable = do
runCmdIn dir ["cabal", "build", executable] False
runCmdIn dir ["cabal", "test", executable] False
testWithoutBootstrapping :: String -> FilePath -> String -> Shell
testWithoutBootstrapping cabal dir executable = do
runCmdIn dir [cabal, "build", executable] False
runCmdIn dir [cabal, "test", executable] False

testWithBootstrapping :: FilePath -> String -> Shell
testWithBootstrapping dir executable = do
runCmdIn dir ["cabal", "build", executable, "-f", "-bootstrap"] False
runCmdIn dir ["cabal", "install", executable, "-f", "-bootstrap", "--installdir=./bootstrap-root"] False
runCmdIn dir ["cabal", "test", executable, "-f", "-bootstrap"] False
testWithBootstrapping :: String -> FilePath -> String -> Shell
testWithBootstrapping cabal dir executable = do
runCmdIn dir [cabal, "build", executable, "-f", "-bootstrap"] False
runCmdIn dir [cabal, "install", executable, "-f", "-bootstrap", "--installdir=./bootstrap-root"] False
runCmdIn dir [cabal, "test", executable, "-f", "-bootstrap"] False

-- We now want our just-built happy to be used for bootstrapping happy, i.e. building happy's .ly files.
-- Using `cabal build --with-happy=` (instead of exporting ./bootstrap-root to PATH) also allows using happy's with a different name like `happy-rad`.
let bootstrapHappy = joinPath [dir, "bootstrap-root", executable]
runCmdIn dir ["cabal", "build", executable, "-f", "+bootstrap", "--with-happy=" ++ bootstrapHappy] False
runCmdIn dir ["cabal", "test", executable, "-f", "+bootstrap"] False
runCmdIn dir [cabal, "build", executable, "-f", "+bootstrap", "--with-happy=" ++ bootstrapHappy] False
runCmdIn dir [cabal, "test", executable, "-f", "+bootstrap"] False

-- Perform `cabal sdist all` and match the output lines to the given package names.
-- This is required to extract the full package name (i.e. package-name-VERSION) for each package.
-- This is less elegant than performing `cabal sdist package` for each package on its own, but is required because `cabal sdist happy` doesn't work on its own - `cabal sdist all` does.
cabalSdistAll :: [String] -> String -> TypedShell [String]
cabalSdistAll packageNames baseDir = do
cabalSdistAll :: String -> [String] -> String -> TypedShell [String]
cabalSdistAll cabal packageNames baseDir = do
liftIO $ setCurrentDirectory baseDir
output <- liftIO $ readProcess "cabal" ["sdist", "all"] "" `catchIO` const (return "")
output <- liftIO $ readProcess cabal ["sdist", "all"] "" `catchIO` const (return "")
let fullNames = catMaybes . catMaybes $ map extractFullName $ lines output
let matched = catMaybes $ map (bestMatch fullNames) packageNames
if length packageNames == length matched then return matched else empty
Expand All @@ -115,4 +116,4 @@ cabalSdistAll packageNames baseDir = do
last' x = if null x then Nothing else Just (last x)

targz :: String
targz = ".tar.gz"
targz = ".tar.gz"

0 comments on commit 08a53f2

Please sign in to comment.