Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zig Run and Zig Test run actions should be able to utilize build.zig dependencies #48

Open
mobiuscog opened this issue May 18, 2024 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@mobiuscog
Copy link

Similar to #41, when there are build dependencies, the 'Green Arrows' in the margins to run code/tests will fail, as they rely on the run configuration.

Is there any way to repurpose these to use the build pipeline instead, or is it a limitation of the IDE that means we cannot use the margin-based runners ? (Basically is it possible to optionally replace all usages of 'run' configurations with 'build' configurations ?

@FalsePattern
Copy link
Owner

FalsePattern commented May 23, 2024

You can use the green arrow run button in build.zig if you want to run zig build-based tasks, the arrows in the files are for zig run and zig test respectively.

@FalsePattern FalsePattern added the unintuitive behaviour Technically correct but doesn't make logical sense label May 23, 2024
@mobiuscog
Copy link
Author

Thanks.

I realise this, but it means the granularity of running individual tests from the files themselves, which is often useful as part of a development iteration loop, is lost.

Oh well.

@FalsePattern
Copy link
Owner

I'll look into implementing some sort of custom build runner into zigbrains in a future release that can utilize build.zig dependencies for the in-file run buttons (similarly to what intellij already does with gradle/maven java projects)

@FalsePattern FalsePattern added enhancement New feature or request and removed unintuitive behaviour Technically correct but doesn't make logical sense labels May 23, 2024
@FalsePattern FalsePattern changed the title Unable to use 'Run' arrows when build dependencies are present Zig Run and Zig Test run actions should be able to utilize build.zig dependencies May 23, 2024
@FalsePattern
Copy link
Owner

FalsePattern commented May 23, 2024

As a rough idea/draft of this feature, here's a concept for how dependency discovery would be done for the tests:

  • For each test-type step in build.zig, extract all the individual files/tests being tested by it, and use the specific dependencied bound to that test step for them

  • If a specific file or test is not present in any test steps in build.zig, the plugin can either notify the user to add the file/test to a step, or just let them bypass it by attempting to run the test with the dependencies from the default test task, and if that fails, show an error popup

The ZB build runner would then just create a single-file test step in the background with the discovered dependencies and use that for the test run buttons.

(As an added bonus, a custom build runner would also make zig build test runs debuggable too!)

@mobiuscog
Copy link
Author

That all sounds awesome. I appreciate how 'young' all of this is - ZigBrains lets so many people learn and grow with Zig within a familiar environment, and enhancements like this will really help.

@FalsePattern FalsePattern added the help wanted Extra attention is needed label Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants