mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-28 04:07:01 -05:00
Separate Forge runtime into its own subproject
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -21,4 +21,5 @@
|
||||
!/Jenkinsfile
|
||||
!/checkstyle.xml
|
||||
!/codenarc.groovy
|
||||
!/bootstrap
|
||||
!/bootstrap
|
||||
!/forge-runtime
|
||||
|
||||
39
build.gradle
39
build.gradle
@@ -13,6 +13,7 @@ plugins {
|
||||
id 'codenarc'
|
||||
id "org.cadixdev.licenser" version "0.5.0"
|
||||
id 'com.github.johnrengelman.shadow' version '7.0.0'
|
||||
id 'net.kyori.blossom' version '1.3.0'
|
||||
}
|
||||
|
||||
sourceCompatibility = 16
|
||||
@@ -40,20 +41,6 @@ if (!isSnapshot) {
|
||||
|
||||
logger.lifecycle(":building plugin v${version}")
|
||||
|
||||
configurations {
|
||||
forgeInjectShadow
|
||||
forgeInjectCompileClasspath.extendsFrom(forgeInjectShadow)
|
||||
forgeInjectRuntimeClasspath.extendsFrom(forgeInjectShadow)
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
forgeInject
|
||||
}
|
||||
|
||||
tasks.compileForgeInjectJava {
|
||||
options.release = 8
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url "https://maven.fabricmc.net/" }
|
||||
@@ -159,14 +146,6 @@ dependencies {
|
||||
implementation ('de.oceanlabs.mcp:mcinjector:3.8.0')
|
||||
implementation ('com.opencsv:opencsv:5.4')
|
||||
|
||||
// Forge injection
|
||||
forgeInjectShadow ('net.fabricmc:tiny-mappings-parser:0.2.2.14')
|
||||
forgeInjectImplementation ('cpw.mods:modlauncher:6.1.3')
|
||||
forgeInjectImplementation ('org.spongepowered:mixin:0.8.2')
|
||||
forgeInjectImplementation ('com.google.code.gson:gson:2.8.6')
|
||||
forgeInjectImplementation ('com.google.guava:guava:21.0')
|
||||
forgeInjectImplementation ('org.apache.logging.log4j:log4j-api:2.11.2')
|
||||
|
||||
// Testing
|
||||
testImplementation(gradleTestKit())
|
||||
testImplementation('org.spockframework:spock-core:2.0-groovy-3.0') {
|
||||
@@ -177,13 +156,8 @@ dependencies {
|
||||
compileOnly 'org.jetbrains:annotations:20.1.0'
|
||||
}
|
||||
|
||||
task forgeInjectJar(type: ShadowJar, dependsOn: [compileForgeInjectJava, processForgeInjectResources]) {
|
||||
relocate 'net.fabricmc.mapping', 'net.fabricmc.loom.mapping'
|
||||
relocate 'net.fabricmc.mappings', 'net.fabricmc.loom.mappings'
|
||||
configurations = [project.configurations.forgeInjectShadow]
|
||||
classifier = 'forgeinject'
|
||||
from compileForgeInjectJava.outputs
|
||||
from processForgeInjectResources.outputs
|
||||
blossom {
|
||||
replaceToken '$LOOM_VERSION', version
|
||||
}
|
||||
|
||||
jar {
|
||||
@@ -191,13 +165,7 @@ jar {
|
||||
}
|
||||
|
||||
task mainJar(type: Jar, dependsOn: jar) {
|
||||
dependsOn forgeInjectJar
|
||||
|
||||
from zipTree(jar.archiveFile)
|
||||
from(forgeInjectJar.outputs) {
|
||||
into "inject"
|
||||
rename { "injection.jar" }
|
||||
}
|
||||
|
||||
manifest {
|
||||
attributes 'Implementation-Version': project.version + ' Build(' + buildNum + ')'
|
||||
@@ -225,7 +193,6 @@ license {
|
||||
exclude '**/loom/util/DownloadUtil.java'
|
||||
exclude '**/projects'
|
||||
exclude '**/loom/util/FileSystemUtil.java'
|
||||
exclude '**/loom/inject/mixin/MixinIntermediaryDevRemapper.java'
|
||||
}
|
||||
|
||||
checkstyle {
|
||||
|
||||
6
forge-runtime/.gitignore
vendored
Normal file
6
forge-runtime/.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
# Ignore everything
|
||||
/*
|
||||
|
||||
!/src
|
||||
!/build.gradle
|
||||
!/.gitignore
|
||||
82
forge-runtime/build.gradle
Normal file
82
forge-runtime/build.gradle
Normal file
@@ -0,0 +1,82 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'maven-publish'
|
||||
id 'com.github.johnrengelman.shadow'
|
||||
id 'org.cadixdev.licenser'
|
||||
}
|
||||
|
||||
group = rootProject.group
|
||||
archivesBaseName = 'architectury-loom-forge-runtime'
|
||||
version = rootProject.version
|
||||
|
||||
sourceCompatibility = 8
|
||||
targetCompatibility = 8
|
||||
|
||||
configurations {
|
||||
include
|
||||
compileOnly.extendsFrom include
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
it.options.encoding = "UTF-8"
|
||||
it.options.release = 8
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url "https://maven.fabricmc.net/" }
|
||||
maven {
|
||||
url "https://maven.minecraftforge.net/"
|
||||
content {
|
||||
excludeGroupByRegex "org\\.eclipse\\.?.*"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
include ('net.fabricmc:tiny-mappings-parser:0.2.2.14')
|
||||
compileOnly ('cpw.mods:modlauncher:6.1.3')
|
||||
compileOnly ('org.spongepowered:mixin:0.8.2')
|
||||
compileOnly ('com.google.code.gson:gson:2.8.6')
|
||||
compileOnly ('com.google.guava:guava:21.0')
|
||||
compileOnly ('org.apache.logging.log4j:log4j-api:2.11.2')
|
||||
}
|
||||
|
||||
jar {
|
||||
archiveClassifier = "slim"
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
archiveClassifier = ""
|
||||
configurations = [project.configurations.include]
|
||||
relocate "net.fabricmc.mapping", "dev.architectury.loom.forgeruntime.shadow.mapping"
|
||||
relocate "net.fabricmc.mappings", "dev.architectury.loom.forgeruntime.shadow.mappings"
|
||||
}
|
||||
|
||||
assemble.dependsOn shadowJar
|
||||
|
||||
license {
|
||||
header rootProject.file("HEADER")
|
||||
include "**/*.java"
|
||||
exclude '**/loom/inject/mixin/MixinIntermediaryDevRemapper.java'
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
if (System.getenv("MAVEN_PASS") != null) {
|
||||
maven {
|
||||
url = "https://deploy.shedaniel.me/"
|
||||
credentials {
|
||||
username = "shedaniel"
|
||||
password = System.getenv("MAVEN_PASS")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,7 +25,8 @@
|
||||
package mcp;
|
||||
|
||||
/**
|
||||
* A dummy class, required for some Forge classes to load.
|
||||
* A dummy class, required for some Forge classes to load
|
||||
* because {@code MethodsReturnNonnullByDefault} in MCP has runtime retention.
|
||||
*
|
||||
* @deprecated Don't use this in your mods. JetBrains annotations are there for you.
|
||||
*/
|
||||
@@ -1,2 +1,3 @@
|
||||
rootProject.name = "architectury-loom"
|
||||
include "bootstrap"
|
||||
include "bootstrap"
|
||||
include "forge-runtime"
|
||||
|
||||
@@ -136,7 +136,8 @@ public class LaunchProvider extends DependencyProvider {
|
||||
annotationDependency = addDependency(Constants.Dependencies.JETBRAINS_ANNOTATIONS + Constants.Dependencies.Versions.JETBRAINS_ANNOTATIONS, JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME);
|
||||
|
||||
if (getExtension().isForge()) {
|
||||
addDependency(Constants.Dependencies.JAVAX_ANNOTATIONS + Constants.Dependencies.Versions.JAVAX_ANNOTATIONS, "compileOnly");
|
||||
addDependency(Constants.Dependencies.FORGE_RUNTIME + Constants.Dependencies.Versions.FORGE_RUNTIME, JavaPlugin.RUNTIME_ONLY_CONFIGURATION_NAME);
|
||||
addDependency(Constants.Dependencies.JAVAX_ANNOTATIONS + Constants.Dependencies.Versions.JAVAX_ANNOTATIONS, JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME);
|
||||
}
|
||||
|
||||
postPopulationScheduler.accept(this::writeRemapClassPath);
|
||||
|
||||
@@ -339,25 +339,6 @@ public class MinecraftPatchedProvider extends DependencyProvider {
|
||||
copyAll(getExtension().getForgeUniversalProvider().getForge(), environment.patchedSrgJar.apply(this));
|
||||
copyUserdevFiles(getExtension().getForgeUserdevProvider().getUserdevJar(), environment.patchedSrgJar.apply(this));
|
||||
});
|
||||
|
||||
logger.lifecycle(":injecting loom classes into minecraft");
|
||||
File injection = File.createTempFile("loom-injection", ".jar");
|
||||
|
||||
try (InputStream in = MinecraftProvider.class.getResourceAsStream("/inject/injection.jar")) {
|
||||
FileUtils.copyInputStreamToFile(in, injection);
|
||||
}
|
||||
|
||||
for (Environment environment : Environment.values()) {
|
||||
String side = environment.side();
|
||||
File target = environment.patchedSrgJar.apply(this);
|
||||
walkFileSystems(injection, target, it -> {
|
||||
if (it.getFileName().toString().equals("MANIFEST.MF")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return getExtension().useFabricMixin || !it.getFileName().toString().endsWith("cpw.mods.modlauncher.api.ITransformationService");
|
||||
}, this::copyReplacing);
|
||||
}
|
||||
}
|
||||
|
||||
private void accessTransformForge(Logger logger) throws Exception {
|
||||
|
||||
@@ -91,6 +91,7 @@ public class Constants {
|
||||
public static final String TERMINAL_CONSOLE_APPENDER = "net.minecrell:terminalconsoleappender:";
|
||||
public static final String JETBRAINS_ANNOTATIONS = "org.jetbrains:annotations:";
|
||||
public static final String JAVAX_ANNOTATIONS = "com.google.code.findbugs:jsr305:"; // I hate that I have to add these.
|
||||
public static final String FORGE_RUNTIME = "dev.architectury:architectury-loom-forge-runtime:";
|
||||
|
||||
private Dependencies() {
|
||||
}
|
||||
@@ -104,6 +105,7 @@ public class Constants {
|
||||
public static final String TERMINAL_CONSOLE_APPENDER = "1.2.0";
|
||||
public static final String JETBRAINS_ANNOTATIONS = "19.0.0";
|
||||
public static final String JAVAX_ANNOTATIONS = "3.0.2";
|
||||
public static final String FORGE_RUNTIME = "$LOOM_VERSION"; // replaced with current version at build time
|
||||
|
||||
private Versions() {
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user