Providing plugin classpath through JPS extensions
Original commit: af9c5cc45d
This commit is contained in:
@@ -22,4 +22,5 @@ import org.jetbrains.jps.incremental.CompileContext
|
||||
|
||||
public trait KotlinJpsCompilerArgumentsProvider {
|
||||
public fun getExtraArguments(moduleBuildTarget: ModuleBuildTarget, context: CompileContext): List<String>
|
||||
public fun getClasspath(moduleBuildTarget: ModuleBuildTarget, context: CompileContext): List<String>
|
||||
}
|
||||
@@ -142,11 +142,20 @@ public class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR
|
||||
|
||||
val representativeTarget = chunk.representativeTarget()
|
||||
|
||||
fun concatenate(strings: Array<String>?, cp: List<String>) = array(*(strings ?: array<String>()), *cp.copyToArray())
|
||||
|
||||
for (argumentProvider in ServiceLoader.load(javaClass<KotlinJpsCompilerArgumentsProvider>())) {
|
||||
// appending to pluginOptions
|
||||
commonArguments.pluginOptions = array(
|
||||
*(commonArguments.pluginOptions ?: array<String>()),
|
||||
*argumentProvider.getExtraArguments(representativeTarget, context).copyToArray()
|
||||
commonArguments.pluginOptions = concatenate(commonArguments.pluginOptions,
|
||||
argumentProvider.getExtraArguments(representativeTarget, context))
|
||||
// appending to classpath
|
||||
commonArguments.pluginClasspaths = concatenate(commonArguments.pluginClasspaths,
|
||||
argumentProvider.getClasspath(representativeTarget, context))
|
||||
|
||||
messageCollector.report(
|
||||
INFO,
|
||||
"Plugin loaded: ${argumentProvider.javaClass.getSimpleName()}",
|
||||
NO_LOCATION
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user