-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
161 lines (133 loc) · 4.02 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
/*
* Copyright 2018 - 2019 Duncan Sterken
*
* 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.
*/
//to build everything: "gradlew build"
//to build and upload everything: "gradlew bintrayUpload"
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id 'java-library'
id 'maven-publish'
}
group = 'me.duncte123'
archivesBaseName = 'weebJava'
version = "3.0.1_${getBuildNumber()}"
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
maven {
url = "https://m2.duncte123.dev/releases"
}
}
dependencies {
api group: 'org.apache.commons', name: 'commons-text', version: '1.10.0'
api 'com.google.code.findbugs:jsr305:3.0.2'
api(group: 'me.duncte123', name: 'reliqua', version: '2.6.5') {
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
}
api group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.14.9'
api group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.12.7.1'
}
javadoc {
failOnError = false
options.memberLevel = JavadocMemberLevel.PUBLIC
options.author()
options.encoding = 'UTF-8'
options.addStringOption('-html5')
exclude('me/duncte123/weebJava/models/impl')
exclude('me/duncte123/weebJava/models/reputation/impl')
exclude('me/duncte123/weebJava/models/settings/impl')
exclude('me/duncte123/weebJava/web')
exclude('me/duncte123/weebJava/exceptions')
exclude('me/duncte123/weebJava/helpers')
}
task sourcesForRelease(type: Copy) {
from('src/main/java') {
include '**/WeebInfo.java'
filter(ReplaceTokens, tokens: [
version: version.toString()
])
}
into 'build/filteredSrc'
includeEmptyDirs = false
}
task generateJavaSources(type: SourceTask) {
def javaSources = sourceSets.main.allJava.filter {
it.name != 'WeebInfo.java'
}
source = javaSources + sourcesForRelease.destinationDir
dependsOn sourcesForRelease
}
compileJava {
options.encoding = 'UTF-8'
source = generateJavaSources.source
dependsOn generateJavaSources
}
task sourcesJar(type: Jar, dependsOn: classes) {
getArchiveClassifier().set('sources')
from('src/main/java') {
exclude '**/WeebInfo.java'
}
from sourcesForRelease.destinationDir
dependsOn sourcesForRelease
}
task javadocJar(type: Jar, dependsOn: javadoc) {
getArchiveClassifier().set('javadoc')
from javadoc.destinationDir
}
build {
dependsOn clean
dependsOn jar
dependsOn javadocJar
dependsOn sourcesJar
jar.mustRunAfter clean
javadocJar.mustRunAfter jar
sourcesJar.mustRunAfter javadocJar
}
publish {
dependsOn build
onlyIf {
System.getenv("JFROG_USERNAME") != null && System.getenv("JFROG_TOKEN") != null
}
}
publishing {
publications {
maven(MavenPublication) {
from components.java
artifactId archivesBaseName
groupId project.group
version project.version
artifact javadocJar
artifact sourcesJar
}
}
repositories {
maven {
name = "jfrog"
url = "https://m2.duncte123.dev/releases"
credentials {
username = System.getenv("JFROG_USERNAME")
password = System.getenv("JFROG_TOKEN")
}
}
}
}
wrapper {
gradleVersion = '8.2.1'
distributionType = Wrapper.DistributionType.BIN
}
static def getBuildNumber() {
return System.getenv("GITHUB_RUN_NUMBER") ?: "dev"
}