refactor(ffi-linkage): Phase 9.2d — rename foreign_path → runtime_path (coupled .sx↔.zig↔hook)

The JNI/runtime-class path (Decision 5, Runtime* family). Coordinated across the
hook boundary so the BuildOptions accessor + its registered hook string stay in sync:
- src/: RuntimeClassDecl.foreign_path→runtime_path, splitForeignPath→splitRuntimePath,
  foreignPathToJavaName→runtimePathToJavaName, jni_main_foreign_paths→
  jni_main_runtime_paths, hookJniMainForeignPathAt→hookJniMainRuntimePathAt, and the
  hook string 'BuildOptions.jni_main_foreign_path_at'→'…runtime_path_at'.
- library/: build.sx accessor jni_main_foreign_path_at→jni_main_runtime_path_at +
  bundle.sx call sites + the  local var → runtime_path + a comment.
- specs.md: the accessor name + <foreign_path_with_dots> doc refs.
- Regenerated 37 .ir snapshots: every program importing build declares the renamed
  @BuildOptions.jni_main_runtime_path_at hook stub — symbol-name change only (verified
  the .ir diff is ONLY this rename; reverted orthogonal empty-file normalization).
Suite green (646 corpus / 444 unit, 0 failed).
This commit is contained in:
agra
2026-06-15 09:20:30 +03:00
parent a15a868391
commit 8cca3b9dde
53 changed files with 130 additions and 130 deletions

View File

@@ -4,7 +4,7 @@
// Given a `RuntimeClassDecl` whose `is_main` flag is set, emit a `.java`
// source file that:
//
// - declares a `public class` at the foreign_path's package + simple
// - declares a `public class` at the runtime_path's package + simple
// name (e.g. `co/swipelab/Test/SxTestActivity` →
// `package co.swipelab.Test; public class SxTestActivity`);
// - extends the parent specified by `#extends Alias` (or
@@ -91,7 +91,7 @@ pub fn emitJavaSource(
var buf: std.ArrayList(u8) = .empty;
errdefer buf.deinit(allocator);
const parts = splitForeignPath(fcd.foreign_path);
const parts = splitRuntimePath(fcd.runtime_path);
if (parts.pkg.len > 0) {
try buf.appendSlice(allocator, "package ");
try appendDotted(allocator, &buf, parts.pkg);
@@ -104,7 +104,7 @@ pub fn emitJavaSource(
.extends => |alias| {
if (opts.classes) |reg| {
if (reg.get(alias)) |path| {
parent = try foreignPathToJavaName(allocator, path);
parent = try runtimePathToJavaName(allocator, path);
parent_owned = true;
break;
}
@@ -189,13 +189,13 @@ pub fn emitJavaSource(
const PathParts = struct { pkg: []const u8, cls: []const u8 };
fn splitForeignPath(foreign_path: []const u8) PathParts {
const last_slash = std.mem.lastIndexOfScalar(u8, foreign_path, '/') orelse {
return .{ .pkg = "", .cls = foreign_path };
fn splitRuntimePath(runtime_path: []const u8) PathParts {
const last_slash = std.mem.lastIndexOfScalar(u8, runtime_path, '/') orelse {
return .{ .pkg = "", .cls = runtime_path };
};
return .{
.pkg = foreign_path[0..last_slash],
.cls = foreign_path[last_slash + 1 ..],
.pkg = runtime_path[0..last_slash],
.cls = runtime_path[last_slash + 1 ..],
};
}
@@ -212,7 +212,7 @@ fn appendDotted(
}
}
fn foreignPathToJavaName(allocator: Allocator, slash_path: []const u8) EmitError![]u8 {
fn runtimePathToJavaName(allocator: Allocator, slash_path: []const u8) EmitError![]u8 {
var buf: std.ArrayList(u8) = .empty;
try appendDotted(allocator, &buf, slash_path);
return buf.toOwnedSlice(allocator);