forked from shedaniel/cloth-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
executable file
·206 lines (177 loc) · 5.69 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
plugins {
id 'java'
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'dev.architectury.loom' version '0.12.0-SNAPSHOT' apply false
id 'org.cadixdev.licenser' version '0.6.1'
id "org.ajoberstar.grgit" version "3.1.1"
id 'com.matthewprenger.cursegradle' version "1.4.0"
}
def runNumber = (System.getenv("GITHUB_RUN_NUMBER") == null ? "9999" : System.getenv("GITHUB_RUN_NUMBER"))
version = rootProject.base_version + "." + runNumber
logger.lifecycle("Building cloth-api: " + version)
archivesBaseName = "cloth-api"
def getBranch() {
if (System.getenv().GIT_BRANCH) {
def branch = System.getenv().GIT_BRANCH
return branch.substring(branch.lastIndexOf("/") + 1)
}
if (grgit == null) {
return "unknown"
}
def branch = grgit.branch.current().name
return branch.substring(branch.lastIndexOf("/") + 1)
}
allprojects {
apply plugin: 'maven-publish'
apply plugin: 'dev.architectury.loom'
apply plugin: 'org.cadixdev.licenser'
sourceCompatibility = targetCompatibility = 1.8
group = "me.shedaniel.cloth.api"
ext {
shouldGenerateData = false
}
sourceSets {
testmod {
compileClasspath += main.compileClasspath
runtimeClasspath += main.runtimeClasspath
}
main {
resources {
srcDir 'src/generated/resources'
}
}
}
repositories {
maven { url "https://maven.shedaniel.me/" }
}
dependencies {
minecraft "com.mojang:minecraft:$project.minecraft_version"
mappings "net.fabricmc:yarn:${project.yarn_version}:v2"
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_version}"
compileOnly "com.google.code.findbugs:jsr305:3.0.2"
modApi "me.shedaniel.cloth:basic-math:${project.cloth_basic_math}"
}
configurations {
dev
}
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release.set 16
}
artifacts {
dev file: jar.archiveFile.get().asFile, type: "jar", builtBy: jar
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
license {
header rootProject.file('HEADER')
include '**/*.java'
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
}
subprojects {
version = rootProject.version
dependencies {
testmodImplementation sourceSets.main.output
}
publishing {
publications {
create("${archivesBaseName}_mavenJava", MavenPublication) {
afterEvaluate {
artifact(remapJar)
artifact(sourcesJar) {
builtBy remapSourcesJar
}
}
}
}
repositories {
if (System.getenv("MAVEN_PASS") != null) {
maven {
url = "https://deploy.shedaniel.me/"
credentials {
username = "shedaniel"
password = System.getenv("MAVEN_PASS")
}
}
}
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact(remapJar)
artifact(sourcesJar) {
builtBy remapSourcesJar
}
pom.withXml {
def depsNode = asNode().appendNode("dependencies")
subprojects.each {
def depNode = depsNode.appendNode("dependency")
depNode.appendNode("groupId", it.group)
depNode.appendNode("artifactId", it.name)
depNode.appendNode("version", it.version)
depNode.appendNode("scope", "compile")
}
}
}
}
repositories {
if (System.getenv("MAVEN_PASS") != null) {
maven {
url = "https://deploy.shedaniel.me/"
credentials {
username = "shedaniel"
password = System.getenv("MAVEN_PASS")
}
}
}
}
}
task licenseFormatAll
subprojects { p -> licenseFormatAll.dependsOn("${p.path}:licenseFormat") }
subprojects.each { remapJar.dependsOn("${it.path}:remapJar") }
sourceSets {
testmod
}
dependencies {
subprojects.each {
implementation project(path: ":${it.name}", configuration: "namedElements")
include project("${it.name}:")
testmodImplementation project("${it.name}:").sourceSets.testmod.output
}
include "me.shedaniel.cloth:basic-math:${project.cloth_basic_math}"
}
curseforge {
apiKey = project.hasProperty('apiKey') ? project.property('apiKey') : System.getenv('CF_API_KEY')
if (apiKey != null)
project {
id = '317121'
changelog = 'A changelog can be found at https://github.com/shedaniel/cloth-api/commits'
releaseType = 'release'
addGameVersion '1.19'
addGameVersion '1.19-Snapshot'
addGameVersion 'Fabric'
mainArtifact(file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar")) {
displayName = "[Fabric $project.minecraft_version] v$project.version"
}
afterEvaluate {
uploadTask.dependsOn("remapJar")
}
}
options {
forgeGradleIntegration = false
javaVersionAutoDetect = false
}
}