Skip to content

Use java_common.run_ijar #538

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

Merged
merged 6 commits into from
Jun 27, 2018
Merged

Use java_common.run_ijar #538

merged 6 commits into from
Jun 27, 2018

Conversation

johnynek
Copy link
Contributor

here is a supported function to run ijar:

https://docs.bazel.build/versions/master/skylark/lib/java_common.html#run_ijar

I don't know at the moment when it was introduced because bazel docs are sadly unversioned. It does allow us to delete a fair amount of code, so I think it is worth it.

cc @ittaiz @ianoc

@johnynek
Copy link
Contributor Author

looks like run_ijar was added in 0.14.1.


ijar = None
# compile the java now
Copy link
Contributor

Choose a reason for hiding this comment

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

this comment from the diff looks to be around the ijar rather than the java?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

well, yeah, it is before the ijar which is before java. Due to CI slowness, I'll pick this up in the next PR (the merge of #524 with this).

@ianoc-stripe
Copy link
Contributor

small nit on the comment, otherwise lgtm

Copy link
Contributor

@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.

LGTM

test_target='//test_expect_failure/missing_direct_deps/internal_deps:transitive_dependency_java_user'

expected_message="$dependency_file.*$test_target"
Copy link
Contributor

Choose a reason for hiding this comment

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

this doesn't sound like the right approach. Can you share what the error message was when it failed? this expected message is too generic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it no longer prints the ijar. Which you shouldn't have as far as I can tell. Users shouldn't need to worry about it.

It still fails, and if you follow the recommendation, it still gives the correct next step.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PS: I'm pretty convinced we need to move the jdeps approach and away from this custom approach that runs at analysis time (vs build time).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

can you explain why you shouldn't have the ijar?

Re approach:

  1. As far as I understand they are trying to get rid of jdeps since the params passing is too expensive and instead just stamp each jar with a canonical label and if an infraction is spotted pay the cost of extracting the label from the jar.
  2. Our approach is very similar to the jdeps one where we only warn/error in build time (in the compiler plugin); Our difference is in how we collect the list of labels/jars to pass.
  3. We want to align ourselves with the mainstream approach and I've been working with Google people about a shared design for this

Copy link
Contributor

Choose a reason for hiding this comment

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

btw, also the test that fails now was changed in #505 and it looks like that for it too the above assertion should be used

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay, I see how I goofed. I think this is better. What do you think of the current change?

Copy link
Contributor

Choose a reason for hiding this comment

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

Wrote on the commit. I don’t think it’s enough.
IMHO the point is to show the transitive_target and the test_target since they’re both related

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay, I pushed one more time.

These tests don't work when run multiple times, which is annoying. It looks like you are relying on the side effect of building, which doesn't happen on the second build with a warn mode.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree it’s annoying. There’s no way to re trigger warnings and this issue on CI only started happening with the caching which is pretty recent. The real solution is bazel integration testing since we have a reproducible sandbox for each scenario

@ittaiz
Copy link
Contributor

ittaiz commented Jun 27, 2018

@or-shachar @natansil fyi re changes to our fix strict deps script

@ianoc-stripe
Copy link
Contributor

Given the assertion looks to be @ittaiz one, lgtm

@johnynek johnynek merged commit 7240d24 into master Jun 27, 2018
@johnynek johnynek deleted the oscar/use_run_ijar branch June 27, 2018 21:32
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