Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for isolated projects #75

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import org.gradle.api.Project
import org.gradle.api.plugins.JavaBasePlugin
import org.gradle.api.tasks.TaskProvider
import org.gradle.kotlin.dsl.create
import org.gradle.kotlin.dsl.named
import org.gradle.kotlin.dsl.register
import org.gradle.kotlin.dsl.registerIfAbsent

Expand Down Expand Up @@ -52,22 +51,20 @@ class MarathonPlugin : Plugin<Project> {
description = "Runs all the instrumentation test variations on all the connected devices"
}

val marathonWorkerTask = rootProject.tasks.named<MarathonWorkerRunTask>(WORKER_TASK_NAME)
val androidComponents = extensions.getByType(AndroidComponentsExtension::class.java)
androidComponents.onVariants { variant ->
variant.components
.filter { it is GeneratesTestApk }
.forEach { component ->
val testTask = registerTestTask(variant, component, marathonWorkerTask)
val testTask = registerTestTask(variant, component)
marathonTask.configure { dependsOn(testTask) }
}
}
}

private fun Project.registerTestTask(
variant: Variant,
testComponent: Component,
marathonWorkerTask: TaskProvider<MarathonWorkerRunTask>
testComponent: Component
): TaskProvider<MarathonScheduleTestsToWorkerTask> =
tasks.register<MarathonScheduleTestsToWorkerTask>(variant.computeTaskName(TASK_PREFIX, "androidTest")) {
group = JavaBasePlugin.VERIFICATION_GROUP
Expand All @@ -83,7 +80,7 @@ class MarathonPlugin : Plugin<Project> {
is TestVariant -> testedApkDir.set(variant.testedApks)
}

finalizedBy(marathonWorkerTask)
finalizedBy("${Project.PATH_SEPARATOR}$WORKER_TASK_NAME")
}

companion object {
Expand Down
1 change: 1 addition & 0 deletions sample/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ org.gradle.caching=true
org.gradle.configuration-cache=true
org.gradle.jvmargs=-Xmx8g -XX:+UseParallelGC
org.gradle.parallel=true
org.gradle.unsafe.isolated-projects=true
kotlin.daemon.jvmargs=-Xmx1g -XX:+UseParallelGC

android.useAndroidX=true
Loading