rework dsl, add mod configurations (remapped), add support for other mappings #3
|
@ -21,6 +21,7 @@ import org.gradle.api.Project
|
|||
import org.gradle.api.model.ObjectFactory
|
||||
import org.gradle.api.plugins.JavaBasePlugin
|
||||
import org.gradle.api.plugins.JavaPlugin
|
||||
import org.gradle.api.tasks.Delete
|
||||
import org.gradle.configurationcache.extensions.capitalized
|
||||
import org.jetbrains.java.decompiler.main.Fernflower
|
||||
import org.jetbrains.java.decompiler.main.decompiler.PrintStreamLogger
|
||||
|
@ -173,18 +174,14 @@ abstract class PhytotelmaGradleExtensionImpl @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
project.tasks.register(Constants.CLEAR_LOCAL_CACHE_TASK) { task ->
|
||||
project.tasks.register(Constants.CLEAR_LOCAL_CACHE_TASK, Delete::class.java) { task ->
|
||||
task.group = Constants.TASK_GROUP
|
||||
task.actions.add {
|
||||
clearLocalCache()
|
||||
}
|
||||
task.delete = setOf(ProjectStorage.get(project).localCacheDir)
|
||||
}
|
||||
|
||||
project.tasks.register(Constants.CLEAR_GLOBAL_CACHE_TASK) { task ->
|
||||
project.tasks.register(Constants.CLEAR_GLOBAL_CACHE_TASK, Delete::class.java) { task ->
|
||||
task.group = Constants.TASK_GROUP
|
||||
task.actions.add {
|
||||
clearGlobalCache()
|
||||
}
|
||||
task.delete = setOf(PhytotelmaPlugin.globalCacheDir)
|
||||
}
|
||||
|
||||
project.afterEvaluate {
|
||||
|
@ -192,16 +189,6 @@ abstract class PhytotelmaGradleExtensionImpl @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalPathApi::class)
|
||||
private fun clearLocalCache() {
|
||||
ProjectStorage.get(project).localCacheDir?.deleteRecursively()
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalPathApi::class)
|
||||
private fun clearGlobalCache() {
|
||||
PhytotelmaPlugin.globalCacheDir.deleteRecursively()
|
||||
}
|
||||
|
||||
private fun remapModDependencies() {
|
||||
ModConfigurations.configurations.forEach { conf ->
|
||||
val artifacts = project.configurations.getByName("mod" + conf.name.capitalized())
|
||||
|
@ -231,7 +218,8 @@ abstract class PhytotelmaGradleExtensionImpl @Inject constructor(
|
|||
val groupname = (group + "_" + name).replace(".", "_")
|
||||
val version = artifact.moduleVersion.id.version
|
||||
val classifier = artifact.classifier
|
||||
val remappedPath = targetPath.resolve(groupname).resolve(version).resolve(groupname+"-"+version+(classifier?.let { "-$it" }?:"")+".jar")
|
||||
val remappedPath = targetPath.resolve(groupname).resolve(version)
|
||||
.resolve(groupname + "-" + version + (classifier?.let { "-$it" } ?: "") + ".jar")
|
||||
remappedPath.createParentDirectories()
|
||||
remappedPaths.add(remappedPath)
|
||||
|
||||
|
@ -250,7 +238,10 @@ abstract class PhytotelmaGradleExtensionImpl @Inject constructor(
|
|||
|
||||
Thyroxine.remap(mappings, artifact.file.toPath(), remappedPath, false, false)
|
||||
|
||||
project.dependencies.add(target.name, "dev.frogmc.phytotelma.remapped_mods:$groupname:$version"+(classifier?.let { ":$it" }?:""))
|
||||
project.dependencies.add(
|
||||
target.name,
|
||||
"dev.frogmc.phytotelma.remapped_mods:$groupname:$version" + (classifier?.let { ":$it" } ?: "")
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue