mirror of
https://github.com/roc-lang/roc.git
synced 2025-12-23 08:48:03 +00:00
Consolidate some build.zig logic
This commit is contained in:
parent
82c6562352
commit
09c50c77ca
2 changed files with 8 additions and 16 deletions
20
build.zig
20
build.zig
|
|
@ -178,12 +178,6 @@ pub fn build(b: *std.Build) void {
|
|||
bin_filename,
|
||||
);
|
||||
}
|
||||
|
||||
// Also copy builtin_indices.bin
|
||||
_ = write_compiled_builtins.addCopyFile(
|
||||
.{ .cwd_relative = "zig-out/builtins/builtin_indices.bin" },
|
||||
"builtin_indices.bin",
|
||||
);
|
||||
} else {
|
||||
// Use existing .bin files from zig-out/builtins/
|
||||
for (roc_files) |roc_path| {
|
||||
|
|
@ -196,14 +190,14 @@ pub fn build(b: *std.Build) void {
|
|||
bin_filename,
|
||||
);
|
||||
}
|
||||
|
||||
// Also copy builtin_indices.bin
|
||||
_ = write_compiled_builtins.addCopyFile(
|
||||
.{ .cwd_relative = "zig-out/builtins/builtin_indices.bin" },
|
||||
"builtin_indices.bin",
|
||||
);
|
||||
}
|
||||
|
||||
// Also copy builtin_indices.bin
|
||||
_ = write_compiled_builtins.addCopyFile(
|
||||
.{ .cwd_relative = "zig-out/builtins/builtin_indices.bin" },
|
||||
"builtin_indices.bin",
|
||||
);
|
||||
|
||||
// Generate compiled_builtins.zig dynamically based on discovered .roc files
|
||||
const builtins_source_str = generateCompiledBuiltinsSource(b, roc_files) catch |err| {
|
||||
std.debug.print("Failed to generate compiled_builtins.zig: {}\n", .{err});
|
||||
|
|
@ -219,9 +213,7 @@ pub fn build(b: *std.Build) void {
|
|||
.root_source_file = compiled_builtins_source,
|
||||
});
|
||||
|
||||
// Add compiled_builtins to the repl module so it can load Bool and Result
|
||||
roc_modules.repl.addImport("compiled_builtins", compiled_builtins_module);
|
||||
// Add compiled_builtins to the compile module for type checking with builtin indices
|
||||
roc_modules.compile.addImport("compiled_builtins", compiled_builtins_module);
|
||||
|
||||
// Manual rebuild command: zig build rebuild-builtins
|
||||
|
|
|
|||
|
|
@ -2361,7 +2361,7 @@ fn rocTest(allocs: *Allocators, args: cli_args.TestArgs) !void {
|
|||
try env.initCIRFields(allocs.gpa, module_name);
|
||||
|
||||
// Create canonicalizer
|
||||
var canonicalizer = Can.init(&env, &parse_ast, null, .{}) catch |err| {
|
||||
var canonicalizer = Can.init(&env, &parse_ast, null) catch |err| {
|
||||
try stderr.print("Failed to initialize canonicalizer: {}", .{err});
|
||||
std.process.exit(1);
|
||||
};
|
||||
|
|
@ -2392,7 +2392,7 @@ fn rocTest(allocs: *Allocators, args: cli_args.TestArgs) !void {
|
|||
};
|
||||
|
||||
// Create test runner infrastructure for test evaluation
|
||||
var test_runner = TestRunner.init(allocs.gpa, &env) catch |err| {
|
||||
var test_runner = TestRunner.init(allocs.gpa, &env, module_common_idents.bool_stmt) catch |err| {
|
||||
try stderr.print("Failed to create test runner: {}\n", .{err});
|
||||
std.process.exit(1);
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue