Skip to content

Commit

Permalink
Use single repo for node download (fixes #120)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sten Roger Sandvik committed Jun 27, 2016
1 parent f11820e commit 146c426
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/main/groovy/com/moowork/gradle/node/task/SetupTask.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.moowork.gradle.node.task
import com.moowork.gradle.node.NodeExtension
import com.moowork.gradle.node.variant.Variant
import org.gradle.api.DefaultTask
import org.gradle.api.artifacts.repositories.ArtifactRepository
import org.gradle.api.artifacts.repositories.IvyArtifactRepository
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.OutputDirectory
Expand All @@ -19,6 +20,8 @@ class SetupTask

private IvyArtifactRepository repo

private List<ArtifactRepository> allRepos;

SetupTask()
{
this.group = 'Node'
Expand Down Expand Up @@ -69,7 +72,7 @@ class SetupTask

unpackNodeTarGz()
setExecutableFlag()
removeRepository()
restoreRepositories()
}

private void copyNodeExe()
Expand Down Expand Up @@ -117,6 +120,10 @@ class SetupTask

private void addRepository()
{
this.allRepos = new ArrayList<>()
this.allRepos.addAll( this.project.repositories )
this.project.repositories.clear()

def distUrl = this.config.distBaseUrl
this.repo = this.project.repositories.ivy {
url distUrl
Expand All @@ -127,8 +134,9 @@ class SetupTask
}
}

private void removeRepository()
private void restoreRepositories()
{
this.project.repositories.remove( this.repo )
this.project.repositories.clear();
this.project.repositories.addAll( this.allRepos );
}
}

0 comments on commit 146c426

Please sign in to comment.