1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-27 00:38:11 -07:00

Source directories now coming from ISourceDirectoryContributor.

This commit is contained in:
Cedric Beust 2015-12-05 23:06:26 -08:00
parent 89b7b774fe
commit 29a68fde19

View file

@ -26,7 +26,7 @@ abstract class JvmCompilerPlugin @Inject constructor(
open val executors: KobaltExecutors, open val executors: KobaltExecutors,
open val jvmCompiler: JvmCompiler, open val jvmCompiler: JvmCompiler,
val taskContributor : TaskContributor = TaskContributor()) val taskContributor : TaskContributor = TaskContributor())
: BasePlugin(), IProjectContributor, ITaskContributor by taskContributor { : BasePlugin(), ISourceDirectoryContributor, IProjectContributor, ITaskContributor by taskContributor {
companion object { companion object {
@ExportedProjectProperty(doc = "Projects this project depends on", type = "List<ProjectDescription>") @ExportedProjectProperty(doc = "Projects this project depends on", type = "List<ProjectDescription>")
@ -154,6 +154,10 @@ abstract class JvmCompilerPlugin @Inject constructor(
} }
} }
/**
* Create a CompilerActionInfo (all the information that a compiler needs to know) for the given parameters.
* Runs all the contributors and interceptors relevant to that task.
*/
protected fun createCompilerActionInfo(project: Project, context: KobaltContext, generatedSourceDir: File?, protected fun createCompilerActionInfo(project: Project, context: KobaltContext, generatedSourceDir: File?,
isTest: Boolean) : CompilerActionInfo { isTest: Boolean) : CompilerActionInfo {
copyResources(project, JvmCompilerPlugin.SOURCE_SET_MAIN) copyResources(project, JvmCompilerPlugin.SOURCE_SET_MAIN)
@ -174,11 +178,6 @@ abstract class JvmCompilerPlugin @Inject constructor(
initialSourceDirectories.add(it) initialSourceDirectories.add(it)
} }
// Source directories from the project and variants
if (! isTest) {
initialSourceDirectories.addAll(context.variant.sourceDirectories(project))
}
// Source directories from the contributors // Source directories from the contributors
initialSourceDirectories.addAll( initialSourceDirectories.addAll(
if (isTest) { if (isTest) {
@ -208,5 +207,9 @@ abstract class JvmCompilerPlugin @Inject constructor(
}) })
return result return result
} }
// ISourceDirectoryContributor
override fun sourceDirectoriesFor(project: Project, context: KobaltContext)
= if (accept(project)) context.variant.sourceDirectories(project) else listOf()
} }