Skip to content

Instantly share code, notes, and snippets.

@Lanse505
Created July 12, 2020 12:35
Show Gist options
  • Save Lanse505/520778858ac2f1164c10bc06b5b1f102 to your computer and use it in GitHub Desktop.
Save Lanse505/520778858ac2f1164c10bc06b5b1f102 to your computer and use it in GitHub Desktop.
import se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
classpath "gradle.plugin.com.matthewprenger:CurseGradle:1.4.0"
}
}
plugins {
id 'maven-publish'
id 'net.minecrell.licenser' version '0.4.1'
id "com.matthewprenger.cursegradle" version "1.4.0"
id "se.bjurr.gitchangelog.git-changelog-gradle-plugin" version "1.64"
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
//def BUILD_NUMBER = System.getenv("COMMIT") ? "${project.api_version}-${System.getenv("COMMIT")}-SNAPSHOT" : "${project.api_version}"
version = "${minecraftVersion}-${project.api_version}"
group = 'com.hrznstudio'
archivesBaseName = 'titanium'
def isReleaseBranch = System.getenv("BRANCH") == "release" || System.getenv("BRANCH") == "release-1.15";
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
repositories {
maven { url 'https://dogforce-games.com/maven' }
}
license {
header = project.file('HEADER')
ext {
year = Calendar.getInstance().get(Calendar.YEAR)
name = 'Horizon Studio'
email = '[email protected]'
mod = 'Titanium'
}
}
minecraft {
mappings channel: 'snapshot', version: '20200712-1.16.1'
runs {
client {
// recommended logging data for a userdev environment
properties 'forge.logging.markers': 'SCAN,REGISTRIES,REGISTRYDUMP'
// recommended logging level for the console
properties 'forge.logging.console.level': 'debug'
workingDirectory project.file('run').canonicalPath
source sourceSets.main
}
server {
// recommended logging data for a userdev environment
properties 'forge.logging.markers': 'SCAN,REGISTRIES,REGISTRYDUMP'
// recommended logging level for the console
properties 'forge.logging.console.level': 'debug'
workingDirectory project.file('run').canonicalPath
source sourceSets.main
}
data {
workingDirectory project.file('run')
property 'forge.logging.console.level', 'info'
args '--mod', 'titanium', '--all', '--output', file('src/main/resources'), '--input', file('src/main/resources')
source sourceSets.main
}
}
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
}
repositories {
mavenCentral()
jcenter()
maven {
// location of the maven that hosts JEI files
name = "Progwml6 maven"
url = "https://dvs1.progwml6.com/files/maven/"
}
maven {
// location of a maven mirror for JEI files, as a fallback
name = "ModMaven"
url = "https://modmaven.k-4u.nl"
}
maven {
url "https://maven.tterrag.com/"
}
}
dependencies {
minecraft 'net.minecraftforge:forge:1.16.1-32.0.23'
compileOnly fg.deobf("mezz.jei:jei-1.16.1:7.0.0.2:api")
// at runtime, use the full JEI jar
runtimeOnly fg.deobf("mezz.jei:jei-1.16.1:7.0.0.2")
}
jar {
manifest {
attributes(["Specification-Title": project.name,
"Specification-Vendor": "Horizon Studio",
"Specification-Version": "2.0",
"Implementation-Title": project.name,
"Implementation-Version": "${project.api_version}",
"Implementation-Vendor" :"Horizon Studio",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"Maven-Artifact": "${group}:${archivesBaseName}:${version}",
"ModSide": "BOTH",
],)
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
task deobfJar(type:Jar) {
from sourceSets.main.output
classifier 'deobf'
}
artifacts {
archives sourcesJar
archives javadocJar
archives deobfJar
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
artifact sourcesJar
artifact javadocJar
artifact deobfJar
}
}
repositories {
if(isReleaseBranch) {
maven {
url "s3://cdn.hrzn.studio/maven"
authentication {
awsIm(AwsImAuthentication)
}
}
} else {
mavenLocal()
}
}
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property 'version', project.version
inputs.property 'mcversion', '1.14'
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'META_INF/mods.toml'
// replace version and mcversion
expand 'version':project.version, 'mcversion': '1.14'
}
// copy everything else except the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'META_INF/mods.toml'
}
}
tasks.curseforge.enabled = System.getenv("CURSE_API") != null && isReleaseBranch
//tasks.makeChangelog.enabled = System.getenv("CURSE_API") != null
curseforge {
logger.info("Curse api: " + System.getenv("CURSE_API"))
if (System.getenv("CURSE_API") != null) {
apiKey = System.getenv("CURSE_API")
}
project {
id = '287342'
changelog = "https://github.com/InnovativeOnlineIndustries/Titanium/blob/changelog/CHANGELOG.md"
changelogType = 'markdown'
releaseType = 'beta'
addGameVersion '1.15.2'
mainArtifact(jar){
}
addArtifact sourcesJar
addArtifact deobfJar
addArtifact javadocJar
}
}
task makeChangelog(type: GitChangelogTask) {
//fromRepo = file("../../home/runner/work/Titanium/Titanium")
file = new File("CHANGELOG.md")
untaggedName = "Version ${project.version}"
fromCommit = "6a5a3df3665643ea181873312e3801db7c662686"
fromRef = "refs/tags/2.4.0"
toRef = "release-1.15"
templateContent = file("changelog.mustache").getText("UTF-8")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment