Skip to content

Commit e4f3a64

Browse files
committed
Make specFile optional in release task
1 parent d950e57 commit e4f3a64

File tree

4 files changed

+30
-1
lines changed

4 files changed

+30
-1
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.text,
142+
spec: spec.exists() ? spec.text : null,
143143
provider: provider
144144
]
145145
def jsonBody = JsonOutput.toJson(requestBody)

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import io.nextflow.gradle.NextflowPluginConfig
55
import org.gradle.api.DefaultTask
66
import org.gradle.api.file.RegularFileProperty
77
import org.gradle.api.tasks.InputFile
8+
import org.gradle.api.tasks.Optional
89
import org.gradle.api.tasks.TaskAction
910

1011
/**
@@ -29,6 +30,7 @@ class RegistryReleaseIfNotExistsTask extends DefaultTask {
2930
* By default, this points to the spec file created by the packagePlugin task.
3031
*/
3132
@InputFile
33+
@Optional
3234
final RegularFileProperty specFile
3335

3436
RegistryReleaseIfNotExistsTask() {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import io.nextflow.gradle.NextflowPluginConfig
55
import org.gradle.api.DefaultTask
66
import org.gradle.api.file.RegularFileProperty
77
import org.gradle.api.tasks.InputFile
8+
import org.gradle.api.tasks.Optional
89
import org.gradle.api.tasks.TaskAction
910

1011
/**
@@ -28,6 +29,7 @@ class RegistryReleaseTask extends DefaultTask {
2829
* By default, this points to the spec file created by the packagePlugin task.
2930
*/
3031
@InputFile
32+
@Optional
3133
final RegularFileProperty specFile
3234

3335
RegistryReleaseTask() {

src/test/groovy/io/nextflow/gradle/registry/RegistryReleaseTaskTest.groovy

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,4 +171,29 @@ class RegistryReleaseTaskTest extends Specification {
171171
// This proves the fallback configuration is working
172172
thrown(RegistryReleaseException)
173173
}
174+
175+
def "should work when spec file is missing"() {
176+
given:
177+
project.ext['npr.apiKey'] = 'project-token'
178+
project.ext['npr.apiUrl'] = 'https://project-registry.com/api'
179+
project.nextflowPlugin {
180+
description = 'A test plugin'
181+
provider = 'Test Author'
182+
className = 'com.example.TestPlugin'
183+
nextflowVersion = '24.04.0'
184+
extensionPoints = ['com.example.TestExtension']
185+
registry {
186+
url = 'https://example.com/registry'
187+
}
188+
}
189+
190+
// Don't set specFile - it should be optional
191+
192+
when:
193+
task.run()
194+
195+
then:
196+
// Should fail with connection error, not with missing file error
197+
thrown(RegistryReleaseException)
198+
}
174199
}

0 commit comments

Comments
 (0)