mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 16:28:12 -07:00
Add context to source contributor.
This commit is contained in:
parent
beedc8c71e
commit
867f9d797c
3 changed files with 3 additions and 3 deletions
|
@ -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>
|
||||||
}
|
}
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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) }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue