forked from FabricMC/fabric-loader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
172 lines (144 loc) · 4.14 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 'maven-publish'
id 'idea'
id 'eclipse'
id("org.cadixdev.licenser") version "0.5.0"
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
archivesBaseName = "fabric-loader"
def ENV = System.getenv()
repositories {
mavenCentral()
jcenter()
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
}
dependencies {
// fabric-loader dependencies
api 'com.google.guava:guava:21.0'
api 'org.apache.logging.log4j:log4j-core:2.8.1'
api 'org.apache.logging.log4j:log4j-api:2.8.1'
api "org.ow2.asm:asm:${project.asm_version}"
api "org.ow2.asm:asm-analysis:${project.asm_version}"
api "org.ow2.asm:asm-commons:${project.asm_version}"
api "org.ow2.asm:asm-tree:${project.asm_version}"
api "org.ow2.asm:asm-util:${project.asm_version}"
// Required for mixin annotation processor
annotationProcessor "org.ow2.asm:asm:${project.asm_version}"
annotationProcessor "org.ow2.asm:asm-analysis:${project.asm_version}"
annotationProcessor "org.ow2.asm:asm-commons:${project.asm_version}"
annotationProcessor "org.ow2.asm:asm-tree:${project.asm_version}"
annotationProcessor "org.ow2.asm:asm-util:${project.asm_version}"
api('net.fabricmc:sponge-mixin:0.8.2+build.24') {
exclude module: 'launchwrapper'
exclude module: 'guava'
}
api 'net.fabricmc:tiny-mappings-parser:0.2.2.14'
api 'net.fabricmc:tiny-remapper:0.3.0.70'
api 'net.fabricmc:access-widener:1.0.0'
api 'com.google.jimfs:jimfs:1.2-fabric'
api 'net.fabricmc:fabric-loader-sat4j:2.3.5.4'
api 'net.sf.jopt-simple:jopt-simple:5.0.3'
testCompileOnly 'org.jetbrains:annotations:19.0.0'
// Unit testing for mod metadata
testImplementation('org.junit.jupiter:junit-jupiter:5.6.2')
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
jar {
manifest {
attributes (
'Main-Class': 'net.fabricmc.loader.launch.knot.Knot'
)
}
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
if (JavaVersion.current().isJava9Compatible()) {
it.options.release = 8
}
}
javadoc {
options {
if (file("README.html").exists()) {
overview = "README.html"
}
source = "8"
encoding = 'UTF-8'
charSet = 'UTF-8'
memberLevel = JavadocMemberLevel.PACKAGE
links(
'https://asm.ow2.io/javadoc/',
'https://docs.oracle.com/javase/8/docs/api/',
'https://logging.apache.org/log4j/2.x/log4j-api/apidocs/'
)
// Disable the crazy super-strict doclint tool in Java 8
addStringOption('Xdoclint:none', '-quiet')
}
source sourceSets.main.allJava.srcDirs
classpath = sourceSets.main.compileClasspath + sourceSets.main.output // compile impl stuff for dep as well
include("**/api/**")
// workaround as one of the api stuff use that package
failOnError false
}
task javadocJar(type: Jar) {
dependsOn javadoc
from javadoc.destinationDir
classifier = 'javadoc'
}
build.dependsOn javadocJar
license {
header file("HEADER")
include '**/*.java'
// Exclude gson since it is google's code, we just modify and bundle it
exclude '**/lib/gson/*.java'
}
publishing {
publications {
mavenJava(MavenPublication) {
// add all the jars that should be included when publishing to maven
from components.java
artifact sourcesJar
artifact javadocJar
}
}
// select the repositories you want to publish to
repositories {
if (ENV.MAVEN_URL) {
maven {
url ENV.MAVEN_URL
credentials {
username ENV.MAVEN_USERNAME
password ENV.MAVEN_PASSWORD
}
}
}
}
}
// A task to ensure that the version being released has not already been released.
task checkVersion {
doFirst {
def xml = new URL("https://raw.githubusercontent.com/GrossFabricHackers/maven/master/net/fabricmc/fabric-loader/maven-metadata.xml").text
def metadata = new XmlSlurper().parseText(xml)
def versions = metadata.versioning.versions.version*.text();
if (versions.contains(version)) {
logger.log(LogLevel.WARN, "${version} has already been released!")
}
}
}
publish.mustRunAfter checkVersion