From db4275e31c2e08c95f186d4112edd0f37edaa8e7 Mon Sep 17 00:00:00 2001 From: 5hif7y <44300833+5hif7y@users.noreply.github.com> Date: Sun, 15 Nov 2026 20:31:45 -0300 Subject: [PATCH 1/2] Give the engines of the plugin build tests a compressor collection The build passes -collection:compressor (and compressor_open) to every plugin library, and odin refuses a collection whose folder is missing. The engines four cook/build tests write had no std/compressor, so their plugin libraries never compiled. Co-Authored-By: Claude Opus 5.5 --- cook/build/plugins_test.odin | 3 +++ cook/build/relink_test.odin | 1 + 2 files changed, 4 insertions(+) diff --git a/cook/build/plugins_test.odin b/cook/build/plugins_test.odin index 496350c8c..057daac19 100644 --- a/cook/build/plugins_test.odin +++ b/cook/build/plugins_test.odin @@ -130,6 +130,7 @@ a_plugin_library_is_linked_against_an_import_library_made_ahead :: proc(t:^testi split_plugin_write :: proc(t:^testing.T,folder:string) -> (engine,game:string) { files:=[][2]string{ {"engine/core/data.odin","package core\n"}, + {"engine/std/compressor/compressor.odin","package compressor\n"}, // the build names its collection {"engine/plugins/thing/plugin.mirai",`{"name": "thing", "version": "1.0.0", "parts": ["Runtime"]}`}, {"engine/plugins/thing/runtime/thing.odin","package thing\n\nimport \"plugins:thing/runtime/sim\"\n\ndoubled :: proc(value:i32) -> i32 {return sim.answer()*value}\n"}, {"engine/plugins/thing/runtime/sim/sim.odin","package sim\n\n@(component)\nSim_Probe :: struct {value:f32}\n\nanswer :: proc() -> i32 {return 21}\n"}, @@ -335,6 +336,7 @@ a_plugin_step_receives_a_params_struct_through_its_library :: proc(t:^testing.T) if folder=="" {return} files:=[][2]string{ {"engine/core/data.odin","package core\n\nTable :: struct($T:typeid) {values:[2]T}\nRead :: struct($T:typeid) {table:^Table(T)}\n\n@(component)\nProbe :: struct {value:i32}\n\n@(storage,queue)\nAsks :: struct {count:i32}\n\n@(params)\nProber :: struct {probes:^Table(Probe),asks:^Asks}\n"}, + {"engine/std/compressor/compressor.odin","package compressor\n"}, // the build names its collection {"engine/plugins/thing/plugin.mirai",`{"name": "thing", "version": "1.0.0", "parts": ["Runtime"]}`}, {"engine/plugins/thing/runtime/thing.odin","package thing\n\nimport \"mirai:core\"\n\n@(step=\"fixed\")\nthing_probe :: proc(prober:core.Prober) {\n prober.probes.values[1].value=40\n prober.asks.count+=2\n}\n"}, {"game/project.mirai",`{"name": "Params", "plugins": ["thing"]}`}, @@ -452,6 +454,7 @@ a_plugin_library_compiles_once_those_it_links_against_are_published :: proc(t:^t if folder=="" {return} files:=[][2]string{ {"engine/core/data.odin","package core\n"}, + {"engine/std/compressor/compressor.odin","package compressor\n"}, // the build names its collection {"engine/plugins/base_thing/plugin.mirai",`{"name": "base_thing", "version": "1.0.0", "parts": ["Runtime"]}`}, {"engine/plugins/base_thing/runtime/base.odin","package base_thing\n\nanswer :: proc() -> i32 {return 21}\n"}, {"engine/plugins/middle/plugin.mirai",`{"name": "middle", "version": "1.0.0", "dependencies": ["base_thing"], "parts": ["Runtime"]}`}, diff --git a/cook/build/relink_test.odin b/cook/build/relink_test.odin index 88697fe3f..7c64c1ef2 100644 --- a/cook/build/relink_test.odin +++ b/cook/build/relink_test.odin @@ -22,6 +22,7 @@ a_change_inside_a_procedure_links_what_links_against_it_again :: proc(t:^testing base_source:="engine/plugins/base_thing/runtime/base.odin" files:=[][2]string{ {"engine/core/data.odin","package core\n"}, + {"engine/std/compressor/compressor.odin","package compressor\n"}, // the build names its collection {"engine/plugins/base_thing/plugin.mirai",`{"name": "base_thing", "version": "1.0.0", "parts": ["Runtime"]}`}, {base_source,"package base_thing\n\nanswer :: proc() -> i32 {return 21}\n"}, {"engine/plugins/middle/plugin.mirai",`{"name": "middle", "version": "1.0.0", "dependencies": ["base_thing"], "parts": ["Runtime"]}`}, From 9ee3a50fd3f43e4bef695b32375875fed16b07fb Mon Sep 17 00:00:00 2001 From: tomaszbk-pc Date: Sun, 15 Nov 2026 21:53:09 -0300 Subject: [PATCH 2/2] Write the engines of the build tests through one fixture writer fixture_write writes the files of a test's engine and project, with the compressor collection every engine has and the build names, so a fixture lists only what it tests and the next folder the build names is added once. Co-Authored-By: Claude Opus 5.5 --- cook/build/plugins_test.odin | 41 ++++++++++++------------------------ cook/build/relink_test.odin | 8 +------ 2 files changed, 15 insertions(+), 34 deletions(-) diff --git a/cook/build/plugins_test.odin b/cook/build/plugins_test.odin index 057daac19..ba4699c9a 100644 --- a/cook/build/plugins_test.odin +++ b/cook/build/plugins_test.odin @@ -130,7 +130,6 @@ a_plugin_library_is_linked_against_an_import_library_made_ahead :: proc(t:^testi split_plugin_write :: proc(t:^testing.T,folder:string) -> (engine,game:string) { files:=[][2]string{ {"engine/core/data.odin","package core\n"}, - {"engine/std/compressor/compressor.odin","package compressor\n"}, // the build names its collection {"engine/plugins/thing/plugin.mirai",`{"name": "thing", "version": "1.0.0", "parts": ["Runtime"]}`}, {"engine/plugins/thing/runtime/thing.odin","package thing\n\nimport \"plugins:thing/runtime/sim\"\n\ndoubled :: proc(value:i32) -> i32 {return sim.answer()*value}\n"}, {"engine/plugins/thing/runtime/sim/sim.odin","package sim\n\n@(component)\nSim_Probe :: struct {value:f32}\n\nanswer :: proc() -> i32 {return 21}\n"}, @@ -138,12 +137,21 @@ split_plugin_write :: proc(t:^testing.T,folder:string) -> (engine,game:string) { {"engine/plugins/thing/runtime/testdata/ignored.odin","package ignored\n"}, {"game/project.mirai",`{"name": "Split", "plugins": ["thing"]}`}, } - for file in files { + return fixture_write(t,folder,files) +} + +// Writes the files of the engine and the project of a test under folder, with +// what every engine has and the build names: the collection of the compressor. +@(private) +fixture_write :: proc(t:^testing.T,folder:string,files:[][2]string) -> (engine,game:string) { + write :: proc(t:^testing.T,folder:string,file:[2]string) { path:=project.path(folder,file[0],allocator=context.temp_allocator) directory:=path[:strings.last_index_byte(path,'/')] testing.expect(t,os.make_directory_all(directory)==nil || os.is_dir(directory)) testing.expect(t,os.write_entire_file(path,file[1])==nil,path) } + write(t,folder,{"engine/std/compressor/compressor.odin","package compressor\n"}) + for file in files {write(t,folder,file)} return project.path(folder,"engine",allocator=context.temp_allocator),project.path(folder,"game",allocator=context.temp_allocator) } @@ -287,15 +295,7 @@ a_plugin_that_imports_a_plugin_it_does_not_depend_on_is_an_error :: proc(t:^test context.allocator=context.temp_allocator folder:=base.test_folder(t,"plugin-imports") if folder=="" {return} - write :: proc(t:^testing.T,folder:string,files:[][2]string) { - for file in files { - path:=project.path(folder,file[0],allocator=context.temp_allocator) - directory:=path[:strings.last_index_byte(path,'/')] - testing.expect(t,os.make_directory_all(directory)==nil || os.is_dir(directory)) - testing.expect(t,os.write_entire_file(path,file[1])==nil,path) - } - } - write(t,folder,{ + engine,game:=fixture_write(t,folder,{ {"engine/core/data.odin","package core\n"}, {"engine/plugins/base_thing/plugin.mirai",`{"name": "base_thing", "version": "1.0.0", "parts": ["Runtime"]}`}, {"engine/plugins/base_thing/runtime/base.odin","package base_thing\n\nanswer :: proc() -> i32 {return 21}\n"}, @@ -305,14 +305,13 @@ a_plugin_that_imports_a_plugin_it_does_not_depend_on_is_an_error :: proc(t:^test {"engine/plugins/user/runtime/user.odin","package user\n\nimport base_thing \"plugins:base_thing/runtime\"\n\nthrice :: proc() -> i32 {return 3*base_thing.answer()}\n"}, {"game/project.mirai",`{"name": "Imports", "plugins": ["middle", "user"]}`}, }) - engine,game:=project.path(folder,"engine"),project.path(folder,"game") p,error:=project.open(game,engine) if !testing.expectf(t,error.code==.None,"the project opens: %v",error) {return} world:=world_generate(&p,context.temp_allocator) if !testing.expect_value(t,len(world.errors),1) {return} testing.expectf(t,strings.contains(world.errors[0],"user.odin") && strings.contains(world.errors[0],`add "base_thing" to the dependencies`),"%s",world.errors[0]) // Through a dependency of a dependency is a dependency too. - write(t,folder,{{"engine/plugins/user/plugin.mirai",`{"name": "user", "version": "1.0.0", "dependencies": ["middle"], "parts": ["Runtime"]}`}}) + fixture_write(t,folder,{{"engine/plugins/user/plugin.mirai",`{"name": "user", "version": "1.0.0", "dependencies": ["middle"], "parts": ["Runtime"]}`}}) project.close(&p) p,error=project.open(game,engine) if !testing.expect(t,error.code==.None) {return} @@ -336,17 +335,11 @@ a_plugin_step_receives_a_params_struct_through_its_library :: proc(t:^testing.T) if folder=="" {return} files:=[][2]string{ {"engine/core/data.odin","package core\n\nTable :: struct($T:typeid) {values:[2]T}\nRead :: struct($T:typeid) {table:^Table(T)}\n\n@(component)\nProbe :: struct {value:i32}\n\n@(storage,queue)\nAsks :: struct {count:i32}\n\n@(params)\nProber :: struct {probes:^Table(Probe),asks:^Asks}\n"}, - {"engine/std/compressor/compressor.odin","package compressor\n"}, // the build names its collection {"engine/plugins/thing/plugin.mirai",`{"name": "thing", "version": "1.0.0", "parts": ["Runtime"]}`}, {"engine/plugins/thing/runtime/thing.odin","package thing\n\nimport \"mirai:core\"\n\n@(step=\"fixed\")\nthing_probe :: proc(prober:core.Prober) {\n prober.probes.values[1].value=40\n prober.asks.count+=2\n}\n"}, {"game/project.mirai",`{"name": "Params", "plugins": ["thing"]}`}, } - for file in files { - path:=project.path(folder,file[0]) - testing.expect(t,os.make_directory_all(path[:strings.last_index_byte(path,'/')])==nil || os.is_dir(path[:strings.last_index_byte(path,'/')])) - testing.expect(t,os.write_entire_file(path,file[1])==nil,path) - } - engine,game:=project.path(folder,"engine"),project.path(folder,"game") + engine,game:=fixture_write(t,folder,files) p,error:=project.open(game,engine) if !testing.expectf(t,error.code==.None,"the project opens: %v",error) {return} world:=world_generate(&p,context.temp_allocator) @@ -454,7 +447,6 @@ a_plugin_library_compiles_once_those_it_links_against_are_published :: proc(t:^t if folder=="" {return} files:=[][2]string{ {"engine/core/data.odin","package core\n"}, - {"engine/std/compressor/compressor.odin","package compressor\n"}, // the build names its collection {"engine/plugins/base_thing/plugin.mirai",`{"name": "base_thing", "version": "1.0.0", "parts": ["Runtime"]}`}, {"engine/plugins/base_thing/runtime/base.odin","package base_thing\n\nanswer :: proc() -> i32 {return 21}\n"}, {"engine/plugins/middle/plugin.mirai",`{"name": "middle", "version": "1.0.0", "dependencies": ["base_thing"], "parts": ["Runtime"]}`}, @@ -463,12 +455,7 @@ a_plugin_library_compiles_once_those_it_links_against_are_published :: proc(t:^t {"engine/plugins/lone/runtime/lone.odin","package lone\n\nalone :: proc() -> i32 {return 1}\n"}, {"game/project.mirai",`{"name": "Order", "plugins": ["middle", "lone"]}`}, } - for file in files { - path:=project.path(folder,file[0]) - testing.expect(t,os.make_directory_all(path[:strings.last_index_byte(path,'/')])==nil) - testing.expect(t,os.write_entire_file(path,file[1])==nil,path) - } - engine,game:=project.path(folder,"engine"),project.path(folder,"game") + engine,game:=fixture_write(t,folder,files) p,error:=project.open(game,engine) if !testing.expectf(t,error.code==.None,"the project opens: %v",error) {return} testing.expect(t,os.make_directory_all(engine_paths(engine,.Dev).decl)==nil) diff --git a/cook/build/relink_test.odin b/cook/build/relink_test.odin index 7c64c1ef2..85e22ace6 100644 --- a/cook/build/relink_test.odin +++ b/cook/build/relink_test.odin @@ -22,19 +22,13 @@ a_change_inside_a_procedure_links_what_links_against_it_again :: proc(t:^testing base_source:="engine/plugins/base_thing/runtime/base.odin" files:=[][2]string{ {"engine/core/data.odin","package core\n"}, - {"engine/std/compressor/compressor.odin","package compressor\n"}, // the build names its collection {"engine/plugins/base_thing/plugin.mirai",`{"name": "base_thing", "version": "1.0.0", "parts": ["Runtime"]}`}, {base_source,"package base_thing\n\nanswer :: proc() -> i32 {return 21}\n"}, {"engine/plugins/middle/plugin.mirai",`{"name": "middle", "version": "1.0.0", "dependencies": ["base_thing"], "parts": ["Runtime"]}`}, {"engine/plugins/middle/runtime/middle.odin","package middle\n\nimport base_thing \"plugins:base_thing/runtime\"\n\ntwice :: proc() -> i32 {return 2*base_thing.answer()}\n"}, {"game/project.mirai",`{"name": "Relink", "plugins": ["middle"]}`}, } - for file in files { - path:=project.path(folder,file[0]) - testing.expect(t,os.make_directory_all(path[:strings.last_index_byte(path,'/')])==nil) - testing.expect(t,os.write_entire_file(path,file[1])==nil,path) - } - engine,game:=project.path(folder,"engine"),project.path(folder,"game") + engine,game:=fixture_write(t,folder,files) p,error:=project.open(game,engine) if !testing.expectf(t,error.code==.None,"the project opens: %v",error) {return} testing.expect(t,os.make_directory_all(engine_paths(engine,.Dev).decl)==nil)