Fix lint task in Android projects depending on MPP, KT-27170
This commit is contained in:
+13
@@ -324,6 +324,19 @@ open class KotlinAndroid32GradleIT : KotlinAndroid3GradleIT() {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testLintInAndroidProjectsDependingOnMppWithoutAndroid() = with(Project("AndroidProject")) {
|
||||
embedProject(Project("sample-lib", directoryPrefix = "new-mpp-lib-and-app"))
|
||||
gradleBuildScript("Lib").appendText(
|
||||
"\ndependencies { implementation(project(':sample-lib')) }"
|
||||
)
|
||||
val lintTask = ":Lib:lintFlavor1Debug"
|
||||
build(lintTask) {
|
||||
assertSuccessful()
|
||||
assertTasksExecuted(lintTask) // Check that the lint task ran successfully, KT-27170
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testKaptUsingApOptionProvidersAsNestedInputOutput() = with(Project("AndroidProject")) {
|
||||
setupWorkingDir()
|
||||
|
||||
+20
@@ -20,6 +20,26 @@ class KotlinJvmTargetConfigurator(kotlinPluginVersion: String) :
|
||||
KotlinOnlyTargetConfigurator<KotlinJvmCompilation, KotlinJvmTarget>(true, true, kotlinPluginVersion),
|
||||
KotlinTargetWithTestsConfigurator<KotlinJvmTestRun, KotlinJvmTarget> {
|
||||
|
||||
override fun configurePlatformSpecificModel(target: KotlinJvmTarget) {
|
||||
super<KotlinOnlyTargetConfigurator>.configurePlatformSpecificModel(target)
|
||||
super<KotlinTargetWithTestsConfigurator>.configurePlatformSpecificModel(target)
|
||||
|
||||
// Create the configuration under the name 'compileClasspath', as Android lint tasks want it, KT-27170
|
||||
target.project.whenEvaluated {
|
||||
if (configurations.findByName("compileClasspath") == null) {
|
||||
configurations.create("compileClasspath").apply {
|
||||
isCanBeResolved = false
|
||||
isCanBeConsumed = false
|
||||
extendsFrom(
|
||||
target.project.configurations.getByName(
|
||||
target.compilations.getByName(KotlinCompilation.MAIN_COMPILATION_NAME).compileDependencyConfigurationName
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override val testRunClass: Class<KotlinJvmTestRun>
|
||||
get() = KotlinJvmTestRun::class.java
|
||||
|
||||
|
||||
Reference in New Issue
Block a user