forked from MockBukkit/MockBukkit
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
154 lines (133 loc) · 4.07 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
plugins {
id 'java-library'
id 'eclipse'
id 'idea'
id 'jacoco'
id 'maven-publish'
id 'signing'
}
repositories {
mavenCentral()
maven {
url 'https://hub.spigotmc.org/nexus/content/repositories/public/'
}
maven {
url 'https://repo.md-5.net/content/groups/public/'
}
}
dependencies {
api "org.spigotmc:spigot-api:${gradle.ext.apiVersionFull}"
implementation 'org.junit.jupiter:junit-jupiter:5.7.1'
implementation 'org.hamcrest:hamcrest-library:1.3'
implementation 'org.apache.commons:commons-io:1.3.2'
implementation 'org.jetbrains:annotations:19.0.0'
}
task javadocJar(type: Jar) {
classifier('javadoc')
from javadoc
}
task sourcesJar(type: Jar) {
classifier('sources')
from sourceSets.main.allSource
}
tasks.withType(JavaCompile) {
Provider<JavaCompiler> compilerProvider = javaToolchains.compilerFor {
JavaLanguageVersion.of(8)
}
JavaCompiler compiler = compilerProvider.orNull
if (compiler != null && compiler.metadata.languageVersion.asInt() > 9) {
// Mark release as 8 if the compiler is Java 10 or newer
options.release.set(8)
} else {
// Only use the legacy compiler options otherwise
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}
artifacts {
archives javadocJar, sourcesJar
}
def isFork = isFork()
signing {
required { !isFork && System.getenv('JITPACK') == null }
sign publishing.publications
}
jacocoTestReport {
reports {
xml.enabled true
}
}
jacoco {
toolVersion = "0.8.6"
}
group = 'com.github.seeseemelk'
version = gradle.ext.version
publishing {
publications {
mockBukkit(MavenPublication) {
artifactId = "MockBukkit-v${gradle.ext.apiVersion}"
from components.java
artifact sourcesJar
artifact javadocJar
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'
}
}
}
}
}
repositories {
maven {
name = 'repository'
url = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/'
credentials {
username = findProperty('ossrhUsername')
password = findProperty('ossrhPassword')
}
}
maven {
name = 'snapshotRepository'
url = 'https://oss.sonatype.org/content/repositories/snapshots/'
credentials {
username = findProperty('ossrhUsername')
password = findProperty('ossrhPassword')
}
}
}
}
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
}