mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-25 13:30:08 +00:00
Drop execution-time project access
- Delete stale jars through an injected FileSystemOperations in the root build - Delete stale loader jars through an injected FileSystemOperations in each adapter - Resolve stale-jar file trees and copy sources at configuration time - Expand the loader metadata templates from the configured version string
This commit is contained in:
1 parent
5c84c6b8d8
commit
89dc5d0447
4 files changed
+157
-104
No files matched your search
@@ -17,9 +17,14 @@
|
||||
*/
|
||||
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.api.file.DeleteSpec
|
||||
import org.gradle.api.file.FileSystemOperations
|
||||
import org.gradle.api.file.FileTree
|
||||
import org.gradle.api.tasks.compile.JavaCompile
|
||||
import org.gradle.jvm.toolchain.JavaLanguageVersion
|
||||
|
||||
import javax.inject.Inject
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -38,6 +43,13 @@ plugins {
|
||||
|
||||
apply plugin: 'art.arcane.volmit-packaging'
|
||||
|
||||
interface IrisFileOperations {
|
||||
@Inject
|
||||
FileSystemOperations getFileSystemOperations()
|
||||
}
|
||||
|
||||
IrisFileOperations irisFileOperations = objects.newInstance(IrisFileOperations)
|
||||
|
||||
apply from: file('../../gradle/modded-generation-build-revision.gradle')
|
||||
|
||||
Properties rootProperties = new Properties()
|
||||
@@ -230,10 +242,10 @@ loom {
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property('version', project.version)
|
||||
inputs.property('version', irisVersion)
|
||||
inputs.property('minecraftVersion', minecraftVersion)
|
||||
filesMatching('fabric.mod.json') {
|
||||
expand('version': project.version, 'minecraftVersion': minecraftVersion)
|
||||
expand('version': irisVersion, 'minecraftVersion': minecraftVersion)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,13 +266,17 @@ Map<String, String> nestedFabricApiJars = [
|
||||
'fabric-permission-api-v1' : 'fabric-permission-api-v1.jar'
|
||||
]
|
||||
|
||||
FileTree staleLoaderJars = fileTree(layout.buildDirectory.dir('libs')) {
|
||||
include('Iris v* [Fabric] *.jar')
|
||||
include('iris-fabric-*.jar')
|
||||
}
|
||||
File legacyLoaderJar = layout.buildDirectory.file("libs/Iris-${project.version}+mc${minecraftVersion}-fabric.jar").get().asFile
|
||||
|
||||
tasks.named('shadowJar', ShadowJar).configure {
|
||||
doFirst {
|
||||
delete(fileTree(layout.buildDirectory.dir('libs')) {
|
||||
include('Iris v* [Fabric] *.jar')
|
||||
include('iris-fabric-*.jar')
|
||||
})
|
||||
delete(layout.buildDirectory.file("libs/Iris-${project.version}+mc${minecraftVersion}-fabric.jar"))
|
||||
irisFileOperations.fileSystemOperations.delete { DeleteSpec spec ->
|
||||
spec.delete(staleLoaderJars, legacyLoaderJar)
|
||||
}
|
||||
}
|
||||
archiveFileName.set(irisArtifactName('Fabric', "${minecraftVersion}+${fabricLoaderVersion}"))
|
||||
configurations = [project.configurations.named('bundle').get()]
|
||||
|
||||
@@ -17,9 +17,14 @@
|
||||
*/
|
||||
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.api.file.DeleteSpec
|
||||
import org.gradle.api.file.FileSystemOperations
|
||||
import org.gradle.api.file.FileTree
|
||||
import org.gradle.api.tasks.compile.JavaCompile
|
||||
import org.gradle.jvm.toolchain.JavaLanguageVersion
|
||||
|
||||
import javax.inject.Inject
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -38,6 +43,13 @@ plugins {
|
||||
|
||||
apply plugin: 'art.arcane.volmit-packaging'
|
||||
|
||||
interface IrisFileOperations {
|
||||
@Inject
|
||||
FileSystemOperations getFileSystemOperations()
|
||||
}
|
||||
|
||||
IrisFileOperations irisFileOperations = objects.newInstance(IrisFileOperations)
|
||||
|
||||
apply from: file('../../gradle/modded-generation-build-revision.gradle')
|
||||
|
||||
Properties rootProperties = new Properties()
|
||||
@@ -232,20 +244,24 @@ tasks.named('test').configure {
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property('version', project.version)
|
||||
inputs.property('version', irisVersion)
|
||||
inputs.property('minecraftVersion', minecraftVersion)
|
||||
filesMatching('META-INF/mods.toml') {
|
||||
expand('version': project.version, 'minecraftVersion': minecraftVersion)
|
||||
expand('version': irisVersion, 'minecraftVersion': minecraftVersion)
|
||||
}
|
||||
}
|
||||
|
||||
FileTree staleLoaderJars = fileTree(layout.buildDirectory.dir('libs')) {
|
||||
include('Iris v* [Forge] *.jar')
|
||||
include('iris-forge-*.jar')
|
||||
}
|
||||
File legacyLoaderJar = layout.buildDirectory.file("libs/Iris-${project.version}+mc${minecraftVersion}-forge.jar").get().asFile
|
||||
|
||||
tasks.named('shadowJar', ShadowJar).configure {
|
||||
doFirst {
|
||||
delete(fileTree(layout.buildDirectory.dir('libs')) {
|
||||
include('Iris v* [Forge] *.jar')
|
||||
include('iris-forge-*.jar')
|
||||
})
|
||||
delete(layout.buildDirectory.file("libs/Iris-${project.version}+mc${minecraftVersion}-forge.jar"))
|
||||
irisFileOperations.fileSystemOperations.delete { DeleteSpec spec ->
|
||||
spec.delete(staleLoaderJars, legacyLoaderJar)
|
||||
}
|
||||
}
|
||||
manifest {
|
||||
// FML 26.2 has no TOML mixin handling at all (ModFileParser reads neither [[mixins]] nor
|
||||
|
||||
@@ -17,9 +17,14 @@
|
||||
*/
|
||||
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.api.file.DeleteSpec
|
||||
import org.gradle.api.file.FileSystemOperations
|
||||
import org.gradle.api.file.FileTree
|
||||
import org.gradle.api.tasks.compile.JavaCompile
|
||||
import org.gradle.jvm.toolchain.JavaLanguageVersion
|
||||
|
||||
import javax.inject.Inject
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -38,6 +43,13 @@ plugins {
|
||||
|
||||
apply plugin: 'art.arcane.volmit-packaging'
|
||||
|
||||
interface IrisFileOperations {
|
||||
@Inject
|
||||
FileSystemOperations getFileSystemOperations()
|
||||
}
|
||||
|
||||
IrisFileOperations irisFileOperations = objects.newInstance(IrisFileOperations)
|
||||
|
||||
apply from: file('../../gradle/modded-generation-build-revision.gradle')
|
||||
|
||||
Properties rootProperties = new Properties()
|
||||
@@ -214,20 +226,24 @@ tasks.named('test').configure {
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property('version', project.version)
|
||||
inputs.property('version', irisVersion)
|
||||
inputs.property('minecraftVersion', minecraftVersion)
|
||||
filesMatching('META-INF/neoforge.mods.toml') {
|
||||
expand('version': project.version, 'minecraftVersion': minecraftVersion)
|
||||
expand('version': irisVersion, 'minecraftVersion': minecraftVersion)
|
||||
}
|
||||
}
|
||||
|
||||
FileTree staleLoaderJars = fileTree(layout.buildDirectory.dir('libs')) {
|
||||
include('Iris v* [NeoForge] *.jar')
|
||||
include('iris-neoforge-*.jar')
|
||||
}
|
||||
File legacyLoaderJar = layout.buildDirectory.file("libs/Iris-${project.version}+mc${minecraftVersion}-neoforge.jar").get().asFile
|
||||
|
||||
tasks.named('shadowJar', ShadowJar).configure {
|
||||
doFirst {
|
||||
delete(fileTree(layout.buildDirectory.dir('libs')) {
|
||||
include('Iris v* [NeoForge] *.jar')
|
||||
include('iris-neoforge-*.jar')
|
||||
})
|
||||
delete(layout.buildDirectory.file("libs/Iris-${project.version}+mc${minecraftVersion}-neoforge.jar"))
|
||||
irisFileOperations.fileSystemOperations.delete { DeleteSpec spec ->
|
||||
spec.delete(staleLoaderJars, legacyLoaderJar)
|
||||
}
|
||||
}
|
||||
archiveFileName.set(irisArtifactName('NeoForge', "${minecraftVersion}+${neoForgeVersion}"))
|
||||
configurations = [project.configurations.named('bundle').get()]
|
||||
|
||||
Reference in new issue
Block a user