Repository navigation
Expand file tree
/
Copy pathbuild.gradle
More file actions
165 lines (139 loc) · 4.17 KB
/
Copy pathbuild.gradle
File metadata and controls
165 lines (139 loc) · 4.17 KB
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
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://papermc.io/repo/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.8.2'
implementation 'org.hamcrest:hamcrest-library:2.2'
// General utilities for the project
implementation 'org.jetbrains:annotations:23.0.0'
// LibraryLoader dependencies
implementation 'org.apache.maven:maven-resolver-provider:3.8.6'
implementation 'org.apache.maven.resolver:maven-resolver-connector-basic:1.8.0'
implementation 'org.apache.maven.resolver:maven-resolver-transport-http:1.8.0'
}
jar {
manifest {
attributes 'Automatic-Module-Name': "be.seeseemelk.mockbukkit"
}
}
task javadocJar(type: Jar) {
classifier('javadoc')
from javadoc
}
task sourcesJar(type: Jar) {
classifier('sources')
from sourceSets.main.allSource
}
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)
}
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.7"
}
group = 'com.github.seeseemelk'
version = property('mockbukkit.version')
nexusPublishing {
repositories {
sonatype {
username = findProperty('ossrhUsername')
password = findProperty('ossrhPassword')
}
}
}
publishing {
publications {
mockBukkit(MavenPublication) {
artifactId = "MockBukkit-v${gradle.ext.apiVersion}"
from components.java
artifact sourcesJar
artifact javadocJar
version = property('mockbukkit.version')
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'
}
}
}
}
}
}
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
}