Build information library for monopam tools.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocaml-xdg: fork dune's internal xdg, merge with previous nox-xdge

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.

+5 -13
+1 -1
lib/index/dune
··· 1 1 (library 2 2 (name monopam_info_index) 3 3 (public_name monopam-info.index) 4 - (libraries eio fpath nox-sexp nox-dune)) 4 + (libraries eio fpath nox-dune))
+4 -12
lib/index/monopam_info_index.ml
··· 46 46 else None) 47 47 entries 48 48 49 - (* Stream stanzas through Library.codec while harvesting library names — 50 - needed for the lib_to_pkg reverse index. Returning the names lets us 51 - register both indexes in one pass. *) 49 + (* Harvest library names for the lib_to_pkg reverse index. Uses the 50 + high-level [Dune.Package.libraries] decoder which already skips the 51 + [(lang ...)] header and any non-library stanzas. *) 52 52 let library_names_in_dune_package content = 53 - match Sexp.Value.parse_string_many content with 54 - | Error _ -> [] 55 - | Ok stanzas -> 56 - List.filter_map 57 - (fun s -> 58 - match Sexp.Codec.decode_value Dune.Package.Library.codec s with 59 - | Ok (lib : Dune.Package.Library.t) -> Some lib.name 60 - | Error _ -> None) 61 - stanzas 53 + Dune.Package.libraries content |> List.map Dune.Package.name 62 54 63 55 let pkg_index t pkg = 64 56 match Hashtbl.find_opt t.pkg_libs pkg with