forked from square/okio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
131 lines (119 loc) · 4.31 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
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",
'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()
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs += "-Xjvm-default=enable"
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}