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

[WIP] Scala import java info #517

Closed
wants to merge 7 commits into from

Conversation

anchlovi
Copy link
Contributor

This changes scala_import to use JavaInfo

@anchlovi
Copy link
Contributor Author

Currently this break strict deps:

'bazel build test_expect_failure/scala_import:scala_import_propagates_compile_deps' should have logged "buildozer 'add deps //test_expect_failure/scala_import:cats' //test_expect_failure/scala_import:scala_import_propagates_compile_deps".

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.

Haven't finished but thought you'd like the WIP thoughts as well

exports_provider = _labels_to_provider(ctx.attr.exports)

jars2labels = _collect_jar_labels(ctx)
_add_labels_of_current_code_jars(depset(transitive=[jars_provider.full_compile_jars, exports_provider.full_compile_jars]), ctx.label, jars2labels) #last to override the label of the export compile jars to the current target
Copy link
Member

Choose a reason for hiding this comment

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

I think you want "regular" compile jars here and not "full"

transitive_compile_jars = []
runtime_jars = []
compile_jars = []
def _labels_to_provider(labels):
Copy link
Member

Choose a reason for hiding this comment

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

labels here is overloaded. I thought it's the actual labels. Any other ideas?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This the purpose of this method - take a list of labels and merge them to a single JavaInfo

if JavaInfo in jar:
fail("jars must contain only jar files")

providers.append(_jar_to_provider(jar.files.to_list()[0]))
Copy link
Member

Choose a reason for hiding this comment

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

why only take the first file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

WIP - the plan is to use only the code files

return java_common.merge(providers)

def _jar_to_provider(jar):
return JavaInfo(
Copy link
Member

Choose a reason for hiding this comment

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

Why are you building the JavaInfo like this (without the deps, exports,runtime_deps)?
I think that's not the correct semantics

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At this point there is only a jar file - not a JavaInfo

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.

I think I'm not done yet but I have a hunch that the changes that might come from the comments I've added so far will change the code greatly so I'm not sure I should continue before we discuss some more

providers = []
for jar in jars:
if JavaInfo in jar:
fail("jars must contain only jar files")
Copy link
Member

Choose a reason for hiding this comment

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

should we have a test for this negative case?

Copy link
Member

Choose a reason for hiding this comment

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

and also the error message is about what it should contain but the check is about whether or not this has JavaInfo.
Isn't there a mix? Maybe have a failure here to say targets of jvm_rules aren't allowed here and add another check below to see that the files are only jar files

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.

Thanks for this cleanup. Is it still a WIP?

Can you merge with master? There have been a number of merged PRs.

@ittaiz
Copy link
Member

ittaiz commented Jun 30, 2018 via email

@johnynek
Copy link
Member

johnynek commented Jun 30, 2018 via email

@ittaiz
Copy link
Member

ittaiz commented Jun 30, 2018 via email

@johnynek
Copy link
Member

@anchlovi what is the status here?

I think JavaInfo issues have been fixed, if I'm not mistaken. Would you have time to merge master and see what the state is?

I appreciate your help.

@johnynek
Copy link
Member

should we close this one or will you have time to merge master and take another stab at it.

@ittaiz is this one of your team?

@ittaiz
Copy link
Member

ittaiz commented Jul 13, 2019

Shachar is indeed on the build at Wix. I'll close this as #781 handled scala_import as well

@ittaiz ittaiz closed this Jul 13, 2019
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.

4 participants