Skip to content

Commit

Permalink
fix windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
0rphee committed Jul 15, 2024
1 parent e737b4e commit 1498277
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 24 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v3
- uses: haskell/actions/hlint-setup@v1
- uses: haskell/actions/hlint-run@v2
- uses: haskell-actions/hlint-setup@v1
- uses: haskell-actions/hlint-run@v2

fourmolu:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -75,6 +75,7 @@ jobs:
needs: [create_release]
name: ${{ matrix.os }}/GHC ${{ matrix.ghc }}/${{ github.ref }}
runs-on: ${{ matrix.os }}
permissions: write-all
strategy:
# Don't fail fast because we test a lot of versions and it's
# good to know which ones work and which ones don't
Expand All @@ -90,7 +91,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Haskell
uses: haskell/actions/setup@v2
uses: haskell-actions/setup@v2
id: setup-haskell-cabal
with:
ghc-version: ${{ matrix.ghc }}
Expand Down
47 changes: 29 additions & 18 deletions app/CmdOptions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,49 @@ where

import Data.Version (showVersion)
import GitHash
import OptEnvConf
import Path
import Options.Applicative
import Paths_asmh (version)

newtype Options = Options
{ sourceCodeFile :: Path Abs File
{ sourceCodeFile :: FilePath
}

instance HasParser Options where
settingsParser = do
val <-
filePathSetting
[ help "the file to compile"
, argument
]
pure $ Options val

runCmdOptions :: IO Options
runCmdOptions = runSettingsParser version descriptionString
runCmdOptions = execParser options

options :: ParserInfo Options
options =
info
(opts <**> helper)
( fullDesc
<> header headerString
<> progDesc "i8086 assembler"
<> footer
"source code: https://github.com/0rphee/asmh"
<> failureCode 64
)
where
descriptionString = concat ["Run asmh - v", showVersion version, gitInfoString]
headerString = "asmh - v" <> versionString

opts :: Parser Options
opts =
Options
<$> strArgument
( metavar "FILENAME"
<> help "Input file"
<> action "file"
)
<**> simpleVersioner versionString

versionString :: String
versionString = showVersion version <> gitInfoString
where
gitInfoString = case $$tGitInfoCwdTry of
Right gi ->
concat
[ " - "
, giBranch gi
, "@"
, giHash gi
, " ("
, show $ giCommitCount gi
, " commits in HEAD"
, ")"
]
_ -> ""
4 changes: 2 additions & 2 deletions app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import Bin

main :: IO ()
main = do
-- (Options sourceCodeFile) <- runCmdOptions
-- putStrLn $ "FILEPATH: " <> toFilePath sourceCodeFile
(Options sourceCodeFile) <- runCmdOptions
putStrLn $ "FILEPATH: " <> sourceCodeFile
assemblyCode <- T.readFile "asm/colors.asm"
-- let assemblyCode =
-- T.unlines
Expand Down
3 changes: 2 additions & 1 deletion asmh.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ executable asmh
bytestring,
cereal,
githash,
opt-env-conf,
optparse-applicative,
path,
text,

-- opt-env-conf,
test-suite asmh-test
import:
common-options
Expand Down

0 comments on commit 1498277

Please sign in to comment.