mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 16:28:12 -07:00
Allow more imports in preBuildScript.
This commit is contained in:
parent
b99eb756ca
commit
3503405488
1 changed files with 3 additions and 2 deletions
|
@ -7,7 +7,6 @@ import java.util.regex.Pattern
|
||||||
fun main(argv: Array<String>) {
|
fun main(argv: Array<String>) {
|
||||||
val lines = File(homeDir("kotlin/kobalt/kobalt/src/Build.kt")).readLines()
|
val lines = File(homeDir("kotlin/kobalt/kobalt/src/Build.kt")).readLines()
|
||||||
val result = BlockExtractor(Pattern.compile("val.*buildScript.*\\{"), '{', '}').extractBlock(lines)
|
val result = BlockExtractor(Pattern.compile("val.*buildScript.*\\{"), '{', '}').extractBlock(lines)
|
||||||
|
|
||||||
// BlockExtractor("plugins", '(', ')').extractBlock(lines)
|
// BlockExtractor("plugins", '(', ')').extractBlock(lines)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +59,9 @@ class BlockExtractor(val regexp: Pattern, val opening: Char, val closing: Char)
|
||||||
result.append(topLines.joinToString("\n"))
|
result.append(topLines.joinToString("\n"))
|
||||||
result.append(line).append("\n")
|
result.append(line).append("\n")
|
||||||
} else {
|
} else {
|
||||||
if (! line.startsWith("import") || (line.startsWith("import") && line.contains("com.beust"))) {
|
val allowedImports = listOf("com.beust", "java")
|
||||||
|
if (! line.startsWith("import") ||
|
||||||
|
(line.startsWith("import") && allowedImports.any { line.contains(it) })) {
|
||||||
topLines.add(line)
|
topLines.add(line)
|
||||||
}
|
}
|
||||||
updateCount(line)
|
updateCount(line)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue