Skip to content

Commit b75b3c9

Browse files
authored
Update AGP version to 7.4 (#353)
* AGP Update * Update build files * Update more buildscripts * Fix formatting
1 parent 62651d9 commit b75b3c9

File tree

67 files changed

+2357
-2050
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+2357
-2050
lines changed

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
root = true
2+
3+
[*.{kt,kts}]
4+
indent_size = 2

.github/workflows/gradle-build.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ jobs:
77
steps:
88
- uses: actions/checkout@v4
99
- uses: gradle/actions/wrapper-validation@v3
10-
- uses: actions/setup-java@v4
10+
- name: "Set up JDK 11"
11+
uses: actions/setup-java@v4
1112
with:
1213
distribution: 'temurin'
13-
java-version: '8'
14+
java-version: '11'
1415
- uses: gradle/actions/setup-gradle@v3
1516
name: Setup Gradle
1617
- name: Check Fladle

android-library-no-tests/build.gradle.kts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,22 @@ plugins {
44
}
55

66
android {
7-
compileSdkVersion(29)
7+
compileSdk = 33
8+
namespace = "com.osacky.flank.gradle.sample.library"
89
defaultConfig {
9-
minSdkVersion(23)
10-
targetSdkVersion(29)
10+
minSdk = 23
1111
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
1212
}
13+
compileOptions {
14+
sourceCompatibility = JavaVersion.VERSION_11
15+
targetCompatibility = JavaVersion.VERSION_11
16+
}
17+
}
18+
19+
java {
20+
toolchain {
21+
languageVersion = JavaLanguageVersion.of(11)
22+
}
1323
}
1424

1525
fulladleModuleConfig {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest package="com.osacky.flank.gradle.sample.library"/>
2+
<manifest />

android-library-no-tests/src/main/java/com/osacky/flank/gradle/sample/MainActivity.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import android.os.Bundle
44
import androidx.appcompat.app.AppCompatActivity
55

66
class MainActivity : AppCompatActivity() {
7-
87
override fun onCreate(savedInstanceState: Bundle?) {
98
super.onCreate(savedInstanceState)
109
}

build.gradle

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,16 @@ plugins {
1313
alias(libs.plugins.kotlinter)
1414
}
1515

16-
kotlinter {
17-
indentSize = 2
18-
}
19-
2016
allprojects {
2117
apply plugin: "org.jmailen.kotlinter"
22-
23-
kotlinter {
24-
indentSize = 2
25-
}
2618
}
2719

2820
fladle {
2921
serviceAccountCredentials = project.layout.projectDirectory.file("sample/flank-gradle-5cf02dc90531.json")
3022
}
3123

32-
tasks.named('wrapper').configure {
33-
gradleVersion = '7.6.3'
24+
tasks.wrapper.configure {
25+
gradleVersion = '8.4'
3426
}
3527

3628
def isNonStable = { String version ->

fladle-plugin/build.gradle.kts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ dependencies {
3636
testImplementation(libs.truth)
3737
}
3838

39-
kotlinter {
40-
indentSize = 2
41-
}
42-
4339
gradlePlugin {
4440
website.set("https://github.com/runningcode/fladle")
4541
vcsUrl.set("https://github.com/runningcode/fladle")
@@ -136,17 +132,17 @@ tasks.withType(ValidatePlugins::class.java).configureEach {
136132
enableStricterValidation.set(true)
137133
}
138134

139-
// Ensure Java 8 Compatibility. See https://github.com/runningcode/fladle/issues/246
135+
// Ensure Java 11 Compatibility. See https://github.com/runningcode/fladle/issues/246
140136
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class.java).configureEach {
141137
kotlinOptions {
142-
jvmTarget = "1.8"
143-
languageVersion = "1.4"
144-
apiVersion = "1.4"
138+
jvmTarget = "11"
139+
languageVersion = "1.7"
140+
apiVersion = "1.7"
145141
}
146142
}
147143

148144
java {
149145
toolchain {
150-
languageVersion.set(JavaLanguageVersion.of(8))
146+
languageVersion.set(JavaLanguageVersion.of(11))
151147
}
152148
}

fladle-plugin/src/main/java/com/osacky/flank/gradle/FladleConfig.kt

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ interface FladleConfig {
5353

5454
@Deprecated(
5555
message = "testShards is deprecated. Use maxTestShards instead",
56-
replaceWith = ReplaceWith("maxTestShards")
56+
replaceWith = ReplaceWith("maxTestShards"),
5757
)
5858
/**
5959
* The maximum number of shards. Value will be overwritten by [maxTestShards] if both used in configuration
@@ -472,13 +472,14 @@ interface FladleConfig {
472472
val additionalGcloudOptions: Property<String>
473473

474474
@Internal
475-
fun getPresentProperties() = this::class.memberProperties
476-
.filter {
477-
when (val prop = it.call(this)) {
478-
is Property<*> -> prop.isPresent
479-
is MapProperty<*, *> -> prop.isPresent && prop.get().isNotEmpty()
480-
is ListProperty<*> -> prop.isPresent && prop.get().isNotEmpty()
481-
else -> false
475+
fun getPresentProperties() =
476+
this::class.memberProperties
477+
.filter {
478+
when (val prop = it.call(this)) {
479+
is Property<*> -> prop.isPresent
480+
is MapProperty<*, *> -> prop.isPresent && prop.get().isNotEmpty()
481+
is ListProperty<*> -> prop.isPresent && prop.get().isNotEmpty()
482+
else -> false
483+
}
482484
}
483-
}
484485
}

fladle-plugin/src/main/java/com/osacky/flank/gradle/FladleConfigImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ data class FladleConfigImpl(
6868
override val additionalFlankOptions: Property<String>,
6969
override val additionalGcloudOptions: Property<String>,
7070
override val dependOnAssemble: Property<Boolean>,
71-
override val async: Property<Boolean>
71+
override val async: Property<Boolean>,
7272
) : FladleConfig {
7373
/**
7474
* Prepare config to run sanity robo.

fladle-plugin/src/main/java/com/osacky/flank/gradle/FladlePluginDelegate.kt

Lines changed: 49 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import org.gradle.kotlin.dsl.create
1414
import org.gradle.util.GradleVersion
1515

1616
class FladlePluginDelegate {
17-
1817
fun apply(target: Project) {
1918
checkMinimumGradleVersion()
2019

@@ -41,7 +40,10 @@ class FladlePluginDelegate {
4140
}
4241
}
4342

44-
private fun configureTasks(project: Project, base: FlankGradleExtension) {
43+
private fun configureTasks(
44+
project: Project,
45+
base: FlankGradleExtension,
46+
) {
4547
if (GradleVersion.current() > GradleVersion.version("6.1")) {
4648
base.flankVersion.finalizeValueOnRead()
4749
base.flankCoordinates.finalizeValueOnRead()
@@ -70,21 +72,26 @@ class FladlePluginDelegate {
7072
}
7173
}
7274

73-
private fun TaskContainer.createTasksForConfig(base: FlankGradleExtension, config: FladleConfig, project: Project, name: String) {
74-
75+
private fun TaskContainer.createTasksForConfig(
76+
base: FlankGradleExtension,
77+
config: FladleConfig,
78+
project: Project,
79+
name: String,
80+
) {
7581
val configName = name.toLowerCase()
7682
// we want to use default dir only if user did not set own `localResultsDir`
7783
val useDefaultDir = config.localResultsDir.isPresent.not()
7884

79-
val validateFladle = register("validateFladleConfig$name") {
80-
description = "Perform validation actions"
81-
group = TASK_GROUP
82-
doLast {
83-
checkIfSanityAndValidateConfigs(config)
84-
validateOptionsUsed(config = config, flank = base.flankVersion.get())
85-
checkForExclusionUsage(config)
85+
val validateFladle =
86+
register("validateFladleConfig$name") {
87+
description = "Perform validation actions"
88+
group = TASK_GROUP
89+
doLast {
90+
checkIfSanityAndValidateConfigs(config)
91+
validateOptionsUsed(config = config, flank = base.flankVersion.get())
92+
checkForExclusionUsage(config)
93+
}
8694
}
87-
}
8895

8996
val writeConfigProps = register("writeConfigProps$name", YamlConfigWriterTask::class.java, base, config, name)
9097

@@ -112,17 +119,25 @@ class FladlePluginDelegate {
112119
if (useDefaultDir) setUpWorkingDir(configName)
113120
description = "Runs instrumentation tests using flank on firebase test lab."
114121
classpath = project.fladleConfig
115-
args = if (project.hasProperty("dumpShards")) {
116-
listOf("firebase", "test", "android", "run", "-c", writeConfigProps.get().fladleConfigFile.get().asFile.absolutePath, "--dump-shards")
117-
} else {
118-
listOf("firebase", "test", "android", "run", "-c", writeConfigProps.get().fladleConfigFile.get().asFile.absolutePath)
119-
}
122+
args =
123+
if (project.hasProperty("dumpShards")) {
124+
listOf(
125+
"firebase", "test", "android", "run", "-c",
126+
writeConfigProps.get().fladleConfigFile.get().asFile.absolutePath, "--dump-shards",
127+
)
128+
} else {
129+
listOf(
130+
"firebase", "test", "android", "run", "-c",
131+
writeConfigProps.get().fladleConfigFile.get().asFile.absolutePath,
132+
)
133+
}
120134
if (config.serviceAccountCredentials.isPresent) {
121135
environment(mapOf("GOOGLE_APPLICATION_CREDENTIALS" to config.serviceAccountCredentials.get()))
122136
}
123137
dependsOn(writeConfigProps)
124138
if (config.dependOnAssemble.isPresent && config.dependOnAssemble.get()) {
125-
val testedExtension = requireNotNull(project.extensions.findByType(TestedExtension::class.java)) { "Could not find TestedExtension in ${project.name}" }
139+
val testedExtension =
140+
requireNotNull(project.extensions.findByType(TestedExtension::class.java)) { "Could not find TestedExtension in ${project.name}" }
126141
testedExtension.testVariants.configureEach {
127142
if (testedVariant.isExpectedVariant(config)) {
128143
if (testedVariant.assembleProvider.isPresent) {
@@ -154,19 +169,28 @@ class FladlePluginDelegate {
154169
}
155170
}
156171

157-
private fun automaticallyConfigureTestOrchestrator(project: Project, config: FladleConfig, androidExtension: AppExtension) {
172+
private fun automaticallyConfigureTestOrchestrator(
173+
project: Project,
174+
config: FladleConfig,
175+
androidExtension: AppExtension,
176+
) {
158177
project.afterEvaluate {
159-
val useOrchestrator = androidExtension.testOptions.getExecutionEnum() == TestOptions.Execution.ANDROIDX_TEST_ORCHESTRATOR ||
160-
androidExtension.testOptions.getExecutionEnum() == TestOptions.Execution.ANDROID_TEST_ORCHESTRATOR
178+
val useOrchestrator =
179+
androidExtension.testOptions.getExecutionEnum() == TestOptions.Execution.ANDROIDX_TEST_ORCHESTRATOR ||
180+
androidExtension.testOptions.getExecutionEnum() == TestOptions.Execution.ANDROID_TEST_ORCHESTRATOR
161181
if (useOrchestrator) {
162182
log("Automatically detected the use of Android Test Orchestrator")
163183
}
164184
config.useOrchestrator.set(useOrchestrator)
165185
}
166186
}
167187

168-
private fun findDebugAndInstrumentationApk(project: Project, config: FladleConfig) {
169-
val baseExtension = requireNotNull(project.extensions.findByType(AppExtension::class.java)) { "Could not find AppExtension in ${project.name}" }
188+
private fun findDebugAndInstrumentationApk(
189+
project: Project,
190+
config: FladleConfig,
191+
) {
192+
val baseExtension =
193+
requireNotNull(project.extensions.findByType(AppExtension::class.java)) { "Could not find AppExtension in ${project.name}" }
170194
automaticallyConfigureTestOrchestrator(project, config, baseExtension)
171195
baseExtension.testVariants.configureEach {
172196
val appVariant = testedVariant
@@ -195,9 +219,10 @@ class FladlePluginDelegate {
195219
get() = configurations.getByName(FLADLE_CONFIG)
196220

197221
companion object {
198-
val GRADLE_MIN_VERSION: GradleVersion = GradleVersion.version("5.5")
222+
val GRADLE_MIN_VERSION: GradleVersion = GradleVersion.version("6.5")
199223
const val TASK_GROUP = "fladle"
200224
const val FLADLE_CONFIG = "fladle"
225+
201226
fun Project.log(message: String) {
202227
logger.info("Fladle: $message")
203228
}

0 commit comments

Comments
 (0)