-
-
Notifications
You must be signed in to change notification settings - Fork 287
Fix resource priority under name collision #1456
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
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
liucijus
left a comment
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 |
simuons
left a comment
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 followingCLASSPATHorder.(see the definition of the target "child" here )
parent.jaris first, andchild.jaris last.I think we can fix this by moving
child.jarto the first ofCLASSPATHis the fix. Actually, movingchild.jarto the place beforeparent.jarfixed the issue.What do you think?
Motivation
see #1455