1
0
mirror of https://github.com/Suiranoil/SkinRestorer.git synced 2026-01-16 04:42:12 +00:00
Files
SkinRestorer/build.gradle
2024-06-27 18:20:25 +03:00

171 lines
5.4 KiB
Groovy

plugins {
id 'dev.architectury.loom' version '1.6-SNAPSHOT' apply false
id 'architectury-plugin' version '3.4-SNAPSHOT'
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
id "io.github.pacifistmc.forgix" version "1.2.9"
// id "com.modrinth.minotaur" version "2.+"
// id 'net.darkhax.curseforgegradle' version '1.1.15'
}
version = "${project.mod_version}+${project.minecraft_version}"
ext.version_name = "${project.capitalized_name} ${project.mod_version}"
ext.headTag = "git describe --tags --abbrev=0 HEAD".execute([], rootProject.projectDir).text.trim()
ext.previousTag = "git describe --tags --abbrev=0 HEAD^".execute([], rootProject.projectDir).text.trim()
architectury {
minecraft = project.minecraft_version
}
forgix {
group = "$project.maven_group.$project.mod_id"
// forgix does not append .jar extension for some reason
mergedJarName = "${project.archives_name}-${project.version}.jar"
outputDir = "build/libs/merged"
// removeDuplicate "$project.maven_group.$project.mod_id"
}
allprojects {
version = rootProject.version
group = project.maven_group
}
subprojects {
apply plugin: 'dev.architectury.loom'
apply plugin: 'architectury-plugin'
base {
archivesName = "$rootProject.archives_name-$project.name"
}
build.finalizedBy(mergeJars)
assemble.finalizedBy(mergeJars)
repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
}
dependencies {
minecraft "net.minecraft:minecraft:$rootProject.minecraft_version"
mappings loom.layered {
it.mappings("net.fabricmc:yarn:$rootProject.yarn_mappings:v2")
it.mappings("dev.architectury:yarn-mappings-patch-neoforge:$rootProject.yarn_mappings_patch_neoforge_version")
}
}
java {
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
jar {
from "$rootProject.projectDir/LICENSE"
}
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release.set(21)
}
}
// Adapted from https://raw.githubusercontent.com/TerraformersMC/GradleScripts/2.7/ferry.gradle
tasks.register('generateChangelog') {
ext.changelog = ""
def lastTag = previousTag
def currentTag = headTag
def changes = new StringBuilder()
def commits = "git log --max-count=${project.changelog_max_commit_search} --pretty=format:\"%b\" $lastTag..$currentTag".execute()
commits.in.eachLine { line -> // Loops over the lines the git log command returns
def processedLine = line.toString()
if (processedLine.startsWith("\"")) {
processedLine = processedLine.substring(1)
}
if (processedLine.endsWith("\"")) {
processedLine = processedLine.substring(0, processedLine.length() - 1)
}
if (processedLine.startsWith("- ")) {
if (changes.length() == 0) {
changes << processedLine
} else {
changes << "\n$processedLine"
}
}
}
commits.err.eachLine { line -> println line }
commits.waitFor()
ext.changelog = changes.toString()
if (ext.changelog.isEmpty()) {
ext.changelog = "No Changelog Available"
}
}
tasks.register('assertNewVersion') {
if (headTag == previousTag) {
throw new GradleException("Current version $headTag is the same as previous. Please create a new version tag if you want to proceed.")
}
}
//tasks.register('publish') {
// group = 'publishing'
// dependsOn 'assertNewVersion'
// dependsOn 'generateChangelog'
// dependsOn 'modrinth'
//// dependsOn 'curseforge'
// doFirst {
// println "Last version: $previousTag"
// println "Current version: $headTag"
// println "Changelog:"
// println generateChangelog.changelog
// }
//}
//
//modrinth {
// token = System.getenv('MODRINTH_TOKEN')
// projectId = project.modrinth_id
// versionName = version_name
// versionType = "release"
// changelog = generateChangelog.changelog
// uploadFile = remapJar
// project.modrinth_game_versions.split(',').each {
// gameVersions.add(it.trim())
// }
// project.modrinth_mod_loaders.split(',').each {
// loaders.add(it.trim())
// }
//}
//
//tasks.modrinth.dependsOn('assertNewVersion')
// cannot test it, returns 403 Forbidden. disabled for now
//import net.darkhax.curseforgegradle.TaskPublishCurseForge
//task curseforge(type: TaskPublishCurseForge) {
// group = 'publishing'
//
// disableVersionDetection()
//
// apiToken = System.getenv("CURSEFORGE_TOKEN")
//
// def mainFile = upload(project.curseforge_id, remapJar)
// mainFile.releaseType = 'release'
// mainFile.changelog = generateChangelog.changelog
// mainFile.changelogType = 'markdown'
// project.curseforge_game_versions.split(',').each {
// mainFile.addGameVersion(it.trim())
// }
// project.curseforge_mod_loaders.split(',').each {
// mainFile.addModLoader(it.trim())
// }
//}
//
// tasks.curseforge.dependsOn('assertNewVersion')