Skip to content

Commit 09d3d34

Browse files
committed
merge conflicts
1 parent bad1fd3 commit 09d3d34

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetectorPlugin.kt

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class AffectedModuleDetectorPlugin : Plugin<Project> {
9797
internal fun registerTestTasks(rootProject: Project) {
9898
registerImpactAnalysisTask(
9999
rootProject = rootProject,
100-
taskType = InternalTaskType.JVM_TEST,
100+
taskType = InternalTaskType.ANDROID_JVM_TEST,
101101
groupName = TEST_TASK_GROUP_NAME
102102
)
103103

@@ -128,8 +128,8 @@ class AffectedModuleDetectorPlugin : Plugin<Project> {
128128
project.afterEvaluate {
129129
pluginIds.forEach { pluginId ->
130130
if (pluginId == PLUGIN_JAVA_LIBRARY || pluginId == PLUGIN_KOTLIN) {
131-
if (taskType == InternalTaskType.JVM_TEST) {
132-
withPlugin(pluginId, task, taskType, project)
131+
if (taskType == InternalTaskType.ANDROID_JVM_TEST) {
132+
withPlugin(pluginId, task, InternalTaskType.JVM_TEST, project)
133133
}
134134
} else {
135135
withPlugin(pluginId, task, taskType, project)
@@ -176,9 +176,16 @@ class AffectedModuleDetectorPlugin : Plugin<Project> {
176176
InternalTaskType.ASSEMBLE_ANDROID_TEST -> {
177177
getPathAndTask(project, tasks.assembleAndroidTestTask)
178178
}
179-
InternalTaskType.JVM_TEST -> {
179+
InternalTaskType.ANDROID_JVM_TEST -> {
180180
getPathAndTask(project, tasks.jvmTestTask)
181181
}
182+
InternalTaskType.JVM_TEST -> {
183+
if (tasks.jvmTestTask != AffectedTestConfiguration.DEFAULT_JVM_TEST_TASK) {
184+
getPathAndTask(project, tasks.jvmTestTask)
185+
} else {
186+
getPathAndTask(project, taskType.originalGradleCommand)
187+
}
188+
}
182189
else -> {
183190
getPathAndTask(project, taskType.originalGradleCommand)
184191
}
@@ -226,7 +233,7 @@ class AffectedModuleDetectorPlugin : Plugin<Project> {
226233
internal const val CUSTOM_TASK_GROUP_NAME = "Affected Module Detector custom tasks"
227234

228235
private const val PLUGIN_ANDROID_APPLICATION = "com.android.application"
229-
private const val PLUGIN_ANDROID_LIBRARY = "java-library"
236+
private const val PLUGIN_ANDROID_LIBRARY = "java"
230237
private const val PLUGIN_JAVA_LIBRARY = "com.android.library"
231238
private const val PLUGIN_KOTLIN = "kotlin"
232239

affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/InternalTaskType.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,15 @@ internal enum class InternalTaskType(
1818
taskDescription = "Assembles all affected Android Tests. Useful when working with device labs."
1919
),
2020

21-
JVM_TEST(
21+
ANDROID_JVM_TEST(
2222
commandByImpact = "runAffectedUnitTests",
2323
originalGradleCommand = "testDebugUnitTest",
2424
taskDescription = "Runs all affected unit tests."
25+
),
26+
27+
JVM_TEST(
28+
commandByImpact = "runAffectedUnitTests",
29+
originalGradleCommand = "test",
30+
taskDescription = "Runs all affected unit tests for non Android modules."
2531
)
2632
}

affectedmoduledetector/src/test/kotlin/com/dropbox/affectedmoduledetector/AffectedModuleDetectorPluginTest.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class AffectedModuleDetectorPluginTest {
155155
plugin.registerTestTasks(rootProject)
156156
val androidTestTask = rootProject.tasks.findByPath(InternalTaskType.ANDROID_TEST.commandByImpact)
157157
val assembleAndroidTestTask = rootProject.tasks.findByPath(InternalTaskType.ASSEMBLE_ANDROID_TEST.commandByImpact)
158-
val jvmTestTask = rootProject.tasks.findByPath(InternalTaskType.JVM_TEST.commandByImpact)
158+
val jvmTestTask = rootProject.tasks.findByPath(InternalTaskType.ANDROID_JVM_TEST.commandByImpact)
159159

160160
// THEN
161161
assertThat(androidTestTask).isNotNull()
@@ -168,6 +168,8 @@ class AffectedModuleDetectorPluginTest {
168168
assertThat(jvmTestTask?.group).isEqualTo(AffectedModuleDetectorPlugin.TEST_TASK_GROUP_NAME)
169169
}
170170

171+
172+
171173
@Test
172174
fun `GIVEN affected module detector plugin WHEN registerTestTasks called THEN added all tasks from InternalTaskType`() {
173175
// GIVEN

0 commit comments

Comments
 (0)