Skip to content

Commit

Permalink
Move validation from evaluation to execution
Browse files Browse the repository at this point in the history
  • Loading branch information
citizenmatt committed Sep 27, 2018
1 parent b7665fb commit c41e21d
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/main/groovy/com/ullink/NuGetSources.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,17 @@ class NuGetSources extends BaseNuGet {

NuGetSources() {
super('sources')
project.afterEvaluate{
if(!operation){
throw new GradleException('Operation not specified for NuGetSources task.')
}
if(operation != Operation.list && !sourceName){
throw new GradleException('SourceName not specified for NuGetSources task.')
}
}
}

@Override
void exec() {
if(!operation){
throw new GradleException('Operation not specified for NuGetSources task.')
}
if(operation != Operation.list && !sourceName){
throw new GradleException('SourceName not specified for NuGetSources task.')
}

args operation
if (sourceName) args '-Name', sourceName
if (sourceUrl) args '-Source', sourceUrl
Expand Down

0 comments on commit c41e21d

Please sign in to comment.