diff --git a/ktlint-gradle-plugin/src/test/kotlin/io/github/usefulness/functional/AndroidProjectTest.kt b/ktlint-gradle-plugin/src/test/kotlin/io/github/usefulness/functional/AndroidProjectTest.kt index 142a8ca..27ccabf 100644 --- a/ktlint-gradle-plugin/src/test/kotlin/io/github/usefulness/functional/AndroidProjectTest.kt +++ b/ktlint-gradle-plugin/src/test/kotlin/io/github/usefulness/functional/AndroidProjectTest.kt @@ -44,7 +44,7 @@ internal class AndroidProjectTest : WithGradleTest.Android() { android { namespace 'io.github.usefulness' - compileSdkVersion 33 + compileSdk 33 defaultConfig { minSdkVersion 23 } diff --git a/ktlint-gradle-plugin/src/test/kotlin/io/github/usefulness/functional/ModifiedSourceSetsTest.kt b/ktlint-gradle-plugin/src/test/kotlin/io/github/usefulness/functional/ModifiedSourceSetsTest.kt index 71f57f7..be92707 100644 --- a/ktlint-gradle-plugin/src/test/kotlin/io/github/usefulness/functional/ModifiedSourceSetsTest.kt +++ b/ktlint-gradle-plugin/src/test/kotlin/io/github/usefulness/functional/ModifiedSourceSetsTest.kt @@ -45,7 +45,7 @@ internal class ModifiedSourceSetsTest : WithGradleTest.Android() { android { namespace 'io.github.usefulness' - compileSdkVersion 31 + compileSdk 31 defaultConfig { minSdkVersion 23 } diff --git a/test-project-android/app/build.gradle b/test-project-android/app/build.gradle index 0a125ed..51955ab 100644 --- a/test-project-android/app/build.gradle +++ b/test-project-android/app/build.gradle @@ -8,8 +8,18 @@ ktlint { reporters = ["plain"] } android { - compileSdkVersion(33) namespace = "com.ktint_gradle_plugin.example" + defaultConfig { + compileSdk 33 + minSdkVersion 26 + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 + } + kotlinOptions { + jvmTarget = JavaVersion.VERSION_11 + } } dependencies { diff --git a/test-project-android/app/src/main/java/org/jmailen/gradle/kotlinter/sample/EmptyClassBodyInJavaSourcesClass.kt b/test-project-android/app/src/main/java/io/github/usefulness/sample/EmptyClassBodyInJavaSourcesClass.kt similarity index 100% rename from test-project-android/app/src/main/java/org/jmailen/gradle/kotlinter/sample/EmptyClassBodyInJavaSourcesClass.kt rename to test-project-android/app/src/main/java/io/github/usefulness/sample/EmptyClassBodyInJavaSourcesClass.kt diff --git a/test-project-android/app/src/main/kotlin/org/jmailen/gradle/kotlinter/sample/EmptyClassBodyClass.kt b/test-project-android/app/src/main/kotlin/io/github/usefulness/sample/EmptyClassBodyClass.kt similarity index 100% rename from test-project-android/app/src/main/kotlin/org/jmailen/gradle/kotlinter/sample/EmptyClassBodyClass.kt rename to test-project-android/app/src/main/kotlin/io/github/usefulness/sample/EmptyClassBodyClass.kt diff --git a/test-project-android/app/src/test/kotlin/org/jmailen/gradle/kotlinter/sample/CustomRuleTest.kt b/test-project-android/app/src/test/kotlin/io/github/usefulness/sample/CustomRuleTest.kt similarity index 100% rename from test-project-android/app/src/test/kotlin/org/jmailen/gradle/kotlinter/sample/CustomRuleTest.kt rename to test-project-android/app/src/test/kotlin/io/github/usefulness/sample/CustomRuleTest.kt diff --git a/test-project-android/app/src/test/kotlin/org/jmailen/gradle/kotlinter/sample/OpSpacing.kt b/test-project-android/app/src/test/kotlin/io/github/usefulness/sample/OpSpacing.kt similarity index 100% rename from test-project-android/app/src/test/kotlin/org/jmailen/gradle/kotlinter/sample/OpSpacing.kt rename to test-project-android/app/src/test/kotlin/io/github/usefulness/sample/OpSpacing.kt diff --git a/test-project-android/custom-ktlint-rules/build.gradle b/test-project-android/custom-ktlint-rules/build.gradle index da83e4d..c2e610e 100644 --- a/test-project-android/custom-ktlint-rules/build.gradle +++ b/test-project-android/custom-ktlint-rules/build.gradle @@ -3,5 +3,5 @@ plugins { } dependencies { - compileOnly("com.pinterest.ktlint:ktlint-core:0.49.0") + compileOnly("com.pinterest.ktlint:ktlint-cli-ruleset-core:0.49.0") } diff --git a/test-project-android/custom-ktlint-rules/src/main/kotlin/org/jmailen/gradle/kotlinter/customrules/CustomRuleSetProvider.kt b/test-project-android/custom-ktlint-rules/src/main/kotlin/io/github/usefulness/customrules/CustomRuleSetProvider.kt similarity index 51% rename from test-project-android/custom-ktlint-rules/src/main/kotlin/org/jmailen/gradle/kotlinter/customrules/CustomRuleSetProvider.kt rename to test-project-android/custom-ktlint-rules/src/main/kotlin/io/github/usefulness/customrules/CustomRuleSetProvider.kt index df8b65b..c4e6612 100644 --- a/test-project-android/custom-ktlint-rules/src/main/kotlin/org/jmailen/gradle/kotlinter/customrules/CustomRuleSetProvider.kt +++ b/test-project-android/custom-ktlint-rules/src/main/kotlin/io/github/usefulness/customrules/CustomRuleSetProvider.kt @@ -1,12 +1,10 @@ package io.github.usefulness.customrules -import com.pinterest.ktlint.core.RuleProvider import com.pinterest.ktlint.cli.ruleset.core.api.RuleSetProviderV3 +import com.pinterest.ktlint.rule.engine.core.api.RuleProvider +import com.pinterest.ktlint.rule.engine.core.api.RuleSetId -class CustomRuleSetProvider : RuleSetProviderV3( - "custom-ktlint-rules", - about = NO_ABOUT, -) { +class CustomRuleSetProvider : RuleSetProviderV3(RuleSetId("custom-ktlint-rules")) { override fun getRuleProviders() = setOf( RuleProvider { NoNewLineBeforeReturnTypeRule() }, diff --git a/test-project-android/custom-ktlint-rules/src/main/kotlin/org/jmailen/gradle/kotlinter/customrules/NoNewLineBeforeReturnTypeRule.kt b/test-project-android/custom-ktlint-rules/src/main/kotlin/io/github/usefulness/customrules/NoNewLineBeforeReturnTypeRule.kt similarity index 73% rename from test-project-android/custom-ktlint-rules/src/main/kotlin/org/jmailen/gradle/kotlinter/customrules/NoNewLineBeforeReturnTypeRule.kt rename to test-project-android/custom-ktlint-rules/src/main/kotlin/io/github/usefulness/customrules/NoNewLineBeforeReturnTypeRule.kt index c1a6ef6..8bda324 100644 --- a/test-project-android/custom-ktlint-rules/src/main/kotlin/org/jmailen/gradle/kotlinter/customrules/NoNewLineBeforeReturnTypeRule.kt +++ b/test-project-android/custom-ktlint-rules/src/main/kotlin/io/github/usefulness/customrules/NoNewLineBeforeReturnTypeRule.kt @@ -1,17 +1,20 @@ package io.github.usefulness.customrules -import com.pinterest.ktlint.core.Rule -import com.pinterest.ktlint.core.api.EditorConfigProperties -import com.pinterest.ktlint.core.ast.isPartOfComment -import com.pinterest.ktlint.core.ast.isPartOfString -import com.pinterest.ktlint.core.ast.nextLeaf +import com.pinterest.ktlint.rule.engine.core.api.Rule +import com.pinterest.ktlint.rule.engine.core.api.RuleId +import com.pinterest.ktlint.rule.engine.core.api.isPartOfComment +import com.pinterest.ktlint.rule.engine.core.api.isPartOfString +import com.pinterest.ktlint.rule.engine.core.api.nextLeaf import org.jetbrains.kotlin.com.intellij.lang.ASTNode import org.jetbrains.kotlin.com.intellij.psi.impl.source.tree.LeafPsiElement import org.jetbrains.kotlin.psi.KtFunction import org.jetbrains.kotlin.psi.KtPrimaryConstructor import org.jetbrains.kotlin.psi.KtSecondaryConstructor -class NoNewLineBeforeReturnTypeRule : Rule("no-newline-before-return-type") { +class NoNewLineBeforeReturnTypeRule : Rule( + ruleId = RuleId("custom-ktlint-rules:no-newline-before-return-type"), + about = About() +) { override fun beforeVisitChildNodes( node: ASTNode, diff --git a/test-project/src/main/kotlin/org/jmailen/gradle/kotlinter/sample/EmptyClassBodyClass.kt b/test-project/src/main/kotlin/io/github/usefulness/sample/EmptyClassBodyClass.kt similarity index 100% rename from test-project/src/main/kotlin/org/jmailen/gradle/kotlinter/sample/EmptyClassBodyClass.kt rename to test-project/src/main/kotlin/io/github/usefulness/sample/EmptyClassBodyClass.kt diff --git a/test-project/src/test/kotlin/org/jmailen/gradle/kotlinter/sample/OpSpacing.kt b/test-project/src/test/kotlin/io/github/usefulness/sample/OpSpacing.kt similarity index 100% rename from test-project/src/test/kotlin/org/jmailen/gradle/kotlinter/sample/OpSpacing.kt rename to test-project/src/test/kotlin/io/github/usefulness/sample/OpSpacing.kt