forked from Mekanism-Fabric/Mekanism
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
184 lines (155 loc) · 4.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
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
plugins {
id 'fabric-loom' version '0.10-SNAPSHOT' apply false
id 'maven-publish'
id "java-library"
id 'idea'
}
class Globals {
static def baseVersion = "1.0.0"
static def mcVersion = "1.18.1"
static def yarnVersion = "+build.22"
static def loaderVersion = "0.12.12"
static def maven_group = "mekanism"
static def fabricVersion = "0.46.1+1.18"
static def clothConfigVersion = "6.1.48"
static def modMenuVersion = "3.0.1"
static def wthitVersion = "4.4.1"
static def techRebornEnergyVersion = "2.1.0"
static def reiVersion = "7.1.390"
}
version = Globals.baseVersion
logger.lifecycle("Building Mekanism: " + version)
static def moduleDependencies(project, List<String> depNames) {
def deps = depNames.iterator().collect { project.dependencies.project(path: ":$it", configuration: 'dev') }
project.dependencies {
deps.each {
api it
}
}
project.publishing {
publications {
mavenJava(MavenPublication) {
pom.withXml {
def depsNode = asNode().appendNode("dependencies")
deps.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")
}
}
}
}
}
}
allprojects {
apply plugin: "java-library"
apply plugin: "fabric-loom"
apply plugin: "maven-publish"
apply plugin: "idea"
tasks.withType(JavaCompile).configureEach {
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
// If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8"
// Minecraft 1.17 (21w19a) upwards uses Java 16.
it.options.release = 17
}
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
group = Globals.maven_group
sourceSets {
testmod {
compileClasspath += main.compileClasspath
runtimeClasspath += main.runtimeClasspath
}
}
loom {
runs {
testmodClient {
client()
ideConfigGenerated project.rootProject == project
name = "Testmod Client"
source sourceSets.testmod
}
testmodServer {
server()
ideConfigGenerated project.rootProject == project
name = "Testmod Server"
source sourceSets.testmod
}
}
}
dependencies {
minecraft "com.mojang:minecraft:$Globals.mcVersion"
mappings "net.fabricmc:yarn:${Globals.mcVersion}${Globals.yarnVersion}:v2"
modApi "net.fabricmc:fabric-loader:${Globals.loaderVersion}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${Globals.fabricVersion}"
compileOnly 'org.projectlombok:lombok:1.18.20'
annotationProcessor 'org.projectlombok:lombok:1.18.20'
modRuntime("com.terraformersmc:modmenu:${Globals.modMenuVersion}") {
transitive(false)
}
modCompileOnly "mcp.mobius.waila:wthit-api:fabric-${Globals.wthitVersion}"
modRuntime "mcp.mobius.waila:wthit:fabric-${Globals.wthitVersion}"
modCompileOnly "me.shedaniel:RoughlyEnoughItems-api:${Globals.reiVersion}"
modRuntime "me.shedaniel:RoughlyEnoughItems-fabric:${Globals.reiVersion}"
implementation 'com.electronwill.night-config:toml:3.6.4'
implementation 'com.electronwill.night-config:core:3.6.4'
//https://github.com/TechReborn/Energy/issues/18
include modApi("teamreborn:energy:2.1.0") {
exclude(group: "net.fabricmc.fabric-api")
}
modImplementation "curse.maven:ForgeConfigAPIPort-547434:3600918"
}
configurations { dev }
loom { shareCaches = true }
repositories {
mavenLocal()
maven { url "https://maven.shedaniel.me" }
maven { url "https://maven.terraformersmc.com/releases" }
maven { url "https://bai.jfrog.io/artifactory/maven" }
maven { url "https://maven.bai.lol" }
maven { url "https://cursemaven.com" }
mavenCentral()
}
jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
archiveClassifier = "dev"
}
afterEvaluate {
remapJar {
input = file("${project.buildDir}/libs/$archivesBaseName-$version-dev.jar")
archiveName = "${archivesBaseName}-${version}.jar"
}
artifacts {
dev file: file("${project.buildDir}/libs/$archivesBaseName-$version-dev.jar"), type: "jar", builtBy: jar
}
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
}
tasks.withType(AbstractArchiveTask) {
preserveFileTimestamps = false
reproducibleFileOrder = true
}
}
dependencies {
afterEvaluate {
subprojects.each {
api project(path: ":${it.name}", configuration: "dev")
include project("${it.name}:")
testmodImplementation project("${it.name}:").sourceSets.testmod.output
}
}
}