mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-27 00:38:11 -07:00
Fix a few cases where BuildConfig.java was not being compiled.
This commit is contained in:
parent
84c819b4f7
commit
56ef7a8c1d
1 changed files with 17 additions and 10 deletions
|
@ -26,10 +26,11 @@ class Variant(val initialProductFlavor: ProductFlavorConfig? = null,
|
||||||
fun toTask(taskName: String) = taskName + productFlavor.name.capitalize() + buildType.name.capitalize()
|
fun toTask(taskName: String) = taskName + productFlavor.name.capitalize() + buildType.name.capitalize()
|
||||||
|
|
||||||
fun sourceDirectories(project: Project) : List<File> {
|
fun sourceDirectories(project: Project) : List<File> {
|
||||||
val sourceDirectories = project.sourceDirectories.map { File(it) }
|
|
||||||
if (isDefault) return sourceDirectories
|
|
||||||
else {
|
|
||||||
val result = arrayListOf<File>()
|
val result = arrayListOf<File>()
|
||||||
|
val sourceDirectories = project.sourceDirectories.map { File(it) }
|
||||||
|
if (isDefault) {
|
||||||
|
result.addAll(sourceDirectories)
|
||||||
|
} else {
|
||||||
// The ordering of files is: 1) build type 2) product flavor 3) default
|
// The ordering of files is: 1) build type 2) product flavor 3) default
|
||||||
buildType.let {
|
buildType.let {
|
||||||
val dir = File(KFiles.joinDir("src", it.name, project.projectInfo.sourceDirectory))
|
val dir = File(KFiles.joinDir("src", it.name, project.projectInfo.sourceDirectory))
|
||||||
|
@ -42,16 +43,18 @@ class Variant(val initialProductFlavor: ProductFlavorConfig? = null,
|
||||||
result.add(dir)
|
result.add(dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Now that all the variant source directories have been added, add the project's default ones
|
||||||
|
result.addAll(sourceDirectories)
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
// Generated directory, if applicable
|
// Generated directory, if applicable
|
||||||
generatedSourceDirectory?.let {
|
generatedSourceDirectory?.let {
|
||||||
result.add(it)
|
result.add(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now that all the variant source directories have been added, add the project's default ones
|
|
||||||
result.addAll(sourceDirectories)
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fun archiveName(project: Project, archiveName: String?, suffix: String) : String {
|
fun archiveName(project: Project, archiveName: String?, suffix: String) : String {
|
||||||
val result =
|
val result =
|
||||||
|
@ -113,8 +116,12 @@ class Variant(val initialProductFlavor: ProductFlavorConfig? = null,
|
||||||
"packageName needs to be defined on the project in order to generate BuildConfig")
|
"packageName needs to be defined on the project in order to generate BuildConfig")
|
||||||
|
|
||||||
val code = project.projectInfo.generateBuildConfig(pkg, context.variant, buildConfigs)
|
val code = project.projectInfo.generateBuildConfig(pkg, context.variant, buildConfigs)
|
||||||
generatedSourceDirectory = KFiles.makeDir(generated(project), pkg.replace('.', File.separatorChar))
|
val g = KFiles.makeDir(generated(project))
|
||||||
val outputFile = File(generatedSourceDirectory, "BuildConfig" + project.sourceSuffix)
|
// Make sure the generatedSourceDirectory doesn't contain the project.directory since
|
||||||
|
// that directory will be added when trying to find recursively all the sources in it
|
||||||
|
generatedSourceDirectory = File(g.relativeTo(File(project.directory)))
|
||||||
|
val outputGeneratedSourceDirectory = File(g, pkg.replace('.', File.separatorChar))
|
||||||
|
val outputFile = File(outputGeneratedSourceDirectory, "BuildConfig" + project.sourceSuffix)
|
||||||
KFiles.saveFile(outputFile, code)
|
KFiles.saveFile(outputFile, code)
|
||||||
log(2, "Generated ${outputFile.path}")
|
log(2, "Generated ${outputFile.path}")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue