damondouglas commented on code in PR #25022:
URL: https://github.com/apache/beam/pull/25022#discussion_r1072575604
##########
playground/terraform/build.gradle.kts:
##########
@@ -295,7 +295,25 @@ tasks.register("prepareConfig") {
val configFileName = "config.g.dart"
val modulePath =
project(":playground:frontend").projectDir.absolutePath
var file = File("$modulePath/lib/$configFileName")
-
+ val lines = file.readLines()
+ val endOfSlice = lines.indexOfFirst { it.contains("Generated content
below") }
+ if (endOfSlice != -1) {
+ val oldContent = lines.slice(0 until endOfSlice)
+ val flagDelete = file.delete()
+ if (!flagDelete) {
+ throw kotlin.RuntimeException("Deleting file failed")
+ }
+ val sb = kotlin.text.StringBuilder()
+ val lastLine = oldContent[oldContent.size - 1]
+ oldContent.forEach {
+ if (it == lastLine) {
+ sb.append(it)
+ } else {
+ sb.appendLine(it)
+ }
+ }
+ file.writeText(sb.toString())
+ }
Review Comment:
@MakarkinSAkvelon / @alexeyinkin Do we really need a gradle task wrapper to
generate the `config.g.dart` file? What would be the consequences if we do not
automate its generation?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]