-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
ijar: fix manifest sections handling #12771
ijar: fix manifest sections handling #12771
Conversation
@cushon wdyt? Rather small PR which could help us out at rules_scala |
Can anyone help with this? @liucijus stepped up and not only reported the issue but also sent a small PR and it's just sitting here. |
@aiuto process wise and bazel community- how long should a community contributor wait before getting a review? Especially for a small and confined PR? |
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.
LGTM, except that I would like to also have a test where Target-Label is in the manifest with sections and it is skipped.
third_party/ijar/test/BUILD
Outdated
@@ -144,6 +144,14 @@ genrule( | |||
tools = ["//third_party/ijar"], | |||
) | |||
|
|||
genrule( | |||
name = "jar_with_manifest_sections", | |||
srcs = ["jar-with-manifest-sections.jar"], |
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.
For reference:
Archive: jar-with-manifest-sections.jar
Length Date Time Name
--------- ---------- ----- ----
1382 2010-01-01 05:00 AnnotatedClass.class
476 2010-01-01 05:00 Annotations.class
381 2010-01-01 05:00 Annotations$ParametersOnlyAnnotation.class
468 2010-01-01 05:00 Annotations$RuntimeInvisible.class
561 2010-01-01 05:00 Annotations$RuntimeVisible.class
0 2010-01-01 05:00 META-INF/
96 2021-01-04 09:23 META-INF/MANIFEST.MF
19 2018-03-29 15:53 textfile.txt
--------- -------
3383 8 files
$ cat META-INF/MANIFEST.MF
Manifest-Version: 1.0
Created-By: test-code
Name: foo
Foo: bar
Name: baz
Another: bar
@cushon, do you think this could have any impact on the other Java code? My best guess is that it doesn't, because before the patch manifests with sections would just get mangled. |
third_party/ijar/test/BUILD
Outdated
|
||
genrule( | ||
name = "jar_with_target_label_and_manifest_sections", | ||
srcs = ["jar-with-target-label-and-manifest-sections.jar"], |
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.
For reference:
Archive: jar-with-target-label-and-manifest-sections.jar
Length Date Time Name
--------- ---------- ----- ----
1382 2010-01-01 05:00 AnnotatedClass.class
476 2010-01-01 05:00 Annotations.class
381 2010-01-01 05:00 Annotations$ParametersOnlyAnnotation.class
468 2010-01-01 05:00 Annotations$RuntimeInvisible.class
561 2010-01-01 05:00 Annotations$RuntimeVisible.class
0 2010-01-01 05:00 META-INF/
122 2021-01-29 08:19 META-INF/MANIFEST.MF
19 2018-03-29 15:53 textfile.txt
--------- -------
3409 8 files
$ cat META-INF/MANIFEST.MF
Manifest-Version: 1.0
Created-By: test-code
Target-Label: //not:this
Name: foo
Foo: bar
Name: baz
Another: bar
Internal linter says: ".jar files are no longer allowed in third_party." and prevents me from adding new .jar file (while old ones are fine). Bazel should be able to generate those .jars from sources, but it's another curve ball. |
I assume you want a test to show that existing label is update, right? If I'm not missing anything, it's the way ijar works. |
Correct. I already reviewed it, it's ok. |
Do you have resource/will to fix this as well? |
I'll look into it |
Done |
Fixes #12730
Important changes:
MANIFEST.MF
content is appended - this way sections data is preserved.