Skip to content

refactor(api)!: drop the inert globals - #832

Merged
andiwand merged 1 commit into
mainfrom
refactor/drop-inert-globals
Sep 6, 2026
Merged

refactor(api)!: drop the inert globals#832
andiwand merged 1 commit into
mainfrom
refactor/drop-inert-globals

Conversation

@andiwand

@andiwand andiwand commented Sep 6, 2026

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

PR 2 of the v7 API plan.

docs/design/README.md has carried this as an open task for a while, with the
reason it was still open written into it: "Removing them is the breaking change
this deliberately is not."
A major is when it becomes one.

What was inert, and since when

GlobalParams stored two strings and read neither back:

  • odr_core_data_path — where the renderer's css and js used to be read from.
    They are compiled into the library now.
  • libmagic_database_path — the magic.mgc every consumer had to ship and
    point us at. Detection is our own, and it reads inside zip and cfb
    containers, which libmagic could not.

Both accessors were kept so a caller that configured them kept compiling. Same
for ODR_WITH_LIBMAGIC and ODR_BUNDLE_ASSETS, which by then did nothing but
print a message(DEPRECATION).

What goes

C++ odr/global_params.hpp, global_params.cpp
JNI GlobalParams.java, four Java_..._GlobalParams_* entry points
Python pyodr.GlobalParams
ObjC ODRGlobalParams incl. bootstrapFromFrameworkBundle
Android OdrAndroid and its no-op init(context)
Build ODR_WITH_LIBMAGIC, ODR_BUNDLE_ASSETS, conan with_libmagic, bundle_assets

Net −327/+23.

HtmlConfig::embed_shipped_resources, resource_path,
relative_resource_paths and HtmlResource::is_shipped are not touched —
those decide where the compiled-in css and js land, which is a live question.
What died is the idea of finding a data directory.

Notes

  • Deleting OdrAndroid empties android/src/main/java; the module's sources
    come from ../jni/java via sourceSets, so nothing else changes.
  • OdrAndroidTest loses its initIsANoOp case and is renamed AarContractTest
    — it now only checks what it was always really about, that the AAR works with
    no setup.

Verified

Library, CLI, JNI + java jar, python module and odr_test all build; the 68
python tests pass. Apple and wasm are deletions only, with no remaining
reference to ODRGlobalParams anywhere in the tree.

Migration

Delete the calls. Nothing replaces them — that is the point.

GlobalParams stored two paths nothing read. The renderer's css and js became
part of the library and detection became our own, and both accessors were kept
only so a caller that pointed us somewhere kept working. v7 is where that ends.

Gone with it: the java, python and objc mirrors, OdrAndroid and its no-op init,
ODRGlobalParams.bootstrapFromFrameworkBundle, and the ODR_WITH_LIBMAGIC /
ODR_BUNDLE_ASSETS cmake options with the conan options that set them - the
latter two did nothing but print a deprecation.

The android instrumented test loses its init case and is renamed for what it
still checks: that the AAR works with no setup at all.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016hxDa2rev11eLUEJZJ5nmz
@andiwand
andiwand force-pushed the refactor/drop-inert-globals branch from c99976b to 6fe2167 Compare September 6, 2026 12:52
@andiwand
andiwand merged commit 6d6cfcc into main Sep 6, 2026
25 checks passed
@andiwand
andiwand deleted the refactor/drop-inert-globals branch September 6, 2026 12:55
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