-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: apply configuration for source sets and targets that are added a…
…fter the plugin is applied Use `DomainObjectCollection.all` instead of `Iterable<T>.forEach`. `all` executes the given function also against any objects subsequently added objects
- Loading branch information
1 parent
7901898
commit 4474650
Showing
4 changed files
with
119 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
plugin/src/test/kotlin/org/jlleitschuh/gradle/ktlint/KotlinMultiplatformPluginTests.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package org.jlleitschuh.gradle.ktlint | ||
|
||
import org.assertj.core.api.Assertions.assertThat | ||
import org.gradle.util.GradleVersion | ||
import org.jlleitschuh.gradle.ktlint.tasks.GenerateReportsTask | ||
import org.jlleitschuh.gradle.ktlint.testdsl.CommonTest | ||
import org.jlleitschuh.gradle.ktlint.testdsl.GradleTestVersions | ||
import org.jlleitschuh.gradle.ktlint.testdsl.build | ||
import org.jlleitschuh.gradle.ktlint.testdsl.project | ||
import org.jlleitschuh.gradle.ktlint.testdsl.projectSetup | ||
import org.junit.jupiter.api.DisplayName | ||
import java.io.File | ||
|
||
/** | ||
* Contains all tests related to "org.jetbrains.kotlin.multiplatform" plugin support. | ||
*/ | ||
@GradleTestVersions | ||
class KotlinMultiplatformPluginTests : AbstractPluginTest() { | ||
private fun multiplatformProjectSetup(gradleVersion: GradleVersion): (File) -> Unit = { | ||
projectSetup("multiplatform", gradleVersion).invoke(it) | ||
|
||
//language=Groovy | ||
it.resolve("build.gradle").appendText( | ||
""" | ||
| | ||
|kotlin { | ||
| js { | ||
| browser() | ||
| } | ||
| jvm() | ||
|} | ||
""".trimMargin() | ||
) | ||
} | ||
|
||
@DisplayName("Should add check on all sources") | ||
@CommonTest | ||
fun addCheckTasks(gradleVersion: GradleVersion) { | ||
project(gradleVersion, projectSetup = multiplatformProjectSetup(gradleVersion)) { | ||
build("-m", CHECK_PARENT_TASK_NAME) { | ||
val ktlintTasks = output.lineSequence().toList() | ||
|
||
assertThat(ktlintTasks).anySatisfy { | ||
assertThat(it).contains( | ||
GenerateReportsTask.generateNameForSourceSets( | ||
"commonMain", | ||
GenerateReportsTask.LintType.CHECK | ||
) | ||
) | ||
} | ||
assertThat(ktlintTasks).anySatisfy { | ||
assertThat(it).contains( | ||
GenerateReportsTask.generateNameForSourceSets( | ||
"JsMain", | ||
GenerateReportsTask.LintType.CHECK | ||
) | ||
) | ||
} | ||
assertThat(ktlintTasks).anySatisfy { | ||
assertThat(it).contains( | ||
GenerateReportsTask.generateNameForSourceSets( | ||
"JvmMain", | ||
GenerateReportsTask.LintType.CHECK | ||
) | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters