-
Notifications
You must be signed in to change notification settings - Fork 281
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
Fix resource priority under name collision #1456
Fix resource priority under name collision #1456
Conversation
@tanishiking indeed you're right, this is runtime behavior. I would look for problem in collect jars phase. |
It looks like the problem is around here in phase_compile rjars = depset(out.full_jars, transitive = [rjars]), where To guarantee the left-to-right order, changed the order to preorder |
2992db9
to
c7add52
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @tanishiking!
With topological order, there's no left-to-right order guarantee https://bazel.build/rules/lib/depset As a result, `test/shell/test_misc`'s `test_multi_service_manifest` fails because the order of `exepected_service_manifest.txt` reverses.
447dec2
to
ae85cde
Compare
(Just force-pushed the change on test description) https://github.com/bazelbuild/rules_scala/pull/1456/files#diff-96060316d4c081f3a4d50a995f83805f403e50c478da6c2bd14c26068f84666cR7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @tanishiking
Description
This PR adds a failing test for #1455
@liucijus mentioned this issue occurs around here https://github.com/bazelbuild/rules_scala/blob/master/src/java/io/bazel/rulesscala/scalac/ScalacWorker.java#L65-L71 but re-ordering those lines doesn't work (I guess because re-ordering them control the priority of
resource
,resource_jars
, andclasspath_resources
. It's not about resource name crash with things in JAR files).My hunch is this is caused because the executable file has a "wrong" order of CLASSPATH.
For example,
bazel-bin/test/src/main/scala/scalarules/test/duplicated_resources/child/child
(generated by$ bazel build //test/src/main/scala/scalarules/test/duplicated_resources/child
) contains the followingCLASSPATH
order.(see the definition of the target "child" here )
parent.jar
is first, andchild.jar
is last.I think we can fix this by moving
child.jar
to the first ofCLASSPATH
is the fix. Actually, movingchild.jar
to the place beforeparent.jar
fixed the issue.What do you think?
Motivation
see #1455