Skip to content

Commit

Permalink
Run guessing_game in build.zig
Browse files Browse the repository at this point in the history
  • Loading branch information
desttinghim committed Jan 17, 2023
1 parent b983c3f commit 042d3ce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 9 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ pub fn build(b: *std.build.Builder) void {
exe.setTarget(target);
exe.setBuildMode(mode);
exe.install();

const run_cmd = exe.run();
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}

const run_step = b.step("guessing_game", "Run guessing game example");
run_step.dependOn(&run_cmd.step);
}

// Tests (it requires a JDK installed)
Expand Down
5 changes: 1 addition & 4 deletions examples/guessing-game/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ pub fn main() !void {
const JNI_1_10 = jui.JNIVersion{ .major = 10, .minor = 0 };
const args = jui.JavaVMInitArgs{
.version = JNI_1_10,
.options = &.{
.{ .option = "-Djava.class.path=./test/src" },
},
.options = &.{},
.ignore_unrecognized = true,
};
var result = jui.JavaVM.createJavaVM(&args) catch |err| {
Expand All @@ -102,7 +100,6 @@ pub fn main() !void {
std.debug.assert(jvm == created_jvm.?);

try jniMain(env);
// jui.wrapErrors(jniMain, .{env});
}

pub fn jniMain(env: *jui.JNIEnv) !void {
Expand Down

0 comments on commit 042d3ce

Please sign in to comment.