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

Clean up engine selection #258

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

linusg
Copy link
Contributor

@linusg linusg commented Nov 12, 2024

Lots of issues here:

  • Engine enum is duplicated for no reason

  • The Zig build system supports passing an enum type to options natively, with much nicer output:

    error: Expected -Dengine to be of type build.Engine.
    error:   access the help menu with 'zig build -h'
    

    and

    Project-Specific Options:
      -Dtarget=[string]            The CPU architecture, OS, and ABI to build for
      [...]
      -Dengine=[enum]              JS engine (v8)
                                     Supported Values:
                                       v8
    
  • buildOptions() is fallible for no reason after using the right options API

  • Everything after @hasDecl(build_opts, "engine") is dead code, this is always true

  • Even if the intention was to check value for its null state (also defaulted here, build_opts.engine orelse "v8") the build system already adds v8 to the build graph due to Options.engine being non-nullable with a fallback value

  • If all of this worked correctly and you could specify the engine via a root declaration, it could not return a value in its engine() function due to EngineType being an exhaustive enum hardcoded in the library

Overall that last part is a nice idea but obviously it's not been tested. It can be added back with all the above in mind at a later point. (e.g. explicit -Dengine=custom to not pull in v8 deps, non-exhaustive enum for custom values, etc)

@krichprollsch
Copy link
Member

Hello @linusg
TYVM for your PR and your comments 🙏
We wiil take the time to look at it seriously with @francisbouvier next week.

@francisbouvier
Copy link
Member

Hi @linusg. Thank you for your PR.
You're right, it's better like that, LGTM.

Do you mind signing your commits? So I can merge this PR. Thanks

@linusg
Copy link
Contributor Author

linusg commented Nov 26, 2024

Will have to look into how that works but will give it a try this evening, sure :)

@linusg
Copy link
Contributor Author

linusg commented Nov 26, 2024

I treat all of my SSH keys as temporary by design and I don't plan to create and maintain a PGP key either, so assuming you mean sign as in https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits I'm not willing to do that.

If you mean adding a Signed-off-by line I can do that, even though I personally don't see any value added by those. Please let me know.

@francisbouvier
Copy link
Member

I agree that Signed-off-by does not add any value if the commit it not signed by a PGP or SSH key.

OK I will merge it like that.

@francisbouvier francisbouvier merged commit 81dcc9d into lightpanda-io:main Nov 26, 2024
6 checks passed
@linusg linusg deleted the build-option-enum branch November 26, 2024 11:44
@linusg
Copy link
Contributor Author

linusg commented Nov 26, 2024

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants