-
Notifications
You must be signed in to change notification settings - Fork 259
feat: meson additional targets #1385
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
feat: meson additional targets #1385
Conversation
|
@jsharpe I'm trying to debug the failure but I can't repro it easily :-/ Do you know if there's a simple way to run the same CI environment locally? e.g. if Buildkite has some CLI that would allow me to point it at the PS: I see the |
|
OK, I managed to get a Bazel build to work in my docker container commenting out a bunch of stuff in diff --git a/examples/MODULE.bazel b/examples/MODULE.bazel
index 97512a8..2fdb757 100644
--- a/examples/MODULE.bazel
+++ b/examples/MODULE.bazel
@@ -28,6 +28,7 @@ python.toolchain(
# Only set when you have mulitple toolchain versions.
is_default = True,
python_version = "3.10",
+ ignore_root_user_error = True,
)
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
diff --git a/examples/WORKSPACE.bazel b/examples/WORKSPACE.bazel
index e47cec2..355f4cf 100644
--- a/examples/WORKSPACE.bazel
+++ b/examples/WORKSPACE.bazel
@@ -17,10 +17,6 @@ load("//deps:repositories.bzl", "repositories")
repositories()
-load("//deps:deps_android.bzl", "deps_android")
-
-deps_android()
-
load("//deps:deps_jvm_external.bzl", "deps_jvm_external")
deps_jvm_external()
@@ -36,6 +32,7 @@ protobuf_deps()
python_register_toolchains(
name = "python_3_10",
python_version = "3.10",
+ ignore_root_user_error = True,
)
load("@rules_python//python:pip.bzl", "pip_parse")
diff --git a/examples/WORKSPACE.bzlmod b/examples/WORKSPACE.bzlmod
index 6cdd676..cac7926 100644
--- a/examples/WORKSPACE.bzlmod
+++ b/examples/WORKSPACE.bzlmod
@@ -4,10 +4,6 @@ load("//deps:repositories.bzl", "repositories")
repositories()
-load("//deps:deps_android.bzl", "deps_android")
-
-deps_android()
-
load("//deps:deps_jvm_external.bzl", "deps_jvm_external")
deps_jvm_external()I think the python root stuff has finally been fixed in the latest Anyway, if you have any ideas / know how to do this, please let me know. I'll be happy to work on this! |
7fe5e98 to
8d1c8ec
Compare
I don't know if there is a good way to reproduce the CI environment; its all defined in the bazelbuild/continuous-integration repo though if you want to try to reconstruct something locally from the scripts there.. |
Yeah the hard fail from android is annoying - it actually never used to do this until I think bazel 5(or maybe 4? I don't recall exactly) came out which introduced that hard fail; I just tend to comment out the deps_android call as you've done to run locally. |
Maybe there's a way to gatekeep those and only try to load the dependencies if some flag is set... and then the flag could be just set for CI or something. In any case, commenting it out is a simple fix anyway so no worries. Let me know what you think of the PR and if you want me to rebase it! |
The obvious way to resolve this is another workspace specifically for testing the android rules and only that one then needs to take the dependency on the android rules. |
8d1c8ec to
9f2d8b9
Compare
Meson didn't support the `targets` attribute in `CC_EXTERNAL_RULE_ATTRIBUTES` that other rules use. This is useful for running other Meson commands such as `meson test` or `meson introspection`.
Add a new output to be able to capture certain files from commands that don't yield the usual "compilation output". Modify the outputs so that out_data_files can override all other outputs without failing (e.g. while forcing out_lib_dir and out_include_dir to "").
9f2d8b9 to
45f9178
Compare
|
@jsharpe I've improved the "API" for the introspect command, so users can use the default args or provide custom introspect args, and provide an introspect filename. Let me know what you think! Hopefully it's ready to merge :) |
45f9178 to
69e531a
Compare
|
@jsharpe ping? 😄 could you have a quick look to see if you like the approach in the PR? 🙏 and if not, what should be changed? Thanks!! |
Test meson rule and the new support for extra targets such as introspect.
69e531a to
57b54f3
Compare
|
I made a minor update trying to simplify the example and realized that because of the default values and default output group, it broke the tests. But I fixed that and there's still one CI job broken... it looks like something else broke and not something in the PR :-/ |
|
Sorry, I haven't forgotten about this, just had very little time recently to dedicate to this. Yeah looks like the CI flake was network related. |
| if args_ and target_name in target_args: | ||
| fail("Please migrate '{t}_args' to 'target_args[\"{t}\"]'".format(t = target_name)) | ||
|
|
||
| target_args[target_name] = args_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from my testing, this will override any values I currently have set in target_args
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
created #1444
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right the code is wrong, but see my comments in the PR.
Extend the `pg_build()` rule to generate additional Meson introspection
targets on top of the regular Postgres build.
These targets invoke the [Meson `introspect` command] to emit JSON
metadata about the configuration of the build.
This metadata is useful for analyzing or programmatically extracting
parts of the Postgres build, such as contrib extensions.
NOTE: Bump `rules_foreign_cc` to v0.15.0 which is where [PR#1385] is
included ("feat: meson additional targets").
[Meson `introspect` command]: https://mesonbuild.com/Commands.html#introspect
[PR#1385]: bazel-contrib/rules_foreign_cc#1385
Add support for
targetsto meson rule: Meson didn't support thetargetsattribute inCC_EXTERNAL_RULE_ATTRIBUTESthat other rules use. This is useful for running other Meson commands such asmeson testormeson introspection.Add a new
out_data_filesoutput to be able to capture certain files from commands that don't yield the usual "compilation output".Modify the outputs so that
out_data_filescan override all other outputs without failing (e.g. while forcingout_lib_dirandout_include_dirto"").Add two simple tests to exercise the
mesonrule and the new support for Meson targets such asintrospect.