forked from Kodehawa/imageboard-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
138 lines (112 loc) · 2.89 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
plugins {
id 'com.jfrog.bintray' version '1.8.5'
id 'java'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '6.1.0'
}
import org.apache.tools.ant.filters.ReplaceTokens
def versionObj = new Version(major: 2, minor: 4, revision: 4)
group 'net.kodehawa'
version "$versionObj"
def artifactid = 'imageboard-api'
apply plugin: 'java'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
implementation 'com.fasterxml.jackson.core:jackson-core:2.11.3'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.11.3'
implementation 'com.squareup.okhttp3:okhttp:3.14.9'
implementation 'org.slf4j:slf4j-api:1.7.30'
testImplementation 'ch.qos.logback:logback-classic:1.2.3'
testImplementation 'junit:junit:4.13.1'
}
task sourcesForRelease(type: Copy) {
from 'src/main/java'
into 'build/filteredSrc'
}
//Task for the versioning system
task prepareSource(type: Copy) {
from 'src/main/java'
into 'build/prepared-src'
filter(ReplaceTokens, tokens: [
version: versionObj.toString()
])
dependsOn clean
}
prepareSource.dependsOn clean
compileJava {
source = sourcesForRelease.destinationDir
classpath = sourceSets.main.compileClasspath
options.encoding = 'UTF-8'
dependsOn sourcesForRelease
}
jar {
archiveBaseName = project.name
manifest {
attributes 'Implementation-Version': archiveVersion
}
}
shadowJar {
classifier("withDependencies")
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier("sources")
from "${buildDir}/filteredSrc"
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier("javadoc")
from javadoc.destinationDir
}
bintray {
user = "$bintray_user"
key = "$bintray_api_key"
publications = ["BintrayRelease"]
pkg {
repo = 'maven'
name = 'imageboard-api'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/Kodehawa/imageboard-api.git'
publish = true
version {
name = project.version
released = new Date()
}
}
}
publishing {
publications {
BintrayRelease(MavenPublication) {
from components.java
groupId group
artifactId artifactid
version version
artifact javadocJar
artifact sourcesJar
}
}
}
build {
dependsOn clean
dependsOn jar
dependsOn javadocJar
dependsOn sourcesJar
dependsOn shadowJar
dependsOn test
jar.mustRunAfter clean
javadocJar.mustRunAfter jar
sourcesJar.mustRunAfter javadocJar
shadowJar.mustRunAfter sourcesJar
}
bintrayUpload {
dependsOn build
onlyIf { !"$bintray_user".isEmpty() }
onlyIf { !"$bintray_api_key".isEmpty() }
}
class Version {
String major, minor, revision
String toString() {
"${major}.${minor}" + (revision == "0" ? "" : ".${revision}")
}
}