diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 00000000..8e2a5955
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,4 @@
+root = true
+
+[*.{kt,kts}]
+indent_size = 2
\ No newline at end of file
diff --git a/.github/workflows/gradle-build.yml b/.github/workflows/gradle-build.yml
index 54bf30fc..4a81caf6 100644
--- a/.github/workflows/gradle-build.yml
+++ b/.github/workflows/gradle-build.yml
@@ -7,10 +7,11 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: gradle/actions/wrapper-validation@v3
- - uses: actions/setup-java@v4
+ - name: "Set up JDK 11"
+ uses: actions/setup-java@v4
with:
distribution: 'temurin'
- java-version: '8'
+ java-version: '11'
- uses: gradle/actions/setup-gradle@v3
name: Setup Gradle
- name: Check Fladle
diff --git a/android-library-no-tests/build.gradle.kts b/android-library-no-tests/build.gradle.kts
index 9ef01243..bed1b75d 100644
--- a/android-library-no-tests/build.gradle.kts
+++ b/android-library-no-tests/build.gradle.kts
@@ -4,12 +4,22 @@ plugins {
}
android {
- compileSdkVersion(29)
+ compileSdk = 33
+ namespace = "com.osacky.flank.gradle.sample.library"
defaultConfig {
- minSdkVersion(23)
- targetSdkVersion(29)
+ minSdk = 23
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
+ compileOptions {
+ sourceCompatibility = JavaVersion.VERSION_11
+ targetCompatibility = JavaVersion.VERSION_11
+ }
+}
+
+java {
+ toolchain {
+ languageVersion = JavaLanguageVersion.of(11)
+ }
}
fulladleModuleConfig {
diff --git a/android-library-no-tests/src/main/AndroidManifest.xml b/android-library-no-tests/src/main/AndroidManifest.xml
index 8487ce01..8072ee00 100644
--- a/android-library-no-tests/src/main/AndroidManifest.xml
+++ b/android-library-no-tests/src/main/AndroidManifest.xml
@@ -1,2 +1,2 @@
-
+
diff --git a/android-library-no-tests/src/main/java/com/osacky/flank/gradle/sample/MainActivity.kt b/android-library-no-tests/src/main/java/com/osacky/flank/gradle/sample/MainActivity.kt
index c0132658..964eb395 100644
--- a/android-library-no-tests/src/main/java/com/osacky/flank/gradle/sample/MainActivity.kt
+++ b/android-library-no-tests/src/main/java/com/osacky/flank/gradle/sample/MainActivity.kt
@@ -4,7 +4,6 @@ import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
class MainActivity : AppCompatActivity() {
-
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
}
diff --git a/build.gradle b/build.gradle
index 1296d1bc..20fdfeaf 100644
--- a/build.gradle
+++ b/build.gradle
@@ -13,24 +13,16 @@ plugins {
alias(libs.plugins.kotlinter)
}
-kotlinter {
- indentSize = 2
-}
-
allprojects {
apply plugin: "org.jmailen.kotlinter"
-
- kotlinter {
- indentSize = 2
- }
}
fladle {
serviceAccountCredentials = project.layout.projectDirectory.file("sample/flank-gradle-5cf02dc90531.json")
}
-tasks.named('wrapper').configure {
- gradleVersion = '7.6.3'
+tasks.wrapper.configure {
+ gradleVersion = '8.4'
}
def isNonStable = { String version ->
diff --git a/fladle-plugin/build.gradle.kts b/fladle-plugin/build.gradle.kts
index 311ed2ca..14412bcb 100644
--- a/fladle-plugin/build.gradle.kts
+++ b/fladle-plugin/build.gradle.kts
@@ -36,10 +36,6 @@ dependencies {
testImplementation(libs.truth)
}
-kotlinter {
- indentSize = 2
-}
-
gradlePlugin {
website.set("https://github.com/runningcode/fladle")
vcsUrl.set("https://github.com/runningcode/fladle")
@@ -136,17 +132,17 @@ tasks.withType(ValidatePlugins::class.java).configureEach {
enableStricterValidation.set(true)
}
-// Ensure Java 8 Compatibility. See https://github.com/runningcode/fladle/issues/246
+// Ensure Java 11 Compatibility. See https://github.com/runningcode/fladle/issues/246
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class.java).configureEach {
kotlinOptions {
- jvmTarget = "1.8"
- languageVersion = "1.4"
- apiVersion = "1.4"
+ jvmTarget = "11"
+ languageVersion = "1.7"
+ apiVersion = "1.7"
}
}
java {
toolchain {
- languageVersion.set(JavaLanguageVersion.of(8))
+ languageVersion.set(JavaLanguageVersion.of(11))
}
}
diff --git a/fladle-plugin/src/main/java/com/osacky/flank/gradle/FladleConfig.kt b/fladle-plugin/src/main/java/com/osacky/flank/gradle/FladleConfig.kt
index 30486811..869a9938 100644
--- a/fladle-plugin/src/main/java/com/osacky/flank/gradle/FladleConfig.kt
+++ b/fladle-plugin/src/main/java/com/osacky/flank/gradle/FladleConfig.kt
@@ -53,7 +53,7 @@ interface FladleConfig {
@Deprecated(
message = "testShards is deprecated. Use maxTestShards instead",
- replaceWith = ReplaceWith("maxTestShards")
+ replaceWith = ReplaceWith("maxTestShards"),
)
/**
* The maximum number of shards. Value will be overwritten by [maxTestShards] if both used in configuration
@@ -472,13 +472,14 @@ interface FladleConfig {
val additionalGcloudOptions: Property
@Internal
- fun getPresentProperties() = this::class.memberProperties
- .filter {
- when (val prop = it.call(this)) {
- is Property<*> -> prop.isPresent
- is MapProperty<*, *> -> prop.isPresent && prop.get().isNotEmpty()
- is ListProperty<*> -> prop.isPresent && prop.get().isNotEmpty()
- else -> false
+ fun getPresentProperties() =
+ this::class.memberProperties
+ .filter {
+ when (val prop = it.call(this)) {
+ is Property<*> -> prop.isPresent
+ is MapProperty<*, *> -> prop.isPresent && prop.get().isNotEmpty()
+ is ListProperty<*> -> prop.isPresent && prop.get().isNotEmpty()
+ else -> false
+ }
}
- }
}
diff --git a/fladle-plugin/src/main/java/com/osacky/flank/gradle/FladleConfigImpl.kt b/fladle-plugin/src/main/java/com/osacky/flank/gradle/FladleConfigImpl.kt
index 71437808..4105cad4 100644
--- a/fladle-plugin/src/main/java/com/osacky/flank/gradle/FladleConfigImpl.kt
+++ b/fladle-plugin/src/main/java/com/osacky/flank/gradle/FladleConfigImpl.kt
@@ -68,7 +68,7 @@ data class FladleConfigImpl(
override val additionalFlankOptions: Property,
override val additionalGcloudOptions: Property,
override val dependOnAssemble: Property,
- override val async: Property
+ override val async: Property,
) : FladleConfig {
/**
* Prepare config to run sanity robo.
diff --git a/fladle-plugin/src/main/java/com/osacky/flank/gradle/FladlePluginDelegate.kt b/fladle-plugin/src/main/java/com/osacky/flank/gradle/FladlePluginDelegate.kt
index 02bf0527..ea878e0f 100644
--- a/fladle-plugin/src/main/java/com/osacky/flank/gradle/FladlePluginDelegate.kt
+++ b/fladle-plugin/src/main/java/com/osacky/flank/gradle/FladlePluginDelegate.kt
@@ -14,7 +14,6 @@ import org.gradle.kotlin.dsl.create
import org.gradle.util.GradleVersion
class FladlePluginDelegate {
-
fun apply(target: Project) {
checkMinimumGradleVersion()
@@ -41,7 +40,10 @@ class FladlePluginDelegate {
}
}
- private fun configureTasks(project: Project, base: FlankGradleExtension) {
+ private fun configureTasks(
+ project: Project,
+ base: FlankGradleExtension,
+ ) {
if (GradleVersion.current() > GradleVersion.version("6.1")) {
base.flankVersion.finalizeValueOnRead()
base.flankCoordinates.finalizeValueOnRead()
@@ -70,21 +72,26 @@ class FladlePluginDelegate {
}
}
- private fun TaskContainer.createTasksForConfig(base: FlankGradleExtension, config: FladleConfig, project: Project, name: String) {
-
+ private fun TaskContainer.createTasksForConfig(
+ base: FlankGradleExtension,
+ config: FladleConfig,
+ project: Project,
+ name: String,
+ ) {
val configName = name.toLowerCase()
// we want to use default dir only if user did not set own `localResultsDir`
val useDefaultDir = config.localResultsDir.isPresent.not()
- val validateFladle = register("validateFladleConfig$name") {
- description = "Perform validation actions"
- group = TASK_GROUP
- doLast {
- checkIfSanityAndValidateConfigs(config)
- validateOptionsUsed(config = config, flank = base.flankVersion.get())
- checkForExclusionUsage(config)
+ val validateFladle =
+ register("validateFladleConfig$name") {
+ description = "Perform validation actions"
+ group = TASK_GROUP
+ doLast {
+ checkIfSanityAndValidateConfigs(config)
+ validateOptionsUsed(config = config, flank = base.flankVersion.get())
+ checkForExclusionUsage(config)
+ }
}
- }
val writeConfigProps = register("writeConfigProps$name", YamlConfigWriterTask::class.java, base, config, name)
@@ -112,17 +119,25 @@ class FladlePluginDelegate {
if (useDefaultDir) setUpWorkingDir(configName)
description = "Runs instrumentation tests using flank on firebase test lab."
classpath = project.fladleConfig
- args = if (project.hasProperty("dumpShards")) {
- listOf("firebase", "test", "android", "run", "-c", writeConfigProps.get().fladleConfigFile.get().asFile.absolutePath, "--dump-shards")
- } else {
- listOf("firebase", "test", "android", "run", "-c", writeConfigProps.get().fladleConfigFile.get().asFile.absolutePath)
- }
+ args =
+ if (project.hasProperty("dumpShards")) {
+ listOf(
+ "firebase", "test", "android", "run", "-c",
+ writeConfigProps.get().fladleConfigFile.get().asFile.absolutePath, "--dump-shards",
+ )
+ } else {
+ listOf(
+ "firebase", "test", "android", "run", "-c",
+ writeConfigProps.get().fladleConfigFile.get().asFile.absolutePath,
+ )
+ }
if (config.serviceAccountCredentials.isPresent) {
environment(mapOf("GOOGLE_APPLICATION_CREDENTIALS" to config.serviceAccountCredentials.get()))
}
dependsOn(writeConfigProps)
if (config.dependOnAssemble.isPresent && config.dependOnAssemble.get()) {
- val testedExtension = requireNotNull(project.extensions.findByType(TestedExtension::class.java)) { "Could not find TestedExtension in ${project.name}" }
+ val testedExtension =
+ requireNotNull(project.extensions.findByType(TestedExtension::class.java)) { "Could not find TestedExtension in ${project.name}" }
testedExtension.testVariants.configureEach {
if (testedVariant.isExpectedVariant(config)) {
if (testedVariant.assembleProvider.isPresent) {
@@ -154,10 +169,15 @@ class FladlePluginDelegate {
}
}
- private fun automaticallyConfigureTestOrchestrator(project: Project, config: FladleConfig, androidExtension: AppExtension) {
+ private fun automaticallyConfigureTestOrchestrator(
+ project: Project,
+ config: FladleConfig,
+ androidExtension: AppExtension,
+ ) {
project.afterEvaluate {
- val useOrchestrator = androidExtension.testOptions.getExecutionEnum() == TestOptions.Execution.ANDROIDX_TEST_ORCHESTRATOR ||
- androidExtension.testOptions.getExecutionEnum() == TestOptions.Execution.ANDROID_TEST_ORCHESTRATOR
+ val useOrchestrator =
+ androidExtension.testOptions.getExecutionEnum() == TestOptions.Execution.ANDROIDX_TEST_ORCHESTRATOR ||
+ androidExtension.testOptions.getExecutionEnum() == TestOptions.Execution.ANDROID_TEST_ORCHESTRATOR
if (useOrchestrator) {
log("Automatically detected the use of Android Test Orchestrator")
}
@@ -165,8 +185,12 @@ class FladlePluginDelegate {
}
}
- private fun findDebugAndInstrumentationApk(project: Project, config: FladleConfig) {
- val baseExtension = requireNotNull(project.extensions.findByType(AppExtension::class.java)) { "Could not find AppExtension in ${project.name}" }
+ private fun findDebugAndInstrumentationApk(
+ project: Project,
+ config: FladleConfig,
+ ) {
+ val baseExtension =
+ requireNotNull(project.extensions.findByType(AppExtension::class.java)) { "Could not find AppExtension in ${project.name}" }
automaticallyConfigureTestOrchestrator(project, config, baseExtension)
baseExtension.testVariants.configureEach {
val appVariant = testedVariant
@@ -195,9 +219,10 @@ class FladlePluginDelegate {
get() = configurations.getByName(FLADLE_CONFIG)
companion object {
- val GRADLE_MIN_VERSION: GradleVersion = GradleVersion.version("5.5")
+ val GRADLE_MIN_VERSION: GradleVersion = GradleVersion.version("6.5")
const val TASK_GROUP = "fladle"
const val FLADLE_CONFIG = "fladle"
+
fun Project.log(message: String) {
logger.info("Fladle: $message")
}
diff --git a/fladle-plugin/src/main/java/com/osacky/flank/gradle/FlankExecutionTask.kt b/fladle-plugin/src/main/java/com/osacky/flank/gradle/FlankExecutionTask.kt
index 03fe141d..168c5712 100644
--- a/fladle-plugin/src/main/java/com/osacky/flank/gradle/FlankExecutionTask.kt
+++ b/fladle-plugin/src/main/java/com/osacky/flank/gradle/FlankExecutionTask.kt
@@ -5,18 +5,26 @@ import org.gradle.api.tasks.Nested
import org.gradle.work.DisableCachingByDefault
import javax.inject.Inject
-@DisableCachingByDefault(because = "Flank executions are dependent on resources such as network connection and server and therefore cannot be cached.")
-open class FlankExecutionTask @Inject constructor(projectLayout: ProjectLayout, @get:Nested val config: FladleConfig) : FlankJavaExec(projectLayout) {
-
- init {
- doFirst {
- checkFilesExist(config)
+@DisableCachingByDefault(
+ because = "Flank executions are dependent on resources such as network connection and server and therefore cannot be cached.",
+)
+open class FlankExecutionTask
+ @Inject
+ constructor(
+ projectLayout: ProjectLayout,
+ @get:Nested val config: FladleConfig,
+ ) : FlankJavaExec(projectLayout) {
+ init {
+ doFirst {
+ checkFilesExist(config)
+ }
}
- }
- private fun checkFilesExist(base: FladleConfig) {
- if (base.serviceAccountCredentials.isPresent) {
- check(base.serviceAccountCredentials.get().asFile.exists()) { "serviceAccountCredential file doesn't exist ${base.serviceAccountCredentials.get()}" }
+ private fun checkFilesExist(base: FladleConfig) {
+ if (base.serviceAccountCredentials.isPresent) {
+ check(base.serviceAccountCredentials.get().asFile.exists()) {
+ "serviceAccountCredential file doesn't exist ${base.serviceAccountCredentials.get()}"
+ }
+ }
}
}
-}
diff --git a/fladle-plugin/src/main/java/com/osacky/flank/gradle/FlankGradleExtension.kt b/fladle-plugin/src/main/java/com/osacky/flank/gradle/FlankGradleExtension.kt
index 540dce79..8c333688 100644
--- a/fladle-plugin/src/main/java/com/osacky/flank/gradle/FlankGradleExtension.kt
+++ b/fladle-plugin/src/main/java/com/osacky/flank/gradle/FlankGradleExtension.kt
@@ -14,208 +14,214 @@ import org.gradle.kotlin.dsl.mapProperty
import org.gradle.kotlin.dsl.property
import javax.inject.Inject
-open class FlankGradleExtension @Inject constructor(objects: ObjectFactory) : FladleConfig {
+open class FlankGradleExtension
+ @Inject
+ constructor(objects: ObjectFactory) : FladleConfig {
+ companion object {
+ const val FLANK_VERSION = "23.10.1"
+ }
- companion object {
- const val FLANK_VERSION = "23.10.1"
- }
-
- @get:Input
- val flankCoordinates: Property = objects.property(String::class.java).convention("com.github.flank:flank")
+ @get:Input
+ val flankCoordinates: Property = objects.property(String::class.java).convention("com.github.flank:flank")
- override val sanityRobo: Property = objects.property().convention(false)
+ override val sanityRobo: Property = objects.property().convention(false)
- @get:Input
- val flankVersion: Property = objects.property(String::class.java).convention(FLANK_VERSION)
- // Project id is automatically discovered by default. Use this to override the project id.
- override val projectId: Property = objects.property()
- override val serviceAccountCredentials: RegularFileProperty = objects.fileProperty()
- override val useOrchestrator: Property = objects.property().convention(false)
- override val autoGoogleLogin: Property = objects.property().convention(false)
- override val devices: ListProperty