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

java_common.compile should support neverlink #3735

Closed
ittaiz opened this issue Sep 14, 2017 · 17 comments
Closed

java_common.compile should support neverlink #3735

ittaiz opened this issue Sep 14, 2017 · 17 comments
Assignees
Labels
P1 I'll work on this now. (Assignee required) type: bug

Comments

@ittaiz
Copy link
Member

ittaiz commented Sep 14, 2017

Please provide the following information. The more we know about your system and use case, the more easily and likely we can help.

Description of the problem / feature request / question:

given I call java_common.compile with a dependency which is neverlink I expect its jar to be added as a compile time dependency but not added as a runtime dependency.
According to a discussion @iirina and myself had over #3528 it seems this isn't the case and will probably cause classpath pollution.

@iirina iirina self-assigned this Sep 14, 2017
@laszlocsomor laszlocsomor added category: rules > java P2 We'll consider working on this in future. (Assignee optional) type: bug labels Sep 19, 2017
@ittaiz
Copy link
Member Author

ittaiz commented Sep 24, 2017

@iirina - Will you be tackling this one after #3769?
This will be great to try and finalize the advancement of java_common compile and create_provider

@iirina
Copy link
Contributor

iirina commented Sep 26, 2017

Yes - but the progress won't be that fast on these issues, I had to prioritize some other things. They are scheduled for Q4.

@ittaiz
Copy link
Member Author

ittaiz commented Oct 15, 2017

friendly ping

@iirina
Copy link
Contributor

iirina commented Dec 13, 2017

@ittaiz This will have to wait for Q1.

@ittaiz
Copy link
Member Author

ittaiz commented Dec 13, 2017

I wonder if, given specific need of rules_scala where I have another provider which I create myself, I'm blocked with this or not. Any ideas?

@iirina
Copy link
Contributor

iirina commented Dec 14, 2017

I don't understand, can you provide more details?

@ittaiz
Copy link
Member Author

ittaiz commented Dec 16, 2017

ok, scratch my previous statement.
I think that this might block our adoption of the new create_provider API.
Given the new API is more high level and only accepts one actual file (output_jar) then rules_scala will have to use the JavaInfo provider returned from java_common.compile. Given this provider is deeply flawed in propagating the neverlink onto to the classpath that is a problem.
I also thought of taking the full jar from the java_common.compile and creating a new provider but then I'd either have to forego ijars in my java (if in the manual java provider I will create an ijar bazel will error that both actions created the same file).

@iirina
Copy link
Contributor

iirina commented Dec 18, 2017

Thanks @ittaiz for explaining. I'm looking into this now. I'll try implementing it this week.

Given the new API is more high level and only accepts one actual file (output_jar) then rules_scala will have to use the JavaInfo provider returned from java_common.compile.

So you don't have the neverlink problem with the current version of create_provider? How come you can replace the JavaInfo created from jars with the one returned by java_common.compile? Also with the new constructor you can set neverlink.

Given this provider is deeply flawed in propagating the neverlink onto to the classpath that is a problem.

This I agree with and will be solved ASAP.

I also thought of taking the full jar from the java_common.compile and creating a new provider but then I'd either have to forego ijars in my java (if in the manual java provider I will create an ijar bazel will error that both actions created the same file).

Yes let's not do this.

bazel-io pushed a commit that referenced this issue Dec 18, 2017
We need to handle neverlink libraries in java_common (see #3735). Therefore JavaInfo needs to store the neverlink information. Instead of wrapping yet
another provider (JavaNeverlinkInfoProvider) into JavaInfo, store the neverlink
value directly.

PiperOrigin-RevId: 179439005
@ittaiz
Copy link
Member Author

ittaiz commented Dec 19, 2017

Thanks!
Re "So you don't have the neverlink problem with the current version of create_provider?"- we don't since we just take the jars (full and ijar) and manually add them to the java info we create for the scala code (since it works with raw jars)
Re "Also with the new constructor you can set neverlink."- which new constructor? Of create provider? That's not my problem. My prolem is when you have neverlink dependencies

@ittaiz
Copy link
Member Author

ittaiz commented Jan 21, 2018

Hi,
What is the status of this issue?

@ittaiz
Copy link
Member Author

ittaiz commented Jan 21, 2018

@helenalt this might become another blocker

@iirina
Copy link
Contributor

iirina commented Jan 30, 2018

Sorry Ittai for the lack of replies, I have been caught up in something else. There is no update on this. Work on java_common had to be deprioritized for a while. I'm back on it now.

My prolem is when you have neverlink dependencies

I don't understand the problem. Dependencies of what? If the neverlink attribute will be available on java_common.compile, wouldn't that solve this issue?

Do you need this in bazel 0.11.0?

@ittaiz
Copy link
Member Author

ittaiz commented Jan 30, 2018

What I meant is that if we change semantics on java provider from files (current) to dependencies (WIP) then I’ll have a big problem because I can’t do the manipulation I do today.
Does that make sense?
And yes, we will need it for 0.11.0

@iirina
Copy link
Contributor

iirina commented Jan 31, 2018

What I meant is that if we change semantics on java provider from files (current) to dependencies (WIP) then I’ll have a big problem because I can’t do the manipulation I do today.

Can you give me an example of how you use the current java_common.create_provider for neverlink? I think it will be easier for me to explain on examples.

And yes, we will need it for 0.11.0

Noted. The neverlink attribute on java_common.compile should reach 0.11.0 (#3959)

@iirina iirina added P1 I'll work on this now. (Assignee required) Release blocker and removed P2 We'll consider working on this in future. (Assignee optional) labels Jan 31, 2018
@ittaiz
Copy link
Member Author

ittaiz commented Jan 31, 2018 via email

@ittaiz
Copy link
Member Author

ittaiz commented Mar 1, 2018

@iirina will java_common.compile "respect" the neverlink attribute on a JavaInfo that was created with a neverlink attribute (when it tries to create its own JavaInfo)?

@iirina
Copy link
Contributor

iirina commented Mar 5, 2018

Yes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 I'll work on this now. (Assignee required) type: bug
Projects
None yet
Development

No branches or pull requests

3 participants