Skip to content

Commit

Permalink
Refactor PaketPack task properties
Browse files Browse the repository at this point in the history
Description
===========

The internal usage of `packageID` property was confusing. This pr
changes the handling of `packageID` provided by `paket.template`

Changes
=======

![IMPROVE] `PaketPack` properties
  • Loading branch information
Larusso committed Mar 13, 2018
1 parent e72eb4e commit 7b9dcb0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Expand Up @@ -107,9 +107,8 @@ class PaketPackPlugin implements Plugin<Project> {

packTask = tasks.create(taskName, PaketPack.class)
packTask.group = BasePlugin.BUILD_GROUP
packTask.description = "Pack package ${templateReader.getPackageId()}"
packTask.description = "Pack package ${packageID}"
packTask.templateFile = file
packTask.packageId = packageID

PublishArtifact artifact = PaketPublishingArtifact.fromTask(packTask)

Expand Down
Expand Up @@ -27,7 +27,7 @@ class PaketPublishingArtifact implements PublishArtifact {

@Override
String getName() {
return task.packageId
return task.getPackageId()
}

@Override
Expand Down
13 changes: 7 additions & 6 deletions src/main/groovy/wooga/gradle/paket/pack/tasks/PaketPack.groovy
Expand Up @@ -39,16 +39,19 @@ import wooga.gradle.paket.base.utils.internal.PaketTemplate
*/
class PaketPack extends AbstractPaketTask {

@Internal
def packageId
/**
* @return the packageId of the nuget to be packed.
*/
String getPackageId() {
new PaketTemplate(getTemplateFile()).getPackageId()
}

/**
* The nuget package version.
*/
@Input
String version


@Optional
@InputFile
def templateFile
Expand All @@ -73,9 +76,7 @@ class PaketPack extends AbstractPaketTask {
*/
@OutputFile
File getOutputFile() {
def templateReader = new PaketTemplate(getTemplateFile())
def packageID = templateReader.getPackageId()
project.file({"$outputDir/${packageID}.${getVersion()}.nupkg"})
project.file({"$outputDir/${getPackageId()}.${getVersion()}.nupkg"})
}

PaketPack() {
Expand Down

0 comments on commit 7b9dcb0

Please sign in to comment.