Standardize to more kt-compatible syntax
The groovy file syntax was very inconsistent, and as we are moving toward
being able to configure gradle with kotlin instead of groovy, the kt-compatible
syntax is preferred by the build team.
Change-Id: I8692107f9095a5725364318ff6628101686389f1
diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
index 074020df..9e2ccc4 100644
--- a/buildSrc/build.gradle
+++ b/buildSrc/build.gradle
@@ -4,7 +4,7 @@
project.ext.supportRootFolder = project.projectDir.getParentFile()
repositories {
maven {
- url "${supportRootFolder}/../../prebuilts/androidx/external"
+ url("${supportRootFolder}/../../prebuilts/androidx/external")
}
}
@@ -16,7 +16,7 @@
configurations.classpath.resolutionStrategy {
eachDependency { details ->
- if (details.requested.group == 'org.jetbrains.kotlin') {
+ if (details.requested.group == "org.jetbrains.kotlin") {
details.useVersion build_versions.kotlin
}
}
@@ -28,7 +28,7 @@
ext.supportRootFolder = project.projectDir.getParentFile()
apply from: "local_dokka.gradle"
-apply from: 'repos.gradle'
+apply from: "repos.gradle"
apply from: "build_dependencies.gradle"
apply plugin: "kotlin"
apply from: "kotlin-dsl-dependency.gradle"
@@ -64,25 +64,25 @@
}
dependencies {
- cacheableApi build_libs.agp
- cacheableImplementation build_libs.dex_member_list
- cacheableApi build_libs.kotlin.gradle_plugin
- cacheableImplementation build_libs.kotlinpoet
- cacheableImplementation gradleApi()
- cacheableApi build_libs.dokka_gradle
+ cacheableApi(build_libs.agp)
+ cacheableImplementation(build_libs.dex_member_list)
+ cacheableApi(build_libs.kotlin.gradle_plugin)
+ cacheableImplementation(build_libs.kotlinpoet)
+ cacheableImplementation(gradleApi())
+ cacheableApi(build_libs.dokka_gradle)
// needed by inspection plugin
- cacheableImplementation "com.google.protobuf:protobuf-gradle-plugin:0.8.13"
+ cacheableImplementation("com.google.protobuf:protobuf-gradle-plugin:0.8.13")
// TODO(aurimas): remove when b/174658825 is fixed
- cacheableImplementation "org.anarres.jarjar:jarjar-gradle:1.0.1"
- cacheableImplementation "com.github.jengelman.gradle.plugins:shadow:5.2.0"
+ cacheableImplementation("org.anarres.jarjar:jarjar-gradle:1.0.1")
+ cacheableImplementation("com.github.jengelman.gradle.plugins:shadow:5.2.0")
// dependencies that aren't used by buildSrc directly but that we resolve here so that the
// root project doesn't need to re-resolve them and their dependencies on every build
- cacheableRuntimeOnly build_libs.hilt_plugin
+ cacheableRuntimeOnly(build_libs.hilt_plugin)
// room kotlintestapp uses the ksp plugin but it does not publish a plugin marker yet
- cacheableRuntimeOnly build_libs.kotlin.ksp_gradle_plugin
+ cacheableRuntimeOnly(build_libs.kotlin.ksp_gradle_plugin)
// dependencies whose resolutions we don't need to cache
compileOnly(findGradleKotlinDsl()) // Only one file in this configuration, no need to cache it
- implementation project("jetpad-integration") // Doesn't have a .pom, so not slow to load
+ implementation(project("jetpad-integration")) // Doesn't have a .pom, so not slow to load
}
apply plugin: "java-gradle-plugin"
@@ -102,12 +102,12 @@
gradlePlugin {
plugins {
benchmark {
- id = 'androidx.benchmark'
- implementationClass = 'androidx.benchmark.gradle.BenchmarkPlugin'
+ id = "androidx.benchmark"
+ implementationClass = "androidx.benchmark.gradle.BenchmarkPlugin"
}
inspection {
- id = 'androidx.inspection'
- implementationClass = 'androidx.inspection.gradle.InspectionPlugin'
+ id = "androidx.inspection"
+ implementationClass = "androidx.inspection.gradle.InspectionPlugin"
}
}
}
diff --git a/buildSrc/build_dependencies.gradle b/buildSrc/build_dependencies.gradle
index 16179ec..c6dacda 100644
--- a/buildSrc/build_dependencies.gradle
+++ b/buildSrc/build_dependencies.gradle
@@ -47,10 +47,10 @@
if (System.getenv("BUILD_DOKKA") != null) {
build_versions.dokka = getSourceDokkaVersion()
} else {
- build_versions.dokka = '0.9.17-g013'
+ build_versions.dokka = "0.9.17-g013"
}
-rootProject.ext['build_versions'] = build_versions
+rootProject.ext["build_versions"] = build_versions
def build_libs = [:]
@@ -75,4 +75,4 @@
build_libs.hilt_plugin = "com.google.dagger:hilt-android-gradle-plugin:${build_versions.hilt}"
-rootProject.ext['build_libs'] = build_libs
+rootProject.ext["build_libs"] = build_libs
diff --git a/buildSrc/dependencies.gradle b/buildSrc/dependencies.gradle
index 6c39faa..0eb002e 100644
--- a/buildSrc/dependencies.gradle
+++ b/buildSrc/dependencies.gradle
@@ -17,18 +17,18 @@
def libs = [:]
libs.exclude_bytebuddy = {
- exclude group: 'net.bytebuddy'
+ exclude group: "net.bytebuddy"
}
libs.exclude_for_espresso = {
- exclude group: 'androidx.annotation'
- exclude group: 'androidx.appcompat'
- exclude group: 'androidx.recyclerview'
- exclude group: 'androidx.legacy'
- exclude group: 'androidx.cardview'
- exclude group: 'androidx.fragment'
- exclude group: 'com.google.android.material'
- exclude group: 'androidx.core'
+ exclude group: "androidx.annotation"
+ exclude group: "androidx.appcompat"
+ exclude group: "androidx.recyclerview"
+ exclude group: "androidx.legacy"
+ exclude group: "androidx.cardview"
+ exclude group: "androidx.fragment"
+ exclude group: "com.google.android.material"
+ exclude group: "androidx.core"
}
-rootProject.ext['libs'] = libs
+rootProject.ext["libs"] = libs
diff --git a/buildSrc/jetpad-integration/build.gradle b/buildSrc/jetpad-integration/build.gradle
index e09185b..995d9c5 100644
--- a/buildSrc/jetpad-integration/build.gradle
+++ b/buildSrc/jetpad-integration/build.gradle
@@ -1 +1 @@
-apply plugin:'java'
\ No newline at end of file
+apply plugin:"java"
diff --git a/buildSrc/remoteBuildCache.gradle b/buildSrc/remoteBuildCache.gradle
index 51c07c2..11efaf3 100644
--- a/buildSrc/remoteBuildCache.gradle
+++ b/buildSrc/remoteBuildCache.gradle
@@ -1,7 +1,7 @@
-def useRemoteBuildCache = System.getenv('USE_ANDROIDX_REMOTE_BUILD_CACHE') == 'true'
+def useRemoteBuildCache = System.getenv("USE_ANDROIDX_REMOTE_BUILD_CACHE") == "true"
if (useRemoteBuildCache) {
- logger.warn('Using AndroidX remote build cache')
+ logger.warn("Using AndroidX remote build cache")
gradle.settingsEvaluated { settings ->
settings.buildCache {
remote(HttpBuildCache) {
@@ -10,10 +10,10 @@
case { it.contains("mac os x") }:
case { it.contains("darwin") }:
case { it.contains("osx") }:
- url = 'http://gradle-remote-cache.uplink2.goog:999/cache/'
+ url = "http://gradle-remote-cache.uplink2.goog:999/cache/"
break
default:
- url = 'http://gradle-remote-cache.uplink.goog:999/cache/'
+ url = "http://gradle-remote-cache.uplink.goog:999/cache/"
break
}
allowInsecureProtocol = true
diff --git a/buildSrc/repos.gradle b/buildSrc/repos.gradle
index 12d0d92..a882adba 100644
--- a/buildSrc/repos.gradle
+++ b/buildSrc/repos.gradle
@@ -31,7 +31,7 @@
*/
def addMavenRepositories(RepositoryHandler handler) {
handler.maven {
- url "${repos.prebuiltsRoot}/androidx/internal"
+ url("${repos.prebuiltsRoot}/androidx/internal")
metadataSources {
mavenPom()
artifact()
@@ -45,7 +45,7 @@
handler.ivy {
// TODO: maybe we can move this no-group ivy repo directly into prebuilts/androidx/external
// once https://youtrack.jetbrains.com/issue/KT-35049 gets resolved */
- url "${repos.prebuiltsRoot}/androidx/external/no-group"
+ url("${repos.prebuiltsRoot}/androidx/external/no-group")
patternLayout {
artifact("[artifact]/[revision]/[artifact]-[revision].[ext]")
}
@@ -53,12 +53,12 @@
it.artifact()
}
content {
- includeGroup ""
+ includeGroup("")
}
}
def buildDokka = System.getenv("BUILD_DOKKA") != null
handler.maven {
- url "${repos.prebuiltsRoot}/androidx/external"
+ url("${repos.prebuiltsRoot}/androidx/external")
metadataSources {
mavenPom()
artifact()
@@ -71,9 +71,9 @@
}
if (buildDokka) {
handler.maven {
- url "${repos.checkoutRoot}/external/dokka/build/dist-maven"
+ url("${repos.checkoutRoot}/external/dokka/build/dist-maven")
content {
- includeGroup "org.jetbrains.dokka"
+ includeGroup("org.jetbrains.dokka")
}
}
}
@@ -82,7 +82,7 @@
handler.jcenter()
handler.google()
handler.maven {
- url "https://plugins.gradle.org/m2/"
+ url("https://plugins.gradle.org/m2/")
}
handler.mavenLocal()
}
diff --git a/buildSrc/settings.gradle b/buildSrc/settings.gradle
index af0681e..9849f62 100644
--- a/buildSrc/settings.gradle
+++ b/buildSrc/settings.gradle
@@ -14,4 +14,4 @@
* limitations under the License.
*/
-include ':jetpad-integration'
+include ":jetpad-integration"