mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-26 05:50:39 +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()
|
||||
@@ -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