Skip to content
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

Add compat module. #4

Merged
merged 3 commits into from Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
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
@@ -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
@@ -0,0 +1 @@
include Camomile.DefaultConfig
1 change: 1 addition & 0 deletions compat/camomileDefaultConfig__.ml
@@ -0,0 +1 @@
module InstallConfig = CamomileDefaultConfig__InstallConfig
1 change: 1 addition & 0 deletions compat/camomileDefaultConfig__InstallConfig.ml
@@ -0,0 +1 @@
let share_dir = Filename.dirname Camomile.DefaultConfig.datadir
15 changes: 15 additions & 0 deletions compat/camomileLibrary.ml
@@ -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
@@ -0,0 +1,2 @@
module Config = CamomileDefaultConfig
module Camomile = Camomile
1 change: 1 addition & 0 deletions compat/camomileLibraryDyn.ml
@@ -0,0 +1 @@
include CamomileLibraryDefault
9 changes: 9 additions & 0 deletions compat/dune
@@ -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
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
@@ -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
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
@@ -1,4 +1,5 @@
(install
(package camomile)
(section
(site
(camomile database)))
Expand Down
1 change: 1 addition & 0 deletions src/locales/dune.inc
@@ -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
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
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
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