Bazelify V8: Link V8 engine in Bazel builds.
In preparation of https://github.com/project-oak/oak/issues/74 and https://github.com/project-oak/oak/issues/126 we want to link V8 so that it can be included in Bazel BUILD files as dependency.
DRAFT commit includes compiled Chrome V8 sources in docker image and links them in Bazel WORKSPACE as new_local_repository: https://github.com/hansman/oak/commit/6dde6e871f0d177caf4b5d9c13ac90499be8208f
Hey @hansman , thanks for putting this together! It seems that @ofrobots has already done some of the V8 Bazel-ification work in https://github.com/ofrobots/no-bazel/blob/master/v8.BUILD.bazel .
@ofrobots do you have any thoughts / suggestions about this?
I was doing the bazelification of the V8 build for an experiment. I am no longer maintaining it, but feel free to use it as a starting point. One challenge would be the busy work needed to keep things functional as upstream GN build file changes. In an ideal world, it would be good to have a tool that does the conversion automatically; or convince upstream to switch to bazel :upside_down_face: .
Thanks for sharing @ofrobots! This must have taken you some time to put together. This is awesome!
Maintaining the V8 dependency can be costly in case we want to upgrade to a different V8 version along the way. Is this what you mean with keeping things functional with regards to BUILD.gn changes? I guess this is a risk/cost we want to evaluate as we learn how to bazelify V8 @tiziano88.
Building the project I ran into some problems on bazel target @v8//:core_lib. One thing that seems missing are generated sources, for example builtins-generated/* (https://github.com/ofrobots/no-bazel/blob/master/third_party/v8/BUILD.gn#L1528). There are scripts to generate those in the V8 sources, we probably have to call each of those before the bazel build.
https://github.com/ofrobots/no-bazel/blob/f7eb147044dc35aac86df8bd9bec2cc55863ce17/third_party/v8/BUILD.gn#L996-L1012
Maintaining the V8 dependency can be costly in case we want to upgrade to a different V8 version along the way. Is this what you mean with keeping things functional with regards to BUILD.gn changes?
Yes. The V8 build uses lots of tools that generate source files (e.g. the bytecode builtins that you pointed out). In my experience these parts are expensive to update on V8 version upgrades.