diff --git a/learning/tour-of-beam/frontend/build.gradle.kts b/learning/tour-of-beam/frontend/build.gradle.kts new file mode 100644 index 000000000000..31bf46e59ffe --- /dev/null +++ b/learning/tour-of-beam/frontend/build.gradle.kts @@ -0,0 +1,156 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * License); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +evaluationDependsOn(":playground:frontend:playground_components") + +tasks.register("generate") { + dependsOn(":playground:frontend:playground_components:generate") + + dependsOn("generateCode") + + group = "build" + description = "Generates all generated files." +} + +tasks.register("analyze") { + dependsOn(":playground:frontend:playground_components:generateCode") + dependsOn("generateCode") + + group = "verification" + description = "Analyze dart code" + + doLast { + exec { + executable("dart") + args("analyze", "lib", "test") + } + } +} + +tasks.register("pubGet") { + group = "build" + description = "Get packages for the frontend project" + doLast { + exec { + executable("flutter") + args("pub", "get") + } + } +} + +tasks.register("format") { + group = "build" + description = "Idiomatically format Dart source code" + doLast { + exec { + executable("dart") + args("format", "lib", "test") + } + } +} + +tasks.register("run") { + group = "application" + description = "Run application on Google Chrome" + + doLast { + exec { + executable("flutter") + args("run", "-d", "chrome") + } + } +} + +tasks.register("test") { + dependsOn(":playground:frontend:playground_components:generateCode") + dependsOn("generateCode") + + group = "verification" + description = "flutter test" + + doLast { + exec { + executable("flutter") + args("test") + } + } +} + +tasks.register("precommit") { + dependsOn(":playground:frontend:playground_components:precommit") + + dependsOn("analyze") + dependsOn("test") +} + +tasks.register("generateCode") { + dependsOn(":playground:frontend:playground_components:generateCode") + + dependsOn("cleanFlutter") + dependsOn("pubGet") + + group = "build" + description = "Generate code" + + doLast { + exec { + executable("flutter") + args("pub", "run", "build_runner", "build", "--delete-conflicting-outputs") + } + } +} + +tasks.register("cleanFlutter") { + group = "build" + description = "Remove build artifacts" + + doLast { + exec { + executable("flutter") + args("clean") + } + } +} + +tasks.register("cleanGenerated") { + dependsOn(":playground:frontend:playground_components:cleanGenerated") + + group = "build" + description = "Remove build artifacts" + + doLast { + println("Deleting:") + + deleteFilesByRegExp(".*\\.g\\.dart\$") + deleteFilesByRegExp(".*\\.gen\\.dart\$") + deleteFilesByRegExp(".*\\.mocks\\.dart\$") + } +} + +val deleteFilesByRegExp: (String) -> Unit = { re -> + // Prints file names. + exec { + executable("find") + args("assets", "lib", "test", "-regex", re) + } + // Actually deletes them. + exec { + executable("find") + args("assets", "lib", "test", "-regex", re, "-delete") + } +} diff --git a/learning/tour-of-beam/frontend/lib/pages/tour/widgets/playground_demo.dart b/learning/tour-of-beam/frontend/lib/pages/tour/widgets/playground_demo.dart index 4b5347a24810..c8016a120caf 100644 --- a/learning/tour-of-beam/frontend/lib/pages/tour/widgets/playground_demo.dart +++ b/learning/tour-of-beam/frontend/lib/pages/tour/widgets/playground_demo.dart @@ -48,7 +48,6 @@ class PlaygroundDemoWidget extends StatelessWidget { first: SnippetEditor( controller: snippetController, isEditable: true, - goToContextLine: false, ), second: OutputWidget( playgroundController: playgroundController, diff --git a/playground/frontend/build.gradle b/playground/frontend/build.gradle index 4de0f867b363..0ca56258ecb2 100644 --- a/playground/frontend/build.gradle +++ b/playground/frontend/build.gradle @@ -60,7 +60,6 @@ tasks.register("analyze") { doLast { exec { - // Exact paths instead of '.' so it does not go into playground_components executable("dart") args("analyze", "lib", "test") } @@ -69,7 +68,7 @@ tasks.register("analyze") { tasks.register("pubGet") { group = "build" - description = "Get packages for the playground frontend project" + description = "Get packages for the frontend project" doLast { exec { executable("flutter") @@ -83,7 +82,6 @@ tasks.register("format") { description = "Idiomatically format Dart source code" doLast { exec { - // Exact paths instead of '.' so it does not go into playground_components executable("dart") args("format", "lib", "test") } @@ -225,7 +223,7 @@ task copyDockerfileDependencies(type: Copy) { docker { group = "build" - description = "Build container for playground frontend application" + description = "Build container for frontend application" name = containerImageName( name: project.docker_image_default_repo_prefix + "playground-frontend", root: project.rootProject.hasProperty(["docker-repository-root"]) diff --git a/settings.gradle.kts b/settings.gradle.kts index 0829c523843b..5279951d13fa 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -74,6 +74,9 @@ include(":playground:backend:containers:python") include(":playground:backend:containers:router") include(":playground:backend:containers:scio") include(":playground:terraform") + +include(":learning:tour-of-beam:frontend") + include(":runners:core-construction-java") include(":runners:core-java") include(":runners:direct-java")