Skip to content

Commit

Permalink
Add compat module. (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
toots committed Apr 14, 2023
1 parent fc466d1 commit 9ce6174
Show file tree
Hide file tree
Showing 17 changed files with 61 additions and 3 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,21 @@ Please note that `dune install` installs the file under the same local directory
This option is meant to be used when packaging the library for distributions using binary packages such
as debian or ubuntu packages, RPM package etc.

## Migration form 1.x.x

The library's API was update and cleaned up in its version `2.0.0` as part of the migration to support OCaml `5.0.0`. As a
consequence, modules depending on the old library are now incompatible with the new library.
If you were previously using the `CamomileLibraryDefault` module, all you should have to do is
use the new top-level `Camomile` module.
If you were previously using the configuration functor to define your own library, you should be able to
use the new `Camomile.Make` functor available at top-level as well.
Otherwise, you can check the `compat/` directory of this repository. It contains a simple compatibility
library that you should be able to re-use in your code. We do, however, recommend simply updating your
code to the new API. It really shouldn't be too hard!

## Using libraries

### Configuration
Expand Down
2 changes: 1 addition & 1 deletion camomile.opam
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
version: "2.0.0"
version: "2.0.1"
synopsis: "A Unicode library"
description: """
Camomile is a Unicode library for OCaml. Camomile provides Unicode character
Expand Down
1 change: 1 addition & 0 deletions compat/camomileDefaultConfig.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include Camomile.DefaultConfig
1 change: 1 addition & 0 deletions compat/camomileDefaultConfig__.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module InstallConfig = CamomileDefaultConfig__InstallConfig
1 change: 1 addition & 0 deletions compat/camomileDefaultConfig__InstallConfig.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
let share_dir = Filename.dirname Camomile.DefaultConfig.datadir
15 changes: 15 additions & 0 deletions compat/camomileLibrary.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[@@@ocaml.deprecated
"this module is deprecated, please update to the most recent camomile API"]

include Camomile
module CharEncoding = CamomileLib.CharEncoding
module UCharInfo = CamomileLib.UCharInfo
module UNF = CamomileLib.UNF
module UCol = CamomileLib.UCol
module CaseMap = CamomileLib.CaseMap
module UReStr = CamomileLib.UReStr
module StringPrep = CamomileLib.StringPrep

module ConfigInt = struct
module type Type = CamomileLib.Config.Type
end
2 changes: 2 additions & 0 deletions compat/camomileLibraryDefault.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module Config = CamomileDefaultConfig
module Camomile = Camomile
1 change: 1 addition & 0 deletions compat/camomileLibraryDyn.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include CamomileLibraryDefault
9 changes: 9 additions & 0 deletions compat/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
(env
(dev
(flags
(:standard -w -3))))

(library
(name camomileCompat)
(libraries camomile camomile.lib)
(wrapped false))
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
(using dune_site 0.1)

(name camomile)
(version 2.0.0)
(version 2.0.1)

(generate_opam_files true)
(license "LGPL-2.0-or-later WITH OCaml-LGPL-linking-exception")
Expand Down
1 change: 1 addition & 0 deletions src/charmaps/dune.inc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

(install
(package camomile)
(section (site (camomile charmaps)))
(files
ANSI_X3%2E110-1983.mar
Expand Down
1 change: 1 addition & 0 deletions src/charmaps/dune_gen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ let () =
let pr fmt = Printf.bprintf buf (fmt ^^ "\n") in
pr "";
pr "(install";
pr " (package camomile)";
pr " (section (site (camomile charmaps)))";
pr " (files";
List.iter to_install ~f:(fun fn -> pr " %s" fn);
Expand Down
1 change: 1 addition & 0 deletions src/database/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
(install
(package camomile)
(section
(site
(camomile database)))
Expand Down
1 change: 1 addition & 0 deletions src/locales/dune.inc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@


(install
(package camomile)
(section (site (camomile locales)))
(files
af.mar
Expand Down
1 change: 1 addition & 0 deletions src/locales/dune_gen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ let () =
{|

(install
(package camomile)
(section (site (camomile locales)))
(files
%s
Expand Down
1 change: 1 addition & 0 deletions src/mappings/dune
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
(libraries str toolslib camomileLib))

(install
(package camomile)
(section
(site
(camomile mappings)))
Expand Down
9 changes: 8 additions & 1 deletion test/tester/dune
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@
uCS4_test
uReStr_test
uTF16_test)
(libraries stdlib-random.v4 unix str camomile camomile.lib blender tester_lib))
(libraries
stdlib-random.v4
unix
str
camomile
camomile.lib
blender
tester_lib))

(rule
(alias runtest)
Expand Down

0 comments on commit 9ce6174

Please sign in to comment.