-
Notifications
You must be signed in to change notification settings - Fork 232
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
Provide out_data_dirs
attribute (#419)
#622
Conversation
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.
I'm not sure how I feel about accepting directories as the output group here. Given that Bazel can't make virtually any determinism guarantees about these build systems, I think it's better for the rules to request specific outputs. Though, I'd imagine there'd be a massive list of files here if you needed to be explicit. Maybe @jsharpe would have some thoughts there
Also this target doesn't seem to be hooked up. The examples are in a less than ideal state and require you to add things to a test_suite to get them tested:
rules_foreign_cc/examples/third_party/BUILD.bazel
Lines 3 to 59 in 98c88de
test_suite( | |
name = "linux_tests", | |
tags = ["manual"], | |
tests = [ | |
"//bison:bison_build_test", | |
"//cares:test_c_ares", | |
"//curl:curl_build_test", | |
"//gn:gn_launch_test", | |
"//libgit2:libgit2_build_test", | |
"//libpng:test_libpng", | |
"//libssh2:libssh2_build_test", | |
"//openssl:openssl_build_test", | |
"//pcre:pcre_build_test", | |
], | |
) | |
test_suite( | |
name = "linux_rbe_tests", | |
tags = ["manual"], | |
tests = [ | |
# Missing a new enough m4 to build | |
#"//bison:bison_build_test", | |
"//cares:test_c_ares", | |
"//curl:curl_build_test", | |
# Attempts to access git sha during configure of build so fails | |
#"//gn:gn_launch_test", | |
"//libgit2:libgit2_build_test", | |
"//libpng:test_libpng", | |
"//libssh2:libssh2_build_test", | |
"//openssl:openssl_build_test", | |
"//pcre:pcre_build_test", | |
], | |
) | |
test_suite( | |
name = "macos_tests", | |
tags = ["manual"], | |
tests = [ | |
"//cares:test_c_ares", | |
"//curl:curl_build_test", | |
"//gn:gn_launch_test", | |
"//iconv:iconv_build_test", | |
"//libgit2:libgit2_build_test", | |
"//libpng:test_libpng", | |
"//libssh2:libssh2_build_test", | |
"//openssl:openssl_build_test", | |
"//pcre:pcre_build_test", | |
], | |
) | |
test_suite( | |
name = "windows_tests", | |
tags = ["manual"], | |
tests = [ | |
# TODO: Add windows tests | |
], | |
) |
Can you add the new target there?
12f53d6
to
deb2fae
Compare
@UebelAndre I have actioned your change requests. I agree that this is against bazel best practice, although the same can be said for how includes are handled in this repository as they too are added using The |
505b81f
to
3d2d3fd
Compare
|
||
py_runtime( | ||
name = "py3_runtime", | ||
files = ["@python"], |
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.
Could you instead use the gen_dir
output group to create a filegroup with all of these files? If using gen_dir
includes too much you can always use the postfix_script
attribute to remove any files you don't need from the install directory?
If that works then this would avoid the need to add an extra attribute.
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.
This also seems related to #582
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.
@jsharpe I'll look into using gen_dir
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.
@jsharpe I tried adding the following filegroup
to Build.python3.bazel
filegroup(
name = "gen_dir",
srcs = [":python3"],
output_group = "gen_dir",
)
I then set the files
attribute of the py_runtime
to ["@python3//:gen_dir]
. Sadly the files inside the lib
directory generated by the build of python were not included in the runfiles
for the python3_test
. As such, the invocation of python3
failed.
Perhaps I am doing something wrong?
e5a8a52
to
1a15e14
Compare
Even more confusing then! lol How is it possible to build py3 if the path is mangled? Maybe it's a linux only feature? I pulled your branch earlier and successfully built. I'm otherwise not sure how that's possible. |
Yeah it is quite bizarre! Are you testing on Linux or Mac? |
The latest build (https://buildkite.com/bazel/rules-foreign-cc/builds/2913#7a58e48b-85b0-4b71-8e4f-6899742b121d) has the same error as before but for Python2 now:
|
I'm only testing on my mac.
I'm a bit busy today so I don't have too much time to dig into this but can you narrow down what specific call is failing here? Maybe by wrapping some commands in |
Also worth noting that it's the standalone build which failed again..... |
The error seems to occur during or after the |
I added debug prints to the start and end of |
Ok, finally, I think #687 will solve the issue.... |
Awesome! I have merged your branch into this one to see if the standalone MacOS builds are successful first time |
@UebelAndre I have rebased off the |
Hey, yeah, I unfortunately had to restore the need for PRs to commit docs. So you'll have to run I'm still waiting on my reviewer for #687 so once that's in then I think this will immediately follow |
Great, thanks. I figured the docs out about 10 mins ago and the build is now all green :) |
This change facilitates hermetic python toolchains, as demonstrated by the test added in this commit.
Done and merged. |
@UebelAndre @jsharpe This PR is now ready for re-review :) |
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.
"//conditions:default": [], | ||
}), | ||
configure_options = [ | ||
"CFLAGS='-Dredacted=\"redacted\"'", |
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.
We need to revisit the quoting if this option is still required.
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.
but at least this will act as a test to make sure its fixed!
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.
LGTM
When the
python
executable, built usingconfigure_make
, is invoked it requires the files within the generatedlib
folder to be available on the file system.This commit provides an
out_data_dirs
attribute, which declares the given directories as outputs to the bazel build action. By specifying the generatedlib
dir as one of theoutput_data_dirs
, thelib
directory is accessible when thepython
executable is invoked.This facilitates hermetic python toolchains, built using the awesome
rules_foreign_cc
repoThis resolves #419