Skip to content

Commit

Permalink
Update net.wooga.plugins to version 3.x (#80)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Larusso committed May 5, 2022
1 parent 24cb7ba commit cf7c6fe
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 129 deletions.
9 changes: 8 additions & 1 deletion build.gradle
Expand Up @@ -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"
Expand All @@ -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'
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Expand Up @@ -28,4 +28,4 @@ pluginManagement {
}
}

rootProject.name = 'atlas-paket'
rootProject.name = 'paket'
Expand Up @@ -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
Expand Down Expand Up @@ -58,39 +57,26 @@ class PaketDependenciesTask extends DefaultTask {
}

@Nested
private PaketDependencyMacros getMacros() {
PaketDependencyMacros getMacros() {
macros
}

@Nested
private PaketDependencyConfigurationContainer getDependencyConfigurationContainer() {
dependencyHandler.configurationContainer
}

@Nested
private List<NugetArtifactRepository> getRepositories() {
project.repositories.findAll {it instanceof NugetArtifactRepository} as List<NugetArtifactRepository>
project.repositories.findAll { it instanceof NugetArtifactRepository } as List<NugetArtifactRepository>
}

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
}
Expand Down Expand Up @@ -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()}")
}
Expand All @@ -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 {
Expand All @@ -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(", ")}")
}
}
Expand Down
Expand Up @@ -29,10 +29,8 @@ abstract class AbstractPaketTask<T extends AbstractPaketTask> extends Convention

static Logger logger = Logging.getLogger(AbstractPaketTask)

@Internal
private final Class<T> taskType

@Internal
protected Boolean supportLogfile = true

@InputFile
Expand All @@ -54,18 +52,20 @@ abstract class AbstractPaketTask<T extends 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<String> arguments = []
Expand Down
Expand Up @@ -43,6 +43,7 @@ class PaketPack extends AbstractPaketTask {
/**
* @return the packageId of the nuget to be packed.
*/
@Input
String getPackageId() {
new PaketTemplate(getTemplateFile()).getPackageId()
}
Expand Down
Expand Up @@ -84,18 +84,22 @@ class PaketPush extends AbstractPaketTask {
}
}

def inputFile
private def inputFile

/**
* Returns the path to the .nupkg file
*
* @return path to the .nupkg file
*/
@InputFile
File getinputFile() {
File getInputFile() {
project.file inputFile
}

void setInputFile(Object value) {
inputFile = value
}

def endpoint

@Optional
Expand Down Expand Up @@ -134,6 +138,6 @@ class PaketPush extends AbstractPaketTask {
args << "endpoint" << getEndpoint()
}

args << "file" << getinputFile().path
args << "file" << getInputFile().path
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit cf7c6fe

Please sign in to comment.