Skip to content

Commit

Permalink
Dunify
Browse files Browse the repository at this point in the history
  • Loading branch information
liyishuai committed Oct 8, 2024
1 parent b827ba8 commit 4217963
Show file tree
Hide file tree
Showing 20 changed files with 58 additions and 41 deletions.
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
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ From JSON to Coq, and vice versa.
- [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) 2.5 or later
- Coq namespace: `JSON`
- Related publication(s): none

Expand All @@ -43,8 +44,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.

5 changes: 2 additions & 3 deletions coq-json.opam
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ 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"
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)
2 changes: 1 addition & 1 deletion meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,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
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.

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

(rule
(alias runtest)
(deps
(package coq-json))
(action
(run coqc %{dep:TestDecode.v})))

(rule
(alias runtest)
(deps
(package coq-json))
(action
(run coqc %{dep:TestParse.v})))

(rule
(alias runtest)
(deps
(package coq-json))
(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})))

0 comments on commit 4217963

Please sign in to comment.