File tree Expand file tree Collapse file tree 6 files changed +8
-21
lines changed
functionalTest/groovy/com/autonomousapps/android
main/kotlin/com/autonomousapps
test/kotlin/com/autonomousapps/internal/reason Expand file tree Collapse file tree 6 files changed +8
-21
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ final class ReasonSpec extends AbstractAndroidSpec {
9898 " " " \
9999 ----------------------------------------
100100 You asked about the Android score for ' :proj' .
101- There was no Android - related module structure advice for this project. It uses several Android features .
101+ There was no Android - related module structure advice for this project. It uses at least one Android feature .
102102 ----------------------------------------
103103
104104 Android features :
Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ internal class ProjectHealthConsoleReportBuilder(
137137
138138 moduleAdvice.forEach { m ->
139139 when (m) {
140- is AndroidScore -> if (m.couldBeJvm ()) append(m.text())
140+ is AndroidScore -> if (m.shouldBeJvm ()) append(m.text())
141141 }
142142 }
143143 }
Original file line number Diff line number Diff line change @@ -43,12 +43,8 @@ internal class ModuleAdviceExplainer(
4343 " You have been advised to change this project from an Android project to a JVM project. No use of any " +
4444 " Android feature was detected."
4545 )
46- finalAndroidScore.couldBeJvm() -> append(
47- " You have been advised to change this project from an Android project to a JVM project. Only limited use " +
48- " of Android feature was detected."
49- )
5046 else -> append(
51- " There was no Android-related module structure advice for this project. It uses several Android features ."
47+ " There was no Android-related module structure advice for this project. It uses at least one Android feature ."
5248 )
5349 }
5450 }
Original file line number Diff line number Diff line change @@ -70,14 +70,9 @@ data class AndroidScore(
7070 /* * True if this project uses no Android facilities at all. */
7171 fun shouldBeJvm (): Boolean = score == 0f
7272
73- /* * True if this project only uses some limited number of Android facilities. */
74- fun couldBeJvm (): Boolean = score < THRESHOLD
75-
76- override fun isActionable (): Boolean = couldBeJvm()
73+ override fun isActionable (): Boolean = shouldBeJvm()
7774
7875 internal companion object {
79- private const val THRESHOLD = 2f
80-
8176 fun ofVariants (scores : Collection <AndroidScoreVariant >): AndroidScore ? {
8277 // JVM projects don't have an AndroidScore
8378 if (scores.isEmpty()) return null
Original file line number Diff line number Diff line change @@ -126,8 +126,6 @@ abstract class GenerateBuildHealthTask : DefaultTask() {
126126 projectAdvice.moduleAdvice.filterIsInstance<AndroidScore >().forEach {
127127 if (it.shouldBeJvm()) {
128128 androidMetricsBuilder.shouldBeJvmCount++
129- } else if (it.couldBeJvm()) {
130- androidMetricsBuilder.couldBeJvmCount++
131129 }
132130 }
133131 }
Original file line number Diff line number Diff line change @@ -30,10 +30,9 @@ internal class ModuleAdviceExplainerTest {
3030 ).inOrder()
3131 }
3232
33- @Test fun `can explain there is little reason for this to be an Android project` () {
33+ @Test fun `can explain there is at least one reason for this to be an Android project` () {
3434 // Given
3535 val score = Fixture .emptyScore.copy(
36- hasBuildConfig = true ,
3736 hasAndroidDependencies = true
3837 )
3938 val computer = Fixture (
@@ -47,14 +46,13 @@ internal class ModuleAdviceExplainerTest {
4746 // Then
4847 assertThat(reason.decolorize().lines()).containsExactlyElementsIn(
4948 """
50-
49+
5150 ----------------------------------------
5251 You asked about the Android score for ':root'.
53- You have been advised to change this project from an Android project to a JVM project. Only limited use of Android feature was detected .
52+ There was no Android-related module structure advice for this project. It uses at least one Android feature.
5453 ----------------------------------------
55-
54+
5655 Android features:
57- * Includes BuildConfig.
5856 * Has Android library dependencies.
5957 """ .trimIndent().lines()
6058 ).inOrder()
You can’t perform that action at this time.
0 commit comments