Skip to content

Commit 2fd1b71

Browse files
authored
Merge pull request #667 from SimonMarquis/cleanup/warnings
Cleanup warnings and replace deprecated methods
2 parents 70b9c4c + f19dd06 commit 2fd1b71

File tree

9 files changed

+15
-17
lines changed

9 files changed

+15
-17
lines changed

app-nia-catalog/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ android {
4747
missingDimensionStrategy(FlavorDimension.contentType.name, NiaFlavor.demo.name)
4848
}
4949

50-
packagingOptions {
50+
packaging {
5151
resources {
5252
excludes.add("/META-INF/{AL2.0,LGPL2.1}")
5353
}
5454
}
5555
namespace = "com.google.samples.apps.niacatalog"
5656

5757
buildTypes {
58-
val release by getting {
58+
release {
5959
// To publish on the Play store a private signing key is required, but to allow anyone
6060
// who clones the code to sign and run the release variant, use the debug signing key.
6161
// TODO: Abstract the signing configuration to a separate file to avoid hardcoding this.

app/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ android {
3939
}
4040

4141
buildTypes {
42-
val debug by getting {
42+
debug {
4343
applicationIdSuffix = NiaBuildType.DEBUG.applicationIdSuffix
4444
}
4545
val release by getting {
@@ -52,7 +52,7 @@ android {
5252
// TODO: Abstract the signing configuration to a separate file to avoid hardcoding this.
5353
signingConfig = signingConfigs.getByName("debug")
5454
}
55-
val benchmark by creating {
55+
create("benchmark") {
5656
// Enable all the optimizations from release build through initWith(release).
5757
initWith(release)
5858
matchingFallbacks.add("release")
@@ -65,7 +65,7 @@ android {
6565
}
6666
}
6767

68-
packagingOptions {
68+
packaging {
6969
resources {
7070
excludes.add("/META-INF/{AL2.0,LGPL2.1}")
7171
}

benchmarks/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ android {
3939
// This benchmark buildType is used for benchmarking, and should function like your
4040
// release build (for example, with minification on). It's signed with a debug key
4141
// for easy local/CI testing.
42-
val benchmark by creating {
42+
create("benchmark") {
4343
// Keep the build type debuggable so we can attach a debugger if needed.
4444
isDebuggable = true
4545
signingConfig = signingConfigs.getByName("debug")

build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/GradleManagedDevices.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import com.android.build.api.dsl.CommonExtension
2020
import com.android.build.api.dsl.ManagedVirtualDevice
2121
import org.gradle.api.Project
2222
import org.gradle.kotlin.dsl.invoke
23-
import java.util.Locale
2423

2524
/**
2625
* Configure project for Gradle managed devices
@@ -55,7 +54,7 @@ private data class DeviceConfig(
5554
val systemImageSource: String,
5655
) {
5756
val taskName = buildString {
58-
append(device.toLowerCase(Locale.ROOT).replace(" ", ""))
57+
append(device.lowercase().replace(" ", ""))
5958
append("api")
6059
append(apiLevel.toString())
6160
append(systemImageSource.replace("-", ""))

build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Jacoco.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import org.gradle.kotlin.dsl.withType
2727
import org.gradle.testing.jacoco.plugins.JacocoPluginExtension
2828
import org.gradle.testing.jacoco.plugins.JacocoTaskExtension
2929
import org.gradle.testing.jacoco.tasks.JacocoReport
30+
import java.util.Locale
3031

3132
private val coverageExclusions = listOf(
3233
// Android
@@ -36,6 +37,10 @@ private val coverageExclusions = listOf(
3637
"**/Manifest*.*"
3738
)
3839

40+
private fun String.capitalize() = replaceFirstChar {
41+
if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString()
42+
}
43+
3944
internal fun Project.configureJacoco(
4045
androidComponentsExtension: AndroidComponentsExtension<*, *, *>,
4146
) {

build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/KotlinAndroid.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ internal fun Project.configureKotlinAndroid(
6262
// Enable experimental coroutines APIs, including Flow
6363
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
6464
"-opt-in=kotlinx.coroutines.FlowPreview",
65-
"-opt-in=kotlin.Experimental",
6665
)
6766
}
6867
}

core/database/build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
// TODO: Remove once https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed
18-
@Suppress("DSL_SCOPE_VIOLATION")
1917
plugins {
2018
id("nowinandroid.android.library")
2119
id("nowinandroid.android.library.jacoco")

core/datastore/build.gradle.kts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
// TODO: Remove once https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed
18-
@Suppress("DSL_SCOPE_VIOLATION")
1917
plugins {
2018
id("nowinandroid.android.library")
2119
id("nowinandroid.android.library.jacoco")
@@ -43,10 +41,10 @@ protobuf {
4341
generateProtoTasks {
4442
all().forEach { task ->
4543
task.builtins {
46-
val java by registering {
44+
register("java") {
4745
option("lite")
4846
}
49-
val kotlin by registering {
47+
register("kotlin") {
5048
option("lite")
5149
}
5250
}

core/model/build.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
// TODO: Remove once https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed
17-
@Suppress("DSL_SCOPE_VIOLATION")
16+
1817
plugins {
1918
id("kotlin")
2019
}

0 commit comments

Comments
 (0)