From e0d331d4d48d040ff8477d44f00ae948549506a3 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Wed, 19 May 2021 15:24:24 +0300 Subject: [PATCH] Fix publication task dependency --- .../ru/mipt/npm/gradle/KScienceProjectPlugin.kt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt index 9b1caaa..9a4e0d2 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt @@ -35,8 +35,9 @@ class KSciencePublishingExtension(val project: Project) { project.addGithubPublishing(githubOrg, githubProject) if (publish) { - val publicationTask = project.tasks.getByName("publish${project.publicationTarget}ToGithubRepository") - releaseTask?.dependsOn(publicationTask) + project.tasks.findByName("publish${project.publicationTarget}ToGithubRepository")?.let {publicationTask-> + releaseTask?.dependsOn(publicationTask) + } } } @@ -51,8 +52,9 @@ class KSciencePublishingExtension(val project: Project) { require(initializedFlag) { "The project vcs is not set up use 'vcs' method to do so" } project.addSpacePublishing(spaceRepo) if (publish) { - val publicationTask = project.tasks.getByName("publish${project.publicationTarget}ToSpaceRepository") - releaseTask?.dependsOn(publicationTask) + project.tasks.findByName("publish${project.publicationTarget}ToSpaceRepository")?.let { publicationTask -> + releaseTask?.dependsOn(publicationTask) + } } } @@ -69,8 +71,10 @@ class KSciencePublishingExtension(val project: Project) { require(initializedFlag) { "The project vcs is not set up use 'vcs' method to do so" } project.addSonatypePublishing() if (publish) { - val publicationTask = project.tasks.getByName("publish${project.publicationTarget}ToSonatypeRepository") - releaseTask?.dependsOn(publicationTask) + project.tasks.findByName("publish${project.publicationTarget}ToSonatypeRepository") + ?.let { publicationTask -> + releaseTask?.dependsOn(publicationTask) + } } } }