Skip to content

Ocaml 5.3 support for ocamlformat-mlx #5

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
129 changes: 65 additions & 64 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,81 +36,82 @@ jobs:
- name: Opam dependencies
run: opam install --deps-only -t .

- name: Format
run: opam exec -- dune fmt
# - name: Format
# run: opam exec -- dune fmt

- name: Build
run: |
opam exec -- dune subst
opam exec -- dune build -p ocamlformat-lib,ocamlformat
opam exec -- dune build -p ocamlformat-mlx-lib,ocamlformat-mlx

- name: Runtest
run: opam exec -- dune runtest

- name: Check manpages
run: opam exec -- dune build @gen_manpage --auto-promote
# - name: Check manpages
# run: opam exec -- dune build @gen_manpage --auto-promote

- name: Upload binary
# Using a specific version because of https://github.com/actions/upload-artifact/issues/590
uses: actions/[email protected]
with:
name: ocamlformat-${{ runner.os }}-${{ runner.arch }}
path: _build/install/default/bin/ocamlformat

test-branch:
if: ${{ github.ref != 'refs/heads/main' }}
needs: build-linux
runs-on: ubuntu-latest
strategy:
matrix:
profile:
- conventional
- ocamlformat
- janestreet
# To enable comparing with ocp-indent:
# include:
# - ocp_indent: true
# ocp_indent_config: JaneStreet
# profile: janestreet

steps:
- name: Install ocp-indent
if: ${{ matrix.ocp_indent }}
run: |
sudo apt install -y ocp-indent
sudo touch /etc/ocamlfind.conf

# Clone the project
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/cache@v3
with:
path: test-extra/code
key: test-extra-code

- name: Fetch main build of ocamlformat
uses: dawidd6/action-download-artifact@v6
with:
workflow: build-linux.yml
workflow_conclusion: ""
check_artifacts: true
branch: main
name: ocamlformat-${{ runner.os }}-${{ runner.arch }}
path: ocamlformat-a

- name: Fetch new build of ocamlformat
uses: actions/[email protected]
with:
name: ocamlformat-${{ runner.os }}-${{ runner.arch }}
path: ocamlformat-b

- name: Test ${{ matrix.profile }} profile
run: |
chmod +x ocamlformat-a/ocamlformat ocamlformat-b/ocamlformat
./tools/test_branch.sh $TEST_BRANCH_ARGS -n -a ocamlformat-a/ocamlformat -b ocamlformat-b/ocamlformat 'profile=${{ matrix.profile }}'
shell: bash
env:
OCP_INDENT_CONFIG: ${{ matrix.ocp_indent_config }}
TEST_BRANCH_ARGS: ${{ matrix.ocp_indent && '-o -s' || '' }}
path: _build/install/default/bin/ocamlformat-mlx

# test-branch:
# if: ${{ github.ref != 'refs/heads/main' }}
# needs: build-linux
# runs-on: ubuntu-latest
# strategy:
# matrix:
# profile:
# - conventional
# - ocamlformat
# - janestreet
# # To enable comparing with ocp-indent:
# # include:
# # - ocp_indent: true
# # ocp_indent_config: JaneStreet
# # profile: janestreet
#
# steps:
# - name: Install ocp-indent
# if: ${{ matrix.ocp_indent }}
# run: |
# sudo apt install -y ocp-indent
# sudo touch /etc/ocamlfind.conf
#
# # Clone the project
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0
#
# - uses: actions/cache@v3
# with:
# path: test-extra/code
# key: test-extra-code
#
# - name: Fetch main build of ocamlformat
# uses: dawidd6/action-download-artifact@v6
# with:
# workflow: build-linux.yml
# workflow_conclusion: ""
# check_artifacts: true
# branch: main
# name: ocamlformat-${{ runner.os }}-${{ runner.arch }}
# path: ocamlformat-a
# allow_forks: true
#
# - name: Fetch new build of ocamlformat
# uses: actions/[email protected]
# with:
# name: ocamlformat-${{ runner.os }}-${{ runner.arch }}
# path: ocamlformat-b
#
# - name: Test ${{ matrix.profile }} profile
# run: |
# chmod +x ocamlformat-a/ocamlformat ocamlformat-b/ocamlformat
#./tools/test_branch.sh $TEST_BRANCH_ARGS -n -a ocamlformat-a/ocamlformat -b ocamlformat-b/ocamlformat 'profile=${{ matrix.profile }}'
# shell: bash
# env:
# OCP_INDENT_CONFIG: ${{ matrix.ocp_indent_config }}
# TEST_BRANCH_ARGS: ${{ matrix.ocp_indent && '-o -s' || '' }}
14 changes: 7 additions & 7 deletions .github/workflows/build-mingw64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@ jobs:

