Skip to content

Commit

Permalink
Fix cppo -version and improve make release
Browse files Browse the repository at this point in the history
This commit fixes issue #92 and proposes an improved command `make release VERSION=X.Y.Z` which creates and publishes a new release.
  • Loading branch information
fpottier authored Sep 7, 2024
1 parent e5f75ac commit 21f0586
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 15 deletions.
3 changes: 3 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## v1.7.1 (2024-??-??)
- [bug] Fix `cppo -version`, which used to print a blank line (#92).

## v1.7.0 (2024-08-22)
- [+ui] Multi-line macros, without line terminators `\`,
can now be defined using `#def` and `#enddef`.
Expand Down
66 changes: 51 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,31 +1,67 @@
.PHONY: all clean test check install uninstall release

all:
@dune build

clean:
@git clean -fX

test:
@dune runtest

check: test

install:
@dune install

uninstall:
@dune uninstall

check: test

.PHONY: clean all check test install uninstall

clean:
dune clean

# To make a release:
# + check that [make] and [make test] succeed
# + check that everything has been committed
# + check that [make test] succeeds
# + check that everything has been committed and pushed
# + check that the CI has succeeded
# + check that [opam lint] is happy
# + make sure that the package is not pinned: [opam pin remove cppo]
# + create a tag, e.g. [git tag vX.Y.Z]
# (the tag should not be annotated, as it shows up in [cppo -version])
# + run [make publishX.Y.Z]
# + run [make release VERSION=X.Y.Z]

publish%:
opam publish --tag=v$* -v $* ocaml-community/cppo
release:
# Check if this is the master branch.
@ if [ "$$(git symbolic-ref --short HEAD)" != "master" ] ; then \
echo "Error: this is not the master branch." ; \
git branch ; \
exit 1 ; \
fi
# Check if everything has been committed.
@ if [ -n "$$(git status --porcelain)" ] ; then \
echo "Error: there remain uncommitted changes." ; \
git status ; \
exit 1 ; \
fi
# Make sure the current version can be compiled.
@ make clean
@ make test
# Check the current package description.
@ opam lint
# Make sure $(VERSION) is nonempty.
@ if [ -z "$(VERSION)" ] ; then \
echo "Error: please use: make release VERSION=X.Y.Z" ; \
exit 1 ; \
fi
# Make sure a CHANGES entry with the current version seems to exist.
@ if ! grep "## v$(VERSION)" Changes.md >/dev/null ; then \
echo "Error: Changes.md has no entry for version $(VERSION)." ; \
exit 1 ; \
fi
# Make sure the current version is mentioned in dune-project.
@ if ! grep "(version $(VERSION))" dune-project >/dev/null ; then \
echo "Error: dune-project does not mention version $(VERSION)." ; \
grep "(version" dune-project ; \
exit 1 ; \
fi
# Create a git tag.
@ git tag -v$(VERSION)
# Upload. (This automatically makes a .tar.gz archive available on github.)
@ git push
@ git push --tags
# Publish an opam description.
@ opam publish --tag=v$(VERSION) -v $(VERSION) ocaml-community/cppo
1 change: 1 addition & 0 deletions cppo.opam
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "1.7.0"
synopsis: "Code preprocessor like cpp for OCaml"
description: """
Cppo is an equivalent of the C preprocessor for OCaml programs.
Expand Down
1 change: 1 addition & 0 deletions cppo_ocamlbuild.opam
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "1.7.0"
synopsis: "Plugin to use cppo with ocamlbuild"
description: """
This ocamlbuild plugin lets you use cppo in ocamlbuild projects.
Expand Down
1 change: 1 addition & 0 deletions dune-project
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(lang dune 2.0)
(name cppo)
(version 1.7.0)

(generate_opam_files true)

Expand Down

0 comments on commit 21f0586

Please sign in to comment.