Skip to content

Commit

Permalink
Port 1.3 to dune (#273)
Browse files Browse the repository at this point in the history
* Port to dune

* Add CI for 1.3

* Update test

This test has been failing since at least tag 1.3.1, I think there just
wasn't any CI to check. So I'm just updating the expected result to
match.

Co-authored-by: Shon Feder <[email protected]>
  • Loading branch information
tmattio and shonfeder authored Jul 1, 2022
1 parent 861afb6 commit 244bd36
Show file tree
Hide file tree
Showing 20 changed files with 161 additions and 235 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Main workflow

on:
pull_request:
push:

jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
ocaml-compiler:
- 4.04.2
- 4.13.x

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Use OCaml ${{ matrix.ocaml-compiler }}
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
cache-prefix: 1.3.1-${{ matrix.container }}

- run: opam install . --deps-only --with-test

- run: opam exec -- dune build

- run: opam exec -- dune runtest
3 changes: 0 additions & 3 deletions .merlin

This file was deleted.

69 changes: 15 additions & 54 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,59 +1,20 @@
PKGNAME = $(shell oasis query name)
PKGVERSION = $(shell oasis query version)
PKG_TARBALL = $(PKGNAME)-$(PKGVERSION).tar.gz
##
# Omd
#
# @file

DISTFILES = README.md _oasis setup.ml Makefile \
$(wildcard $(addprefix src/, *.ml *.mli *.mllib *.mlpack *.ab))
.PHONY: test build fmt deps

PREFIX = $(shell opam config var prefix)
ifneq ($(PREFIX),)
PREFIX_FLAG = --prefix $(PREFIX)
endif
build: deps
dune build

.PHONY: all byte native doc install uninstall reinstall test
deps:
opam install . --deps-only --yes

all byte native setup.log: configure
ocaml setup.ml -build
test:
dune build @gen --auto-promote
dune runtest

configure: setup.data
setup.data: setup.ml
ocaml $< -configure --enable-tests $(PREFIX_FLAG)

setup.ml: _oasis
oasis setup -setup-update dynamic
touch $@

doc install uninstall reinstall test: setup.log
ocaml setup.ml -$@


# Make a tarball
.PHONY: dist tar
dist tar: $(DISTFILES)
mkdir $(PKGNAME)-$(PKGVERSION)
cp --parents -r $(DISTFILES) $(PKGNAME)-$(PKGVERSION)/
# setup.ml independent of oasis:
# and remove test_cow!
test "$(wc -l < _oasis)" == 59 ; echo $?
head -n 36 _oasis > $(PKGNAME)-$(PKGVERSION)/_oasis
sed -e "s/VERSION/$(PKGVERSION) of $$(date -u)/" src/omd_main.ml > $(PKGNAME)-$(PKGVERSION)/src/omd_main.ml
cd $(PKGNAME)-$(PKGVERSION) && oasis setup
tar -zcvf $(PKG_TARBALL) $(PKGNAME)-$(PKGVERSION)
$(RM) -rf $(PKGNAME)-$(PKGVERSION)

.PHONY: clean distclean dist-clean
clean:
ocaml setup.ml -clean
$(RM) $(PKG_TARBALL)

distclean dist-clean:: clean
ocaml setup.ml -distclean
$(RM) $(wildcard *.ba[0-9] *.bak *~ *.odocl)

opam:
test "$(wc -l < _oasis)" == 59 || (echo $?; exit $?)
cp _oasis _oasis_orig
head -n 36 _oasis_orig > _oasis
oasis2opam http://pw374.github.io/distrib/omd/$(PKGNAME)-$(PKGVERSION).tar.gz
mv _oasis_orig _oasis
printf 'tags: [\n "org:ocamllabs"\n "org:mirage"\n]\n' >> $(PKGNAME).$(PKGVERSION)/opam
fmt:
dune build @fmt --auto-promote
# end
61 changes: 0 additions & 61 deletions _oasis

This file was deleted.

4 changes: 0 additions & 4 deletions _tags

This file was deleted.

28 changes: 28 additions & 0 deletions dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
(lang dune 2.7)
(name omd)
(version 1.3.1)

(generate_opam_files)

(license ISC)
(authors "Philippe Wang <[email protected]>"
"Nicolás Ojeda Bär <[email protected]>")
(maintainers "Shon Feder <[email protected]>"
"Raphael Sousa Santos <@sonologico>")
(source (github ocaml/omd))

(package
(name omd)
(synopsis "A Markdown frontend in pure OCaml")
(description
"This Markdown library is implemented using only pure OCaml (including
I/O operations provided by the standard OCaml compiler distribution).
OMD is meant to be as faithful as possible to the original Markdown.
Additionally, OMD implements a few Github markdown features, an
extension mechanism, and some other features. Note that the opam
package installs both the OMD library and the command line tool `omd`.")
(tags (org:ocamllabs org:mirage))
(depends
(ocaml (>= 4.04))
base-bigarray
base-bytes))
5 changes: 0 additions & 5 deletions omd.install

This file was deleted.

44 changes: 44 additions & 0 deletions omd.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "1.3.1"
synopsis: "A Markdown frontend in pure OCaml"
description: """
This Markdown library is implemented using only pure OCaml (including
I/O operations provided by the standard OCaml compiler distribution).
OMD is meant to be as faithful as possible to the original Markdown.
Additionally, OMD implements a few Github markdown features, an
extension mechanism, and some other features. Note that the opam
package installs both the OMD library and the command line tool `omd`."""
maintainer: [
"Shon Feder <[email protected]>" "Raphael Sousa Santos <@sonologico>"
]
authors: [
"Philippe Wang <[email protected]>"
"Nicolás Ojeda Bär <[email protected]>"
]
license: "ISC"
tags: ["org:ocamllabs" "org:mirage"]
homepage: "https://github.com/ocaml/omd"
bug-reports: "https://github.com/ocaml/omd/issues"
depends: [
"dune" {>= "2.7"}
"ocaml" {>= "4.04"}
"base-bigarray"
"base-bytes"
"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/ocaml/omd.git"
8 changes: 0 additions & 8 deletions opam/descr

This file was deleted.

32 changes: 0 additions & 32 deletions opam/opam

This file was deleted.

52 changes: 0 additions & 52 deletions src/Makefile

This file was deleted.

16 changes: 16 additions & 0 deletions src/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
(library
(name omd)
(wrapped false)
(modules :standard \ omd_main)
(flags
(:standard -w -50-6-27-32-39-33-35))
(public_name omd)
(libraries
bigarray
bytes))

(executable
(name omd_main)
(public_name omd)
(modules omd_main)
(libraries omd))
2 changes: 1 addition & 1 deletion src/omd_html.ml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ let to_string html =
| (a, Some v) ->
if not (String.contains v '\'') then
pp " %s='%s'" a v
else not (String.contains v '"') then
else if not (String.contains v '"') then
pp " %s=\"%s\"" a v
else
(
Expand Down
Loading

0 comments on commit 244bd36

Please sign in to comment.