Knockdowns-Legacy/gradle/scripts/publishing.gradle
Rongmario c82fcee8aa
Merge overhaul branch to be upstream (#24)
* Debug mode for publishing artifacts
* Jabel
* Generation of mod meta, pack meta and mixin jsons
* Fixed runObfServer using 1.7's main class rather than 1.12's
- Allows changing of source without it being regenerated in dev
* ExampleMod + fixing tag collection
* Template expanding for mcmod.info + pack.mcmeta + remove redundant tasks
- Now supports arbitrary script blocks to retrieve value `${{ }}` from directly in gradle.properties
* Deployment via tasks/actions + changelog support + script folder
* Fixed mixin json generating condition
* Fix ATs not being applied
* Allow mixinbooter & configanytime to be prioritized in obf runs
* Remove redundant coremod arg addition as manifest is read at runtime
* Allow processResources to work correctly
* refactor: make parser changelog as method instead of job
* fix: ensure correct header parser for changelog (2to2 and 3to3)
* fix: no env available due to Github don't automatic inject env value to GHA
* refactor: standardize mod version with SemVer, remove unnecessary changelog block in `build.gradle`
* refactor: mixin config template and generator, resource filter
* Updated Gradle to 8.7 + RetroFuturaGradle to 1.3.35
* Update MixinBooter to 9.1 + provide wiki link

Co-authored-by: Oganesson897 <101081378+Darknight123MC@users.noreply.github.com>
Co-authored-by: Li <nhatlinh.l195@gmail.com>
Co-authored-by: Li <li.hvktqs@gmail.com>
2024-04-07 18:39:25 +01:00

107 lines
No EOL
4.1 KiB
Groovy

apply from: 'gradle/scripts/helpers.gradle'
setDefaultProperty('publish_to_maven', true, false)
setDefaultProperty('publish_to_curseforge', true, false)
setDefaultProperty('publish_to_modrinth', true, false)
if (propertyBool('publish_to_maven')) {
assertProperty('maven_name')
assertProperty('maven_url')
publishing {
repositories {
maven {
name propertyString('maven_name').replaceAll("\\s", "")
url propertyString('maven_url')
credentials(PasswordCredentials)
}
}
publications {
mavenJava(MavenPublication) {
from components.java // Publish with standard artifacts
setGroupId(propertyString('root_package'))// Publish with root package as maven group
setArtifactId(propertyString('mod_id')) // Publish artifacts with mod id as the artifact id
// Custom artifact:
// If you want to publish a different artifact to the one outputted when building normally
// Create a different gradle task (Jar task), in extra.gradle
// Remove the 'from components.java' line above
// Add this line (change the task name):
// artifacts task_name
}
}
}
}
// Documentation here: https://github.com/matthewprenger/CurseGradle/wiki/
if (propertyBool('publish_to_curseforge')) {
apply plugin: 'com.matthewprenger.cursegradle'
assertProperty('curseforge_project_id')
assertProperty('release_type')
setDefaultProperty('curseforge_debug', false, false)
curseforge {
apiKey = System.getenv('CURSEFORGE_TOKEN') == null ? "" : System.getenv('CURSEFORGE_TOKEN')
// noinspection GroovyAssignabilityCheck
project {
id = propertyString('curseforge_project_id')
addGameVersion 'Java 8'
addGameVersion 'Forge'
addGameVersion '1.12.2'
releaseType = propertyString('release_type')
if (!propertyBool('publish_with_changelog')) {
changelog = parserChangelog()
changelogType = 'markdown'
}
mainArtifact tasks.reobfJar, {
displayName = "${propertyString('mod_name')} ${propertyString('mod_version')}"
if (propertyBool('use_mixins')) {
relations {
requiredDependency 'mixin-booter'
}
}
if (propertyBool('use_asset_mover')) {
relations {
requiredDependency 'assetmover'
}
}
}
options {
debug = propertyBool('curseforge_debug')
}
}
}
}
// Documentation here: https://github.com/modrinth/minotaur
if (propertyBool('publish_to_modrinth')) {
apply plugin: 'com.modrinth.minotaur'
assertProperty('modrinth_project_id')
assertProperty('release_type')
setDefaultProperty('modrinth_debug', false, false)
modrinth {
token = System.getenv('MODRINTH_TOKEN') ? "" : System.getenv('MODRINTH_TOKEN')
projectId = propertyString('modrinth_project_id')
versionNumber = propertyString('mod_version')
versionType = propertyString('release_type')
uploadFile = tasks.reobfJar
gameVersions = ['1.12.2']
loaders = ['forge']
debugMode = propertyBool('modrinth_debug')
if (propertyBool('use_mixins') || propertyBool('use_asset_mover')) {
dependencies {
if (propertyBool('use_mixins')) {
required.project 'mixinbooter'
}
if (propertyBool('use_asset_mover')) {
required.project 'assetmover'
}
}
}
if (!propertyBool('publish_with_changelog')) {
changelog = parserChangelog()
}
if (propertyBool('modrinth_sync_readme')) {
syncBodyFrom = file('README.md').text
tasks.modrinth.dependsOn(tasks.modrinthSyncBody)
}
}
}