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

Migrate from Maven to Bazel when Bazel is stable and cross-platform #2850

Open
1 of 2 tasks
jbduncan opened this issue Jun 17, 2017 · 27 comments
Open
1 of 2 tasks

Migrate from Maven to Bazel when Bazel is stable and cross-platform #2850

jbduncan opened this issue Jun 17, 2017 · 27 comments
Labels
P4 type=enhancement Make an existing feature better

Comments

@jbduncan
Copy link
Contributor

jbduncan commented Jun 17, 2017

I'm sure that migrating from Maven to Bazel has been​ thought about by someone on the Guava team already, but I thought that the task might as well be jotted down in an issue on GitHub as a future reminder and a meta-issue for when the time comes.

Perhaps the two most important criteria which Bazel needs to meet before migration can even be started would be:

  • Be at a stable version (likely version 1.0 or greater).
  • Can run on all the major OSs that Maven supports (or some other reasonable definition of cross-platform). Will likely include widely-used Linux distributions (Ubuntu, Fedora and others), macOS/OS X, and Windows 7+.

Other things to consider:

  • Use Bazelisk as the build tool, so that developers don't need to install Bazel beforehand, and so that the build can specify which version of Bazel to download for (arguably) more consistent builds.
@cpovirk
Copy link
Member

cpovirk commented Jun 19, 2017

Thanks. We have some notes about this internally, to which I've added your points.

Dagger moved to Bazel a while back, so we have some reason to believe that it would work. On the other hand, Guava has some special requirements (like GWT testing) that I'm not sure are well supported in Bazel at the moment, so we might end up blocked on those.

@jbduncan
Copy link
Contributor Author

jbduncan commented Jun 19, 2017

@cpovirk Do you know if Dagger receives bug reports from its Windows users who wish to build Dagger from scratch?

I suppose that's my main concern with migrating Guava to Bazel too early (disregarding potential issues like GWT), because I am primarily a Windows 7 user, and my experience with the Windows distribution of Bazel version 0.4.x on chocolatey.org is that it fails to even install core dependencies like msys2 correctly.

I raised this as an issue with the Bazel devs some time ago, but I've admittedly not yet tested if more recent versions like 0.5.x work, so maybe my fear is unfounded now.

@cpovirk
Copy link
Member

cpovirk commented Jun 19, 2017

Do you know if Dagger receives bug reports from its Windows users who wish to build Dagger from scratch?

I didn't see anything from a quick search of its bug database, but @ronshapiro would know better.

@ronshapiro
Copy link
Contributor

I haven't received any, but I'd happily accept any request, and we could always set up AppVeyor tests if necessary

@perezd
Copy link

perezd commented Feb 21, 2018

Hey, I did the work:
https://github.com/perezd/guava/blob/bazel/README.bazel.md

Above is my branch with this working, checkout the README, and here's a bazel-based travis run:
https://travis-ci.org/perezd/guava/builds/344132470

@gengjiawen
Copy link

@ronshapiro Do you have time to migrate guava from maven to bazel. I know gradle but not bazel. A lot of work blocked for limitation of maven.

@ooxi
Copy link

ooxi commented Mar 5, 2018

This is more of a meta question, but how does Dagger build Maven metadata files for publication on Maven Central?

@perezd
Copy link

perezd commented Mar 5, 2018

@gengjiawen Did you happen to take a look at my branch? I did a majority of the work there already.

@ooxi, I don't really understand how that relates to this thread, can you please start another? I'd like to keep this discussion focused. Thanks!

@ronshapiro
Copy link
Contributor

@perezd we have some BUILD files internally that we want to use/transform to the opensource BUILD files that we would want to have, rather than maintaining two sets of build files. I think the initial questions (bazel 1.0, windows+gwt testing) are probably the bigger points right now.

I can take a look at trying to sanitize+export our internal build files and release them in "alpha" mode. That way @jbduncan can test the windows experience. @cpovirk - thoughts?

@gengjiawen
Copy link

@ronshapiro How about a pr ? When @cpovirk got time, he can directly review and merge this ?

@ronshapiro
Copy link
Contributor

A PR for something like this won't be so helpful because we already have BUILD files internally. Having two sets is no better (and arguably worse) than just sticking with the status quo until we're ready to adopt Bazel

@gengjiawen
Copy link

I mean a pr to convert build system from maven to bazel. Stuch with maven won't get full android support.

@jbduncan
Copy link
Contributor Author

@gengjiawen I'm personally a bit lost as to what you mean by "full android support". Guava already has Android-specific versions, right? How else would it need to support Android? 😕

@gengjiawen
Copy link

Actually no. Guava android version doesn't bundle it's proguard rules. So basically everyone use android-guava need to google or stackoverflow the proguard rules to fix the build and crash problem when enable minify.

@jbduncan
Copy link
Contributor Author

jbduncan commented Mar 23, 2018

@gengjiawen Ah okay, thanks for the clarification.

However, I think I agree with @ronshapiro that it's best to wait until the Guava team are themselves ready to open source the Google-internal BUILD files for Guava. That way, it will prevent duplicating existing work done by the Guava team and @perezd.

@perezd
Copy link

perezd commented Mar 23, 2018 via email

@gengjiawen
Copy link

@perezd Why not a pr ?

@perezd
Copy link

perezd commented Mar 23, 2018 via email

@cpovirk
Copy link
Member

cpovirk commented Mar 23, 2018

Sorry that I haven't replied here.

Our internal BUILD files are much more complicated than basic external one need to be, to the point that it might not even be worth trying to sanitize and export them. It might well be easier to have separate external BUILD files (probably named something like BUILD.bazel in our internal repo so that they don't interfere with the real ones). But @ronshapiro has the experience with this.

@perezd
Copy link

perezd commented Mar 23, 2018 via email

@jbduncan
Copy link
Contributor Author

Bazel hit version 1.0 a good amount of time ago (🎉), so I've updated the topmost message to tick off that requirement.

@jbduncan
Copy link
Contributor Author

It may also be worth considering using Bazelisk, so that future contributors won't be forced to install Bazel before building the project.

I've added this as a point of consideration to the topmost message of this issue.

@jermowery
Copy link

Any updates on this? It would be great for Google libraries to support Bazel

@cpovirk
Copy link
Member

cpovirk commented Aug 27, 2020

This (in concert with Bazelisk and .bazelversion) would also provide us with (I think) a stable version of Java compiler at a given Git commit. That could theoretically help avoid issues like #2173 (comment) and #3990 (by making us consider whether a change in Bazel version will change the output). I'm not sure it really would, but it still seems like at least a marginal improvement over pulling in whatever Java build tools happen to be on the PATH, as we currently do with Maven.

@cpovirk
Copy link
Member

cpovirk commented Dec 14, 2021

One thing we'd want to verify is whether it's still possible to use Bazel to run tests under JDK8 nowadays. It may well be; I'd just want to check.

@perezd
Copy link

perezd commented Dec 14, 2021

@cpovirk
Copy link
Member

cpovirk commented Dec 14, 2021

Oh, thanks. And that was fast :)

I got worried by bazelbuild/bazel@c406da0, but your link makes clear that that's just about the "main" runtime, not about the toolchain.

[edit: But by the time we implement this, who knows if either Bazel or Guava will support JDK8 :)]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P4 type=enhancement Make an existing feature better
Projects
None yet
Development

No branches or pull requests

7 participants