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

Allow .module files to be uploaded #843

Merged
merged 2 commits into from
Aug 13, 2022
Merged

Allow .module files to be uploaded #843

merged 2 commits into from
Aug 13, 2022

Conversation

ajoberstar
Copy link
Contributor

Gradle module files [1] are Gradle's alternative to POM files. They have a similar goal of defining the primary component
group/artifact/version that was published along with its dependencies. Additionally they allow declaring variants of the main
component that may have different dependencies or capabilities.

We're doing very minimal validation, parsing it as JSON and validating the top-level component group/module/version the upload path (as is already done for POM files).

It does look like Gradle uploads maven-metadata.xml last, so I believe this should fit in with how the existing validation works. I think this is the line in Gradle's code that implies the order.

[1] https://docs.gradle.org/current/userguide/publishing_gradle_module_metadata.html

Fixes #835

This was my first crack at it. Open to any feedback or changes that you'd like to see.

Copy link
Member

@tobias tobias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for implementing this! It looks good, I have just one point for discussion.

Comment on lines 165 to 169
(defn find-module [dir]
(->> dir
file-seq
(filter module?)
first))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: you could use clojars.util/filter-some here instead:

Suggested change
(defn find-module [dir]
(->> dir
file-seq
(filter module?)
first))
(defn find-module [dir]
(util/filter-some module? (file-seq dir)))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! Also added a new commit to do the same in find-pom for consistency. I can drop that commit, if you'd prefer not to have that function changed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for cleaning up that usage as well! We'll keep the commit.

project.clj Outdated Show resolved Hide resolved
src/clojars/gradle.clj Outdated Show resolved Hide resolved
Gradle module files [1] are Gradle's alternative to POM files. They
have a similar goal of defining the primary component
group/artifact/version that was published along with its
dependencies. Additionally they allow declaring variants of the main
component that may have different dependencies or capabilities.

We're doing very minimal validation, parsing it as JSON and validating
the top-level component group/module/version the upload path (as is
already done for POM files).

[1] https://docs.gradle.org/current/userguide/publishing_gradle_module_metadata.html

Fixes #835
For consistency with the find-module function.
@tobias tobias merged commit da9bd43 into clojars:main Aug 13, 2022
@tobias
Copy link
Member

tobias commented Aug 13, 2022

I merged and deployed this as part of Clojars 177. Let me know if you see any issues with it, and thanks for the contribution!

@ajoberstar ajoberstar deleted the gradle branch August 14, 2022 00:07
@ajoberstar
Copy link
Contributor Author

I merged and deployed this as part of Clojars 177. Let me know if you see any issues with it, and thanks for the contribution!

Just did a quick test and everything works great! I appreciate the quick reviews and feedback.

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

Successfully merging this pull request may close these issues.

Gradle publish to clojars failing with Http 400
2 participants