File tree Expand file tree Collapse file tree 4 files changed +30
-1
lines changed
main/groovy/io/nextflow/gradle/registry
test/groovy/io/nextflow/gradle/registry Expand file tree Collapse file tree 4 files changed +30
-1
lines changed Original file line number Diff line number Diff 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)
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import io.nextflow.gradle.NextflowPluginConfig
55import org.gradle.api.DefaultTask
66import org.gradle.api.file.RegularFileProperty
77import org.gradle.api.tasks.InputFile
8+ import org.gradle.api.tasks.Optional
89import 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 () {
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import io.nextflow.gradle.NextflowPluginConfig
55import org.gradle.api.DefaultTask
66import org.gradle.api.file.RegularFileProperty
77import org.gradle.api.tasks.InputFile
8+ import org.gradle.api.tasks.Optional
89import 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 () {
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments