generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
131 lines (109 loc) · 3.85 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
plugins {
id 'fabric-loom' version '0.8.17' apply false
}
version = cfg_version
allprojects {
apply plugin: 'maven-publish'
apply plugin: 'fabric-loom'
java {
sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16
}
group = 'net.dblsaiko.qcommon.cfg'
dependencies {
minecraft group: 'com.mojang', name: 'minecraft', version: minecraft_version
mappings group: 'net.fabricmc', name: 'yarn', version: mappings_version, classifier: 'v2'
modImplementation group: 'net.fabricmc', name: 'fabric-loader', version: loader_version
modImplementation group: 'net.fabricmc.fabric-api', name: 'fabric-api', version: fabric_api_version
}
configurations {
dev
}
repositories {
}
afterEvaluate {
artifacts {
dev file: file("${project.buildDir}/libs/$archivesBaseName-${version}-dev.jar"), type: 'jar', builtBy: remapJar
}
processResources {
inputs.property 'version', project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}
apply from: 'https://dblsaiko.net/pub/gradle/publish-slim.gradle'
}
subprojects {
task remapMavenJar(type: Copy, dependsOn: remapJar) {
afterEvaluate {
from("${project.buildDir}/libs/$archivesBaseName-${version}.jar")
into("${project.buildDir}/libs/")
rename { String fn -> "$archivesBaseName-${version}-maven.jar" }
}
}
afterEvaluate {
publishing {
publications {
mavenJava(MavenPublication) {
artifact(file("${project.buildDir}/libs/$archivesBaseName-${project.version}-maven.jar")) {
builtBy remapMavenJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
}
}
}
}
}
task remapMavenJar(type: net.fabricmc.loom.task.RemapJarTask, dependsOn: jar) {
afterEvaluate {
input = file("${project.buildDir}/libs/${archivesBaseName}-${version}-dev.jar")
archiveName = "${archivesBaseName}-${version}-maven.jar"
addNestedDependencies = false
}
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact(file("${project.buildDir}/libs/$archivesBaseName-${project.version}-maven.jar")) {
builtBy remapMavenJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
pom.withXml {
def buildid = System.getenv("PUBLISH_BUILD")
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", buildid != null ? "${it.version}-${buildid}":it.version)
depNode.appendNode("scope", "compile")
}
}
}
}
}
subprojects.each { remapJar.dependsOn("${it.path}:remapJar") }
repositories {
maven { url = 'https://maven.dblsaiko.net' }
}
dependencies {
// modRuntime group: 'net.dblsaiko', name: 'winwonders', version: '0.1.2-4'
// modRuntime(group: 'io.github.prospector', name: 'modmenu', version: '1.11.8+build.13') {
// exclude module: 'fabric-api'
// }
afterEvaluate {
subprojects.each {
implementation project(path: ":${it.name}", configuration: "dev")
include project("${it.name}:")
}
}
}