mirror of
https://github.com/tadfisher/gradle2nix.git
synced 2026-01-11 15:30:38 -05:00
Exclude local repositories from dependency resolution
Fixes https://github.com/tadfisher/gradle2nix/issues/8
This commit is contained in:
@@ -8,10 +8,12 @@ import org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler.MAVEN_CENT
|
||||
import strikt.api.expectThat
|
||||
import strikt.assertions.all
|
||||
import strikt.assertions.containsExactly
|
||||
import strikt.assertions.flatMap
|
||||
import strikt.assertions.get
|
||||
import strikt.assertions.hasSize
|
||||
import strikt.assertions.isEqualTo
|
||||
import strikt.assertions.map
|
||||
import strikt.assertions.none
|
||||
import strikt.assertions.startsWith
|
||||
|
||||
class BasicTest : JUnit5Minutests {
|
||||
@@ -22,6 +24,12 @@ class BasicTest : JUnit5Minutests {
|
||||
expectThat(build()) {
|
||||
get("gradle version") { gradle.version }.isEqualTo(System.getProperty("compat.gradle.version"))
|
||||
|
||||
get("all dependencies") {
|
||||
pluginDependencies +
|
||||
rootProject.buildscriptDependencies +
|
||||
rootProject.projectDependencies
|
||||
}.flatMap { it.urls }.none { startsWith("file:") }
|
||||
|
||||
get("root project dependencies") { rootProject.projectDependencies }.and {
|
||||
ids.containsExactly(
|
||||
"com.squareup.moshi:moshi:1.8.0@jar",
|
||||
@@ -47,5 +55,17 @@ class BasicTest : JUnit5Minutests {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
withFixture("basic/basic-kotlin-project") {
|
||||
test("excludes embedded kotlin repo") {
|
||||
expectThat(build()) {
|
||||
get("all dependencies") {
|
||||
pluginDependencies +
|
||||
rootProject.buildscriptDependencies +
|
||||
rootProject.projectDependencies
|
||||
}.flatMap { it.urls }.all { not { startsWith("file:") } }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,9 @@ internal class ConfigurationResolverFactory(repositories: RepositoryHandler) {
|
||||
})
|
||||
}
|
||||
|
||||
private val resolvers = repositories.filterIsInstance<ResolutionAwareRepository>()
|
||||
private val resolvers = repositories
|
||||
.filterIsInstance<ResolutionAwareRepository>()
|
||||
.filterNot { it.createResolver().isLocal }
|
||||
.mapNotNull { it.repositoryResolver(ivySettings) }
|
||||
|
||||
fun create(dependencies: DependencyHandler): ConfigurationResolver =
|
||||
|
||||
Reference in New Issue
Block a user