arangelov | 3f7da6e | 2021-04-19 13:18:50 +0100 | [diff] [blame] | 1 | buildscript { |
| 2 | // If false - JS targets will not be configured in multiplatform projects. |
| 3 | ext.kmpJsEnabled = Boolean.parseBoolean(System.getProperty('kjs', 'true')) |
| 4 | |
| 5 | // If false - Native targets will not be configured in multiplatform projects. |
| 6 | ext.kmpNativeEnabled = Boolean.parseBoolean(System.getProperty('knative', 'true')) |
| 7 | |
| 8 | ext.versions = [ |
| 9 | 'kotlin': '1.4.20', |
| 10 | 'jmhPlugin': '0.5.0', |
| 11 | 'animalSnifferPlugin': '1.5.0', |
| 12 | 'dokka': '1.4.20', |
| 13 | 'jmh': '1.23', |
| 14 | 'animalSniffer': '1.16', |
| 15 | 'junit': '4.12', |
| 16 | 'assertj': '1.7.0', |
| 17 | 'shadowPlugin': '5.2.0', |
| 18 | 'spotless': '5.8.2', |
| 19 | 'ktlint': '0.40.0', |
| 20 | 'bndPlugin': '5.1.2' |
| 21 | ] |
| 22 | |
| 23 | ext.deps = [ |
| 24 | 'android': [ |
| 25 | 'gradlePlugin': "com.android.tools.build:gradle:4.1.1", |
| 26 | 'desugarJdkLibs': "com.android.tools:desugar_jdk_libs:1.1.1", |
| 27 | ], |
| 28 | 'androidx': [ |
| 29 | 'testExtJunit': "androidx.test.ext:junit:1.1.2", |
| 30 | 'testRunner': "androidx.test:runner:1.3.0", |
| 31 | ], |
| 32 | 'kotlin': [ |
| 33 | 'gradlePlugin': "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}", |
| 34 | 'stdLib': [ |
| 35 | 'common': "org.jetbrains.kotlin:kotlin-stdlib-common", |
| 36 | 'jdk8': "org.jetbrains.kotlin:kotlin-stdlib-jdk8", |
| 37 | 'jdk7': "org.jetbrains.kotlin:kotlin-stdlib-jdk7", |
| 38 | 'jdk6': "org.jetbrains.kotlin:kotlin-stdlib", |
| 39 | 'js': "org.jetbrains.kotlin:kotlin-stdlib-js", |
| 40 | ], |
| 41 | 'test': [ |
| 42 | 'common': "org.jetbrains.kotlin:kotlin-test-common", |
| 43 | 'annotations': "org.jetbrains.kotlin:kotlin-test-annotations-common", |
| 44 | 'jdk': "org.jetbrains.kotlin:kotlin-test-junit", |
| 45 | 'js': "org.jetbrains.kotlin:kotlin-test-js", |
| 46 | ], |
| 47 | 'time': 'org.jetbrains.kotlinx:kotlinx-datetime:0.1.1', |
| 48 | ], |
| 49 | 'jmh': [ |
| 50 | 'gradlePlugin': "me.champeau.gradle:jmh-gradle-plugin:${versions.jmhPlugin}", |
| 51 | 'core': "org.openjdk.jmh:jmh-core:${versions.jmh}", |
| 52 | 'generator': "org.openjdk.jmh:jmh-generator-annprocess:${versions.jmh}", |
| 53 | ], |
| 54 | 'animalSniffer': [ |
| 55 | 'gradlePlugin': "ru.vyarus:gradle-animalsniffer-plugin:${versions.animalSnifferPlugin}", |
| 56 | 'annotations': "org.codehaus.mojo:animal-sniffer-annotations:${versions.animalSniffer}", |
| 57 | ], |
| 58 | 'japicmp': 'me.champeau.gradle:japicmp-gradle-plugin:0.2.8', |
| 59 | 'dokka': "org.jetbrains.dokka:dokka-gradle-plugin:${versions.dokka}", |
| 60 | 'shadow': "com.github.jengelman.gradle.plugins:shadow:${versions.shadowPlugin}", |
| 61 | 'spotless': "com.diffplug.spotless:spotless-plugin-gradle:${versions.spotless}", |
| 62 | 'bnd': "biz.aQute.bnd:biz.aQute.bnd.gradle:${versions.bndPlugin}", |
| 63 | 'test': [ |
| 64 | 'junit': "junit:junit:${versions.junit}", |
| 65 | 'assertj': "org.assertj:assertj-core:${versions.assertj}", |
| 66 | ] |
| 67 | ] |
| 68 | |
| 69 | dependencies { |
| 70 | classpath deps.android.gradlePlugin |
| 71 | classpath deps.kotlin.gradlePlugin |
| 72 | classpath deps.animalSniffer.gradlePlugin |
| 73 | classpath deps.japicmp |
| 74 | classpath deps.dokka |
| 75 | classpath deps.shadow |
| 76 | classpath deps.jmh.gradlePlugin |
| 77 | classpath deps.spotless |
| 78 | classpath deps.bnd |
| 79 | // https://github.com/melix/japicmp-gradle-plugin/issues/36 |
| 80 | classpath 'com.google.guava:guava:28.2-jre' |
| 81 | } |
| 82 | |
| 83 | repositories { |
| 84 | mavenCentral() |
| 85 | gradlePluginPortal() |
| 86 | jcenter() |
| 87 | google() |
| 88 | maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' } |
| 89 | maven { url 'https://kotlin.bintray.com/kotlinx/' } |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | // when scripts are applied the buildscript classes are not accessible directly therefore we save the class here to make it accessible |
| 94 | ext.bndBundleTaskConventionClass = aQute.bnd.gradle.BundleTaskConvention |
| 95 | |
| 96 | allprojects { |
| 97 | group = GROUP |
| 98 | version = VERSION_NAME |
| 99 | } |
| 100 | |
| 101 | subprojects { |
| 102 | repositories { |
| 103 | mavenCentral() |
| 104 | jcenter() |
| 105 | google() |
| 106 | maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' } |
| 107 | maven { url 'https://kotlin.bintray.com/kotlinx/' } |
| 108 | } |
| 109 | |
| 110 | apply plugin: "com.diffplug.spotless" |
| 111 | |
| 112 | spotless { |
| 113 | kotlin { |
| 114 | target("**/*.kt") |
| 115 | ktlint(versions.ktlint).userData([indent_size: '2']) |
| 116 | trimTrailingWhitespace() |
| 117 | endWithNewline() |
| 118 | } |
| 119 | } |
| 120 | } |