-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
java rules should be able to depend on Skylark rules #970
Comments
Assigning to @laurentlb to get an idea how feasible this is. |
I would say there could be some contract that the java rule expects, and if skylark rules for scala, clojure, etc... follow that, the java rule would accept them. This kind of jvm interop is pretty important for these other jvm languages. |
here is a possible work around approach: |
@johnynek - Just out of curiosity, why do the scala_library(
name = "HelloLib",
srcs = ["HelloLib.scala"],
deps = [
"OtherJavaLib",
"OtherLib",
"MacroTest"
],
) |
@davidzchen it worked and I started removing them (fewer characters the better). Should targets always have |
We've generally been using ":" to indicate rules, and "" to Bazel handles both kinds of references as label references relative to the On Thu, Mar 3, 2016 at 10:29 AM, P. Oscar Boykin [email protected]
|
Thanks for the explanations! I think using @ulfjack - Is there a particular reason why Bazel allows referencing rules without the leading |
+1 to stronger checks. Would be a nice bazelrc option to require that. |
Yes, I think it would be possible to have a stricter check. On Fri, Mar 4, 2016 at 12:21 AM, P. Oscar Boykin [email protected]
|
This conversation got derailed a bit around the :label, but I am curious how we want to deal with interop between JVM languages I agree with @johnynek that the best way would be to create a contract that jar producing things can follow, and then some tools to pick them up and build a classpath |
Carmi started to work on a Skylark API for Java such that custom rules can interop with the built-in ones and that we can eventually rewrite the built-in rules in Skylark. It's not there yet, but it's coming. |
Maybe we can publish the current proposal and have the discussion publically? |
That sounds great. On Tuesday, May 24, 2016, Ulf Adams [email protected] wrote:
P. Oscar Boykin, Ph.D. | http://twitter.com/posco | http://pobox.com/~boykin |
any news about this? I just stumbled on another use-case- I want to use the java_test rule from scala since my testing library (specs2) integrates with JUnit and that's how we work with it today. |
I'm currently refactoring bazel/src/main/java/com/google/devtools/build/lib/rules/java/JavaLibraryHelper.java to make it easier to expose. |
@dslomov is working on a more complete proposal. Dmitry, would you mind giving more details on that? |
I know the importance of this is understood but just to give a small reminder- I want to add junit support for scala. def scala_junit_test(name, srcs, visibility = None, **kwargs):
scala_library(
name = name + "_junit_lib",
srcs = srcs,
visibility = ['//visibility:private'],
**kwargs
)
native.java_test(
name = name,
srcs = java_srcs,
deps = [":" + name + "_junit_lib"] + kwargs.get("deps",[]),
visibility = visibility,
**kwargs
) I'll have to go and reimplement junit running much like java and groovy rules already do |
I see. Then, to be consistent, how about using |
@ittaiz Could you provide a little (non-working of course) demo for the scala_junit_test? Just a few Java and scala files and a BUILD fille to reflect how you would like the API to look like? It would make me more confident that my solution would work for your case and I would realize faster what needs to be done. |
@iirina I actually have something working already in my fork |
@iirina please see my pull request to see how I worked around it. IIUC the main changes I'll need to make will be that in |
(sorry for the late reply!)
I'm not sure what you would like to turn into a macro?
Are you asking about details on your current implementation of
I added the possibility of creating a provider from compile and runtime jars (3695880) but I don't think it's going to be in the next release (scheduled this week). You could still try it out by building I am trying now to play around with your implementation of |
Re macro- In a nutshell I mainly need to change About my question about the launcher creation never mind- It relates to my implementation of scala_junit_test and it might be unclear. Again for sanity of this issue I think we can move on. About provider creation that's great! I'm actually usually on HEAD so that shouldn't be a problem. About |
I would actually like to have #2539 for tracking the progress on fixing that issue from the native
Yes, you should be able to pass the output jar to
So you should be able to collect the providers from both scala and java deps (meaning |
I have been working with this experimentally and have had a few rough parts:
I left out addressing/mimicking a bunch of other features in the native java rules (neverlink, non_strict, whatever DependencyArtifacts in JavaCompilationArgs add, etc.) but I think this would go a long way to allowing users to closely mimic what is the 'common path' of a java_library rule. It would actually be an interesting exercise (perhaps for testing purposes) to see in how many places then java_library in https://github.com/bazelbuild/bazel/blob/master/tools/build_rules/java_rules_skylark.bzl could just be used instead of native.java_library without the rest of the build graph noticing at all. |
Thanks for all your feedback, Stephen! To address your items:
Yup, this API needs some more work, that's why it's undocumented. Your idea sounds good, I will look into it.
This should be solved by previous comments. |
thanks @sdtwigg for leading this integration in the rules_scala area! I'm sure we're all waiting eagerly for progress there |
Hello Irina, is this still expected to be fixed in 0.5? Is this a release blocker? We're still at least 2 weeks away from the release but we should be getting ready. |
Yup, this is expected to be in the next release. All important changes have been submitted and a few small patches will follow soon. |
After offline discussion not treating as a release blocker. Although it seems this issue will be closed by then anyway :) |
@sdtwigg took the lead there so if he thinks he has all the tools he needs
then we're good.
@sdtwigg,
Any loose ends towards our ability to use java_common.compile, depend on
scala from java and remove the scala provider?
…On Mon, 10 Apr 2017 at 14:43 Irina Iancu ***@***.***> wrote:
@ittaiz <https://github.com/ittaiz> Is there anything else you would need
for implementing the scala rules using java_common? The issues raised by
@sdtwigg <https://github.com/sdtwigg> are WIP.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#970 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABUIFzWweNkWemiK-n6gyb0WcdvEFMFEks5ruhX1gaJpZM4HhVSL>
.
|
I am reasonably confident everything is in order with those proposals.
Using
sdtwigg/rules_scala@9c8f720
as a base, it looks like java_common should be a drop in. I haven't
experimented with the java_common.compile stuff yet but it seems reasonable
to add as a follow-on (modulo a few questions wrt java_toolchain
interacting with other toolchain proposals and host_javabase).
Once I get convergence with Irina on the proposals (primarily on the
Skylark API although Friday PR discussion resolved almost all of this):
will make a bazel fork with the changes integrated. This can then be used
to test an experimental follow-on rules_scala commit that drops using the
scala provider in favor of JavaProvider. If that works then would be enough
to say the sandwich is fulfilled. This can also be done in parallel to the
various pending bazel PRs (since the bazel fork would just assume they are
all cherry-picked in).
There are a handful of potential follow-on concerns regarding the sandwich
and inter-operating with other features in java rules but I don't think is
worth primary consideration. Just something to keep in mind for eventual
consideration.
On Mon, Apr 10, 2017 at 2:54 PM, Ittai Zeidman <[email protected]>
wrote:
… @sdtwigg took the lead there so if he thinks he has all the tools he needs
then we're good.
@sdtwigg,
Any loose ends towards our ability to use java_common.compile, depend on
scala from java and remove the scala provider?
On Mon, 10 Apr 2017 at 14:43 Irina Iancu ***@***.***> wrote:
> @ittaiz <https://github.com/ittaiz> Is there anything else you would
need
> for implementing the scala rules using java_common? The issues raised by
> @sdtwigg <https://github.com/sdtwigg> are WIP.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#970 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABUIFzWweNkWemiK-
n6gyb0WcdvEFMFEks5ruhX1gaJpZM4HhVSL>
> .
>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#970 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA9_-DLduFieSVYhFaMJp76aZuEUqpUoks5ruqUfgaJpZM4HhVSL>
.
|
Moving to 0.6 for the remaining work to do, the basics for rules_scala should be already there. |
Ok, thanks everybody! |
Maybe the right thing to do is to open several smaller issues for the
remaining work? Dmitry already commented the thread might be too long here
…On Tue, 11 Apr 2017 at 11:30 Marcel Hlopko ***@***.***> wrote:
Ok, thanks everybody!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#970 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABUIF73ThQpdseao394ikRinENrc3J47ks5ruzpBgaJpZM4HhVSL>
.
|
+1 to this suggestion, it will be easier to track and to understand what's remaining. |
In that case, let me close this bug and continue the discussion on per-issue ones. |
@lbrelki do we have additional issues for these? I don't think so |
@iirina do you mean 9671: Loosen java_library.exports and java_import.*? |
See:
https://github.com/bazelbuild/rules_scala/blob/master/test/BUILD#L15
The java libraries should probe to see if there are jars, transitive_runtime deps, etc...
The text was updated successfully, but these errors were encountered: