Skip to content

Modernize module namespace with (include_subdirs qualified)#702

Closed
balat wants to merge 23 commits into
masterfrom
modernize
Closed

Modernize module namespace with (include_subdirs qualified)#702
balat wants to merge 23 commits into
masterfrom
modernize

Conversation

@balat

@balat balat commented Apr 9, 2026

Copy link
Copy Markdown
Member

Summary

  • Replace (wrapped (module_name Os)) with (include_subdirs qualified) + (wrapped false)
  • Move source files into Os/ subdirectory
  • Rename internal library names: ocsigen_startocsigen_start_server / ocsigen_start_client
  • Use --server-objs-dir in ocsigen-dune-rules for direct .cmo paths
  • Migrate to wrapped ocsigenserver module names (Ocsigen.Config, Ocsigen.Extensions, etc.)
  • Add ocsigen-dune-rules as opam dependency
  • Remove vendored ocsigen-dune-rules

Module names (Os.Session, Os.User, etc.) are unchanged.

Part of the Ocsigen namespace modernization effort.

🤖 Generated with Claude Code

@balat
balat force-pushed the modernize branch 5 times, most recently from 263b04d to fd35544 Compare April 30, 2026 19:50
@balat
balat force-pushed the modernize branch 4 times, most recently from 03c3848 to 8ef4365 Compare May 29, 2026 17:06
balat added 21 commits June 22, 2026 14:39
js_of_ocaml must not be a runtime dependency of the server library,
only a compile-time include for type definitions. Otherwise, loading
the library via Dynlink (ocsigenserver in lib mode) fails with
"Unimplemented Javascript primitive caml_pure_js_expr".

Use -I include flags (via type_includes) instead of libraries, like
Eliom does.
Update all references from old Eliom_xxx names to new wrapped names:
- Eliom_service -> Eliom.Service
- Eliom_content -> Eliom.Content
- Eliom_registration -> Eliom.Registration
- Eliom_parameter -> Eliom.Parameter
- Eliom_client -> Eliom.Client
- Eliom_config -> Eliom.Config
- Eliom_reference -> Eliom.Reference
- Eliom_state -> Eliom.State
- Eliom_shared -> Eliom.Shared
- Eliom_bus -> Eliom.Bus
- Eliom_comet -> Eliom.Comet
- Eliom_notif -> Eliom.Notif
- Eliom_request_info -> Eliom.Request_info
- Eliom_tools -> Eliom.Tools
- Eliom_cscache -> Eliom.Cscache
- Eliom.run -> Eliom.App.run
Ot_form -> Ot.Form, Ot_popup -> Ot.Popup, Ot_icons -> Ot.Icons, etc.
Drop the [Os_] prefix from all source files and all internal
references (Os_session -> Session, Os_user -> User, etc.).  The
modules become accessible to users as [Os.Session], [Os.User], ...
via dune's wrapping.
Sync the bundled distillery template with the os_template repository
(via the rename script).
Place all module sources in [src/Os/] and use dune's standard
[(include_subdirs qualified)] + [(wrapped false)] to expose them
under the [Os.] namespace.  Split client side into a separate
[src/client/dune] with [(include dune.client)] + [(mode promote)].

The dune.client generation rule passes [--server-objs-dir] to
ocsigen-dune-rules so [-server-cmo] resolves unambiguously to the
server lib's [.cmo].
Use the installed version from opam instead.

Add ocsigen-dune-rules dependency
The migrate-to-Eliom.Xxx and ocsigenserver wrapping commits depend
on eliom 13. Use [>= "13.0~"] (not [>= "13.0.0"]) so opam also
accepts the pre-release [13.0~dev] version shipped by the eliom
modernize branch (in opam semver, [13.0~dev < 13.0.0]).

Cap at [< 14.0.0] so CI does not try to build against future
eliom majors that may break this.
Ocsigen_config -> Ocsigen.Config
Ocsigen_extensions -> Ocsigen.Extensions
Ocsigen_lib -> Ocsigen_base.Lib
Ocsigen_stream -> Ocsigen_base.Ocsigen_stream
Bundled CSS files for toolkit widgets (ot_buttons, ot_carousel,
ot_datetime, ot_drawer, ot_form, ot_icons, ot_page_transition,
ot_picture_uploader, ot_popup, ot_spinner, ot_sticky, ot_tongue),
default CSS, wasm_loader.js, and npm metadata (package.json,
package-lock.json).
Provides old Os_xxx module names as aliases to new Os.Xxx modules
to ease migration of existing code.
Apply the same change as in os_template upstream: PROJECT_NAME_icons.eliom's
[Make] functor now takes [Eliom.Content.Html.T] as parameter, replacing
the local ad-hoc ICON_HTML signature.
Use the standard dune install pattern:

    (install
     (package ocsigen-start)
     (section lib_root)
     (files
      (glob_files_rec
       (template.distillery/* with_prefix eliom/templates/os))))

so eliom-distillery picks up the os template at the conventional
[lib/eliom/templates/os/] location.  The template source directory
is named [template.distillery/], and the installed name is [os].

Update src/client/dune to invoke [ocsigen-dune-rules gen ...] using
the new sub-command syntax.
Module namespace migration to Os.Xxx, ocsigen-start-compat package,
PROJECT_NAME_icons on Eliom.Content.Html.T, template renamed to os
and installed at lib/eliom/templates/os/, migration to Eliom 13 +
wrapped ocsigenserver names. Major version bump (9.0.0~dev) for the
module renames.
build/gen_wikidoc.sh runs eliomdoc with the wikidoc plugin against the
modernize layout's wrapped Os.* modules in src/Os/, producing .wiki
files in _build/doc/dev/api/{server,client}/.

The script handles the strengthening of wrapped module names by
generating short-name [include Os__X] aliases in a temporary directory
before invoking eliomdoc, so that doc cross-references like [Session.X]
resolve correctly.

The output is meant to be committed on the wikidoc branch under
doc/dev/api/. The README is updated to point to the script.
The wikidoc plugin generates menu.wiki from the structure of the
ocamldoc -intro file. doc/server.indexdoc and doc/client.indexdoc
group the Os.* modules by topic (User management, Persistence,
Notifications, ...) so the website navigation reflects that grouping
instead of being a flat list.

The script also stops feeding .mli files to the client-side
generation: those files declare server-only modules and would
otherwise produce client docs for modules that don't exist on the
client side.
Replaces the previous print-only stub (left when the OCamlnet
implementation was removed for OCaml 5 compatibility) with one that
pipes an RFC-2822 message to the configured mailer ("sendmail" by
default) via Lwt_process.

When the mailer is not on PATH, the email is dumped to stderr through
Logs.warn instead of failing, so applications remain usable out of
the box without configuring an MTA.

Drops the now-unused Invalid_mailer exception.
@balat
balat force-pushed the modernize branch 2 times, most recently from 5e844c8 to fa0b9ff Compare June 25, 2026 14:58
@balat

balat commented Jun 25, 2026

Copy link
Copy Markdown
Member Author

Superseded by #703, which now targets master directly and contains both the module-namespace modernization and the Deriving_Json migration (the modernize branch is being retired in favour of deriving).

@balat balat closed this Jun 25, 2026
@balat
balat deleted the modernize branch June 25, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant