You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "MakarkinSAkvelon (via GitHub)" <gi...@apache.org> on 2023/02/01 14:05:45 UTC
[GitHub] [beam] MakarkinSAkvelon commented on a diff in pull request #25022: [Playground] Add config.g.dart+Fix gradle
MakarkinSAkvelon commented on code in PR #25022:
URL: https://github.com/apache/beam/pull/25022#discussion_r1093269220
##########
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:
In case we leave this file - config.g.dart - "as-is" Frontend will use the wrong Backend URLs and the playground will not work at all
--
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: github-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org