Skip to content
This repository has been archived by the owner on Feb 11, 2022. It is now read-only.

Commit

Permalink
Support for copying folders into the repo
Browse files Browse the repository at this point in the history
  • Loading branch information
tasomaniac committed Dec 10, 2018
1 parent 6dc877a commit 5ab15b1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Expand Up @@ -35,8 +35,7 @@ class KtlintIntegrationTest {
[TestProjectRule.forKotlinProject(), '5.1.0', 'ktlint-main.txt'],
[TestProjectRule.forAndroidKotlinProject(), '5.1.0', 'ktlint-debug.txt'],
[TestProjectRule.forKotlinProject(), '6.1.0', 'ktlintMainCheck.txt'],
// Fails for our test setup since we have custom sourceDirs. https://github.com/JLLeitschuh/ktlint-gradle/issues/153
// [TestProjectRule.forAndroidKotlinProject(), '6.1.0', 'ktlintDebugCheck.txt'],
[TestProjectRule.forAndroidKotlinProject(), '6.1.0', 'ktlintMainCheck.txt'],
[TestProjectRule.forKotlinProject(), '6.2.1', 'ktlintMainCheck.txt'],
[TestProjectRule.forAndroidKotlinProject(), '6.2.1', 'ktlintMainCheck.txt'],
[TestProjectRule.forKotlinProject(), '6.3.1', 'ktlintMainCheck.txt'],
Expand Down Expand Up @@ -116,7 +115,7 @@ class KtlintIntegrationTest {
private TestProject createProjectWith(File sources, int maxErrors = 0) {
projectRule.newProject()
.withPlugin('org.jlleitschuh.gradle.ktlint', ktlintVersion)
.withSourceSet('main', sources)
.copyIntoSourceSet('main', sources)
.withPenalty("""{
maxWarnings = 0
maxErrors = ${maxErrors}
Expand Down
7 changes: 7 additions & 0 deletions plugin/src/test/groovy/com/novoda/test/TestProject.groovy
Expand Up @@ -63,6 +63,13 @@ ${project.additionalConfiguration}
file.text = text
}

public T copyIntoSourceSet(String sourceSet, File srcDir) {
srcDir.listFiles().each {
withFile(it, "src/${sourceSet}/java/${it.name}")
}
return this
}

public T withSourceSet(String sourceSet, File... srcDirs) {
sourceSets[sourceSet] = srcDirs
return this
Expand Down

0 comments on commit 5ab15b1

Please sign in to comment.