Skip to content

Commit

Permalink
add melange-json-native pkg
Browse files Browse the repository at this point in the history
  • Loading branch information
jchavarri committed Aug 27, 2024
1 parent c9e9b4e commit b671657
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 14 deletions.
18 changes: 13 additions & 5 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@

(package
(name melange-json)
(synopsis
"Compositional JSON encode/decode library and PPX for Melange, with native compatibility")
(synopsis "Compositional JSON encode/decode library and PPX for Melange")
(description
"Provides encoders and decoders to convert JSON values into typed values. With the possibility to create custom encoders and decoders and automate them with a PPX.")
"Provides tools for converting JSON to typed OCaml values in Melange. It includes custom encoders, decoders, and a PPX for automating these conversions.")
(depends
ocaml
(melange
Expand All @@ -37,8 +36,17 @@
(>= "3.10.0")
:with-test))
ppxlib
(yojson
(>= "1.6.0")) ; only used for the native version
(opam-check-npm-deps :with-test) ; todo: use with-dev-setup once opam 2.2 is out
(ocaml-lsp-server :with-test)
(ocamlformat :with-test)))

(package
(name melange-json-native)
(synopsis "Compositional JSON encode/decode PPX for OCaml")
(description
"A PPX for OCaml that automates encoding and decoding JSON into typed values. It supports custom encoders and decoders, and integrates with Yojson")
(depends
ocaml
ppxlib
(yojson
(>= "1.6.0"))))
35 changes: 35 additions & 0 deletions melange-json-native.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
synopsis: "Compositional JSON encode/decode PPX for OCaml"
description:
"A PPX for OCaml that automates encoding and decoding JSON into typed values. It supports custom encoders and decoders, and integrates with Yojson"
maintainer: [
"Antonio Nuno Monteiro <[email protected]>"
"Javier Chávarri <[email protected]>"
]
authors: ["glennsl" "Andrey Popp"]
license: ["LGPL-3.0-only" "MPL-2.0"]
homepage: "https://github.com/melange-community/melange-json/"
bug-reports: "https://github.com/melange-community/melange-json/issues"
depends: [
"dune" {>= "3.9"}
"ocaml"
"ppxlib"
"yojson" {>= "1.6.0"}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/melange-community/melange-json.git"
6 changes: 2 additions & 4 deletions melange-json.opam
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
synopsis:
"Compositional JSON encode/decode library and PPX for Melange, with native compatibility"
synopsis: "Compositional JSON encode/decode library and PPX for Melange"
description:
"Provides encoders and decoders to convert JSON values into typed values. With the possibility to create custom encoders and decoders and automate them with a PPX."
"Provides tools for converting JSON to typed OCaml values in Melange. It includes custom encoders, decoders, and a PPX for automating these conversions."
maintainer: [
"Antonio Nuno Monteiro <[email protected]>"
"Javier Chávarri <[email protected]>"
Expand All @@ -19,7 +18,6 @@ depends: [
"melange-jest" {with-test}
"reason" {>= "3.10.0" & with-test}
"ppxlib"
"yojson" {>= "1.6.0"}
"opam-check-npm-deps" {with-test}
"ocaml-lsp-server" {with-test}
"ocamlformat" {with-test}
Expand Down
8 changes: 4 additions & 4 deletions ppx/native/dune
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
(library
(public_name melange-json.ppx-native)
(public_name melange-json-native.ppx)
(name ppx_deriving_json_native)
(modules
:standard
\
ppx_deriving_json_runtime
ppx_deriving_json_native_test)
(libraries ppxlib)
(ppx_runtime_libraries melange-json.ppx-runtime-native)
(ppx_runtime_libraries melange-json-native.ppx-runtime)
(preprocess
(pps ppxlib.metaquot))
(kind ppx_deriver))

(library
(public_name melange-json.ppx-runtime-native)
(public_name melange-json-native.ppx-runtime)
(name ppx_deriving_json_native_runtime)
(wrapped false)
(modules ppx_deriving_json_runtime)
Expand All @@ -22,7 +22,7 @@
(executable
(name ppx_deriving_json_native_test)
(modules ppx_deriving_json_native_test)
(libraries melange-json.ppx-native ppxlib))
(libraries melange-json-native.ppx ppxlib))

(rule
(target ppx_deriving_json_native.mli)
Expand Down
2 changes: 1 addition & 1 deletion ppx/test/ppx_deriving_json_native.e2e.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
> (name main)
> (libraries yojson)
> (flags :standard -w -37-69 -open Ppx_deriving_json_runtime.Primitives)
> (preprocess (pps melange-json.ppx-native)))' > dune
> (preprocess (pps melange-json-native.ppx)))' > dune

$ echo '
> open Example
Expand Down

0 comments on commit b671657

Please sign in to comment.