forked from apache/beam
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor focusing to contextLine (apache#24613)
- Loading branch information
1 parent
aa6cc16
commit 829806c
Showing
7 changed files
with
432 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,267 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
|
||
apply plugin: 'org.apache.beam.module' | ||
apply plugin: 'base' | ||
applyDockerNature() | ||
|
||
def playgroundBackendUrl = project.playgroundBackendUrl | ||
def analyticsUA = project.analyticsUA | ||
def playgroundBackendJavaRouteUrl = project.playgroundBackendJavaRouteUrl | ||
def playgroundBackendGoRouteUrl = project.playgroundBackendGoRouteUrl | ||
def playgroundBackendPythonRouteUrl = project.playgroundBackendPythonRouteUrl | ||
def playgroundBackendScioRouteUrl = project.playgroundBackendScioRouteUrl | ||
|
||
def playgroundJobServerProject = "${project.path.replace('-container', '')}" | ||
|
||
description = project(playgroundJobServerProject).description + " :: Container" | ||
|
||
configurations { | ||
dockerDependency | ||
// print(dockerDependency) | ||
} | ||
|
||
dependencies { | ||
dockerDependency project(path: playgroundJobServerProject, configuration: "shadow") | ||
// print(dockerDependency) | ||
} | ||
|
||
task generate { | ||
dependsOn("playground_components:generate") | ||
|
||
dependsOn("generateCode") | ||
|
||
group = "build" | ||
description = "Generates all generated files." | ||
} | ||
|
||
task printPath { | ||
doLast { | ||
exec { | ||
executable("printenv") | ||
args("PATH") | ||
} | ||
} | ||
} | ||
|
||
task analyze { | ||
dependsOn("playground_components:generateCode") | ||
dependsOn("generateCode") | ||
|
||
group = "verification" | ||
description = "Analyze dart code" | ||
|
||
doLast { | ||
exec { | ||
// Exact paths instead of '.' so it does not go into playground_components | ||
executable("dart") | ||
args("analyze", "lib", "test") | ||
} | ||
} | ||
} | ||
|
||
task pubGet { | ||
group = "build" | ||
description = "Get packages for the playground frontend project" | ||
doLast { | ||
exec { | ||
executable("flutter") | ||
args("pub", "get") | ||
} | ||
} | ||
} | ||
|
||
task format { | ||
group = "build" | ||
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") | ||
} | ||
} | ||
} | ||
|
||
task run { | ||
group = "application" | ||
description = "Run application on Google Chrome" | ||
doLast { | ||
exec { | ||
executable("flutter") | ||
args("run", "-d", "chrome") | ||
} | ||
} | ||
} | ||
|
||
task test { | ||
dependsOn("playground_components:generateCode") | ||
dependsOn("generateCode") | ||
|
||
group = "verification" | ||
description = "flutter test" | ||
|
||
doLast { | ||
exec { | ||
executable("flutter") | ||
args("test") | ||
} | ||
} | ||
} | ||
|
||
task precommit { | ||
dependsOn("playground_components:precommit") | ||
|
||
dependsOn("analyze") | ||
dependsOn("test") | ||
} | ||
|
||
task generateCode { | ||
dependsOn("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") | ||
} | ||
} | ||
} | ||
|
||
task cleanFlutter { | ||
group = "build" | ||
description = "Remove build artifacts" | ||
|
||
doLast { | ||
exec { | ||
executable("flutter") | ||
args("clean") | ||
} | ||
} | ||
} | ||
|
||
task cleanGenerated { | ||
dependsOn("playground_components:cleanGenerated") | ||
|
||
group = "build" | ||
description = "Remove build artifacts" | ||
|
||
doLast { | ||
println("Deleting:") | ||
|
||
deleteFilesByRegExp(".*\\.g\\.dart\$") | ||
deleteFilesByRegExp(".*\\.gen\\.dart\$") | ||
deleteFilesByRegExp(".*\\.mocks\\.dart\$") | ||
} | ||
} | ||
|
||
ext.deleteFilesByRegExp = { 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") | ||
} | ||
} | ||
|
||
task copyDockerfileDependencies(type: Copy) { | ||
group = "build" | ||
description = "Copy files that required to build docker container" | ||
copy { | ||
from '.' | ||
into 'build/' | ||
exclude 'build' | ||
exclude 'Dockerfile' | ||
} | ||
copy { | ||
from '../playground' | ||
into 'build/playground' | ||
} | ||
} | ||
|
||
docker { | ||
group = "build" | ||
description = "Build container for playground frontend application" | ||
name containerImageName( | ||
name: project.docker_image_default_repo_prefix + "playground-frontend", | ||
root: project.rootProject.hasProperty(["docker-repository-root"]) ? | ||
project.rootProject["docker-repository-root"] : | ||
project.docker_image_default_repo_root) | ||
files "./build/" | ||
tags containerImageTags() | ||
buildArgs(['FLUTTER_VERSION': project.rootProject.hasProperty(["flutter-version"]) ? | ||
project.rootProject["flutter-version"] : | ||
"3.3.2" ]) | ||
} | ||
|
||
println(docker) | ||
println(containerImageName) | ||
|
||
// Ensure that we build the required resources and copy and file dependencies from related projects | ||
dockerPrepare.dependsOn copyDockerfileDependencies | ||
|
||
task("createConfig") { | ||
group = "build" | ||
description = "Generate config for the playground frontend project" | ||
doLast { | ||
def configFileName = "config.g.dart" | ||
def modulePath = project(":playground:frontend").projectDir.absolutePath | ||
def file = new File(modulePath + "/lib", configFileName) | ||
file.write("""/* | ||
* 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. | ||
*/ | ||
const String kApiClientURL = | ||
'${playgroundBackendUrl}'; | ||
const String kAnalyticsUA = '${analyticsUA}'; | ||
const String kApiJavaClientURL = | ||
'${playgroundBackendJavaRouteUrl}'; | ||
const String kApiGoClientURL = | ||
'${playgroundBackendGoRouteUrl}'; | ||
const String kApiPythonClientURL = | ||
'${playgroundBackendPythonRouteUrl}'; | ||
const String kApiScioClientURL = | ||
'${playgroundBackendScioRouteUrl}'; | ||
""") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.