1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Allow variables in buildScript{}.

Fixes https://github.com/cbeust/kobalt/issues/340
This commit is contained in:
Cedric Beust 2017-03-07 13:24:49 -08:00
parent c90125ede0
commit 204ca452e5

View file

@ -21,6 +21,7 @@ class BlockExtractor(val regexp: Pattern, val opening: Char, val closing: Char)
var foundClosing = false var foundClosing = false
var count = 0 var count = 0
val result = StringBuffer() val result = StringBuffer()
val topLines = arrayListOf<String>()
fun updateCount(line: String) { fun updateCount(line: String) {
val currentLine = StringBuffer() val currentLine = StringBuffer()
@ -46,8 +47,10 @@ class BlockExtractor(val regexp: Pattern, val opening: Char, val closing: Char)
if (found) { if (found) {
foundKeyword = true foundKeyword = true
count = 1 count = 1
result.append(topLines.joinToString("\n"))
result.append(line).append("\n") result.append(line).append("\n")
} else { } else {
topLines.add(line)
updateCount(line) updateCount(line)
} }