mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 00:17:11 -07:00
Handle dependency exclusion for tests too.
This commit is contained in:
parent
262e1e3a26
commit
e03b4527ad
2 changed files with 14 additions and 10 deletions
|
@ -204,15 +204,6 @@ class CompilerUtils @Inject constructor(val files: KFiles, val dependencyManager
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Naïve implementation: just exclude all dependencies that start with one of the excluded dependencies.
|
||||
* Should probably make exclusion more generic (full on string) or allow exclusion to be specified
|
||||
* formally by groupId or artifactId.
|
||||
*/
|
||||
private fun isDependencyExcluded(id: IClasspathDependency, excluded: List<IClasspathDependency>)
|
||||
= excluded.any { id.id.startsWith(it.id) }
|
||||
|
||||
fun sourceCompilerFlags(project: Project?, context: KobaltContext, info: CompilerActionInfo) : List<String> {
|
||||
val adapters = context.pluginInfo.compilerFlagContributors.map {
|
||||
val closure = { project: Project, context: KobaltContext, currentFlags: List<String>,
|
||||
|
@ -234,4 +225,15 @@ class CompilerUtils @Inject constructor(val files: KFiles, val dependencyManager
|
|||
}
|
||||
return result
|
||||
}
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* Naïve implementation: just exclude all dependencies that start with one of the excluded dependencies.
|
||||
* Should probably make exclusion more generic (full on string) or allow exclusion to be specified
|
||||
* formally by groupId or artifactId.
|
||||
*/
|
||||
fun isDependencyExcluded(dep: IClasspathDependency, excluded: List<IClasspathDependency>)
|
||||
= excluded.any { excluded -> dep.id.startsWith(excluded.id) }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,7 +91,9 @@ open class JvmCompilerPlugin @Inject constructor(
|
|||
scopes = listOf(Scope.TEST))
|
||||
val compileDependencies = dependencyManager.calculateDependencies(project, context,
|
||||
scopes = listOf(Scope.COMPILE))
|
||||
val allDependencies = (compileDependencies + testDependencies).toHashSet()
|
||||
val allDependencies = (compileDependencies + testDependencies)
|
||||
.toHashSet()
|
||||
.filter { ! CompilerUtils.isDependencyExcluded(it, project.excludedDependencies) }
|
||||
return testContributor.run(project, context, configName, allDependencies.toList())
|
||||
} else {
|
||||
context.logger.log(project.name, 2,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue