121 lines
4.1 KiB
Groovy
121 lines
4.1 KiB
Groovy
buildscript {
|
|
// If false - JS targets will not be configured in multiplatform projects.
|
|
ext.kmpJsEnabled = Boolean.parseBoolean(System.getProperty('kjs', 'true'))
|
|
|
|
// If false - Native targets will not be configured in multiplatform projects.
|
|
ext.kmpNativeEnabled = Boolean.parseBoolean(System.getProperty('knative', 'true'))
|
|
|
|
ext.versions = [
|
|
'kotlin': '1.4.20',
|
|
'jmhPlugin': '0.5.0',
|
|
'animalSnifferPlugin': '1.5.0',
|
|
'dokka': '1.4.20',
|
|
'jmh': '1.23',
|
|
'animalSniffer': '1.16',
|
|
'junit': '4.12',
|
|
'assertj': '1.7.0',
|
|
'shadowPlugin': '5.2.0',
|
|
'spotless': '5.8.2',
|
|
'ktlint': '0.40.0',
|
|
'bndPlugin': '5.1.2'
|
|
]
|
|
|
|
ext.deps = [
|
|
'android': [
|
|
'gradlePlugin': "com.android.tools.build:gradle:4.1.1",
|
|
'desugarJdkLibs': "com.android.tools:desugar_jdk_libs:1.1.1",
|
|
],
|
|
'androidx': [
|
|
'testExtJunit': "androidx.test.ext:junit:1.1.2",
|
|
'testRunner': "androidx.test:runner:1.3.0",
|
|
],
|
|
'kotlin': [
|
|
'gradlePlugin': "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}",
|
|
'stdLib': [
|
|
'common': "org.jetbrains.kotlin:kotlin-stdlib-common",
|
|
'jdk8': "org.jetbrains.kotlin:kotlin-stdlib-jdk8",
|
|
'jdk7': "org.jetbrains.kotlin:kotlin-stdlib-jdk7",
|
|
'jdk6': "org.jetbrains.kotlin:kotlin-stdlib",
|
|
'js': "org.jetbrains.kotlin:kotlin-stdlib-js",
|
|
],
|
|
'test': [
|
|
'common': "org.jetbrains.kotlin:kotlin-test-common",
|
|
'annotations': "org.jetbrains.kotlin:kotlin-test-annotations-common",
|
|
'jdk': "org.jetbrains.kotlin:kotlin-test-junit",
|
|
'js': "org.jetbrains.kotlin:kotlin-test-js",
|
|
],
|
|
'time': 'org.jetbrains.kotlinx:kotlinx-datetime:0.1.1',
|
|
],
|
|
'jmh': [
|
|
'gradlePlugin': "me.champeau.gradle:jmh-gradle-plugin:${versions.jmhPlugin}",
|
|
'core': "org.openjdk.jmh:jmh-core:${versions.jmh}",
|
|
'generator': "org.openjdk.jmh:jmh-generator-annprocess:${versions.jmh}",
|
|
],
|
|
'animalSniffer': [
|
|
'gradlePlugin': "ru.vyarus:gradle-animalsniffer-plugin:${versions.animalSnifferPlugin}",
|
|
'annotations': "org.codehaus.mojo:animal-sniffer-annotations:${versions.animalSniffer}",
|
|
],
|
|
'japicmp': 'me.champeau.gradle:japicmp-gradle-plugin:0.2.8',
|
|
'dokka': "org.jetbrains.dokka:dokka-gradle-plugin:${versions.dokka}",
|
|
'shadow': "com.github.jengelman.gradle.plugins:shadow:${versions.shadowPlugin}",
|
|
'spotless': "com.diffplug.spotless:spotless-plugin-gradle:${versions.spotless}",
|
|
'bnd': "biz.aQute.bnd:biz.aQute.bnd.gradle:${versions.bndPlugin}",
|
|
'test': [
|
|
'junit': "junit:junit:${versions.junit}",
|
|
'assertj': "org.assertj:assertj-core:${versions.assertj}",
|
|
]
|
|
]
|
|
|
|
dependencies {
|
|
classpath deps.android.gradlePlugin
|
|
classpath deps.kotlin.gradlePlugin
|
|
classpath deps.animalSniffer.gradlePlugin
|
|
classpath deps.japicmp
|
|
classpath deps.dokka
|
|
classpath deps.shadow
|
|
classpath deps.jmh.gradlePlugin
|
|
classpath deps.spotless
|
|
classpath deps.bnd
|
|
// https://github.com/melix/japicmp-gradle-plugin/issues/36
|
|
classpath 'com.google.guava:guava:28.2-jre'
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
gradlePluginPortal()
|
|
jcenter()
|
|
google()
|
|
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
|
|
maven { url 'https://kotlin.bintray.com/kotlinx/' }
|
|
}
|
|
}
|
|
|
|
// when scripts are applied the buildscript classes are not accessible directly therefore we save the class here to make it accessible
|
|
ext.bndBundleTaskConventionClass = aQute.bnd.gradle.BundleTaskConvention
|
|
|
|
allprojects {
|
|
group = GROUP
|
|
version = VERSION_NAME
|
|
}
|
|
|
|
subprojects {
|
|
repositories {
|
|
mavenCentral()
|
|
jcenter()
|
|
google()
|
|
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
|
|
maven { url 'https://kotlin.bintray.com/kotlinx/' }
|
|
}
|
|
|
|
apply plugin: "com.diffplug.spotless"
|
|
|
|
spotless {
|
|
kotlin {
|
|
target("**/*.kt")
|
|
ktlint(versions.ktlint).userData([indent_size: '2'])
|
|
trimTrailingWhitespace()
|
|
endWithNewline()
|
|
}
|
|
}
|
|
}
|