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 jar dependencies of tests from maven_jar to jvm_maven_import_external #871

Closed
wants to merge 5 commits into from

Conversation

jin
Copy link
Member

@jin jin commented Nov 4, 2019

Description

This pull request converts all maven_jar usages to jvm_maven_import_external.

See bazelbuild/bazel#6799 for more information about maven_jar's removal.

Motivation

maven_jar is planned for removal in Bazel 2.0.

Copy link
Member

@johnynek johnynek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm personally -1 on this.

I'd rather use http_jar (a custom implementation in this repo is only a few lines) and just point to the locations rather than add another dependency under all our users.

Secondly, the usability of pointing to paths with full URLs in them seems bad to me.

Lastly, the regression of including the scala version in the targets, I think will at least create large diffs when we do upgrades, and may significantly complicate things (e.g. it becomes easier to have 2_11 and 2_12 on the classpath, which creates very hard to debug errors for most users).

WORKSPACE Outdated Show resolved Hide resolved
test/BUILD Outdated
@@ -63,7 +63,7 @@ scala_binary(
scala_library(
name = "HelloLib",
srcs = ["HelloLib.scala"],
plugins = ["@org_psywerx_hairyfotr__linter//jar"],
plugins = ["@maven//:org_psywerx_hairyfotr_linter_2_11"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still bummed you all didn't find an injective naming scheme. This can collide if you have org.bar:foo.baz and org.bar.foo:baz. That's a shame. The extra _ was to separate the org from the group.

Next, since you all are baking the scala version 2_11 into the targets people use, this will mean upgrading a repo will be a pretty major pain. It may be that every string ending in _2_11" can be converted to _2_12" but previously, we wouldn't have that giant diff. This is a regression in usability for scala users.

"@com_google_guava_guava_21_0_with_file//jar:file",
"@org_apache_commons_commons_lang_3_5//jar:file",
"@maven//:v1/https/jcenter.bintray.com/com/google/guava/guava/21.0/guava-21.0.jar",
"@maven//:v1/https/jcenter.bintray.com/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really need to use the source of the binary in the name? What about users that use private internal resolvers?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filed bazel-contrib/rules_jvm_external#284

There's currently the ability to reference maven_install artifacts with the //jar-style labels with generate_compat_repositories, but we didn't implement the file label. We can definitely do that - will look into it very soon.

@jjudd
Copy link
Contributor

jjudd commented Nov 4, 2019

I'm a fan of rules_scala either adopting the bazelbuild sanctioned third party jvm deps solution (rules_jvm_external) or contributing to it, such that it works for bazelbuild/rules_scala.

I'm personally +1 on moving to rules_jvm_external as we've been using rules_jvm_external for several months internally and our open source projects and it's been working well for us.

@borkaehw
Copy link
Contributor

borkaehw commented Nov 4, 2019

I like how easy to use rules_jvm_external. @jin has done hard works to make it great. The repo maintainers are very active, and I believe we can address the concerns (mentioned above) quickly and efficiently.

I am personally +1 to this and excited to see bazelbuild/rules_scala embrace more tightly to Bazel ecosystem.

@johnynek
Copy link
Member

johnynek commented Nov 4, 2019

I'm sorry I responded to the review. @jin I'm no longer involved with the project so perhaps you want to disregard my opinion. I'll remove my name and unsubscribe from the notifications.

@ittaiz
Copy link
Member

ittaiz commented Nov 4, 2019

Hi,
I'm swamped with the beheamoth (#865) but I'll try to review it this week.
In general I have to say I don't like rules_jvm_external very much since it feels mostly relevant for small builds (I'd rather not open the whole discussion right now but if people strongly request it I will).
Not sure why not just use jvm_import_external like we do in most places.
A more detailed review (and to read what others have written so far) will happen later

@jin
Copy link
Member Author

jin commented Nov 4, 2019

@johnynek thanks for the review! Very good comments and issues raised. These are definitely things that we can fix upstream in rules_jvm_external.

@ittaiz what about maven_install makes you feel that it's only meant for small builds? Certainly, I can see how that's the case if you use it without artifact pinning / maven_install.json.

I don't mind replacing rules_jvm_external with jvm_import_external in this PR. The goal is to move away from maven_jar, anyway.

@borkaehw
Copy link
Contributor

Any update on this?

@jin jin requested a review from ittaiz as a code owner November 14, 2019 17:57
@jin
Copy link
Member Author

jin commented Nov 14, 2019

I've switched rules_jvm_external to jvm_maven_import_external, which is a much smaller and less invasive change. PTAL.

@jin jin changed the title Migrate jar dependencies of tests from maven_jar to rules_jvm_external Migrate jar dependencies of tests from maven_jar to jvm_maven_import_external Nov 14, 2019
@borkaehw
Copy link
Contributor

I see. It's sad to see rules_jvm_external goes. 😢

Copy link
Member

@ittaiz ittaiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this @jin!

@ittaiz
Copy link
Member

ittaiz commented Nov 15, 2019

@jin regarding rules_jvm_external this is a long discussion which I don't have the capacity to have right now, sorry. Late responding to this PR wasn't me trying to make a point but rather a pure capacity and prioritization issue (whatever time I have I try to put into the phases PR).

Hopefully we'll be able to talk about it at BazelCon :)

@ittaiz
Copy link
Member

ittaiz commented Nov 15, 2019

lastly the build is failing. I've checked out the branch and am trying to fix the tests

@ittaiz
Copy link
Member

ittaiz commented Nov 18, 2019

just to update, I was able to get past the failures in travis but got stuck on other failures and ran out of time. Will try to find more time as soon as I can

@jin
Copy link
Member Author

jin commented Nov 27, 2019

@ittaiz I'm adding the @repo//jar:file target to jvm_maven_import_external to keep the API consistent with maven_jar, so the only changes to this PR should only be for the WORKSPACE file.

Unfortunately this will only land in Bazel 2.0. Perhaps we can extract the Starlark rules out to rules_jvm_external to decouple release processes.

I'll open another PR as soon as we have a jvm_maven_import_external that's API compatible to migrate rules_scala.

bazelbuild/bazel#10324

@jin jin closed this Nov 27, 2019
@ittaiz
Copy link
Member

ittaiz commented Nov 28, 2019 via email

@jin jin reopened this Nov 28, 2019
@googlebot
Copy link

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@jin
Copy link
Member Author

jin commented Nov 28, 2019

Argh, my local git tree is so messed up. I'll make another PR.

Is it only for us or are others having a harder time to migrate? If it’s only for us please don’t add it.

Your use case is fairly common, so I think it's a good idea to add it.

@jin jin closed this Nov 28, 2019
@ittaiz
Copy link
Member

ittaiz commented Nov 28, 2019 via email

bazel-io pushed a commit to bazelbuild/bazel that referenced this pull request Nov 28, 2019
…rt_external

This adds compatibility between maven_jar and the Starlark rules' API, and helps with migration from maven_jar as seen in bazelbuild/rules_scala#871

Closes #10324.

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

Successfully merging this pull request may close these issues.

7 participants