- name: Install dependencies
run: |
opam pin add -yn ocamlformat-lib.dev .
opam pin add -yn ocamlformat.dev .
opam install -y --deps-only ocamlformat
opam pin add -yn ocamlformat-mlx-lib.dev .
opam pin add -yn ocamlformat-mlx.dev .
opam install -y --deps-only ocamlformat-mlx

- name: Build
run: |
opam exec -- dune subst
opam exec -- dune build -p ocamlformat-lib,ocamlformat @install
opam exec -- dune install --prefix=install ocamlformat
Copy-Item ${{ github.workspace }}\\install\\bin\\ocamlformat.exe -Destination .\${{ env.artifact_name }}
opam exec -- dune build -p ocamlformat-mlx-lib,ocamlformat-mlx @install
opam exec -- dune install --prefix=install ocamlformat-mlx
Copy-Item ${{ github.workspace }}\\install\\bin\\ocamlformat-mlx.exe -Destination .\${{ env.artifact_name }}

- name: Version check
run: |
echo "Version check:"
install/bin/ocamlformat.exe --version
install/bin/ocamlformat-mlx.exe --version

- name: Upload Artifact
uses: actions/upload-artifact@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-others.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ jobs:
- name: Opam dependencies
run: opam install --deps-only -t .

- name: Format
run: opam exec -- dune fmt
# - name: Format
# run: opam exec -- dune fmt

- name: Runtest
run: opam exec -- dune runtest
5 changes: 4 additions & 1 deletion .github/workflows/changelog-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
jobs:
Changelog-Entry-Check:
name: Check Changelog Action
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: tarides/changelog-check-action@v1
# We don't push changelog entries
# steps:
# - uses: tarides/changelog-check-action@v1
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ default: exe

.PHONY: exe
exe:
@dune build bin/ocamlformat/main.exe bin/ocamlformat-rpc/main.exe
@dune build bin/ocamlformat/main.exe

.PHONY: clean
clean:
Expand Down
1 change: 1 addition & 0 deletions bin/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(data_only_dirs ocamlformat-rpc)
14 changes: 7 additions & 7 deletions bin/ocamlformat/dune
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@

(executable
(name main)
(public_name ocamlformat)
(package ocamlformat)
(public_name ocamlformat-mlx)
(package ocamlformat-mlx)
(modules main)
(flags
(:standard -open Ocamlformat_stdlib))
(instrumentation
(backend bisect_ppx))
(libraries ocamlformat-lib bin_conf))
(libraries ocamlformat-mlx-lib bin_conf))

(rule
(with-stdout-to
ocamlformat.1
(run ./main.exe --help=groff)))

(install
(section man)
(files ocamlformat.1)
(package ocamlformat))
; (install
; (section man)
; (files ocamlformat.1)
; (package ocamlformat))
2 changes: 1 addition & 1 deletion dune
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
(flags
(:standard -noassert))))

(data_only_dirs test-extra)
(data_only_dirs test-extra mlx lib-rpc lib-rpc-server emacs doc bench tools)

