From 4fabf14b6a1c4df2dd9adb2998c4950ca17f36b7 Mon Sep 17 00:00:00 2001 From: Matthew Haughton <3flex@users.noreply.github.com> Date: Wed, 22 Mar 2023 10:47:51 +1100 Subject: [PATCH 1/2] Avoid task configuration when setting up githubRelease task --- .../breadmoirai/githubreleaseplugin/GithubReleasePlugin.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/groovy/com/github/breadmoirai/githubreleaseplugin/GithubReleasePlugin.groovy b/src/main/groovy/com/github/breadmoirai/githubreleaseplugin/GithubReleasePlugin.groovy index 4ad501e..a41a011 100644 --- a/src/main/groovy/com/github/breadmoirai/githubreleaseplugin/GithubReleasePlugin.groovy +++ b/src/main/groovy/com/github/breadmoirai/githubreleaseplugin/GithubReleasePlugin.groovy @@ -34,7 +34,7 @@ class GithubReleasePlugin implements Plugin { def ext = project.extensions.create('githubRelease', GithubReleaseExtension, project) - task = project.tasks.create('githubRelease', GithubReleaseTask) { + task = project.tasks.register('githubRelease', GithubReleaseTask) { it.with { setAuthorization ext.authorizationProvider setOwner ext.ownerProvider From 514c167227d60b7499dba89e300336b2932ca2a2 Mon Sep 17 00:00:00 2001 From: Matthew Haughton <3flex@users.noreply.github.com> Date: Wed, 22 Mar 2023 10:52:21 +1100 Subject: [PATCH 2/2] Remove unnecessary private properties --- .../githubreleaseplugin/GithubReleasePlugin.groovy | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/groovy/com/github/breadmoirai/githubreleaseplugin/GithubReleasePlugin.groovy b/src/main/groovy/com/github/breadmoirai/githubreleaseplugin/GithubReleasePlugin.groovy index a41a011..c32e4b6 100644 --- a/src/main/groovy/com/github/breadmoirai/githubreleaseplugin/GithubReleasePlugin.groovy +++ b/src/main/groovy/com/github/breadmoirai/githubreleaseplugin/GithubReleasePlugin.groovy @@ -25,16 +25,11 @@ import org.slf4j.LoggerFactory class GithubReleasePlugin implements Plugin { - private Project project - private GithubReleaseTask task - @Override void apply(Project project) { - this.project = project - def ext = project.extensions.create('githubRelease', GithubReleaseExtension, project) - task = project.tasks.register('githubRelease', GithubReleaseTask) { + project.tasks.register('githubRelease', GithubReleaseTask) { it.with { setAuthorization ext.authorizationProvider setOwner ext.ownerProvider @@ -52,7 +47,7 @@ class GithubReleasePlugin implements Plugin { setDryRun ext.dryRunProvider setApiEndpoint ext.apiEndpointProvider } - } as GithubReleaseTask + } } }