mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Refactor.
This commit is contained in:
parent
b5fb1ee3da
commit
3bc211bd80
2 changed files with 34 additions and 23 deletions
|
@ -0,0 +1,33 @@
|
||||||
|
package com.beust.kobalt.plugin.android
|
||||||
|
|
||||||
|
import com.beust.kobalt.api.Project
|
||||||
|
import com.beust.kobalt.misc.RunCommand
|
||||||
|
import com.beust.kobalt.misc.log
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
open class AndroidCommand(project: Project, androidHome: String, command: String, cwd: File = File(project.directory))
|
||||||
|
: RunCommand(command) {
|
||||||
|
init {
|
||||||
|
env.put("ANDROID_HOME", androidHome)
|
||||||
|
directory = cwd
|
||||||
|
}
|
||||||
|
|
||||||
|
open fun call(args: List<String>) = run(args,
|
||||||
|
successCallback = { output ->
|
||||||
|
log(1, "$command succeeded:")
|
||||||
|
output.forEach {
|
||||||
|
log(1, " $it")
|
||||||
|
}
|
||||||
|
},
|
||||||
|
errorCallback = { output ->
|
||||||
|
with(StringBuilder()) {
|
||||||
|
append("Error running $command:")
|
||||||
|
output.forEach {
|
||||||
|
append(" $it")
|
||||||
|
}
|
||||||
|
error(this.toString())
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ public class AndroidPlugin @Inject constructor(val javaCompiler: JavaCompiler)
|
||||||
|
|
||||||
inner class AaptCommand(project: Project, aapt: String, val aaptCommand: String,
|
inner class AaptCommand(project: Project, aapt: String, val aaptCommand: String,
|
||||||
useErrorStream: Boolean = false,
|
useErrorStream: Boolean = false,
|
||||||
cwd: File = File(project.directory)) : AndroidCommand(project, aapt) {
|
cwd: File = File(project.directory)) : AndroidCommand(project, androidHome(project), aapt) {
|
||||||
init {
|
init {
|
||||||
directory = cwd
|
directory = cwd
|
||||||
useErrorStreamAsErrorIndicator = useErrorStream
|
useErrorStreamAsErrorIndicator = useErrorStream
|
||||||
|
@ -169,28 +169,6 @@ public class AndroidPlugin @Inject constructor(val javaCompiler: JavaCompiler)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inner open class AndroidCommand(project: Project, command: String, cwd: File = File(project.directory))
|
|
||||||
: RunCommand(command) {
|
|
||||||
init {
|
|
||||||
env.put("ANDROID_HOME", androidHome(project))
|
|
||||||
directory = cwd
|
|
||||||
}
|
|
||||||
|
|
||||||
open fun call(args: List<String>) = run(args,
|
|
||||||
successCallback = { output ->
|
|
||||||
log(1, "$command succeeded:")
|
|
||||||
output.forEach {
|
|
||||||
log(1, " $it")
|
|
||||||
}
|
|
||||||
},
|
|
||||||
errorCallback = { output ->
|
|
||||||
error("Error running $command:")
|
|
||||||
output.forEach {
|
|
||||||
error(" $it")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun generateR(project: Project, generated: String, aapt: String) {
|
private fun generateR(project: Project, generated: String, aapt: String) {
|
||||||
|
|
||||||
mergeAndroidManifest(project, context.variant)
|
mergeAndroidManifest(project, context.variant)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue