mirror of
https://github.com/jaspervdj/patat.git
synced 2024-11-22 06:23:46 +03:00
Install goldplate through cabal file
Stack doesn't understand the new build-tool-depends so removed this for now
This commit is contained in:
parent
72cf0cbee0
commit
e082be16bf
19
.github/workflows/build-and-release.yml
vendored
19
.github/workflows/build-and-release.yml
vendored
@ -20,20 +20,17 @@ jobs:
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: ~/.stack
|
||||
key: "${{ runner.os }}-${{ matrix.ghc }}-v8-${{ hashFiles('patat.cabal', 'stack.yaml', 'stack.yaml.lock') }}"
|
||||
restore-keys: |
|
||||
${{ runner.os }}-${{ matrix.ghc }}-v8-
|
||||
|
||||
- uses: haskell-actions/setup@v2
|
||||
id: setup
|
||||
with:
|
||||
ghc-version: ${{ matrix.ghc }}
|
||||
enable-stack: true
|
||||
stack-version: 'latest'
|
||||
stack-no-global: true
|
||||
stack-setup-ghc: true
|
||||
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ steps.setup.outputs.cabal-store }}
|
||||
key: ${{ runner.os }}-${{ matrix.ghc }}-v9-${{ hashFiles('patat.cabal') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-${{ matrix.ghc }}-v9-
|
||||
|
||||
- run: make build
|
||||
id: build
|
||||
|
21
Makefile
21
Makefile
@ -19,15 +19,7 @@ ARCHIVE_CREATE=tar czf
|
||||
ARCHIVE_EXTRACT=tar xvzf
|
||||
endif
|
||||
|
||||
ifeq ($(UNAME), darwin)
|
||||
# We use `?=` to set SOURCE_DATE_EPOCH only if it is not present. Unfortunately
|
||||
# we can't use `git --date=unix` since only very recent git versions support
|
||||
# that, so we need to make a round trip through `date`.
|
||||
SOURCE_DATE_EPOCH?=$(shell git log -1 --format=%cd --date=unix)
|
||||
else
|
||||
SOURCE_DATE_EPOCH?=$(shell date '+%s' \
|
||||
--date="$(shell git log -1 --format=%cd --date=rfc)")
|
||||
endif
|
||||
|
||||
ifeq ($(UNAME), darwin)
|
||||
COMPRESS_BIN_DEPS=
|
||||
@ -37,8 +29,6 @@ COMPRESS_BIN_DEPS=$(UPX_BINARY)
|
||||
COMPRESS_BIN=upx
|
||||
endif
|
||||
|
||||
STACK=stack
|
||||
|
||||
# Default target.
|
||||
.PHONY: build
|
||||
build: $(PATAT_BINARY)
|
||||
@ -60,7 +50,7 @@ $(PATAT_PACKAGE).$(ARCHIVE): $(PATAT_BINARY) extra/patat.1 $(COMPRESS_BIN_DEPS)
|
||||
$(ARCHIVE_CREATE) $(PATAT_PACKAGE).$(ARCHIVE) $(PATAT_PACKAGE)
|
||||
|
||||
$(PATAT_BINARY):
|
||||
$(STACK) build --copy-bins
|
||||
cabal install --installdir="$(dir $(PATAT_BINARY))"
|
||||
|
||||
# UPX is used to compress the resulting binary. We currently don't use this on
|
||||
# Mac OS.
|
||||
@ -73,11 +63,11 @@ $(UPX_BINARY):
|
||||
|
||||
# Man page.
|
||||
extra/patat.1: README.md $(PATAT_BINARY)
|
||||
SOURCE_DATE_EPOCH="$(SOURCE_DATE_EPOCH)" patat-make-man >$@
|
||||
SOURCE_DATE_EPOCH="$(SOURCE_DATE_EPOCH)" cabal exec -- patat-make-man >$@
|
||||
|
||||
# Bash completion.
|
||||
extra/patat.bash-completion:
|
||||
patat --bash-completion-script patat >$@
|
||||
extra/patat.bash-completion: $(PATAT_BINARY)
|
||||
cabal exec -- patat --bash-completion-script patat >$@
|
||||
|
||||
.PHONY: completion
|
||||
completion: extra/patat.bash-completion
|
||||
@ -88,8 +78,7 @@ man: extra/patat.1
|
||||
# Also check if we can generate the manual.
|
||||
.PHONY: test
|
||||
test: man
|
||||
$(STACK) install goldplate
|
||||
goldplate --pretty-diff tests
|
||||
cabal test
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
|
26
README.md
26
README.md
@ -81,31 +81,11 @@ You can also find generic Linux and Mac OS binaries here:
|
||||
|
||||
### From source
|
||||
|
||||
Installation from source is very easy. You can build from source using `stack
|
||||
install` or `cabal install`. `patat` is also available from [Hackage].
|
||||
|
||||
[Hackage]: https://hackage.haskell.org/package/patat
|
||||
|
||||
For people unfamiliar with the Haskell ecosystem, this means you can do either
|
||||
of the following:
|
||||
|
||||
#### Using stack
|
||||
|
||||
1. Install [stack] for your platform.
|
||||
2. Clone this repository.
|
||||
3. Run `stack setup` (if you're running stack for the first time) and
|
||||
`stack install`.
|
||||
4. Make sure `$HOME/.local/bin` is in your `$PATH`.
|
||||
|
||||
[stack]: https://docs.haskellstack.org/en/stable/README/
|
||||
|
||||
#### Using cabal
|
||||
|
||||
1. Install [cabal] for your platform.
|
||||
2. Run `cabal install patat`.
|
||||
3. Make sure `$HOME/.cabal/bin` is in your `$PATH`.
|
||||
`patat` is also available from [Hackage]. You can install it using [cabal] by
|
||||
running `cabal install patat`.
|
||||
|
||||
[cabal]: https://www.haskell.org/cabal/
|
||||
[Hackage]: https://hackage.haskell.org/package/patat
|
||||
|
||||
Running
|
||||
-------
|
||||
|
4
cabal.project
Normal file
4
cabal.project
Normal file
@ -0,0 +1,4 @@
|
||||
packages: *.cabal
|
||||
package patat
|
||||
tests: True
|
||||
flags: +patat-make-man
|
12
patat.cabal
12
patat.cabal
@ -160,3 +160,15 @@ Test-suite patat-tests
|
||||
tasty-quickcheck >= 0.10 && < 0.11,
|
||||
text >= 1.2 && < 2.2,
|
||||
QuickCheck >= 2.8 && < 2.15
|
||||
|
||||
Test-suite patat-goldplate
|
||||
Main-is: Main.hs
|
||||
Ghc-options: -Wall
|
||||
Hs-source-dirs: tests/golden
|
||||
Type: exitcode-stdio-1.0
|
||||
Default-language: Haskell2010
|
||||
Build-tool-depends: patat:patat
|
||||
|
||||
Build-depends:
|
||||
base >= 4.8 && < 5,
|
||||
goldplate >= 0.2.2.1 && < 0.3
|
||||
|
15
stack.yaml
15
stack.yaml
@ -1,15 +0,0 @@
|
||||
resolver: 'lts-22.3'
|
||||
compiler: 'ghc-9.6.3'
|
||||
save-hackage-creds: false
|
||||
|
||||
packages:
|
||||
- '.'
|
||||
|
||||
flags:
|
||||
patat:
|
||||
patat-make-man: true
|
||||
|
||||
nix:
|
||||
packages:
|
||||
- 'pkg-config'
|
||||
- 'zlib'
|
@ -1,12 +0,0 @@
|
||||
# This file was autogenerated by Stack.
|
||||
# You should not edit this file by hand.
|
||||
# For more information, please see the documentation at:
|
||||
# https://docs.haskellstack.org/en/stable/lock_files
|
||||
|
||||
packages: []
|
||||
snapshots:
|
||||
- completed:
|
||||
sha256: 53a2800f7fe0c4628af0e7d5e985707dd3af9863ac3983a43c835dbaa8ed5f35
|
||||
size: 714094
|
||||
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/22/3.yaml
|
||||
original: lts-22.3
|
8
tests/golden/Main.hs
Normal file
8
tests/golden/Main.hs
Normal file
@ -0,0 +1,8 @@
|
||||
import Goldplate (Options (..), defaultOptions, mainWith)
|
||||
import System.Exit (exitWith)
|
||||
|
||||
main :: IO ()
|
||||
main = mainWith options >>= exitWith
|
||||
where
|
||||
options = defaultOptions
|
||||
{ oPrettyDiff = True, oPaths = ["tests/golden"] }
|
@ -1,7 +1,7 @@
|
||||
---
|
||||
patat:
|
||||
syntaxDefinitions:
|
||||
- 'golden/syntax-definitions/impurescript.xml'
|
||||
- 'syntax-definitions/impurescript.xml'
|
||||
...
|
||||
|
||||
Hello
|
||||
|
@ -1,12 +1,12 @@
|
||||
{
|
||||
"command": "patat",
|
||||
"input_files": "golden/inputs/*",
|
||||
"input_files": "inputs/*",
|
||||
"arguments": ["--dump", "--force", "${GOLDPLATE_INPUT_FILE}"],
|
||||
"environment": {
|
||||
"HOME": "/dev/null"
|
||||
},
|
||||
"asserts": [
|
||||
{"exit_code": 0},
|
||||
{"stdout": "golden/outputs/${GOLDPLATE_INPUT_BASENAME}.dump"}
|
||||
{"stdout": "outputs/${GOLDPLATE_INPUT_BASENAME}.dump"}
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user