Skip to content
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 @@ -17,7 +17,7 @@ import javax.inject.Inject
open class FlankGradleExtension @Inject constructor(objects: ObjectFactory) : FladleConfig {

companion object {
const val FLANK_VERSION = "21.07.1"
const val FLANK_VERSION = "21.07.2"
}

@get:Input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ fun configureModule(project: Project, flankGradleExtension: FlankGradleExtension
return
}

val testedExtension = extensions.getByType<TestedExtension>()
val testedExtension = extensions.findByType(TestedExtension::class.java) ?: return
// Only configure the first test variant per module.
// Does anyone test more than one variant per module?
var addedTestsForModule = false
Expand Down Expand Up @@ -188,12 +188,14 @@ val Project.isAndroidLibraryModule
// returns false if the module explicitly disabled testing or if it simply had no tests
val Project.hasAndroidTest: Boolean
get() {
if (!(isAndroidLibraryModule || isAndroidAppModule)) {
return false
}
val fulladleModuleExtension = extensions.findByType(FulladleModuleExtension::class.java) ?: return false
if ((isAndroidLibraryModule || isAndroidAppModule) && !fulladleModuleExtension.enabled.get()) {
if (!fulladleModuleExtension.enabled.get()) {
return false
}

val testedExtension = extensions.getByType<TestedExtension>()
val testedExtension = extensions.findByType(TestedExtension::class.java) ?: return false
var testsFound = true
testedExtension.testVariants.configureEach testVariant@{
if (!file("$projectDir/src/androidTest").exists()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,76 @@ class FulladlePluginIntegrationTest {
)
}

@Test
fun fulladleWithNonAndroidModule() {
val appFixture = "android-project"
val libraryFixture = "android-library-project"
val nonAndroidFixture = "lib1"
testProjectRoot.newFile("settings.gradle").writeText(
"""
include '$appFixture'
include '$libraryFixture'
include '$nonAndroidFixture'

dependencyResolutionManagement {
repositories {
mavenCentral()
google()
}
}
""".trimIndent()
)
testProjectRoot.setupFixture(appFixture)
testProjectRoot.setupFixture(libraryFixture)
File(testProjectRoot.root, libraryFixture).copyRecursively(testProjectRoot.newFile(nonAndroidFixture), overwrite = true)

writeBuildGradle(
"""
buildscript {
repositories {
google()
jcenter()
}

dependencies {
classpath '$agpDependency'
}
}

plugins {
id "com.osacky.fulladle"
}


fladle {
serviceAccountCredentials = project.layout.projectDirectory.file("android-project/flank-gradle-5cf02dc90531.json")
}
""".trimIndent()
)

// Configure second included project to ignore fulladle module
File(testProjectRoot.root, "$nonAndroidFixture/build.gradle").appendText(
"""
fulladleModuleConfig {
enabled = false
}
""".trimIndent()
)

File(testProjectRoot.root, "$nonAndroidFixture/build.gradle").writeText(
"""
apply plugin: 'java-library'

""".trimIndent()
)

val result = testProjectRoot.gradleRunner()
.withArguments(":printYml")
.build()

assertThat(result.output).contains("SUCCESS")
}

@Test
fun fulladleWithSubmoduleOverrides() {
val appFixture = "android-project"
Expand Down