From ba4e7e2a258bbef281039ed3829b23a657225d27 Mon Sep 17 00:00:00 2001 From: "sebastian.sellmair" Date: Thu, 30 Jul 2020 14:33:41 +0200 Subject: Use `cache-redirector` repositories for Gradle integration tests --- .../dokka/it/gradle/AbstractGradleIntegrationTest.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'integration-tests/gradle/src/main/kotlin') diff --git a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt b/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt index f852dc8b..9998f3fd 100644 --- a/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt +++ b/integration-tests/gradle/src/main/kotlin/org/jetbrains/dokka/it/gradle/AbstractGradleIntegrationTest.kt @@ -4,6 +4,7 @@ import org.gradle.testkit.runner.BuildResult import org.gradle.testkit.runner.GradleRunner import org.gradle.testkit.runner.internal.DefaultGradleRunner import org.gradle.tooling.GradleConnectionException +import org.gradle.util.GradleVersion import org.jetbrains.dokka.it.AbstractIntegrationTest import org.junit.Assume import org.junit.Assume.assumeFalse @@ -11,6 +12,7 @@ import org.junit.AssumptionViolatedException import org.junit.runner.RunWith import org.junit.runners.Parameterized import java.io.File +import java.net.URI import kotlin.test.BeforeTest @RunWith(Parameterized::class) @@ -31,8 +33,8 @@ abstract class AbstractGradleIntegrationTest : AbstractIntegrationTest() { ): GradleRunner { return GradleRunner.create() .withProjectDir(projectDir) - .withGradleVersion(versions.gradleVersion.version) .forwardOutput() + .withJetBrainsCachedGradleVersion(versions.gradleVersion) .withTestKitDir(File("build", "gradle-test-kit").absoluteFile) .withArguments( listOfNotNull( @@ -62,6 +64,16 @@ abstract class AbstractGradleIntegrationTest : AbstractIntegrationTest() { } } +private fun GradleRunner.withJetBrainsCachedGradleVersion(version: GradleVersion): GradleRunner { + return withGradleDistribution( + URI.create( + "https://cache-redirector.jetbrains.com/" + + "services.gradle.org/distributions/" + + "gradle-${version.version}-bin.zip" + ) + ) +} + private fun Throwable.withAllCauses(): Sequence { val root = this return sequence { -- cgit