Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port 1.3 to dune #273

Merged
merged 10 commits into from
Jul 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <philippe.wang@gmail.com>"
"Nicolás Ojeda Bär <n.oje.bar@gmail.com>")
(maintainers "Shon Feder <shon.feder@gmail.com>"
"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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't mean to commit this! Sorry :(

Seems to indicate some inconsistency in our dune builds tho? I'm not sure what accounts for that.

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 <shon.feder@gmail.com>" "Raphael Sousa Santos <@sonologico>"
]
authors: [
"Philippe Wang <philippe.wang@gmail.com>"
"Nicolás Ojeda Bär <n.oje.bar@gmail.com>"
]
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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is curious. I'm not sure how this would have been compiling before!

pp " %s=\"%s\"" a v
else
(
Expand Down
Loading