1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -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.
*/
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
val contributorFlags = if (project != null) {
context.pluginInfo.compilerFlagContributors.flatMap {
it.flagsFor(project, info.compilerArgs)
it.flagsFor(project, context, info.compilerArgs)
}
} else {
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
* 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)) {
var found = currentFlags.any { it == "-source" || it == "-target" }
val result = arrayListOf<String>().apply { addAll(currentFlags) }