This repository has been archived by the owner on Oct 11, 2024. It is now read-only.
forked from mattmalec/Pterodactyl4J
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
140 lines (121 loc) · 3.83 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
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id 'java'
id 'maven'
id 'maven-publish'
}
sourceCompatibility = targetCompatibility = 1.8
def versionObject = new Version(major: 2, minor: 0)
version "$versionObject"
repositories {
mavenCentral()
}
dependencies {
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
implementation 'org.json:json:20160810'
implementation 'org.slf4j:slf4j-api:1.7.32'
}
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/sparkedhost/pterodactyl4j")
credentials {
username = System.getenv("USERNAME") ?: System.getenv("GITHUB_USERNAME")
password = System.getenv("TOKEN") ?: System.getenv("GITHUB_TOKEN")
}
}
}
publications {
mavenJar(MavenPublication) {
from components.java
groupId = "com.sparkedhost"
artifactId = "pterodactyl4j"
version = version
artifact sourcesJar
}
}
}
javadoc {
failOnError = false
options {
memberLevel = JavadocMemberLevel.PUBLIC
encoding = "UTF-8"
}
if (options instanceof StandardJavadocDocletOptions) {
StandardJavadocDocletOptions opt = options
opt.author()
opt.tags("incubating:a:Incubating:")
opt.links(
"https://docs.oracle.com/javase/8/docs/api/",
"https://javadoc.io/doc/com.squareup.okhttp3/okhttp/3.13.0/")
if (JavaVersion.current().isJava9Compatible()) {
opt.addBooleanOption("html5", true)
opt.addStringOption("-release", "8")
}
if (JavaVersion.current().isJava11Compatible()) {
opt.addBooleanOption("-no-module-directories", true)
}
}
exclude("com/sparkedhost/pterodactyl4j/utils/Checks.java",
"com/sparkedhost/pterodactyl4j/utils/ExceptionUtils.java",
"com/sparkedhost/pterodactyl4j/utils/LockUtils.java",
"com/sparkedhost/pterodactyl4j/utils/NamedThreadFactory.java",
"com/sparkedhost/pterodactyl4j/entities/impl",
"com/sparkedhost/pterodactyl4j/application/entities/impl",
"com/sparkedhost/pterodactyl4j/client/entities/impl",
"com/sparkedhost/pterodactyl4j/client/ws/handle",
"com/sparkedhost/pterodactyl4j/client/ws/WebSocketClient.java",
"com/sparkedhost/pterodactyl4j/client/ws/WebSocketAction.java")
}
task sourcesForRelease(type: Copy) {
from('src/main/java') {
include '**/P4JInfo.java'
filter(ReplaceTokens, tokens: [
MAJOR: versionObject.major,
MINOR: versionObject.minor,
BUILD: versionObject.build
])
}
into 'build/filteredSrc'
includeEmptyDirs = false
}
task generateJavaSources(type: SourceTask) {
def javaSources = sourceSets.main.java.filter {
it.name != 'P4JInfo.java'
}
source = javaSources + sourcesForRelease.destinationDir
dependsOn sourcesForRelease
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from ('src/main/java') {
exclude '**/P4JInfo.java'
}
from sourcesForRelease.destinationDir
dependsOn sourcesForRelease
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives javadocJar
archives sourcesJar
}
compileJava {
source = generateJavaSources.source
dependsOn generateJavaSources
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.incremental = true
options.compilerArgs += ["-Xlint:deprecation", "-Xlint:unchecked"]
}
class Version {
String major, minor
def build = System.getenv('BUILD_NUMBER') ?: 'DEV'
String toString() {
return "$major.${minor}-$build"
}
}