diff --git a/android/build.gradle b/android/build.gradle index 5e4d21dd29..22687f6d81 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -7,11 +7,13 @@ buildscript { dependencies { classpath('com.android.tools.build:gradle:4.2.2') classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20" + classpath "com.diffplug.spotless:spotless-plugin-gradle:5.15.0" } } -plugins { - id "com.diffplug.spotless" version "5.14.1" +// spotless is only accessible within react-native-screens repo +if (project == rootProject) { + apply from: 'spotless.gradle' } apply plugin: 'com.android.library' @@ -58,15 +60,3 @@ dependencies { implementation "androidx.core:core-ktx:1.6.0" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.5.20" } - -plugins.apply("com.diffplug.spotless") - -spotless { - kotlin { - target 'src/**/*.kt' - ktlint("0.40.0") - trimTrailingWhitespace() - indentWithSpaces() - endWithNewline() - } -} diff --git a/android/spotless.gradle b/android/spotless.gradle new file mode 100644 index 0000000000..7c9f86c0aa --- /dev/null +++ b/android/spotless.gradle @@ -0,0 +1,12 @@ +// formatter & linter configuration for kotlin +apply plugin: 'com.diffplug.spotless' + +spotless { + kotlin { + target 'src/**/*.kt' + ktlint("0.40.0") + trimTrailingWhitespace() + indentWithSpaces() + endWithNewline() + } +}