Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/.java-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
24
21
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's only "LTS" builds for Windows ARM, and we can't jump to 25 yet

2 changes: 2 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ jobs:
- macos-15
- ubuntu-24.04
- ubuntu-24.04-arm
- windows-2025
- windows-11-arm
Comment on lines +69 to +70
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub just continually crushing it on naming these things...

runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v5
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Unreleased

* New: Add JVM support for Windows (x64 and ARM).
* In-development snapshots are now published to the Central Portal Snapshots repository at https://central.sonatype.com/repository/maven-snapshots/.


Expand Down
18 changes: 8 additions & 10 deletions zipline/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ pub fn build(b: *std.Build) !void {
try setupTarget(b, &deleteLib.step, .linux, .x86_64, "amd64");
try setupTarget(b, &deleteLib.step, .macos, .aarch64, "aarch64");
try setupTarget(b, &deleteLib.step, .macos, .x86_64, "x86_64");
try setupTarget(b, &deleteLib.step, .windows, .aarch64, "aarch64");
try setupTarget(b, &deleteLib.step, .windows, .x86_64, "amd64");
}

fn setupTarget(b: *std.Build, step: *std.Build.Step, tag: std.Target.Os.Tag, arch: std.Target.Cpu.Arch, dir: []const u8) !void {
Expand All @@ -24,9 +26,9 @@ fn setupTarget(b: *std.Build, step: *std.Build.Step, tag: std.Target.Os.Tag, arc
.optimize = .ReleaseSmall,
});

var version_buf: [11]u8 = undefined;
var version_buf: [64]u8 = undefined;
const version = try readVersionFile(&version_buf);
var quoted_version_buf: [12]u8 = undefined;
var quoted_version_buf: [64]u8 = undefined;
const quoted_version = try std.fmt.bufPrint(&quoted_version_buf, "\"{s}\"", .{ version });
lib.root_module.addCMacro("CONFIG_VERSION", quoted_version);

Expand Down Expand Up @@ -81,15 +83,11 @@ fn setupTarget(b: *std.Build, step: *std.Build.Step, tag: std.Target.Os.Tag, arc
step.dependOn(&install.step);
}

fn readVersionFile(version_buf: []u8) ![]u8 {
const version_file = try std.fs.cwd().openFile(
fn readVersionFile(version_buf: []u8) ![]const u8 {
const version = try std.fs.cwd().readFile(
"native/quickjs/VERSION",
.{ },
version_buf,
);
defer version_file.close();

var version_file_reader = std.io.bufferedReader(version_file.reader());
var version_file_stream = version_file_reader.reader();
const version = try version_file_stream.readUntilDelimiterOrEof(version_buf, '\n');
return version.?;
return std.mem.trim(u8, version, "\r\n");
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package app.cash.zipline
import app.cash.zipline.internal.bridge.ThrowableSerializer
import assertk.assertThat
import assertk.assertions.isEqualTo
import java.util.Locale.US
import kotlin.coroutines.cancellation.CancellationException
import kotlin.test.assertEquals
import kotlinx.serialization.json.Json
Expand All @@ -31,6 +32,17 @@ class ThrowableSerializerTest {
contextual(Throwable::class, ThrowableSerializer)
}
}
private val newline: String
private val newlineEscape: String
init {
if ("windows" in System.getProperty("os.name").lowercase(US)) {
newline = "\r\n"
newlineEscape = "\\r\\n"
} else {
newline = "\n"
newlineEscape = "\\n"
}
}

@Test fun happyPath() {
val exception = Exception("boom")
Expand All @@ -41,7 +53,7 @@ class ThrowableSerializerTest {
val exceptionJson = """
|{
| "types": [],
| "stacktraceString": "java.lang.Exception: boom\n\tat ThrowableSerializerTest.goBoom(test.kt:5)"
| "stacktraceString": "java.lang.Exception: boom$newlineEscape\tat ThrowableSerializerTest.goBoom(test.kt:5)"
|}
""".trimMargin()

Expand All @@ -53,10 +65,7 @@ class ThrowableSerializerTest {
val decoded = json.decodeFromString(ThrowableSerializer, exceptionJson)
assertEquals(ZiplineException::class, decoded::class)
assertEquals(
"""
|java.lang.Exception: boom
|${'\t'}at ThrowableSerializerTest.goBoom(test.kt:5)
""".trimMargin(),
"java.lang.Exception: boom$newline\tat ThrowableSerializerTest.goBoom(test.kt:5)",
decoded.message,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ internal actual fun loadNativeLibrary() {
"/jni/$osArch/libquickjs.so"
} else if (osName.contains("mac")) {
"/jni/$osArch/libquickjs.dylib"
} else if (osName.contains("windows")) {
"/jni/$osArch/quickjs.dll"
} else {
throw IllegalStateException("Unsupported OS: $osName")
}
Expand Down