Skip to content

Commit

Permalink
Dunify
Browse files Browse the repository at this point in the history
  • Loading branch information
liyishuai committed Oct 9, 2024
1 parent b827ba8 commit b5a494f
Show file tree
Hide file tree
Showing 22 changed files with 56 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- 'coqorg/coq:dev'
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: coq-community/docker-coq-action@v1
with:
opam_file: 'coq-json.opam'
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ nra.cache
Parser.v
Makefile.coq*
*~
_build/
27 changes: 10 additions & 17 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
COQMAKEFILE ?= Makefile.coq
MENHIR ?= menhir
MENHIRFLAGS ?= --coq
TEMPLATES ?= ../templates
TARGETS = .github/workflows/docker-action.yml coq-json.opam dune-project README.md

ifneq ($(MAKECMDGOALS),clean)
-include $(COQMAKEFILE)
endif
all:
dune build

$(COQMAKEFILE): _CoqProject
$(COQBIN)coq_makefile -f $^ -o $@
test: all
dune test

.PHONY: clean test
clean::
@ rm -f `cat .gitignore`

Parser.v: Parser.vy
$(MENHIR) $(MENHIRFLAGS) $<

test:
$(MAKE) -C test
meta:
$(TEMPLATES)/generate.sh $(TARGETS)

publish%:
opam publish --packages-directory=released/packages \
--repo=coq/opam --tag=v$* -v $* liyishuai/coq-json

.PHONY: all test meta publish
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ From JSON to Coq, and vice versa.
- Compatible Coq versions: 8.14 or later
- Additional dependencies:
- [Parsec](https://github.com/liyishuai/coq-parsec)
- [ExtLib](https://coq-community.org/coq-ext-lib)
- [Menhir](http://gallium.inria.fr/~fpottier/menhir/)
- [MenhirLib](https://gitlab.inria.fr/fpottier/menhir/-/tree/master/coq-menhirlib/)
- [Dune](https://dune.build) 3.6 or later
- Coq namespace: `JSON`
- Related publication(s): none

Expand All @@ -43,8 +43,8 @@ To instead build and install manually, do:
``` shell
git clone https://github.com/liyishuai/coq-json.git
cd coq-json
make # or make -j <number-of-cores-on-your-machine>
make install
dune build
dune install
```


Expand Down
13 changes: 0 additions & 13 deletions _CoqProject

This file was deleted.

8 changes: 3 additions & 5 deletions coq-json.opam
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ synopsis: "JSON in Coq"
description: """
From JSON to Coq, and vice versa."""

build: [make "-j%{jobs}%"]
run-test: [make "-j%{jobs}%" "test"]
install: [make "install"]
build: ["dune" "build" "-p" name "-j" jobs]
depends: [
"dune" {>= "3.6"}
"coq" { >= "8.14~" }
"coq-parsec" { >= "0.1.1" }
"coq-ext-lib"
"coq-parsec" { >= "0.2.0" }
"menhir" { >= "20220210" }
"coq-menhirlib" { >= "20220210" }
]
Expand Down
3 changes: 3 additions & 0 deletions dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(lang dune 3.6)
(using coq 0.6)
(name coq-json)
7 changes: 2 additions & 5 deletions meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ dependencies:
- description: '[Parsec](https://github.com/liyishuai/coq-parsec)'
opam:
name: coq-parsec
version: '{ >= "0.1.1" }'
- description: '[ExtLib](https://coq-community.org/coq-ext-lib)'
opam:
name: coq-ext-lib
version: '{ >= "0.2.0" }'
- description: '[Menhir](http://gallium.inria.fr/~fpottier/menhir/)'
opam:
name: menhir
Expand Down Expand Up @@ -49,7 +46,7 @@ tested_coq_opam_versions:
- version: '8.19'
- version: '8.20'
- version: 'dev'
test_target: test
dune: true
action_appendix: |2-
export: 'OPAMWITHTEST'
env:
Expand Down
1 change: 0 additions & 1 deletion test/Makefile

This file was deleted.

3 changes: 2 additions & 1 deletion test/TestPrint.v
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ Example j1 : json :=
("fields", JSON__Object [("ETag", JSON__String "tag-foo"); ("Content-Length", JSON__String "11")]);
("body", JSON__String "content-bar")].

Compute to_string j1.
Goal to_string j1 = "{""version"":{""major"":1,""minor"":1},""code"":200,""reason"":""OK"",""fields"":{""ETag"":""tag-foo"",""Content-Length"":""11""},""body"":""content-bar""}".
Proof. reflexivity. Qed.
4 changes: 0 additions & 4 deletions test/_CoqProject

This file was deleted.

20 changes: 20 additions & 0 deletions test/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
(alias
(name runtest)
(deps
(package coq-json)
(alias_rec all)))

(rule
(alias runtest)
(action
(run coqc %{dep:TestDecode.v})))

(rule
(alias runtest)
(action
(run coqc %{dep:TestParse.v})))

(rule
(alias runtest)
(action
(run coqc %{dep:TestPrint.v})))
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions theories/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
(coq.theory
(name JSON)
(package coq-json)
(synopsis "JSON in Coq")
(flags -w -deprecated-syntactic-definition))

(rule
(target Parser.v)
(deps Parser.vy)
(action
(run menhir --coq %{deps})))

This comment has been minimized.

Copy link
@proux01

proux01 Oct 10, 2024

Contributor

@liyishuai Could you please add option --coq-no-version-check here, otherwise this won't work in Coq CI. See https://github.com/coq/coq/blob/master/dev/ci/ci-json.sh

0 comments on commit b5a494f

Please sign in to comment.