build: types and packages are mess
the goal of this issue is try to find out a way to not repeat codes in sub-projects and also build files
for example same Options struct exist in ./build.zig and gpu/build.zig. or refAllDecls function (which is very useful for tests and we should consider to use it in other packages) has been declared twice in freetype and audio/soundio
I think the reason for the code repetition was because we can't import from ../. For example we could have a build_utils.zig file with all the structs and functions commonly used in the build.zig files, but we wouldn't be able to import it.
Also, there is the fact that we are offering people the ability to use mach packages by themselves without adding all of mach. For example if someone wanted to use just mach-glfw it would still need that build_utils.zig.
Yep what @PiergiorgioZagaria said is correct.
I will also say, copying a few hundred lines is often preferable over a dependency (repeating code is not a bad thing.) This is a non-issue from my viewpoint.
Have any issues been caused by this? (e.g. two copies actually becoming out of date and it being a problem)? If not, I'd suggest we just do nothing until that happens & then address only that instance of it.
Have any issues been caused by this?
when hacking on #396, i had to use @bitCast while passing the exact same Options struct to gpu.testStep
Mach is definitely going to get bigger, and with the increase of such problems, controlling code quality will become more difficult
hopefully zig's official package manager solves all those
I agree those bitcasts between package parameters are an issue 👍 But I think they're caused by us using symlinks to load packages, not because of code duplication
i think this can be closed as of https://github.com/hexops/mach/commit/fe4e721508ac7990b17d12c7f0c0f25a58f39d8d