Merge pull request #667 from SimonMarquis/cleanup/warnings

Cleanup warnings and replace deprecated methods
pull/700/head
Don Turner 2 years ago committed by GitHub
commit 2fd1b716f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -47,7 +47,7 @@ android {
missingDimensionStrategy(FlavorDimension.contentType.name, NiaFlavor.demo.name) missingDimensionStrategy(FlavorDimension.contentType.name, NiaFlavor.demo.name)
} }
packagingOptions { packaging {
resources { resources {
excludes.add("/META-INF/{AL2.0,LGPL2.1}") excludes.add("/META-INF/{AL2.0,LGPL2.1}")
} }
@ -55,7 +55,7 @@ android {
namespace = "com.google.samples.apps.niacatalog" namespace = "com.google.samples.apps.niacatalog"
buildTypes { buildTypes {
val release by getting { release {
// To publish on the Play store a private signing key is required, but to allow anyone // To publish on the Play store a private signing key is required, but to allow anyone
// who clones the code to sign and run the release variant, use the debug signing key. // who clones the code to sign and run the release variant, use the debug signing key.
// TODO: Abstract the signing configuration to a separate file to avoid hardcoding this. // TODO: Abstract the signing configuration to a separate file to avoid hardcoding this.

@ -39,7 +39,7 @@ android {
} }
buildTypes { buildTypes {
val debug by getting { debug {
applicationIdSuffix = NiaBuildType.DEBUG.applicationIdSuffix applicationIdSuffix = NiaBuildType.DEBUG.applicationIdSuffix
} }
val release by getting { val release by getting {
@ -52,7 +52,7 @@ android {
// TODO: Abstract the signing configuration to a separate file to avoid hardcoding this. // TODO: Abstract the signing configuration to a separate file to avoid hardcoding this.
signingConfig = signingConfigs.getByName("debug") signingConfig = signingConfigs.getByName("debug")
} }
val benchmark by creating { create("benchmark") {
// Enable all the optimizations from release build through initWith(release). // Enable all the optimizations from release build through initWith(release).
initWith(release) initWith(release)
matchingFallbacks.add("release") matchingFallbacks.add("release")
@ -65,7 +65,7 @@ android {
} }
} }
packagingOptions { packaging {
resources { resources {
excludes.add("/META-INF/{AL2.0,LGPL2.1}") excludes.add("/META-INF/{AL2.0,LGPL2.1}")
} }

@ -39,7 +39,7 @@ android {
// This benchmark buildType is used for benchmarking, and should function like your // This benchmark buildType is used for benchmarking, and should function like your
// release build (for example, with minification on). It's signed with a debug key // release build (for example, with minification on). It's signed with a debug key
// for easy local/CI testing. // for easy local/CI testing.
val benchmark by creating { create("benchmark") {
// Keep the build type debuggable so we can attach a debugger if needed. // Keep the build type debuggable so we can attach a debugger if needed.
isDebuggable = true isDebuggable = true
signingConfig = signingConfigs.getByName("debug") signingConfig = signingConfigs.getByName("debug")

@ -20,7 +20,6 @@ import com.android.build.api.dsl.CommonExtension
import com.android.build.api.dsl.ManagedVirtualDevice import com.android.build.api.dsl.ManagedVirtualDevice
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.kotlin.dsl.invoke import org.gradle.kotlin.dsl.invoke
import java.util.Locale
/** /**
* Configure project for Gradle managed devices * Configure project for Gradle managed devices
@ -55,7 +54,7 @@ private data class DeviceConfig(
val systemImageSource: String, val systemImageSource: String,
) { ) {
val taskName = buildString { val taskName = buildString {
append(device.toLowerCase(Locale.ROOT).replace(" ", "")) append(device.lowercase().replace(" ", ""))
append("api") append("api")
append(apiLevel.toString()) append(apiLevel.toString())
append(systemImageSource.replace("-", "")) append(systemImageSource.replace("-", ""))

@ -27,6 +27,7 @@ import org.gradle.kotlin.dsl.withType
import org.gradle.testing.jacoco.plugins.JacocoPluginExtension import org.gradle.testing.jacoco.plugins.JacocoPluginExtension
import org.gradle.testing.jacoco.plugins.JacocoTaskExtension import org.gradle.testing.jacoco.plugins.JacocoTaskExtension
import org.gradle.testing.jacoco.tasks.JacocoReport import org.gradle.testing.jacoco.tasks.JacocoReport
import java.util.Locale
private val coverageExclusions = listOf( private val coverageExclusions = listOf(
// Android // Android
@ -36,6 +37,10 @@ private val coverageExclusions = listOf(
"**/Manifest*.*" "**/Manifest*.*"
) )
private fun String.capitalize() = replaceFirstChar {
if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString()
}
internal fun Project.configureJacoco( internal fun Project.configureJacoco(
androidComponentsExtension: AndroidComponentsExtension<*, *, *>, androidComponentsExtension: AndroidComponentsExtension<*, *, *>,
) { ) {

@ -62,7 +62,6 @@ internal fun Project.configureKotlinAndroid(
// Enable experimental coroutines APIs, including Flow // Enable experimental coroutines APIs, including Flow
"-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi", "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-opt-in=kotlinx.coroutines.FlowPreview", "-opt-in=kotlinx.coroutines.FlowPreview",
"-opt-in=kotlin.Experimental",
) )
} }
} }

@ -14,8 +14,6 @@
* limitations under the License. * limitations under the License.
*/ */
// TODO: Remove once https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed
@Suppress("DSL_SCOPE_VIOLATION")
plugins { plugins {
id("nowinandroid.android.library") id("nowinandroid.android.library")
id("nowinandroid.android.library.jacoco") id("nowinandroid.android.library.jacoco")

@ -14,8 +14,6 @@
* limitations under the License. * limitations under the License.
*/ */
// TODO: Remove once https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed
@Suppress("DSL_SCOPE_VIOLATION")
plugins { plugins {
id("nowinandroid.android.library") id("nowinandroid.android.library")
id("nowinandroid.android.library.jacoco") id("nowinandroid.android.library.jacoco")
@ -43,10 +41,10 @@ protobuf {
generateProtoTasks { generateProtoTasks {
all().forEach { task -> all().forEach { task ->
task.builtins { task.builtins {
val java by registering { register("java") {
option("lite") option("lite")
} }
val kotlin by registering { register("kotlin") {
option("lite") option("lite")
} }
} }

@ -13,8 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
// TODO: Remove once https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed
@Suppress("DSL_SCOPE_VIOLATION")
plugins { plugins {
id("kotlin") id("kotlin")
} }

Loading…
Cancel
Save