This repository has been archived by the owner on Dec 21, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
153 lines (129 loc) · 3.63 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*
* Copyright 2016 - 2017 Florian Spieß
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.time.OffsetDateTime
import java.time.ZoneId
import java.time.format.DateTimeFormatter
buildscript {
ext.kotlin_version = '1.1.1'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'org.jetbrains.dokka:dokka-gradle-plugin:0.9.9'
}
}
plugins {
id 'java'
id 'idea'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '1.2.4'
}
apply plugin: 'kotlin'
apply plugin: 'org.jetbrains.dokka'
sourceCompatibility = 1.8
targetCompatibility = 1.8
group = 'club.minnced'
version = '0.BETA.1'
def jda_version = '3.1.1_224'
sourceSets {
main.kotlin.srcDirs += 'src/main/kotlin'
examples {
compileClasspath = main.output
runtimeClasspath = main.output
}
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
compileOnly 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.14'
// exclude when published
compileOnly "net.dv8tion:JDA:$jda_version"
sourceSets.examples.compileClasspath += configurations.compile + configurations.compileOnly
sourceSets.examples.runtimeClasspath += configurations.runtime
sourceSets.test.compileClasspath += sourceSets.examples.compileClasspath
sourceSets.test.runtimeClasspath += sourceSets.examples.runtimeClasspath
}
task dokkaJavadoc(type: org.jetbrains.dokka.gradle.DokkaTask) {
logging.level = LogLevel.QUIET
outputFormat = 'javadoc'
outputDirectory = "$buildDir/dokkaJavadoc"
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from "$buildDir/sources"
}
task javadocJar(type: Jar, dependsOn: dokkaJavadoc) {
classifier = 'javadoc'
from dokkaJavadoc.outputDirectory
}
task sources(type: Copy) {
from 'src/main/kotlin'
into "$buildDir/sources"
}
compileJava {
dependsOn sources
}
build {
dependsOn clean
dependsOn jar
dependsOn javadocJar
dependsOn sourcesJar
dependsOn shadowJar
jar.mustRunAfter clean
javadocJar.mustRunAfter jar
sourcesJar.mustRunAfter javadocJar
shadowJar.mustRunAfter sourcesJar
}
wrapper {
gradleVersion = '3.4.1'
}
jar {
def time = OffsetDateTime.now(ZoneId.of("UTC"))
manifest {
attributes 'Implementation-Version': version
attributes 'Created-At': time.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)
}
}
publishing {
publications {
maven(MavenPublication) {
groupId 'com.github.JDA-Applications'
artifactId 'Kotlin-JDA'
version project.version
artifact sourcesJar {
classifier "sources"
}
artifact javadocJar {
classifier "javadoc"
}
artifact jar {
classifier ''
}
artifact shadowJar {
classifier 'withDependencies'
}
}
}
}
kotlin {
experimental {
coroutines "enable"
}
}