-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
178 lines (151 loc) · 5.26 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/*
* Copyright 2017-2018 Ton Ly (BreadMoirai)
*
* 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.
*/
plugins {
id 'java'
id 'idea'
id 'com.github.johnrengelman.shadow' version '5.1.0'
// id 'com.sedmelluq.jdaction' version '1.0.2'
id 'com.jfrog.bintray' version '1.8.4'
id 'maven-publish'
id 'signing'
id 'com.github.breadmoirai.github-release' version '2.2.9'
id 'org.ajoberstar.git-publish' version '3.0.0-rc.1'
id 'jacoco'
}
final author = 'BreadMoirai'
final artifactId = 'breadbot-framework'
group = "com.github.${author.toLowerCase()}"
version = '0.13.0'
final versionDesc = "Update JDA from 3.8.3_464 to 4.2.0_225"
//project.hasProperty never seems to work properly
final boolean keysArePresent = false
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
jcenter()
mavenCentral()
maven {
url "https://dl.bintray.com/dv8fromtheworld/maven"
}
}
dependencies {
//Discord Java Library
compileOnly 'net.dv8tion:JDA:4.2.0_225'
implementation 'org.slf4j:slf4j-api:1.7.25'
implementation 'org.reflections:reflections:0.9.10'
implementation 'com.typesafe:config:1.3.2'
implementation 'javax.inject:javax.inject:1'
implementation 'net.sf.trove4j:trove4j:3.0.3'
// compile 'org.jetbrains:annotations:16.0.1'
testImplementation 'uk.org.lidalia:slf4j-test:1.1.0'
testImplementation('junit:junit:4.12') {
exclude group: 'org.hamcrest'
}
testImplementation 'net.dv8tion:JDA:4.2.0_225'
testImplementation 'org.hamcrest:hamcrest-library:1.3'
testImplementation 'org.mockito:mockito-core:2.+'
}
javadoc {
options.memberLevel = JavadocMemberLevel.PUBLIC
exclude 'com/github/breadmoirai/breadbot/framework/internal'
}
githubRelease {
if (keysArePresent)
token = project.findProperty('github.key').toString()
String version = project.version
def title = ""
it.releaseName = "$version $title"
it.body = "## Changes\n$versionDesc\n## Adding as Dependency\n### Gradle\n```gradle\nrepositories {\n jcenter()\n}\n\ndependencies {\n compile '$project.group:$artifactId:$project.version'\n}\n```\n\n### Maven\n```xml\n<repository>\n <id>jcenter</id>\n <name>jcenter</name>\n <url>http://jcenter.bintray.com/</url>\n</repository>\n\n<dependency>\n <groupId>$project.group</groupId>\n <artifactId>$artifactId</artifactId>\n <version>$project.version</version>\n <type>pom</type>\n</dependency>\n```"
releaseAssets = jar.destinationDirectory.asFileTree.filter { file -> file.name.contains(version)}
overwrite = true
// println releaseAssets.findAll()
}
gitPublish {
// where to publish to (repo must exist)
repoUri = 'https://github.com/BreadMoirai/BreadBotFramework.git'
// branch will be created if it doesn't exist
branch = 'gh-pages'
contents {
from javadoc.destinationDir
}
commitMessage = "Javadoc Ver ${project.version} on ${new Date()}" // defaults to 'Generated by gradle-git-publish'
}
gitPublishReset {
dependsOn javadoc
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set 'javadoc'
from javadoc.destinationDir
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier.set 'sources'
from sourceSets.main.java.srcDirs
}
bintray {
user = author.toLowerCase()
if (keysArePresent)
key = project.getProperty('bintray.key').toString()
publications = ["BintrayRelease"]
publish = true
pkg {
repo = 'maven'
name = artifactId
licenses = ['Apache-2.0']
vcsUrl = "https://github.com/${author}/${project.name}.git"
version {
name = project.version
released = new Date()
desc = versionDesc
}
}
}
publishing {
publications.create('BintrayRelease', MavenPublication) {
from components.java
it.groupId = project.group as String
it.artifactId = artifactId
it.version = version
artifact javadocJar
artifact sourcesJar
artifact shadowJar
}
}
compileJava.options.encoding = 'UTF-8'
shadowJar.archiveClassifier.set 'withDependencies'
javadoc.source = sourceSets.main.allJava
javadoc.failOnError = false
task jarMake {
dependsOn jar
dependsOn sourcesJar
dependsOn javadocJar
dependsOn shadowJar
}
test {
testLogging {
events "passed", "skipped", "failed"
exceptionFormat "full"
}
}
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = false
csv.enabled = false
}
}
tasks.withType(JavaCompile) {
options.compilerArgs << '-parameters'
}