(rule
(with-stdout-to
Expand Down
96 changes: 45 additions & 51 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(name ocamlformat)
(name ocamlformat-mlx)

(using menhir 2.1)

Expand All @@ -20,25 +20,23 @@
(generate_opam_files true)

(authors
"Andrey Popp <[email protected]>"
"Josh Berdine <[email protected]>"
"Hugo Heuzard <[email protected]>"
"Etienne Millon <[email protected]>"
"Guillaume Petiot <[email protected]>"
"Jules Aguillon <[email protected]>")

(maintainers
"Guillaume Petiot <[email protected]>"
"Jules Aguillon <[email protected]>"
"Emile Trotignon <[email protected]>")
(maintainers "Andrey Popp <[email protected]>")

(source
(github ocaml-ppx/ocamlformat))
(github ocaml-mlx/ocamlformat-mlx))

(package
(name ocamlformat-lib)
(synopsis "OCaml Code Formatter")
(name ocamlformat-mlx-lib)
(synopsis "OCaml .mlx Code Formatter")
(description
"OCamlFormat is a tool to automatically format OCaml code in a uniform style.")
"OCamlFormat is a tool to automatically format OCaml .mlx code in a uniform style.")
(depends
(ocaml
(>= 4.08))
Expand All @@ -64,10 +62,6 @@
(>= 20201216))
(ocaml-version
(>= 3.5.0))
(ocamlformat-rpc-lib
(and
:with-test
(= :version)))
(ocp-indent
(or
(and
Expand All @@ -88,12 +82,12 @@
camlp-streams))

(package
(name ocamlformat)
(synopsis "Auto-formatter for OCaml code")
(name ocamlformat-mlx)
(synopsis "Auto-formatter for OCaml .mlx code")
(description
"**ocamlformat** is a code formatter for OCaml. It comes with opinionated default settings but is also fully customizable to suit your coding style.\n\n- **Profiles:** ocamlformat offers profiles we predefined formatting configurations. Profiles include `default`, `ocamlformat`, `janestreet`.\n- **Configurable:** Users can change the formatting profile and configure every option in their `.ocamlformat` configuration file.\n- **Format Comments:** ocamlformat can format comments, docstrings, and even code blocks in your comments.\n- **RPC:** ocamlformat provides an RPC server that can be used by other tools to easily format OCaml Code.")
(depends
(ocaml
(ocaml
(>= 4.08))
(cmdliner
(or
Expand All @@ -106,43 +100,43 @@
(csexp
(>= 1.4.0))
dune
(ocamlformat-lib
(ocamlformat-mlx-lib
(= :version))
(ocamlformat-rpc-lib
(and
:with-test
(= :version)))
; (ocamlformat-rpc-lib
; (and
; :with-test
; (= :version)))
(re
(>= 1.10.3))))

(package
(name ocamlformat-bench)
(synopsis "Auto-formatter for OCaml code")
(description
"OCamlFormat is a tool to automatically format OCaml code in a uniform style.")
(depends
(ocaml
(>= 4.08))
(alcotest
(and
:with-test
(>= 1.3.0)))
(bechamel
(>= 0.2.0))
(ocamlformat-lib
(= :version))
stdio
(yojson
(>= 1.6.0))))
; (package
; (name ocamlformat-bench)
; (synopsis "Auto-formatter for OCaml code")
; (description
; "OCamlFormat is a tool to automatically format OCaml code in a uniform style.")
; (depends
; (ocaml
; (>= 4.08))
; (alcotest
; (and
; :with-test
; (>= 1.3.0)))
; (bechamel
; (>= 0.2.0))
; (ocamlformat-lib
; (= :version))
; stdio
; (yojson
; (>= 1.6.0))))

(package
(name ocamlformat-rpc-lib)
(synopsis "Auto-formatter for OCaml code (RPC mode)")
(description
"OCamlFormat is a tool to automatically format OCaml code in a uniform style. This package defines a RPC interface to OCamlFormat")
(license MIT)
(depends
(ocaml
(>= 4.08))
(csexp
(>= 1.4.0))))
; (package
; (name ocamlformat-rpc-lib)
; (synopsis "Auto-formatter for OCaml code (RPC mode)")
; (description
; "OCamlFormat is a tool to automatically format OCaml code in a uniform style. This package defines a RPC interface to OCamlFormat")
; (license MIT)
; (depends
; (ocaml
; (>= 4.08))
; (csexp
; (>= 1.4.0))))
Loading
Loading