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

Add context to source contributor.

This commit is contained in:
Cedric Beust 2015-12-10 01:05:18 +04:00
parent beedc8c71e
commit 867f9d797c
3 changed files with 3 additions and 3 deletions

View file

@ -4,5 +4,5 @@ package com.beust.kobalt.api
* Plugins that add compiler flags. * Plugins that add compiler flags.
*/ */
interface ICompilerFlagContributor : IContributor { interface ICompilerFlagContributor : IContributor {
fun flagsFor(project: Project, currentFlags: List<String>): List<String> fun flagsFor(project: Project, context: KobaltContext, currentFlags: List<String>): List<String>
} }

View file

@ -31,7 +31,7 @@ class JvmCompiler @Inject constructor(val dependencyManager: DependencyManager)
// Plugins that add flags to the compiler // Plugins that add flags to the compiler
val contributorFlags = if (project != null) { val contributorFlags = if (project != null) {
context.pluginInfo.compilerFlagContributors.flatMap { context.pluginInfo.compilerFlagContributors.flatMap {
it.flagsFor(project, info.compilerArgs) it.flagsFor(project, context, info.compilerArgs)
} }
} else { } else {
emptyList() emptyList()

View file

@ -164,7 +164,7 @@ public class AndroidPlugin @Inject constructor(val javaCompiler: JavaCompiler, v
* Make sure we compile and generate 1.6 sources unless the build file defined those (which can * Make sure we compile and generate 1.6 sources unless the build file defined those (which can
* happen if the developer is using RetroLambda for example). * happen if the developer is using RetroLambda for example).
*/ */
override fun flagsFor(project: Project, currentFlags: List<String>) : List<String> { override fun flagsFor(project: Project, context: KobaltContext, currentFlags: List<String>) : List<String> {
if (isAndroid(project)) { if (isAndroid(project)) {
var found = currentFlags.any { it == "-source" || it == "-target" } var found = currentFlags.any { it == "-source" || it == "-target" }
val result = arrayListOf<String>().apply { addAll(currentFlags) } val result = arrayListOf<String>().apply { addAll(currentFlags) }