From 21f05862d6b800e72914d37a7cefa3269442baca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Pottier?= Date: Sat, 7 Sep 2024 16:25:47 +0200 Subject: [PATCH] Fix `cppo -version` and improve `make release` This commit fixes issue #92 and proposes an improved command `make release VERSION=X.Y.Z` which creates and publishes a new release. --- Changes.md | 3 ++ Makefile | 66 ++++++++++++++++++++++++++++++++++---------- cppo.opam | 1 + cppo_ocamlbuild.opam | 1 + dune-project | 1 + 5 files changed, 57 insertions(+), 15 deletions(-) diff --git a/Changes.md b/Changes.md index bc5c0cd..f19742a 100644 --- a/Changes.md +++ b/Changes.md @@ -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`. diff --git a/Makefile b/Makefile index 3742dcc..c89fe7a 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/cppo.opam b/cppo.opam index 5c011d5..0992645 100644 --- a/cppo.opam +++ b/cppo.opam @@ -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. diff --git a/cppo_ocamlbuild.opam b/cppo_ocamlbuild.opam index 3f79f36..94a6126 100644 --- a/cppo_ocamlbuild.opam +++ b/cppo_ocamlbuild.opam @@ -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. diff --git a/dune-project b/dune-project index 84f633a..3424728 100644 --- a/dune-project +++ b/dune-project @@ -1,5 +1,6 @@ (lang dune 2.0) (name cppo) +(version 1.7.0) (generate_opam_files true)