Skip to content

Commit e16c65b

Browse files
committed
Improved build script
1 parent 9f85061 commit e16c65b

1 file changed

Lines changed: 53 additions & 1 deletion

File tree

build.gradle

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ plugins {
22
id 'java-library'
33
id 'net.minecraftforge.gradle' version '6.0.+'
44
id 'idea'
5+
id 'maven-publish'
56
}
67

78
java {
@@ -12,21 +13,28 @@ java {
1213
idea {
1314
module {
1415
inheritOutputDirs = true
15-
excludeDirs += file('./run')
16+
excludeDirs += file('run')
1617
}
1718
}
1819

1920
ext {
2021
loadingPlugin = 'me.theandrey.mods.sidefix.LoadingPlugin'
2122
}
2223

24+
legacy {
25+
fixClasspath = true
26+
extractMappings = true
27+
attachMappings = true
28+
}
29+
2330
minecraft {
2431
mappings channel: 'stable', version: '39-1.12'
2532

2633
// Default run configurations.
2734
runs {
2835
configureEach {
2936
workingDirectory project.file('run')
37+
environment 'MC_VERSION', '1.12.2'
3038
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' // Recommended logging data for a userdev environment
3139
property 'forge.logging.console.level', 'debug' // Recommended logging level for the console
3240
property 'fml.coreMods.load', project.loadingPlugin
@@ -41,8 +49,39 @@ minecraft {
4149
}
4250
}
4351

52+
repositories {
53+
maven {
54+
name "Su5ed LegacyDev Fork"
55+
url "https://maven.su5ed.dev/releases"
56+
}
57+
}
58+
4459
dependencies {
4560
minecraft 'net.minecraftforge:forge:1.12.2-14.23.5.2860'
61+
62+
constraints {
63+
implementation('net.minecraftforge:legacydev:0.3.0.0-legacyExt') {
64+
because 'needed to have all ATs work properly'
65+
}
66+
67+
implementation('org.ow2.asm:asm-debug-all:5.2') {
68+
because 'newer ASM versions include module info that causes errors in Java 8'
69+
}
70+
}
71+
72+
configurations.forEach {
73+
// mergetool pollutes the classpath with conflicting classes
74+
it.exclude(group: 'net.minecraftforge', module: 'mergetool')
75+
76+
// legacydev forge dep wants fatjar as the classifier, but 3.0 lacks it
77+
it.resolutionStrategy.eachDependency {
78+
if (it.requested.module.toString() == "net.minecraftforge:legacydev") {
79+
it.artifactSelection {
80+
it.selectArtifact(DependencyArtifact.DEFAULT_TYPE, null, null)
81+
}
82+
}
83+
}
84+
}
4685
}
4786

4887
tasks.withType(JavaCompile).configureEach {
@@ -64,3 +103,16 @@ tasks.register('sourcesJar', Jar) {
64103
artifacts {
65104
archives tasks.named('sourcesJar')
66105
}
106+
107+
tasks.withType(GenerateModuleMetadata).configureEach {
108+
enabled = false
109+
}
110+
111+
publishing {
112+
publications {
113+
mavenJava(MavenPublication) {
114+
artifact tasks.named('jar')
115+
artifact tasks.named('sourcesJar')
116+
}
117+
}
118+
}

0 commit comments

Comments
 (0)