Skip to content

Commit

Permalink
generate opam file via dune (#39)
Browse files Browse the repository at this point in the history
* generate opam file via dune

also set bisect dependency in the same manner
as we do for pgx. This aligns the project setup
for pgx and mssql.

* fix circleci

* use proper version constraint
  • Loading branch information
Anurag Soni committed May 6, 2020
1 parent 7103ecd commit c5bf09b
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 21 deletions.
4 changes: 3 additions & 1 deletion .circleci/config.yml
Expand Up @@ -34,7 +34,9 @@ jobs:
command: opam config exec -- make pin
- run:
name: Install system dependencies
command: opam depext -y mssql
command: |
opam pin add -y mssql.dev -n .
opam depext -y mssql
- run:
name: Install OCaml dependencies
command: opam install --deps-only -y mssql
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -8,7 +8,7 @@ clean:
@dune clean

coverage: clean
@BISECT_ENABLE=YES dune runtest
@BISECT_ENABLE=yes dune runtest

pin:
opam pin add -yn mssql .
Expand Down
47 changes: 47 additions & 0 deletions dune-project
@@ -1,3 +1,50 @@
(lang dune 1.11)

(using fmt 1.1)

(name mssql)

(generate_opam_files true)

(license "Apache-2.0")

(maintainers "Arena Developers <silver-snakes@arena.io>")

(authors "Arena Developers <silver-snakes@arena.io>")

(source
(github arenadotio/ocaml-mssql))

(package
(name mssql)
(synopsis "Async SQL Server client using FreeTDS")
(description
"Mssql wraps FreeTDS in a nicer and safer interface, with support for parameterized queries, thread-based async IO, and a thread pool.")
(depends
(alcotest
(and
:with-test
(>= 1.0.1)))
(alcotest-async
(and
:with-test
(>= 1.0.1)))
async
bignum
ppx_jane
(iter
(>= 1.2))
(ocaml
(>= 4.06.1))
ounit
logs
(text
(>= 0.8.0))
(freetds
(>= 0.7))
(bisect_ppx
(and
:dev
(>= 2.0.0)))
(dune
(>= 1.11))))
44 changes: 26 additions & 18 deletions mssql.opam
@@ -1,21 +1,16 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
synopsis: "Async SQL Server client using FreeTDS"
description:
"Mssql wraps FreeTDS in a nicer and safer interface, with support for parameterized queries, thread-based async IO, and a thread pool."
maintainer: ["Arena Developers <silver-snakes@arena.io>"]
authors: ["Arena Developers <silver-snakes@arena.io>"]
maintainer: "silver-snakes@arena.io"
license: "Apache-2.0"
homepage: "https://github.com/arenadotio/ocaml-mssql"
dev-repo: "git+https://github.com/arenadotio/ocaml-mssql.git"
bug-reports: "https://github.com/arenadotio/ocaml-mssql/issues"
doc: "https://arenadotio.github.io/ocaml-mssql/doc"
synopsis: "Async SQL Server client using FreeTDS"
description: "Mssql wraps FreeTDS in a nicer and safer interface, with support for parameterized queries, thread-based async IO, and a thread pool."

build: [
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j" jobs] {with-test}
]

depends: [
"alcotest" {>= "1.0.1"}
"alcotest-async" {>= "1.0.1"}
"alcotest" {with-test & >= "1.0.1"}
"alcotest-async" {with-test & >= "1.0.1"}
"async"
"bignum"
"ppx_jane"
Expand All @@ -24,9 +19,22 @@ depends: [
"ounit"
"logs"
"text" {>= "0.8.0"}
"freetds" { >= "0.7" }

"bisect_ppx" {build & >= "2.0.0"}
"dune" { >= "1.11"}
"cppo"
"freetds" {>= "0.7"}
"bisect_ppx" {dev & >= "2.0.0"}
"dune" {>= "1.11"}
]
build: [
["dune" "subst"] {pinned}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/arenadotio/ocaml-mssql.git"
12 changes: 11 additions & 1 deletion src/dune
@@ -1,9 +1,19 @@
(* -*- tuareg -*- *)

let preprocess =
match Sys.getenv "BISECT_ENABLE" with
| "yes" -> "bisect_ppx"
| _ -> ""
| exception Not_found -> ""

let () = Jbuild_plugin.V1.send @@ {|
(library
(public_name mssql)
(libraries core async freetds iter bignum logs oUnit text)
(preprocess
(pps ppx_jane bisect_ppx --conditional)))
(pps ppx_jane |} ^ preprocess ^ {|)))

(ocamllex query_lexer)

(ocamlyacc query_parser)
|}

0 comments on commit c5bf09b

Please sign in to comment.