ijar: fix manifest sections handling#12771
ijar: fix manifest sections handling#12771liucijus wants to merge 5 commits intobazelbuild:masterfrom
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? |
comius
left a comment
There was a problem hiding this comment.
LGTM, except that I would like to also have a test where Target-Label is in the manifest with sections and it is skipped.
|
|
||
| genrule( | ||
| name = "jar_with_manifest_sections", | ||
| srcs = ["jar-with-manifest-sections.jar"], |
There was a problem hiding this comment.
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. |
|
|
||
| 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.
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.MFcontent is appended - this way sections data is preserved.