Skip to content

Commit

Permalink
Refactorize the code with new OCaml tools
Browse files Browse the repository at this point in the history
  • Loading branch information
dannywillems committed Apr 22, 2021
1 parent 31b3779 commit f13e5b9
Show file tree
Hide file tree
Showing 13 changed files with 330 additions and 273 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Main workflow

on:
- pull_request
- push

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use OCaml 4.11.0
uses: avsm/setup-ocaml@v1
with:
ocaml-version: 4.11.0
- name: "Install ocamlformat.0.15.0"
run: opam install ocamlformat.0.15.0
- name: "Check lint"
run: opam exec -- ocamlformat --check src/*.ml*

build:
strategy:
fail-fast: false
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
ocaml-version:
- 4.11.1
- 4.10.2
- 4.09.1
- 4.08.1

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

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

- name: Use OCaml ${{ matrix.ocaml-version }}
uses: avsm/setup-ocaml@v1
with:
ocaml-version: ${{ matrix.ocaml-version }}

- run: opam pin add cordova-plugin-inappbrowser.dev . --no-action

- run: opam depext cordova-plugin-inappbrowser --yes --with-doc --with-test

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

- run: opam exec -- dune build

- run: opam exec -- dune runtest
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
*.cma
*.cmo
*.cmi
*.ml
_build
_opam
1 change: 0 additions & 1 deletion .merlin

This file was deleted.

3 changes: 0 additions & 3 deletions META

This file was deleted.

30 changes: 0 additions & 30 deletions Makefile

This file was deleted.

5 changes: 0 additions & 5 deletions Makefile.conf

This file was deleted.

21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,22 @@ Binding to
[Example
application](https://github.com/dannywillems/ocaml-cordova-plugin-inappbrowser-example).

## What does cordova-plugin-inappbrowser do ?
## Setup a dev environment

```shell
# create a local switch
opam install ocamlformat.0.15.0 merlin
opam install -y .
```
This plugin provides a web browser view that displays when calling

## What does cordova-plugin-inappbrowser do ?

> This plugin provides a web browser view that displays when calling
`cordova.InAppBrowser.open()`.
```

Source: [cordova-plugin-inappbrowser](https://github.com/apache/cordova-plugin-inappbrowser)

## How to install and compile your project by using this plugin ?

Don't forget to switch to a compiler **>= 4.03.0**.
```Shell
opam switch 4.03.0
```
## How to install and compile your project by using this plugin?

You can use opam by pinning the repository with
```Shell
Expand All @@ -32,7 +33,7 @@ opam pin add cordova-plugin-inappbrowser https://github.com/dannywillems/ocaml-c

and to compile your project, use
```Shell
ocamlfind ocamlc -c -o [output_file] -package gen_js_api -package cordova-plugin-inappbrowser [...] -linkpkg [other arguments]
dune build @install
```

Don't forget to install the cordova plugin inappbrowser with
Expand Down
20 changes: 6 additions & 14 deletions opam/opam → cordova-plugin-inappbrowser.opam
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
opam-version: "1.2"
name: "ocaml-cordova-plugin-inappbrowser"
opam-version: "2.0"
maintainer: "Danny Willems <[email protected]>"
author: "Danny Willems <[email protected]>"

authors: "Danny Willems <[email protected]>"
homepage: "https://github.com/dannywillems/ocaml-cordova-plugin-inappbrowser"
bug-reports: "https://github.com/dannywillems/ocaml-cordova-plugin-inappbrowser/issues"

dev-repo: "https://github.com/dannywillems/ocaml-cordova-plugin-inappbrowser"

license: "LGPL-3.0 with OCaml linking exception"

version: "1.0"

build: [make "build"]
install: [make "install"]
remove: [make "remove"]

description: "Binding to the inappbrowser cordova plugin using gen_js_api"
synopsis: "Binding to the inappbrowser cordova plugin using gen_js_api"
build: [[ "dune" "build" "-j" jobs "-p" name "@install" ]]
depends: [
"ocaml" { >= "4.03.0" }
"gen_js_api"
]
available: [ ocaml-version >= "4.03.0" ]
206 changes: 0 additions & 206 deletions cordova_in_app_browser.mli

This file was deleted.

2 changes: 2 additions & 0 deletions dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(lang dune 2.8)
(name cordova-plugin-inappbrowser)
Loading

0 comments on commit f13e5b9

Please sign in to comment.