You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by pe...@apache.org on 2026/10/08 08:28:08 UTC
(openoffice) branch bazel-migration updated (954df93df4 -> 902cdee6fa)
This is an automated email from the ASF dual-hosted git repository.
leginee pushed a change to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git
from 954df93df4 docs: the unopkg front-end chain, and the VC90 manifest every EXE needs
new 1e005ed755 build(odk): loader classes, unowinreg.dll, unoapploader.exe, uno_loader_classes.zip
new 902cdee6fa docs: odk's compiled half, and what the SDK tree still needs
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.agent/migration/frontier.md | 9 +++-
build/rules/java_pipeline.bzl | 8 ++-
main/cppuhelper/BUILD.bazel | 4 ++
main/odk/BUILD.bazel | 123 ++++++++++++++++++++++++++++++++++++++++++
main/odk/readme.md | 84 +++++++++++++++++++++++++++++
main/odk/util/unowinreg.def | 11 ++++
6 files changed, 236 insertions(+), 3 deletions(-)
create mode 100644 main/odk/BUILD.bazel
create mode 100644 main/odk/readme.md
create mode 100644 main/odk/util/unowinreg.def
(openoffice) 02/02: docs: odk's compiled half, and what the SDK tree still needs
Posted by pe...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit 902cdee6fadc22a01fafa703cfe25ae0f6b20436
Author: Peter <pe...@apache.org>
AuthorDate: Thu Oct 8 10:28:01 2026 +0200
docs: odk's compiled half, and what the SDK tree still needs
Co-Authored-By: Claude Opus 5.5 <no...@anthropic.com>
---
.agent/migration/frontier.md | 9 ++++-
main/odk/readme.md | 84 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 92 insertions(+), 1 deletion(-)
diff --git a/.agent/migration/frontier.md b/.agent/migration/frontier.md
index 4932d9b376..3f13f0d47c 100644
--- a/.agent/migration/frontier.md
+++ b/.agent/migration/frontier.md
@@ -953,7 +953,14 @@ solenv ⬜ (legacy build environment, mostly migrated away)
── Remaining: Docs/dev tooling ──────────────────────────────────────────
autodoc ⬜ (API documentation generator)
-odk ⬜ (OpenDocument/Developer Kit)
+odk 🟡 STARTED 2026-10-08 — source/ done on all three configs:
+ loader classes, unowinreg.dll, unoapploader.exe,
+ uno_loader_classes.zip; each verified by running it (32-bit
+ Temurin 8 for x86). Static CRT as upstream, so
+ _SNPRINTF_DLLIMPORT= (empty) avoids C2375 from sal's
+ snprintf.h. javac_classes now handles packaged classes.
+ NEXT: pack/copying (the SDK tree + odkcommon/odkexamples
+ zips); gendocu blocked on autodoc. See main/odk/readme.md.
helpauthoring ⬜ (help authoring tools)
helpcontent2 ✅ DONE 2026-10-03 — the F1 help, en-US: help/en/ with all 9 modules
(.db/.ht/.key HelpLinker, .jar pages, .cfg, .tree Contents, .idxl
diff --git a/main/odk/readme.md b/main/odk/readme.md
new file mode 100644
index 0000000000..f2fa64ccad
--- /dev/null
+++ b/main/odk/readme.md
@@ -0,0 +1,84 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+
+# Notes for odk (in progress)
+
+The Office Development Kit (SDK). Upstream builds it in three layers
+(`prj/build.lst`); this migration is taking them one at a time.
+
+| Layer | Upstream | State |
+|---|---|---|
+| What odk COMPILES | `source/` | **done 2026-10-08**, all three configs |
+| The SDK tree and its zips | `pack/copying`, `pack/unzip_udk`, `pack/check*`, `util` | not yet |
+| The generated API reference | `pack/gendocu` (autodoc + javadoc) | not yet; blocked on `autodoc` |
+
+## What is built
+
+| Target | Upstream | What it is |
+|---|---|---|
+| `:loader_classes` | `source/com/sun/star/lib/loader` | `com.sun.star.lib.loader.*` as loose classes, `--release 8`. An SDK client ships them in its own jar; they find an office and put its UNO jars on a class loader. |
+| `:unowinreg` | `source/unowinreg/win` | `unowinreg.dll`, the JNI half of `WinRegKey`. |
+| `:unoapploader` | `source/unoapploader/win` | `unoapploader.exe`. A client copies it beside its own exe; it finds the office, puts it on `PATH` and starts `_<its own name>.exe`. |
+| `:uno_loader_classes` | `pack/copying` `MYZIPTARGET` | `uno_loader_classes.zip`: `com/...` + `win/unowinreg.dll`, delivered by `prj/d.lst`. |
+
+## Landmines
+
+- **Both native targets link the static CRT**, as upstream (`DYNAMIC_CRT=`
+ empty for unoapploader, `STDSHL=` + `LIBCMT` for unowinreg): they run in
+ processes the office does not own (a client's java.exe, a client's launcher),
+ before any office or VC runtime has been found. So they need no manifest, and
+ `features = ["static_link_msvcrt"]` instead.
+- **`_SNPRINTF_DLLIMPORT=` (empty) on those targets.** `sal/config.h` includes
+ `systools/win32/snprintf.h`, which declares `snprintf` (renamed `_snprintf` by
+ the VC9 toolchain's `crt_defines`) as `__declspec(dllimport)` -- right for the
+ DLL CRT only. Against libcmt that is C2375. The empty macro is the header's
+ own switch; no source change.
+- **unowinreg exports the undecorated `Java_*` names** through
+ `util/unowinreg.def` (= `unowinreg.dxp`). On x86 the functions are
+ `__stdcall`, and link.exe binds each DEF name to its `_Java_...@N` symbol --
+ the jurt `jpipe.def` trick. Verified by actually loading it in a 32-bit JVM.
+- **`WinRegKey` loads the DLL out of the zip**: it reads the resource
+ `win/unowinreg.dll` from its own class loader and extracts it to a temp file.
+ So the zip's layout is the interface, not cosmetic.
+- `findsofficepath.c` is cppuhelper's (exported from //main/cppuhelper), compiled
+ a second time here -- upstream delivers its `.obj` alone for exactly this.
+- `javac_classes` now roots `-d` at the class-path root, so packaged classes
+ land at their declared `com/sun/.../X.class` paths (it used to take the first
+ output's directory, which only worked for a default-package class).
+
+## Verified (2026-10-08)
+
+On all three configs, with the matching JVM (32-bit Temurin 8 for x86, the
+build JDK 21 for x64):
+
+- `WinRegKey` reads `HKLM\...\Windows NT\CurrentVersion\ProductName` through the
+ DLL extracted from `uno_loader_classes.zip`.
+- `java -cp uno_loader_classes.zip;client com.sun.star.lib.loader.Loader
+ UnoClient` with `UNO_PATH` at the staged `program/`: the client loads
+ `com.sun.star.uno.UnoRuntime` from the office's `classes/ridl.jar`.
+- `unoapploader.exe` installed as `foo.exe` beside a `_foo.exe` starts it with the
+ staged `program/` first on `PATH`.
+
+## Next
+
+`pack/copying` is a file list more than a build: `bin/` (cppumaker, idlc,
+javamaker, regcompare, ucpp, uno-skeletonmaker, unoapploader; climaker and
+autodoc not yet migrated), `lib/` import libraries under their SDK names
+(`isal.lib`, `icppu.lib`, ...), `include/`, `idl/`, `classes/`, `settings/`,
+docs and examples, then `odkcommon.zip`/`odkexamples.zip`.
(openoffice) 01/02: build(odk): loader classes, unowinreg.dll, unoapploader.exe, uno_loader_classes.zip
Posted by pe...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
leginee pushed a commit to branch bazel-migration
in repository https://gitbox.apache.org/repos/asf/openoffice.git
commit 1e005ed755b89fb7267a548a30c086252a5d522b
Author: Peter <pe...@apache.org>
AuthorDate: Thu Oct 8 10:28:01 2026 +0200
build(odk): loader classes, unowinreg.dll, unoapploader.exe, uno_loader_classes.zip
What odk compiles (source/), mirroring prj/build.lst. Both native
targets link the static CRT as upstream does: they run inside a client's
java.exe or launcher before any office has been found. An empty
_SNPRINTF_DLLIMPORT keeps sal's snprintf.h from declaring the CRT's
_snprintf dllimport, which against libcmt is C2375. unowinreg exports
the undecorated Java_* names through a DEF made from unowinreg.dxp.
javac_classes now roots -d at the class-path root, so packaged classes
land at their declared com/sun/.../X.class paths; the existing
default-package use (jvmfwk's JREProperties.class) is unchanged.
cppuhelper exports findsofficepath.c for unoapploader.
Co-Authored-By: Claude Opus 5.5 <no...@anthropic.com>
---
build/rules/java_pipeline.bzl | 8 ++-
main/cppuhelper/BUILD.bazel | 4 ++
main/odk/BUILD.bazel | 123 ++++++++++++++++++++++++++++++++++++++++++
main/odk/util/unowinreg.def | 11 ++++
4 files changed, 144 insertions(+), 2 deletions(-)
diff --git a/build/rules/java_pipeline.bzl b/build/rules/java_pipeline.bzl
index 7db66cd14c..0f13a5dbc0 100644
--- a/build/rules/java_pipeline.bzl
+++ b/build/rules/java_pipeline.bzl
@@ -301,7 +301,11 @@ def _javac_classes_impl(ctx):
fail("javac_classes: could not locate javac(.exe) in the JDK runtime")
outs = [ctx.actions.declare_file(n) for n in ctx.attr.outs]
- out_dir = outs[0].dirname
+
+ # javac -d takes the CLASS-PATH ROOT and adds package directories below
+ # it, so the root is the output path minus the declared name, which for a
+ # packaged class carries those directories ("com/sun/.../X.class").
+ out_dir = outs[0].path[:-len(ctx.attr.outs[0]) - 1]
ctx.actions.run(
executable = javac.path,
@@ -327,7 +331,7 @@ javac_classes = rule(
),
"outs": attr.string_list(
mandatory = True,
- doc = "Every .class file javac will emit, e.g. [\"JREProperties.class\"].",
+ doc = "Every .class file javac will emit, relative to the class-path root, e.g. [\"JREProperties.class\"] or [\"com/sun/star/lib/loader/Loader.class\"].",
),
"release": attr.string(
default = "8",
diff --git a/main/cppuhelper/BUILD.bazel b/main/cppuhelper/BUILD.bazel
index 17c07c2871..9dbde7843b 100644
--- a/main/cppuhelper/BUILD.bazel
+++ b/main/cppuhelper/BUILD.bazel
@@ -9,6 +9,10 @@ load("//build:jre.bzl", "jre_home_env")
load("//build/rules:gtest_test.bzl", "gtest_test")
load("//main/postprocess:postprocess.bzl", "services_rdb")
+# findsofficepath.c is also compiled into //main/odk:unoapploader -- upstream
+# delivers its .obj on its own for exactly that (Package_findsofficepath.mk).
+exports_files(["source/findsofficepath.c"])
+
_COPTS = [
"/Zm500", "/Zc:forScope", "/GR", "/nologo", "/Gs",
"/EHsc",
diff --git a/main/odk/BUILD.bazel b/main/odk/BUILD.bazel
new file mode 100644
index 0000000000..ce8670860b
--- /dev/null
+++ b/main/odk/BUILD.bazel
@@ -0,0 +1,123 @@
+load("@rules_cc//cc:defs.bzl", "cc_binary")
+load("//build/rules:extension.bzl", "ext_files", "oxt_package")
+load("//build/rules:java_pipeline.bzl", "javac_classes")
+
+# odk — the Office Development Kit (SDK). Mirrors prj/build.lst.
+#
+# This file so far holds the three things odk COMPILES (source/); the SDK tree
+# itself (pack/copying: tools, import libs, headers, IDL, settings, examples,
+# docs) and the generated reference (pack/gendocu, needs autodoc) are not yet
+# migrated. See readme.md.
+
+_DEFINES = [
+ "WNT",
+ "WIN32",
+]
+
+# Both native targets link the STATIC CRT. sal/config.h pulls in
+# systools/win32/snprintf.h, which declares snprintf -- renamed _snprintf by
+# the VC9 toolchain's crt_defines -- as __declspec(dllimport), matching only
+# the DLL CRT; against libcmt's plain declaration that is C2375. An empty
+# _SNPRINTF_DLLIMPORT is the header's own switch for that.
+_STATIC_CRT_DEFINES = _DEFINES + ["_SNPRINTF_DLLIMPORT="]
+
+# ── com.sun.star.lib.loader — source/com/sun/star/lib/loader ─────────────────
+# The class loader an SDK client application ships inside its own jar: it finds
+# an office installation (registry via unowinreg.dll, or UNO_PATH) and puts its
+# UNO jars on a custom class loader. Loose classes, not a jar: the SDK copies
+# them into a client's jar under com/sun/star/lib/loader/.
+#
+# --release 8: these run inside the CLIENT's JRE, not the build JDK.
+javac_classes(
+ name = "loader_classes",
+ srcs = glob(["source/com/sun/star/lib/loader/*.java"]),
+ outs = ["com/sun/star/lib/loader/" + c + ".class" for c in [
+ "InstallationFinder",
+ "InstallationFinder$StreamGobbler",
+ "Loader",
+ "Loader$CustomURLClassLoader",
+ "Loader$Drain",
+ "WinRegKey",
+ "WinRegKeyException",
+ ]],
+ visibility = ["//visibility:public"],
+)
+
+# ── unowinreg.dll — source/unowinreg/win ─────────────────────────────────────
+# The JNI half of WinRegKey above. Loaded by the CLIENT's java.exe, never by
+# the office, so it links the static CRT (upstream: STDSHL= + LIBCMT) and needs
+# no manifest at all. Exports are the undecorated Java_* names; the .def is
+# unowinreg.dxp as a DEF (same trick as jurt's jpipe.def -- on x86 link.exe
+# binds each name to its __stdcall _Java_...@N symbol).
+cc_binary(
+ name = "unowinreg",
+ srcs = ["source/unowinreg/win/unowinreg.cxx"],
+ copts = [
+ "/EHsc",
+ "/Imain/odk/inc/pch",
+ ],
+ defines = _STATIC_CRT_DEFINES,
+ features = ["static_link_msvcrt"],
+ linkshared = True,
+ win_def_file = "util/unowinreg.def",
+ deps = ["@rules_java//toolchains:jni"],
+ linkopts = [
+ "advapi32.lib",
+ "/MANIFEST:NO",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+# ── unoapploader.exe — source/unoapploader/win ───────────────────────────────
+# Copied by an SDK client next to its own exe under the client's name; finds
+# the office (findsofficepath.c, shared with cppuhelper), puts it on PATH and
+# starts the client's real exe. Static CRT (upstream DYNAMIC_CRT= is empty),
+# so it runs before any office -- and any VC runtime -- has been found.
+cc_binary(
+ name = "unoapploader",
+ srcs = [
+ "source/unoapploader/win/unoapploader.c",
+ "//main/cppuhelper:source/findsofficepath.c",
+ ],
+ copts = ["/TC"],
+ defines = _STATIC_CRT_DEFINES,
+ features = ["static_link_msvcrt"],
+ deps = [
+ "//main/cppuhelper:cppuhelper_headers",
+ "//main/sal:sal_headers",
+ ],
+ linkopts = [
+ "advapi32.lib",
+ "/SUBSYSTEM:WINDOWS",
+ "/MANIFEST:NO",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+# ── uno_loader_classes.zip ────────────────────────────────────────────────────
+# Upstream pack/copying: zip -r of the SDK's classes/ dir, "com/* win/*" -- the
+# loader classes plus win/unowinreg.dll, the layout InstallationFinder expects
+# when it loads the DLL from beside the classes. Delivered to solver bin/ by
+# prj/d.lst. oxt_package is a plain zip-by-archive-path; nothing about it is
+# extension-specific.
+ext_files(
+ name = "_loader_zip_classes",
+ srcs = [":loader_classes"],
+ strip_prefix = "main/odk",
+)
+
+ext_files(
+ name = "_loader_zip_win",
+ srcs = [":unowinreg"],
+ dest = "win",
+)
+
+oxt_package(
+ name = "uno_loader_classes",
+ out = "uno_loader_classes.zip",
+ contents = [
+ ":_loader_zip_classes",
+ ":_loader_zip_win",
+ ],
+ visibility = ["//visibility:public"],
+)
diff --git a/main/odk/util/unowinreg.def b/main/odk/util/unowinreg.def
new file mode 100644
index 0000000000..e84d417a6a
--- /dev/null
+++ b/main/odk/util/unowinreg.def
@@ -0,0 +1,11 @@
+LIBRARY unowinreg
+EXPORTS
+ Java_com_sun_star_lib_loader_WinRegKey_winreg_1RegOpenClassesRoot
+ Java_com_sun_star_lib_loader_WinRegKey_winreg_1RegOpenCurrentConfig
+ Java_com_sun_star_lib_loader_WinRegKey_winreg_1RegOpenCurrentUser
+ Java_com_sun_star_lib_loader_WinRegKey_winreg_1RegOpenLocalMachine
+ Java_com_sun_star_lib_loader_WinRegKey_winreg_1RegOpenUsers
+ Java_com_sun_star_lib_loader_WinRegKey_winreg_1RegOpenKeyEx
+ Java_com_sun_star_lib_loader_WinRegKey_winreg_1RegCloseKey
+ Java_com_sun_star_lib_loader_WinRegKey_winreg_1RegQueryValueEx
+ Java_com_sun_star_lib_loader_WinRegKey_winreg_1RegQueryInfoKey