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

workaround issues with the signing setup #404

Merged
merged 1 commit into from Sep 5, 2022
Merged

Conversation

gabrielittner
Copy link
Collaborator

closes #387
closes #338

Comment on lines +74 to +77
project.tasks.withType(PublishToMavenRepository::class.java).configureEach { publishTask ->
if (publishTask.name.endsWith("ToMavenCentralRepository")) {
publishTask.dependsOn(createRepository)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Found out that PublishToMavenRepository is in the public API so we can use it here as a filter which makes it nicer than afterEvaluate

Comment on lines +125 to +133
// TODO: replace with the following line after https://github.com/gradle/gradle/issues/21857 is fixed
// project.gradleSigning.sign(project.gradlePublishing.publications)
project.gradlePublishing.publications.withType(MavenPublication::class.java).all { publication ->
val task = project.tasks.findByName("sign${publication.name.capitalize()}Publication")
if (task == null) {
project.gradleSigning.sign(publication)
}
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Only call sign on a publication if there is no signing task for it yet which fixes the issue when other plugins already called it.

Comment on lines +135 to +138
// TODO: remove after https://youtrack.jetbrains.com/issue/KT-46466 is fixed
project.tasks.withType(AbstractPublishToMaven::class.java) { publishTask ->
publishTask.dependsOn(project.tasks.withType(Sign::class.java))
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Workaround taken from the linked ticket

@gabrielittner gabrielittner merged commit 86b2c8f into master Sep 5, 2022
@vanniktech vanniktech deleted the signing-issues branch September 5, 2022 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants