| 5 |
| 6 | val webpSources = File(projectRoot, "TMessagesProj/jni/libwebp/Android.mk") |
| 7 | .readLines() |
| 8 | .map { it.trim() } |
| 9 | .filter { it.startsWith("src/") && it.endsWith("\\") } |
| 10 | .map { "libwebp/" + it.substring(0, it.length - 2).replace("\$(NEON)", "c") } |
| 11 |
| 12 | val cmakeLists = File(projectRoot, "TMessagesProj/jni/CMakeLists.txt") |
| 13 |
| 14 | var cmakeListsSource = cmakeLists.readText() |
| 15 |
| 16 | val cmakeListsSourceNew = cmakeListsSource.substringBefore("add_library(webp STATIC") + "add_library(webp STATIC" + |
| 17 | webpSources.joinToString("\n", "\n") { " $it" } + ")" + |
| 18 | cmakeListsSource.substringAfter("add_library(webp STATIC").substringAfter(")") |
| 19 |
| 20 | if (cmakeListsSource == cmakeListsSourceNew) { |
| 21 |
| 22 | println("No changes") |
| 23 |
| 24 | exitProcess(0) |
| 25 |
| 26 | } |
| 27 |
| 28 | cmakeLists.writeText(cmakeListsSourceNew) |
| 29 |
| 30 | println("Updated sources") |