init
This commit is contained in:
@@ -0,0 +1,212 @@
|
||||
plugins {
|
||||
id 'java-library'
|
||||
id 'maven-publish'
|
||||
id "checkstyle"
|
||||
}
|
||||
|
||||
base {
|
||||
archivesName = "${mod_id}-${project.name}-${minecraft_version}"
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain.languageVersion = JavaLanguageVersion.of(java_version)
|
||||
withSourcesJar()
|
||||
// withJavadocJar()
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
// https://docs.gradle.org/current/userguide/declaring_repositories.html#declaring_content_exclusively_found_in_one_repository
|
||||
exclusiveContent {
|
||||
forRepository {
|
||||
maven {
|
||||
name = 'Sponge'
|
||||
url = 'https://repo.spongepowered.org/repository/maven-public'
|
||||
}
|
||||
}
|
||||
filter { includeGroupAndSubgroups('org.spongepowered') }
|
||||
}
|
||||
exclusiveContent {
|
||||
forRepositories(
|
||||
maven {
|
||||
name = 'ParchmentMC'
|
||||
url = 'https://maven.parchmentmc.org/'
|
||||
},
|
||||
maven {
|
||||
name = "NeoForge"
|
||||
url = 'https://maven.neoforged.net/releases'
|
||||
}
|
||||
)
|
||||
filter { includeGroup('org.parchmentmc.data') }
|
||||
}
|
||||
maven {
|
||||
name = 'BlameJared'
|
||||
url = 'https://maven.blamejared.com'
|
||||
}
|
||||
|
||||
maven { url = "https://maven.ithundxr.dev/hidden" } // Registrate
|
||||
maven { url = "https://maven.ithundxr.dev/snapshots" } // Registrate
|
||||
maven { url = "https://maven.createmod.net" } // Ponder
|
||||
|
||||
exclusiveContent {
|
||||
forRepository {
|
||||
maven {
|
||||
name = "Modrinth"
|
||||
url = "https://api.modrinth.com/maven"
|
||||
}
|
||||
}
|
||||
filter {
|
||||
includeGroup "maven.modrinth"
|
||||
}
|
||||
}
|
||||
|
||||
exclusiveContent {
|
||||
forRepository {
|
||||
maven {
|
||||
url = "https://cursemaven.com"
|
||||
}
|
||||
}
|
||||
filter {
|
||||
includeGroup "curse.maven"
|
||||
}
|
||||
}
|
||||
|
||||
maven { url = "https://maven.tterrag.com" } // Flywheel
|
||||
|
||||
maven {
|
||||
url = "https://maven.squiddev.cc"
|
||||
content {
|
||||
includeGroup("cc.tweaked")
|
||||
}
|
||||
}
|
||||
maven { url = "https://raw.githubusercontent.com/Fuzss/modresources/main/maven/" }
|
||||
|
||||
maven {
|
||||
name = "Mortuusars Github Maven"
|
||||
url = "https://raw.githubusercontent.com/mortuusars/resources/main/maven/"
|
||||
}
|
||||
maven {
|
||||
url = "https://maven.ryanhcode.dev/releases"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly "maven.modrinth:lithium:mc1.21.1-0.15.3-neoforge"
|
||||
compileOnly "maven.modrinth:sodium:$sodium_version"
|
||||
compileOnly "maven.modrinth:iris:$iris_version"
|
||||
compileOnly "maven.modrinth:distanthorizons:$distant_horizons_version"
|
||||
compileOnly("cc.tweaked:cc-tweaked-$minecraft_version-forge:$cc_tweaked_version")
|
||||
compileOnly("io.github.mortuusars.exposure:exposure-${minecraft_version}-neoforge:${exposure_version}") { transitive = false }
|
||||
compileOnly("maven.modrinth:jade:${project.jade_version}+neoforge") { transitive = false }
|
||||
compileOnly("maven.modrinth:jade-addons-forge:${project.jade_addons_version}+neoforge") { transitive = false }
|
||||
compileOnly("maven.modrinth:moonlight:${project.moonlight_version}-neoforge")
|
||||
compileOnly("curse.maven:vista-1368607:$vista_version")
|
||||
}
|
||||
|
||||
// Declare capabilities on the outgoing configurations.
|
||||
// Read more about capabilities here: https://docs.gradle.org/current/userguide/component_capabilities.html#sec:declaring-additional-capabilities-for-a-local-component
|
||||
['apiElements', 'runtimeElements', 'sourcesElements'/*, 'javadocElements'*/].each { variant ->
|
||||
configurations."$variant".outgoing {
|
||||
capability("$group:${base.archivesName.get()}:$version")
|
||||
capability("$group:$mod_id-${project.name}-${minecraft_version}:$version")
|
||||
capability("$group:$mod_id:$version")
|
||||
}
|
||||
publishing.publications.configureEach {
|
||||
suppressPomMetadataWarningsFor(variant)
|
||||
}
|
||||
}
|
||||
|
||||
sourcesJar {
|
||||
from(rootProject.file('LICENSE.md')) {
|
||||
rename { "${it}" }
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
from(rootProject.file('LICENSE.md')) {
|
||||
rename { "${it}" }
|
||||
}
|
||||
|
||||
manifest {
|
||||
attributes([
|
||||
'Specification-Title' : mod_name,
|
||||
'Specification-Vendor' : mod_author,
|
||||
'Specification-Version' : project.jar.archiveVersion,
|
||||
'Implementation-Title' : project.name,
|
||||
'Implementation-Version': project.jar.archiveVersion,
|
||||
'Implementation-Vendor' : mod_author,
|
||||
'Built-On-Minecraft' : minecraft_version
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
String createModVersionRange() {
|
||||
def createNeoforgeVersion = create_version.split("-")[0]
|
||||
def parts = createNeoforgeVersion.split("\\.").collect {it.toInteger() }
|
||||
def newMinor = parts[1] + 1
|
||||
def upperBounds = "${parts[0]}.$newMinor.0"
|
||||
|
||||
return "[$createNeoforgeVersion,$upperBounds)"
|
||||
}
|
||||
|
||||
processResources {
|
||||
var expandProps = [
|
||||
'version' : version,
|
||||
'group' : project.group, //Else we target the task's group.
|
||||
'minecraft_version' : minecraft_version,
|
||||
'minecraft_version_range' : minecraft_version_range,
|
||||
'create_version_range' : createModVersionRange(),
|
||||
'fabric_version' : fabric_version,
|
||||
'fabric_loader_version' : fabric_loader_version,
|
||||
'mod_name' : mod_name,
|
||||
'mod_author' : mod_author,
|
||||
'mod_id' : mod_id,
|
||||
'license' : license,
|
||||
'issues' : issues,
|
||||
'description' : project.description,
|
||||
'neoforge_version' : neoforge_version,
|
||||
'neoforge_loader_version_range': neoforge_loader_version_range,
|
||||
'credits' : credits,
|
||||
'java_version' : java_version,
|
||||
'veil_version' : veil_version,
|
||||
'sable_companion_version' : sable_companion_version
|
||||
]
|
||||
|
||||
filesMatching(['pack.mcmeta', 'fabric.mod.json', 'META-INF/mods.toml', 'META-INF/neoforge.mods.toml', '*.mixins.json']) {
|
||||
expand expandProps
|
||||
}
|
||||
inputs.properties(expandProps)
|
||||
}
|
||||
|
||||
|
||||
checkstyleMain {
|
||||
configFile = rootProject.file('config/checkstyle/checkstyle.xml')
|
||||
configProperties = [ 'checkstyle.cache.file': "${buildDir}/checkstyle.cache" ]
|
||||
ignoreFailures = true
|
||||
showViolations = true
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
artifactId = base.archivesName.get()
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
maven {
|
||||
url = System.getenv('local_maven_url')
|
||||
|
||||
credentials {
|
||||
username = System.getenv('local_maven_user')
|
||||
password = System.getenv('local_maven_token')
|
||||
}
|
||||
|
||||
authentication {
|
||||
basic(BasicAuthentication)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
plugins {
|
||||
id "multiloader-common"
|
||||
id "me.modmuss50.mod-publish-plugin" // https://github.com/modmuss50/mod-publish-plugin
|
||||
}
|
||||
|
||||
configurations {
|
||||
commonJava{
|
||||
canBeResolved = true
|
||||
}
|
||||
commonResources{
|
||||
canBeResolved = true
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(':common')) {
|
||||
capabilities {
|
||||
requireCapability "$group:$mod_id"
|
||||
}
|
||||
}
|
||||
commonJava project(path: ':common', configuration: 'commonJava')
|
||||
commonResources project(path: ':common', configuration: 'commonResources')
|
||||
}
|
||||
|
||||
tasks.named('compileJava', JavaCompile) {
|
||||
dependsOn(configurations.commonJava)
|
||||
source(configurations.commonJava)
|
||||
}
|
||||
|
||||
processResources {
|
||||
dependsOn(configurations.commonResources)
|
||||
from(configurations.commonResources)
|
||||
}
|
||||
|
||||
tasks.named('javadoc', Javadoc).configure {
|
||||
dependsOn(configurations.commonJava)
|
||||
source(configurations.commonJava)
|
||||
}
|
||||
|
||||
tasks.named('sourcesJar', Jar) {
|
||||
dependsOn(configurations.commonJava)
|
||||
from(configurations.commonJava)
|
||||
dependsOn(configurations.commonResources)
|
||||
from(configurations.commonResources)
|
||||
}
|
||||
|
||||
publishMods {
|
||||
def isFabric = project.name == "fabric"
|
||||
def loaderName = isFabric ? "Fabric" : "NeoForge"
|
||||
def changelogFile = rootProject.file("changelog.md")
|
||||
|
||||
type = STABLE
|
||||
|
||||
file = isFabric ? project.tasks.remapJar.archiveFile : jar.archiveFile
|
||||
changelog = changelogFile.text
|
||||
|
||||
version = "$project.version+mc$minecraft_version"
|
||||
displayName = "$mod_name $loaderName $project.version for mc$minecraft_version"
|
||||
modLoaders.add(project.name)
|
||||
|
||||
curseforge {
|
||||
accessToken = providers.environmentVariable("CURSEFORGE_API_KEY")
|
||||
projectId = "1312371"
|
||||
projectSlug = "sable"
|
||||
minecraftVersions.add(minecraft_version)
|
||||
|
||||
clientRequired = true
|
||||
serverRequired = true
|
||||
|
||||
if (project.name.contains("neoforge")) {
|
||||
optional("create")
|
||||
}
|
||||
|
||||
if (isFabric) {
|
||||
requires("fabric-api")
|
||||
embeds("forge-config-api-port")
|
||||
}
|
||||
|
||||
embeds("veil-lib")
|
||||
optional "imguimc"
|
||||
}
|
||||
|
||||
modrinth {
|
||||
accessToken = providers.environmentVariable("MODRINTH_TOKEN")
|
||||
projectId = "T9PomCSv"
|
||||
minecraftVersions.add(minecraft_version)
|
||||
|
||||
if (project.name.contains("neoforge")) {
|
||||
optional("create")
|
||||
}
|
||||
|
||||
if (isFabric) {
|
||||
requires("fabric-api")
|
||||
embeds("forge-config-api-port")
|
||||
}
|
||||
|
||||
embeds("veil")
|
||||
optional "imguimc"
|
||||
}
|
||||
|
||||
github {
|
||||
repository = "ryanhcode/sable"
|
||||
accessToken = providers.environmentVariable("GITHUB_TOKEN")
|
||||
tagName = "mc$minecraft_version-$project.version-$project.name"
|
||||
commitish = "main"
|
||||
|
||||
file.unset()
|
||||
file.unsetConvention()
|
||||
|
||||
allowEmptyFiles = true
|
||||
}
|
||||
|
||||
// We only want to send one message
|
||||
if (!isFabric) {
|
||||
discord {
|
||||
webhookUrl = providers.environmentVariable("DISCORD_WEBHOOK")
|
||||
|
||||
avatarUrl = "https://cdn.modrinth.com/data/T9PomCSv/8c0a8c64c9a5a8d446d0aa23d244cb9b52314a1d.png"
|
||||
username = "Sable Updates"
|
||||
|
||||
def modrinthLink = "https://modrinth.com/mod/sable"
|
||||
def curseForgeLink = "<https://www.curseforge.com/minecraft/mc-mods/sable>"
|
||||
|
||||
setPlatforms(publishMods.platforms.modrinth)
|
||||
|
||||
content = changelog.map {
|
||||
"# Sable release $project.version \n$it\nModrinth: $modrinthLink\nCurseForge: $curseForgeLink"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user