forked from MockBukkit/MockBukkit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
172 lines (146 loc) · 3.65 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
plugins {
id 'java-library'
id 'eclipse'
id 'idea'
id 'jacoco'
id 'maven-publish'
id 'signing'
id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
}
repositories {
mavenCentral()
maven {
url 'https://hub.spigotmc.org/nexus/content/repositories/public/'
}
maven {
url 'https://repo.md-5.net/content/groups/public/'
}
maven {
url 'https://repo.papermc.io/repository/maven-public/'
}
}
dependencies {
// Paper API
api "io.papermc.paper:paper-api:${gradle.ext.apiVersionFull}"
// Dependencies for Unit Tests
implementation 'org.junit.jupiter:junit-jupiter:5.9.2'
// General utilities for the project
implementation 'net.kyori:adventure-platform-bungeecord:4.2.0'
implementation 'org.jetbrains:annotations:24.0.0'
// LibraryLoader dependencies
implementation 'org.apache.maven:maven-resolver-provider:3.8.5'
implementation 'org.apache.maven.resolver:maven-resolver-connector-basic:1.7.3'
implementation 'org.apache.maven.resolver:maven-resolver-transport-http:1.7.3'
}
jar {
manifest {
attributes 'Automatic-Module-Name': "be.seeseemelk.mockbukkit"
}
}
java {
withSourcesJar()
withJavadocJar()
}
javadoc {
options {
links "https://jd.papermc.io/paper/${gradle.ext.apiVersion}/"
}
}
processResources {
doLast {
file("${buildDir}/resources/main/build.properties").withWriter { w ->
Properties p = new Properties()
p['full-api-version'] = gradle.ext.apiVersionFull
p.store w, null
}
}
}
sourceCompatibility = gradle.ext.javaVersion
targetCompatibility = gradle.ext.javaVersion
tasks.withType(JavaCompile) {
options.release.set(gradle.ext.javaVersion)
}
def isFork = isFork()
signing {
required { !isFork && System.getenv('CI') != null }
sign publishing.publications
}
jacocoTestReport {
reports {
xml.enabled true
}
}
jacoco {
toolVersion = "0.8.8"
}
group = 'com.github.seeseemelk'
version = this.getVersion()
nexusPublishing {
repositories {
sonatype {
username = findProperty('ossrhUsername')
password = findProperty('ossrhPassword')
}
}
}
publishing {
publications {
mockBukkit(MavenPublication) {
artifactId = "MockBukkit-v${gradle.ext.apiVersion}"
from components.java
pom {
name = "MockBukkit-v${gradle.ext.apiVersion}"
packaging = 'jar'
description = 'MockBukkit is a mocking framework for bukkit to allow the easy unit testing of Bukkit plugins.'
url = 'https://github.com/MockBukkit/MockBukkit'
scm {
connection = 'scm:git:git://github.com/MockBukkit/MockBukkit.git'
developerConnection = 'scm:git:ssh://github.com:MockBukkit/MockBukkit.git'
url = "https://github.com/MockBukkit/MockBukkit/tree/v${gradle.ext.apiVersion}"
}
licenses {
license {
name = 'MIT License'
url = "https://github.com/MockBukkit/MockBukkit/blob/v${gradle.ext.apiVersion}/LICENSE"
}
}
developers {
developer {
id = 'seeseemelk'
name = 'Sebastiaan de Schaetzen'
email = 'sebastiaan.de.schaetzen@gmail.com'
}
}
}
}
}
}
publishToMavenLocal {
doLast {
println("Published to Maven local with version '${this.getVersion()}'")
}
}
test {
useJUnitPlatform()
}
eclipse.classpath.downloadJavadoc = true
eclipse.classpath.downloadSources = true
def isFork() {
try {
def workingDir = new File("${project.projectDir}")
def result = 'git config --get remote.origin.url'.execute(null, workingDir)
result.waitFor()
if (result.exitValue() == 0) {
return !result.text.contains("MockBukkit/MockBukkit")
}
} catch (e) {
}
return true
}
def getVersion() {
if (System.getenv('CI') == null) {
return 'dev-' + 'git rev-parse --verify --short HEAD'.execute().text.trim()
} else {
return property('mockbukkit.version')
}
}