New package [nox-xdg], replacing the prior split between dune's
internal [xdg] library (META description: "[Internal] XDG base
directories specification implementation") and the standalone
[nox-xdge] Eio wrapper.
The fork was driven by two needs:
- dune's [xdg] is marked [Internal] in its META; dune doesn't promise
to keep it stable across releases. Building credential-handling
CLIs ([gdocs], [gsheets], [gslides], [gauth.Local_store]) on top of
a build-tool internal is a stability risk.
- The split layout had [nox-xdge] (Eio wrapper) depending on dune's
[xdg] (pure spec) by their shared library name [xdg], blocking any
attempt to give the wrapper a cleaner name.
Merging into one package solves both. The package provides two
libraries from one [ocaml-xdg/] source tree:
- [nox-xdg] (module [Xdg]) -- pure spec, no Eio dep.
lib/xdg.ml + xdg_stubs.c
- [nox-xdg.eio] (module [Xdg_eio]) -- Eio backend on top of the
resolver. lib/xdg_eio.ml
The pure spec is a Unix+Windows-faithful fork of dune's
[otherlibs/xdg/xdg.ml] and [xdg_stubs.c]. Original code by Jane
Street (MIT); LICENSE.md keeps both copyright lines. The C symbol
[dune_xdg__get_known_folder_path] is renamed to
[nox_xdg__get_known_folder_path] so a downstream binary that links
both this package and dune's internal xdg doesn't hit duplicate
symbols.
One small divergence from upstream: the [make] helper in xdg.ml
defers calling the C stub until the env-var override misses, instead
of computing it eagerly. Identical behaviour on Windows; lets the
test suite exercise the [~win32:true] code path from a non-Windows
host as long as every XDG_*_HOME is set. Documented inline.
Tests:
- [test/test_xdg.ml] (22 cases) -- spec-anchored: every default,
every env-var override, relative/empty/missing values per §4,
HOME interpretation, snapshot semantics at create-time, and the
full Windows extension.
- [test/eio/test_xdg_eio.ml] (5 cases) -- carried over from the old
xdge package, now driving the [Xdg_eio] module.
- [test/eio/cram/] -- the old xdge cram tests, against the renamed
module.
The previous [xdge/] subtree is removed; its [nox-xdge.opam] is
gone. Consumer migration (gauth, gdocs, gsheets, gslides, requests,
cookie, agent, atp, slack, linkedin, oci, uniboot, monopam) lands
in the next commit.
Also fixes an unrelated build break in [monopam-info/lib/index]: the
[Dune.Package.Library.codec] API was removed from [nox-dune] in
favour of the higher-level [Dune.Package.libraries] decoder; switch
to the new entry point and drop the now-unused [nox-sexp] dep.