-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from anmonteiro/anmonteiro/dune-and-prepare-fo…
…r-new-release Upgrade from JBuilder to Dune and document building and testing instructions
- Loading branch information
Showing
16 changed files
with
198 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
_build | ||
*.install | ||
pkg/META | ||
.merlin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
language: c | ||
sudo: required | ||
install: wget https://raw.githubusercontent.com/ocaml/ocaml-ci-scripts/master/.travis-opam.sh | ||
script: bash -ex .travis-opam.sh | ||
sudo: false | ||
services: | ||
- docker | ||
install: wget https://raw.githubusercontent.com/ocaml/ocaml-travisci-skeleton/master/.travis-docker.sh | ||
script: bash -ex ./.travis-docker.sh | ||
env: | ||
global: | ||
- TESTS=true | ||
- PINS="ppx_deriving_yojson:." | ||
matrix: | ||
- OCAML_VERSION=4.04 PACKAGE="ppx_deriving_yojson" | ||
- OCAML_VERSION=4.05 PACKAGE="ppx_deriving_yojson" | ||
- OCAML_VERSION=4.06 PACKAGE="ppx_deriving_yojson" | ||
os: | ||
- linux | ||
- PACKAGE="ppx_deriving_yojson" DISTRO="ubuntu-16.04" OCAML_VERSION="4.07" | ||
- PACKAGE="ppx_deriving_yojson" DISTRO="ubuntu-16.04" OCAML_VERSION="4.06" | ||
- PACKAGE="ppx_deriving_yojson" DISTRO="ubuntu-16.04" OCAML_VERSION="4.05" | ||
- PACKAGE="ppx_deriving_yojson" DISTRO="ubuntu-16.04" OCAML_VERSION="4.04" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Contributing to `ppx_deriving_yojson` | ||
|
||
## Setting up | ||
|
||
This document assumes you have [OPAM](https://opam.ocaml.org/) installed. | ||
|
||
### Installing | ||
|
||
To start building this project you will need to install the packages it depends | ||
on. To do so, run the following command: | ||
|
||
```shell | ||
$ opam install . --deps-only -t | ||
``` | ||
|
||
## Developing | ||
|
||
### Building & Testing | ||
|
||
This project uses [dune](http://dune.build/) as its build system. The | ||
[Makefile](./Makefile) in this repo provides shorter commands over the `dune` | ||
commands. | ||
|
||
#### Building | ||
|
||
To build the project, run `make` or `make build`. | ||
|
||
### Running Tests | ||
|
||
`make test` will build and run the tests in the current OPAM switch. | ||
|
||
### Cleaning up | ||
|
||
`make clean` can be used to clean up the build artifacts. | ||
|
||
## Cutting a release | ||
|
||
### Testing for a release | ||
|
||
Before cutting a release, it is useful to test this project against all the | ||
supported OCaml versions. `make all-supported-ocaml-versions` will do just that, | ||
but requires some setting up beforehand. The instructions are as follows: | ||
|
||
1. The [`dune-workspace.dev`](./dune-workspace.dev) defines all the OPAM | ||
switches that will be tested when running `make | ||
all-supported-ocaml-versions`. Make sure you have switches for all those | ||
OCaml version, with the appropriate names (e.g., for the build context that | ||
`(context (opam (switch 4.07.1)))` defines, make sure you have a switch named | ||
`4.07.1`. To find out which OPAM switches you have, run `opam switch list`). | ||
2. For every OPAM switch listed in the Dune workspace file, switch into it and | ||
run the installation command at the top of this document. | ||
3. Finally, you can now run `make all-supported-ocaml-versions`, which will | ||
build and test this project against all those OCaml versions. | ||
|
||
### Making a release | ||
|
||
- WIP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
(lang dune 1.2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
(lang dune 1.2) | ||
;; This file is used by `make all-supported-ocaml-versions` | ||
(context (opam (switch 4.04.2))) | ||
(context (opam (switch 4.05.0))) | ||
(context (opam (switch 4.06.1))) | ||
(context (opam (switch 4.07.1))) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,30 @@ | ||
opam-version: "1.2" | ||
version: "3.1" | ||
opam-version: "2.0" | ||
maintainer: "whitequark <whitequark@whitequark.org>" | ||
authors: [ "whitequark <whitequark@whitequark.org>" ] | ||
license: "MIT" | ||
homepage: "https://github.com/ocaml-ppx/ppx_deriving_yojson" | ||
doc: "http://ocaml-ppx.github.io/ppx_deriving_yojson" | ||
bug-reports: "https://github.com/ocaml-ppx/ppx_deriving_yojson/issues" | ||
dev-repo: "git://github.com/ocaml-ppx/ppx_deriving_yojson.git" | ||
tags: [ "syntax" "json" ] | ||
build: [ | ||
["jbuilder" "subst" "-n" name] {pinned} | ||
["jbuilder" "build" "-p" name "-j" jobs] | ||
["dune" "subst"] {pinned} | ||
["dune" "build" "-p" name "-j" jobs] | ||
["dune" "runtest" "-p" name] {with-test} | ||
] | ||
build-test: [["jbuilder" "runtest" "-p" name "-j" jobs]] | ||
depends: [ | ||
"ocaml" {>= "4.04.0"} | ||
"yojson" | ||
"result" | ||
"ppx_deriving" {>= "4.0" & < "5.0"} | ||
"ppx_tools" {build} | ||
"ppxfind" {build} | ||
"jbuilder" {build} | ||
"dune" {build} | ||
"cppo" {build} | ||
"ounit" {test} | ||
"ounit" {with-test} | ||
] | ||
synopsis: | ||
"JSON codec generator for OCaml" | ||
description: """ | ||
ppx_deriving_yojson is a ppx_deriving plugin that provides | ||
a JSON codec generator. | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
(rule | ||
(deps ppx_deriving_yojson.cppo.ml) | ||
(targets ppx_deriving_yojson.ml) | ||
(action (run %{bin:cppo} -V OCAML:%{ocaml_version} %{deps} -o %{targets}))) | ||
|
||
(library | ||
(name ppx_deriving_yojson_runtime) | ||
(public_name ppx_deriving_yojson.runtime) | ||
(synopsis "Runtime components of [@@deriving yojson]") | ||
(modules ppx_deriving_yojson_runtime) | ||
(libraries ppx_deriving.runtime result)) | ||
|
||
(library | ||
(name ppx_deriving_yojson) | ||
(public_name ppx_deriving_yojson) | ||
(synopsis "[@@deriving yojson]") | ||
(libraries ppx_deriving.api) | ||
(preprocess | ||
(action (run ppxfind -legacy ppx_tools.metaquot --as-pp %{input-file}))) | ||
(ppx_runtime_libraries ppx_deriving_yojson_runtime yojson) | ||
(modules ppx_deriving_yojson) | ||
(kind ppx_deriver) | ||
(flags (:standard -w -9))) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
(rule | ||
(deps test_ppx_yojson.cppo.ml) | ||
(targets test_ppx_yojson.ml) | ||
(action (run %{bin:cppo} -V OCAML:%{ocaml_version} %{deps} -o %{targets}))) | ||
|
||
(executable | ||
(name test_ppx_yojson) | ||
(libraries oUnit result) | ||
(preprocess (pps ppx_deriving.show ppx_deriving_yojson)) | ||
(flags (:standard -w -9-39-27-34-37))) | ||
|
||
(alias | ||
(name runtest) | ||
(deps test_ppx_yojson.exe) | ||
(action (run %{deps}))) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.