Kotlin Gradle scripts. Part 1 of 2#532
Conversation
Codecov Report
@@ Coverage Diff @@
## master #532 +/- ##
=========================================
Coverage 73.70% 73.70%
Complexity 2930 2930
=========================================
Files 503 503
Lines 11873 11873
Branches 665 665
=========================================
Hits 8751 8751
Misses 2902 2902
Partials 220 220 |
|
@armiol, @alexander-yevsyukov, PTAL. |
armiol
left a comment
There was a problem hiding this comment.
@dmdashenkov mostly LGMT. Please see my comments.
| ) | ||
| @Deprecated("Use Flogger over SLF4J.", | ||
| replaceWith = ReplaceWith("Deps.runtime.floggerSystemBackend")) | ||
| @Suppress("DEPRECATION") |
There was a problem hiding this comment.
I don't understand this suppression. Can you please have a comment?
| testImplementation deps.build.errorProneTestHelpers | ||
| annotationProcessor(Deps.build.autoService.processor) | ||
| compileOnly(Deps.build.autoService.annotations) | ||
| implementation(project(":base")) |
There was a problem hiding this comment.
This one reads better than "implementation" in build.gradle.kt above, i.e.
"implementation"(Deps.build.guava)
"implementation"(Deps.build.checkerAnnotations)
"implementation"(Deps.build.jsr305Annotations)It is possible to use no-quote syntax there as well?
tools/plugin-base/build.gradle.kts
Outdated
| sourceSets.test { | ||
| resources.srcDir("$projectDir/src/test/resources") | ||
| } | ||
|
|
There was a problem hiding this comment.
Please kill these redundant empty lines.
alexander-yevsyukov
left a comment
There was a problem hiding this comment.
Please see my comments and questions.
.travis.yml
Outdated
| # Encrypted `GCS_SECRET` variable. | ||
| - secure: "i8MhONZu7QjyM2V887A1Tydr1WMqQP5jJZNjIJjc1Uae8F0/z8cJZIZ1hstodN7FpoR4VF92zyhUwbt6fz/dsdPEJFccsiMlEc9vlqecQCd267160wgRZneaB6Xe/y/EUmq9XsGdn/k1Ey+QZwX9au/8RU191v+fDsCtMRYXzyEa/BvbQuSwuYRgQDxTAxuJgTmG5Sxl9jWqKw1BfxUcEoErc/jqymU58w6z2TxKxVzIXT29Jy/Z12VuSiS8opigSrIP8e/1fctC84wI7S52mext2ZfhPYSTHFKS+xg1vQDYPb8m5aomL8E6Of7hVD5BTnEnyjj+/Gr63GAzHXtkHhWoxo+vB+xBFfDu8wxM5Aqna3H7LMDD5kGCxQEz8qmzHBHMAhLnhsRzjNVu2+tLCZdeMN88Ud2uemL2SCAcR8Juleg7DGMj3D0SAbPyUH3+9yYYWzSg6iaxgTdHBnJ+uXUJp0Nu+M2EK6Kl+pYAsCLVfZRPGaajFXVnJEPPeSr2PYzk7F4pIzgn/E8AtYEJ0gcEbjoTItS8EjliJKDXM4HdkluXBFLvzIH1O1nCtxKNv4UkUmPhFbfHrPXDcsYq2zsEe+NkvsJlxjAwYnOMkT4NLiEsec1a7K9bBC+iQA9e8rriMbu6/1w63JErQyx05avPjgO8XRDK8hxTf4rhBmY=" | ||
| - GRADLE_OPTS="-Xmx2G" | ||
| # TODO:2020-05-18:dmytro.dashenkov: Remove there 2 lines when Travis stops failing when installing JDK 8. |
There was a problem hiding this comment.
there -> these?
base/build.gradle.kts
Outdated
|
|
||
| configurations { | ||
| // Avoid collisions of Java classes defined both in `protobuf-lite` and `protobuf-java` | ||
| runtimeClasspath.get().exclude(group = "com.google.protobuf", module = "protobuf-lite") |
There was a problem hiding this comment.
Can we have these constants extracted into final variables?
base/build.gradle.kts
Outdated
| /** | ||
| * Checks if the given file belongs to the Google `.proto` sources. | ||
| */ | ||
| fun isGoogleProtoSource(file: FileTreeElement): Boolean { |
There was a problem hiding this comment.
Is it possible to do the following in this context:
fun FileTreeElement.isGoogleProtoSource(): Boolean { ... }
build.gradle.kts
Outdated
| from("$rootDir/config/gradle/dependencies.gradle") | ||
| } | ||
| version = rootProject.extra["versionToPublish"]!! | ||
| version = rootProject.extra["versionToPublish"]!! |
There was a problem hiding this comment.
Why do we need this twice?
build.gradle.kts
Outdated
| Deps.build.protobuf.forEach { "api"(it) } | ||
| "api"(Deps.build.flogger) | ||
| "implementation"(Deps.build.guava) | ||
| "implementation"(Deps.build.checkerAnnotations) |
There was a problem hiding this comment.
Are there calls that allow to say implementation only once, accepting a list of dependencies?
build.gradle.kts
Outdated
|
|
||
| DependencyResolution.forceConfiguration(configurations) | ||
| configurations { | ||
| named("runtime").get().exclude(group = "com.google.protobuf", module = "protobuf-lite") |
There was a problem hiding this comment.
I think this becomes a “reusable code”. Can we extract it somehow?
In this PR we start migrating our Gradle scripts to Kotlin.
For simplicity, we split the changes into 2 PRs. In this PR we migrate the basic scripts of the repo's main build. Other builds (
smoke-testsandbase-validating-builders) are to be migrated in the next part.