Skip to content

Commit

Permalink
Quick gradle fix
Browse files Browse the repository at this point in the history
`the` is replaced by `configure` when applicable

rgegerger
  • Loading branch information
VincentMasselis committed Jun 4, 2024
1 parent ec90730 commit 6ca0c9c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 24 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ buildSrc/build/**
.idea/vcs.xml
.idea/migrations.xml
.idea/deploymentTargetSelector.xml
*.salive
11 changes: 0 additions & 11 deletions app/phone/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,7 @@ android {
defaultConfig {
applicationId = "com.masselis.tpmsadvanced"
namespace = "com.masselis.tpmsadvanced"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
// `useTestStorageService` enables the ability to store files when capturing screenshots.
// `clearPackageData` makes the Android Test Orchestrator run its "pm clear" command after
// each test invocation. This command ensures that the app's state is completely cleared
// between tests.
testInstrumentationRunnerArguments += mapOf(
"useTestStorageService" to "true",
"clearPackageData" to "true"
)
}
testOptions.execution = "ANDROIDX_TEST_ORCHESTRATOR"
if (isDecrypted) {
signingConfigs.create("release") {
val APP_KEY_ALIAS: String by rootProject.extra
Expand Down
11 changes: 10 additions & 1 deletion buildSrc/src/main/kotlin/android-common.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,23 @@ plugins {

// `android {}` is unavailable since I only use the plugin com.android.base
@Suppress("UnstableApiUsage")
the<BaseExtension>().apply android@{
configure<BaseExtension> android@{
compileSdkVersion(libs.versions.sdk.compile.map { it.toInt() }.get())
defaultConfig {
minSdk = libs.versions.sdk.min.map { it.toInt() }.get()
targetSdk = libs.versions.sdk.target.map { it.toInt() }.get()
buildToolsVersion(libs.versions.build.tool.get())

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
// `useTestStorageService` enables the ability to store files when capturing screenshots.
// `clearPackageData` makes the Android Test Orchestrator run its "pm clear" command after
// each test invocation. This command ensures that the app's state is completely cleared
// between tests.
testInstrumentationRunnerArguments += mapOf(
"useTestStorageService" to "true",
"clearPackageData" to "true"
)
testOptions.execution = "ANDROIDX_TEST_ORCHESTRATOR"
}
compileOptions {
// Using sdk 34 allow the usage of Java 17 compatibility
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import org.gradle.api.GradleException
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.assign
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.create
import org.gradle.kotlin.dsl.from
import org.gradle.kotlin.dsl.property
import org.gradle.kotlin.dsl.the

public class GitflowPlugin : Plugin<Project> {
override fun apply(project: Project): Unit = with(project) {
Expand Down Expand Up @@ -75,7 +75,7 @@ public class GitflowPlugin : Plugin<Project> {
})
subprojects {
plugins.all {
if (this is LibraryPlugin) the<BaseExtension>().apply {
if (this is LibraryPlugin) configure<BaseExtension> {
afterEvaluate {
if (buildFeatures.buildConfig == true) productFlavors.all {
buildConfigField(
Expand All @@ -91,7 +91,7 @@ public class GitflowPlugin : Plugin<Project> {
}
}
}
if (this is AppPlugin) the<BaseAppModuleExtension>().apply {
if (this is AppPlugin) configure<BaseAppModuleExtension> {
defaultConfig.versionCode = versionCode.get()
defaultConfig.versionName = currentReleaseTag.get().toString()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.configurationcache.extensions.capitalized
import org.gradle.kotlin.dsl.assign
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.create
import org.gradle.kotlin.dsl.from
import org.gradle.kotlin.dsl.registerIfAbsent
import org.gradle.kotlin.dsl.the

@Suppress("UnstableApiUsage")
public class PlayStorePlugin : Plugin<Project> {
Expand All @@ -29,7 +29,7 @@ public class PlayStorePlugin : Plugin<Project> {
parameters.serviceAccountCredentials = ext.serviceAccountCredentials
}

the<ApplicationAndroidComponentsExtension>().apply {
configure<ApplicationAndroidComponentsExtension> {
onVariants { variant ->
if (variant.isMinifyEnabled.not())
return@onVariants
Expand Down
7 changes: 0 additions & 7 deletions data/vehicle/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ plugins {

android {
namespace = "com.masselis.tpmsadvanced.data.vehicle"
defaultConfig {
// The following argument makes the Android Test Orchestrator run its
// "pm clear" command after each test invocation. This command ensures
// that the app's state is completely cleared between tests.
testInstrumentationRunnerArguments += "clearPackageData" to "true"
}
testOptions.execution = "ANDROIDX_TEST_ORCHESTRATOR"
}

dependencies {
Expand Down

0 comments on commit 6ca0c9c

Please sign in to comment.