From cf7c6fe1d7ac3129853206ce67e0459150e40364 Mon Sep 17 00:00:00 2001 From: Manfred Endres <2523575+Larusso@users.noreply.github.com> Date: Thu, 5 May 2022 20:18:03 +0200 Subject: [PATCH] Update net.wooga.plugins to version 3.x (#80) Description =========== This update will bring the plugin `net.wooga.plugins` to version `3.x`. With this change the groupname of the gradle plugin will change during publish so I thought it might be a good idea to change the project name as well so the groupname won't include the `atlas` name. The old groupname `gradle.plugin.net.wooga.gradle:atlas-paket` would become `net.wooga.gradle:paket`. This patch also includes all changes needed for the new plugin metadata description. Changes ======= * ![UPDATE] `net.wooga.plugins` to version `3.x` range * ![CHANGE] project name and remove `atlas` term * ![IMPROVE] plugin publish metadata --- build.gradle | 9 +++- settings.gradle | 2 +- .../base/tasks/PaketDependenciesTask.groovy | 43 ++++++------------- .../tasks/internal/AbstractPaketTask.groovy | 10 ++--- .../gradle/paket/pack/tasks/PaketPack.groovy | 1 + .../paket/publish/tasks/PaketPush.groovy | 10 +++-- .../net.wooga.paket-get.properties | 18 -------- .../net.wooga.paket-pack.properties | 18 -------- .../net.wooga.paket-publish.properties | 18 -------- .../net.wooga.paket-unity.properties | 18 -------- .../gradle-plugins/net.wooga.paket.properties | 18 -------- 11 files changed, 36 insertions(+), 129 deletions(-) delete mode 100644 src/main/resources/META-INF/gradle-plugins/net.wooga.paket-get.properties delete mode 100644 src/main/resources/META-INF/gradle-plugins/net.wooga.paket-pack.properties delete mode 100644 src/main/resources/META-INF/gradle-plugins/net.wooga.paket-publish.properties delete mode 100644 src/main/resources/META-INF/gradle-plugins/net.wooga.paket-unity.properties delete mode 100644 src/main/resources/META-INF/gradle-plugins/net.wooga.paket.properties diff --git a/build.gradle b/build.gradle index cd678f5..82a6fcf 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ */ plugins { - id "net.wooga.plugins" version "2.3.0" + id "net.wooga.plugins" version "3.2.0" id 'net.wooga.snyk' version '0.10.0' id "net.wooga.snyk-gradle-plugin" version "0.2.0" id "net.wooga.cve-dependency-resolution" version "0.4.0" @@ -29,36 +29,43 @@ pluginBundle { website = 'https://wooga.github.io/atlas-paket/' vcsUrl = 'https://github.com/wooga/atlas-paket' tags = ['Paket', 'c-sharp', 'nuget'] +} +gradlePlugin { plugins { paket { id = 'net.wooga.paket' displayName = 'Gradle Paket plugin' description = 'This plugin provides tasks for retrieving,packing and publishing Nuget packages via Paket' + implementationClass = 'wooga.gradle.paket.PaketPlugin' } paketGet { id = 'net.wooga.paket-get' displayName = 'Gradle Paket Get plugin' description = 'This plugin provides tasks for retrieving Nuget packages via Paket' + implementationClass = 'wooga.gradle.paket.get.PaketGetPlugin' } paketPack { id = 'net.wooga.paket-pack' displayName = 'Gradle Paket Pack plugin' description = 'This plugin provides tasks for packing Nuget packages via Paket' + implementationClass = 'wooga.gradle.paket.pack.PaketPackPlugin' } paketPublish { id = 'net.wooga.paket-publish' displayName = 'Gradle Paket Publish plugin' description = 'This plugin provides tasks for publishing Nuget packages via Paket' + implementationClass = 'wooga.gradle.paket.publish.PaketPublishPlugin' } paketUnity { id = 'net.wooga.paket-unity' displayName = 'Gradle Paket Unity3D plugin' description = 'This plugin provides tasks to apply the Paket.Unity3D extension' + implementationClass = 'wooga.gradle.paket.unity.PaketUnityPlugin' } } } diff --git a/settings.gradle b/settings.gradle index a54472a..3dd8f5b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -28,4 +28,4 @@ pluginManagement { } } -rootProject.name = 'atlas-paket' +rootProject.name = 'paket' diff --git a/src/main/groovy/wooga/gradle/paket/base/tasks/PaketDependenciesTask.groovy b/src/main/groovy/wooga/gradle/paket/base/tasks/PaketDependenciesTask.groovy index c9220b0..17a7dc6 100644 --- a/src/main/groovy/wooga/gradle/paket/base/tasks/PaketDependenciesTask.groovy +++ b/src/main/groovy/wooga/gradle/paket/base/tasks/PaketDependenciesTask.groovy @@ -22,7 +22,6 @@ import org.gradle.api.Task import org.gradle.api.specs.Spec import org.gradle.api.tasks.Input import org.gradle.api.tasks.Nested -import org.gradle.api.tasks.Optional import org.gradle.api.tasks.OutputFile import org.gradle.api.tasks.TaskAction import wooga.gradle.paket.base.PaketBasePlugin @@ -58,39 +57,26 @@ class PaketDependenciesTask extends DefaultTask { } @Nested - private PaketDependencyMacros getMacros() { + PaketDependencyMacros getMacros() { macros } - @Nested private PaketDependencyConfigurationContainer getDependencyConfigurationContainer() { dependencyHandler.configurationContainer } - @Nested private List getRepositories() { - project.repositories.findAll {it instanceof NugetArtifactRepository} as List + project.repositories.findAll { it instanceof NugetArtifactRepository } as List } private String content - /** - * - * @return - */ - @Optional @Input - private String getContent() { - def v = project.gradle.gradleVersion.split(/\./).collect {Integer.parseInt(it)} - if((v[0] == 4 && v[1] >= 7) || v[0] > 4) { - content = null - } - else { - if(!content) { - def w = new StringWriter() - writeDependencies(w) - content = w.toString() - } + protected String getContent() { + if (!content) { + def w = new StringWriter() + writeDependencies(w) + content = w.toString() } content } @@ -127,7 +113,7 @@ class PaketDependenciesTask extends DefaultTask { } protected static void writeGroup(PaketDependencyConfiguration group, Writer writer, boolean printGroupStatement = true, String indent = ' ') { - if(printGroupStatement) { + if (printGroupStatement) { writer.println() writer.println("group ${group.getName().capitalize()}") } @@ -139,22 +125,21 @@ class PaketDependenciesTask extends DefaultTask { protected void writeGroups(Writer writer) { def main = configurationContainer.getByName(PaketDependencyHandler.MAIN_GROUP) - writeGroup(main, writer, false,'') + writeGroup(main, writer, false, '') - configurationContainer.findAll {it.name != 'main'}.each { + configurationContainer.findAll { it.name != 'main' }.each { writeGroup(it, writer) } } protected void writeSources(Writer writer) { getRepositories().each { repo -> - if(repo.url) { + if (repo.url) { writer.print("source ${repo.url}") def credentials = repo.getCredentials() - if(credentials.username && credentials.password) { + if (credentials.username && credentials.password) { writer.println(" username: \"${credentials.username}\" password: \"${credentials.password}\"") - } - else{ + } else { writer.println() } } else { @@ -171,7 +156,7 @@ class PaketDependenciesTask extends DefaultTask { protected void writeMacros(Writer writer) { def frameworks = getMacros().frameworks - if(frameworks) { + if (frameworks) { writer.println("framework: ${frameworks.join(", ")}") } } diff --git a/src/main/groovy/wooga/gradle/paket/base/tasks/internal/AbstractPaketTask.groovy b/src/main/groovy/wooga/gradle/paket/base/tasks/internal/AbstractPaketTask.groovy index b18a633..0de7ddc 100644 --- a/src/main/groovy/wooga/gradle/paket/base/tasks/internal/AbstractPaketTask.groovy +++ b/src/main/groovy/wooga/gradle/paket/base/tasks/internal/AbstractPaketTask.groovy @@ -29,10 +29,8 @@ abstract class AbstractPaketTask extends Convention static Logger logger = Logging.getLogger(AbstractPaketTask) - @Internal private final Class taskType - @Internal protected Boolean supportLogfile = true @InputFile @@ -54,18 +52,20 @@ abstract class AbstractPaketTask extends Convention this.logFile = value } + protected String paketCommand + @Optional @Input - protected String paketCommand + protected String getPaketCommand() { + paketCommand + } @SkipWhenEmpty @InputFiles FileCollection dependenciesFile - @Internal protected ByteArrayOutputStream stdOut - @Internal protected ByteArrayOutputStream stdErr protected ArrayList arguments = [] diff --git a/src/main/groovy/wooga/gradle/paket/pack/tasks/PaketPack.groovy b/src/main/groovy/wooga/gradle/paket/pack/tasks/PaketPack.groovy index a8e4365..1f7e43b 100644 --- a/src/main/groovy/wooga/gradle/paket/pack/tasks/PaketPack.groovy +++ b/src/main/groovy/wooga/gradle/paket/pack/tasks/PaketPack.groovy @@ -43,6 +43,7 @@ class PaketPack extends AbstractPaketTask { /** * @return the packageId of the nuget to be packed. */ + @Input String getPackageId() { new PaketTemplate(getTemplateFile()).getPackageId() } diff --git a/src/main/groovy/wooga/gradle/paket/publish/tasks/PaketPush.groovy b/src/main/groovy/wooga/gradle/paket/publish/tasks/PaketPush.groovy index 3715016..4a9233f 100644 --- a/src/main/groovy/wooga/gradle/paket/publish/tasks/PaketPush.groovy +++ b/src/main/groovy/wooga/gradle/paket/publish/tasks/PaketPush.groovy @@ -84,7 +84,7 @@ class PaketPush extends AbstractPaketTask { } } - def inputFile + private def inputFile /** * Returns the path to the .nupkg file @@ -92,10 +92,14 @@ class PaketPush extends AbstractPaketTask { * @return path to the .nupkg file */ @InputFile - File getinputFile() { + File getInputFile() { project.file inputFile } + void setInputFile(Object value) { + inputFile = value + } + def endpoint @Optional @@ -134,6 +138,6 @@ class PaketPush extends AbstractPaketTask { args << "endpoint" << getEndpoint() } - args << "file" << getinputFile().path + args << "file" << getInputFile().path } } diff --git a/src/main/resources/META-INF/gradle-plugins/net.wooga.paket-get.properties b/src/main/resources/META-INF/gradle-plugins/net.wooga.paket-get.properties deleted file mode 100644 index 8050f70..0000000 --- a/src/main/resources/META-INF/gradle-plugins/net.wooga.paket-get.properties +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright 2018 Wooga GmbH -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# - -implementation-class=wooga.gradle.paket.get.PaketGetPlugin \ No newline at end of file diff --git a/src/main/resources/META-INF/gradle-plugins/net.wooga.paket-pack.properties b/src/main/resources/META-INF/gradle-plugins/net.wooga.paket-pack.properties deleted file mode 100644 index 23606b7..0000000 --- a/src/main/resources/META-INF/gradle-plugins/net.wooga.paket-pack.properties +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright 2018 Wooga GmbH -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# - -implementation-class=wooga.gradle.paket.pack.PaketPackPlugin \ No newline at end of file diff --git a/src/main/resources/META-INF/gradle-plugins/net.wooga.paket-publish.properties b/src/main/resources/META-INF/gradle-plugins/net.wooga.paket-publish.properties deleted file mode 100644 index 6078a96..0000000 --- a/src/main/resources/META-INF/gradle-plugins/net.wooga.paket-publish.properties +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright 2018 Wooga GmbH -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# - -implementation-class=wooga.gradle.paket.publish.PaketPublishPlugin \ No newline at end of file diff --git a/src/main/resources/META-INF/gradle-plugins/net.wooga.paket-unity.properties b/src/main/resources/META-INF/gradle-plugins/net.wooga.paket-unity.properties deleted file mode 100644 index 7c98d3b..0000000 --- a/src/main/resources/META-INF/gradle-plugins/net.wooga.paket-unity.properties +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright 2018 Wooga GmbH -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# - -implementation-class=wooga.gradle.paket.unity.PaketUnityPlugin \ No newline at end of file diff --git a/src/main/resources/META-INF/gradle-plugins/net.wooga.paket.properties b/src/main/resources/META-INF/gradle-plugins/net.wooga.paket.properties deleted file mode 100644 index 0f300c7..0000000 --- a/src/main/resources/META-INF/gradle-plugins/net.wooga.paket.properties +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright 2018 Wooga GmbH -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# - -implementation-class=wooga.gradle.paket.PaketPlugin \ No newline at end of file