mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-27 00:38:11 -07:00
Only generate BuildConfig if at least one buildConfig{} was found.
This commit is contained in:
parent
92922f7e07
commit
9f00303e9d
1 changed files with 10 additions and 8 deletions
|
@ -96,7 +96,7 @@ class Variant(val initialProductFlavor: ProductFlavorConfig? = null,
|
|||
}
|
||||
|
||||
/**
|
||||
* Generate BuildConfig.java. Also look up if any BuildConfig is defined on the current build type,
|
||||
* Generate BuildConfig.java if requested. Also look up if any BuildConfig is defined on the current build type,
|
||||
* product flavor or main project, and use them to generate any additional field (in that order to
|
||||
* respect the priorities).
|
||||
*/
|
||||
|
@ -105,6 +105,7 @@ class Variant(val initialProductFlavor: ProductFlavorConfig? = null,
|
|||
|
||||
val buildConfigs = findBuildConfigs(project, context.variant)
|
||||
|
||||
if (buildConfigs.size > 0) {
|
||||
val androidConfig = (Kobalt.findPlugin("android") as AndroidPlugin).configurationFor(project)
|
||||
val pkg = androidConfig?.applicationId ?: project.packageName ?: project.group
|
||||
?: throw KobaltException(
|
||||
|
@ -116,6 +117,7 @@ class Variant(val initialProductFlavor: ProductFlavorConfig? = null,
|
|||
KFiles.saveFile(outputFile, code)
|
||||
log(2, "Generated ${outputFile.path}")
|
||||
}
|
||||
}
|
||||
|
||||
override fun toString() = toTask("")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue