Skip to content

Commit c257b47

Browse files
committed
Make spec file optional in release task (for real this time)
1 parent e4f3a64 commit c257b47

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/main/groovy/io/nextflow/gradle/registry/RegistryClient.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ class RegistryClient {
139139
id: id,
140140
version: version,
141141
checksum: "sha512:${checksum}",
142-
spec: spec.exists() ? spec.text : null,
142+
spec: spec?.text,
143143
provider: provider
144144
]
145145
def jsonBody = JsonOutput.toJson(requestBody)

src/main/groovy/io/nextflow/gradle/registry/RegistryReleaseIfNotExistsTask.groovy

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ class RegistryReleaseIfNotExistsTask extends DefaultTask {
4545

4646
specFile = project.objects.fileProperty()
4747
specFile.convention(project.provider {
48-
buildDir.file("resources/main/META-INF/spec.json")
48+
def file = buildDir.file("resources/main/META-INF/spec.json").asFile
49+
file.exists() ? project.layout.projectDirectory.file(file.absolutePath) : null
4950
})
5051
}
5152

@@ -75,7 +76,8 @@ class RegistryReleaseIfNotExistsTask extends DefaultTask {
7576

7677
def registryUri = new URI(registryConfig.resolvedUrl)
7778
def client = new RegistryClient(registryUri, registryConfig.resolvedAuthToken)
78-
def result = client.releaseIfNotExists(project.name, version, project.file(specFile), project.file(zipFile), plugin.provider) as Map<String, Object>
79+
def specFileValue = specFile.isPresent() ? project.file(specFile) : null
80+
def result = client.releaseIfNotExists(project.name, version, specFileValue, project.file(zipFile), plugin.provider) as Map<String, Object>
7981

8082
if (result.skipped as Boolean) {
8183
// Plugin already exists - log info message and continue

src/main/groovy/io/nextflow/gradle/registry/RegistryReleaseTask.groovy

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ class RegistryReleaseTask extends DefaultTask {
4444

4545
specFile = project.objects.fileProperty()
4646
specFile.convention(project.provider {
47-
buildDir.file("resources/main/META-INF/spec.json")
47+
def file = buildDir.file("resources/main/META-INF/spec.json").asFile
48+
file.exists() ? project.layout.projectDirectory.file(file.absolutePath) : null
4849
})
4950
}
5051

@@ -72,7 +73,8 @@ class RegistryReleaseTask extends DefaultTask {
7273

7374
def registryUri = new URI(registryConfig.resolvedUrl)
7475
def client = new RegistryClient(registryUri, registryConfig.resolvedAuthToken)
75-
client.release(project.name, version, project.file(specFile), project.file(zipFile), plugin.provider)
76+
def specFileValue = specFile.isPresent() ? project.file(specFile) : null
77+
client.release(project.name, version, specFileValue, project.file(zipFile), plugin.provider)
7678

7779
// Celebrate successful plugin upload! 🎉
7880
project.logger.lifecycle("🎉 SUCCESS! Plugin '${project.name}' version ${version} has been successfully released to Nextflow Registry [${registryUri}]!")

0 commit comments

Comments
 (0)