-
Notifications
You must be signed in to change notification settings - Fork 138
/
build.gradle
125 lines (106 loc) · 2.66 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
apply plugin: 'java-library'
apply plugin: 'maven-publish'
group = 'com.mojang'
version = project.hasProperty('buildNumber') ? "${project.majorMinor}.${project.buildNumber}" : "${project.majorMinor}.0-SNAPSHOT"
def javaMajorVersion = project.hasProperty('javaMajorVersion') ? "${project.javaMajorVersion}" : "17"
sourceCompatibility = "${javaMajorVersion}"
targetCompatibility = "${javaMajorVersion}"
buildscript {
repositories {
mavenCentral()
maven {
url "https://libraries.minecraft.net"
}
}
}
repositories {
maven {
url "https://libraries.minecraft.net"
}
mavenCentral()
}
dependencies {
api 'com.google.code.gson:gson:2.10.1' // JsonElement and the rest used and exposed in JsonOps
api 'com.google.guava:guava:32.1.2-jre' // TypeToken primarily exposed
api 'it.unimi.dsi:fastutil:8.5.12' // various collection types are used in public API
compileOnlyApi 'com.google.code.findbugs:jsr305:3.0.2'
implementation 'org.slf4j:slf4j-api:2.0.9'
testImplementation 'junit:junit-dep:4.11'
testImplementation "org.slf4j:slf4j-simple:2.0.9"
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
sourceSets {
main {
java {
srcDirs = ['src/main/java']
}
resources {
srcDirs = ['src/main/resources']
}
}
test {
java {
srcDirs = ['src/test/java']
}
resources {
srcDirs = ['src/test/resources']
}
}
}
artifacts {
archives jar
archives sourcesJar
}
test {
testLogging {
events "failed", "skipped"
showStandardStreams = true
showExceptions true
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
}
}
}
task report {
doLast {
println "##vso[build.updatebuildnumber]${project.version}"
}
}
def publishDir = file("$buildDir/repo")
def uploadFile(s3, bucket, path, filename) {
println "Uploading $filename to $bucket as $path"
s3.putObject(bucket, path, filename)
}
clean.doLast {
delete publishDir
}
if (version.endsWith("SNAPSHOT")) {
publishing.repositories {
mavenLocal()
}
} else {
publishing.repositories {
maven {
url "$buildDir/repo"
}
}
publish.doLast {
publishDir.eachFileRecurse {
if (!it.isFile()) {
return
}
// Remove junk files
if (it.name.contains(".xml") || it.name.contains(".md5")) {
it.delete()
}
}
}
}