Skip to content
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

Some published sources JARs do not have the correct structure #3474

Closed
aukevanleeuwen opened this issue Sep 21, 2023 · 10 comments
Closed

Some published sources JARs do not have the correct structure #3474

aukevanleeuwen opened this issue Sep 21, 2023 · 10 comments

Comments

@aukevanleeuwen
Copy link

Steps to reproduce

  1. Find one of the affected (see 'Remark' below) source artifacts on maven central: https://repo1.maven.org/maven2/org/junit/jupiter/junit-jupiter-engine/5.10.0/junit-jupiter-engine-5.10.0-sources.jar
  2. Observe that the source jar contains a top level main folder that shouldn't be there: image

Context

  • Used versions (Jupiter/Vintage/Platform): 5.10.0
  • Build Tool/IDE: N/A

Remark

Not all source jars are wrong. I've tried to fix it myself and issue a PR, but I don't understand exactly where it's going wrong.

To the best of my skills I think I can narrow it down to everywhere where the plugin id("junitbuild.kotlin-library-conventions") is used rather than id("junitbuild.java-library-conventions").

I tried to narrow it down with:

  1. Do a ./gradlew publishToMavenLocal
  2. Create small bash script that will output if main/ directory has been found in the given jar file:
    ❯ cat a.sh
    #!/usr/bin/env bash
    
    zipinfo -1 "$1" main/ 2>&1 | awk '{ print "'"$1"': " $0 }'
  3. Run a find on the local repository, excluding the ones where a warning was printed that main was not found:
    $ ~/.m2/repository/org/junit
    ❯ find . -name '*SNAPSHOT-sources.jar' -exec ./a.sh {} \; | grep -v "filename not matched:  main"
    ./jupiter/junit-jupiter-api/5.11.0-SNAPSHOT/junit-jupiter-api-5.11.0-SNAPSHOT-sources.jar: main/
    ./jupiter/junit-jupiter-params/5.11.0-SNAPSHOT/junit-jupiter-params-5.11.0-SNAPSHOT-sources.jar: main/
    ./jupiter/junit-jupiter-engine/5.11.0-SNAPSHOT/junit-jupiter-engine-5.11.0-SNAPSHOT-sources.jar: main/
@sbrannen
Copy link
Member

Thanks for bringing this to our attention, @aukevanleeuwen! 👍

I confirmed the claims for junit-jupiter-engine-5.10.0-sources.jar and also noticed that module-info.java is missing which is present in junit-jupiter-engine-5.9.3-sources.jar.

We'll see if we can fix this for the upcoming 5.10.1 release.

@sbrannen sbrannen changed the title Some source .jar files are not having the correct structure Some published sources JARs do not have the correct structure Sep 22, 2023
@sbrannen sbrannen added this to the 5.10.1 milestone Sep 22, 2023
@marcphilipp marcphilipp self-assigned this Sep 25, 2023
@marcphilipp
Copy link
Member

I ran a git bisect:

$ git bisect start r5.10.0 r5.9.3
$ git bisect run sh -c "gw :jJE:clean :jJE:pTML --no-build-cache -x :junit-jupiter-engine:test && ! (unzip -t junit-jupiter-engine/build/libs/junit-jupiter-engine-*-sources.jar | grep main)"
c3e3c8b82cefea0ccedc47aa1098498ea9a911b8 is the first bad commit
commit c3e3c8b82cefea0ccedc47aa1098498ea9a911b8
Author: Marc Philipp <mail@marcphilipp.de>
Date:   Thu Jun 15 08:25:58 2023 +0200

    Upgradle to 8.2-rc-2 (#3351)

 gradle/wrapper/gradle-wrapper.jar        | Bin 62076 -> 63282 bytes
 gradle/wrapper/gradle-wrapper.properties |   5 +++--
 gradlew                                  |   5 ++++-
 3 files changed, 7 insertions(+), 3 deletions(-)
bisect found first bad commit

@marcphilipp
Copy link
Member

Looks like this is the root cause: https://youtrack.jetbrains.com/issue/kt-54207

@aukevanleeuwen
Copy link
Author

👍 Thanks! That would have taken me a lot longer to figure out for sure ;-) I'm still a bit confused how that bisect ended up on that commit even.

Either way: I've also verified it on a publishToMavenLocal. Thanks again.

@marcphilipp
Copy link
Member

I'm still a bit confused how that bisect ended up on that commit even.

The upgrade from Gradle 8.1 to 8.2-rc-2 included an upgrade of the Kotlin plugin which now seems to be registering an extra kotlinSourcesJar task.

@scordio

This comment was marked as outdated.

@aukevanleeuwen
Copy link
Author

aukevanleeuwen commented Oct 3, 2023

@scordio : it's scheduled for v5.10.1, so it's not fixed for 5.10.0.

Now that I'm reading your question again: I think the answer is: yes, it's supposed to be fixed for all these cases.

@aukevanleeuwen
Copy link
Author

EDIT: I experienced also the same with junit-jupiter-api-5.10.0-sources:

@scordio : indeed, all those 3 were mentioned in the original description under 'Remark' as well.

@scordio

This comment was marked as outdated.

@marcphilipp
Copy link
Member

Yes, it's fixed for all of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants