import java.text.SimpleDateFormat plugins { id 'fabric-loom' version '0.2.6-SNAPSHOT' id 'maven-publish' id 'maven' id 'signing' id 'com.jfrog.bintray' version '1.8.4' id 'com.matthewprenger.cursegradle' version '1.4.0' id 'java-library' } repositories { maven { name = 'Fabric' url = 'https://maven.fabricmc.net/' } jcenter() maven { url "https://jitpack.io" } } sourceCompatibility = targetCompatibility = 1.8 group = "me.shedaniel.cloth" archivesBaseName = "config-2" version = (project.mod_version as String).contains("unstable") ? (project.mod_version + "." + buildTime()) : project.mod_version as String minecraft { } processResources { filesMatching('fabric.mod.json') { expand 'version': project.version } inputs.property "version", project.version } static def buildTime() { def df = new SimpleDateFormat("yyyyMMddHHmm") df.setTimeZone(TimeZone.getTimeZone("UTC")) return df.format(new Date()) } dependencies { compileOnly 'org.jetbrains:annotations:18.0.0' minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" modApi "net.fabricmc:fabric-loader:${project.loader_version}" modApi "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" modApi "me.shedaniel.cloth:basic-math:0.3.0" include "me.shedaniel.cloth:basic-math:0.3.0" modImplementation "io.github.prospector:modmenu:${modmenu_version}" modApi "com.lettuce.fudge:notenoughcrashes-api:1.0.0" include "com.lettuce.fudge:notenoughcrashes-api:1.0.0" modRuntime "com.lettuce.fudge:notenoughcrashes:$nec_version" } bintray { user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_KEY') publications = ["MyPublication"] override = true pkg { repo = "cloth-config-2" name = "config-2" userOrg = "shedaniel" licenses = ["Unlicense"] version { name = project.version vcsTag = project.version released = new Date() desc = "Cloth Config API for Minecraft" githubRepo = 'shedaniel/ClothConfig' websiteUrl = 'https://github.com/shedaniel/ClothConfig' issueTrackerUrl = 'https://github.com/shedaniel/ClothConfig/issues' vcsUrl = 'https://github.com/shedaniel/ClothConfig.git' gpg { sign = true } // mavenCentralSync { // sync = true //[Default: true] Determines whether to sync the version to Maven Central. // user = project.hasProperty('ossToken') ? project.property('ossToken') : System.getenv('OSS_TOKEN') // OSS user token: mandatory // password = project.hasProperty('ossPass') ? project.property('ossPass') : System.getenv('OSS_PASS') //OSS user password: mandatory // close = '1' //Optional property. By default the staging repository is closed and artifacts are released to Maven Central. You can optionally turn this behaviour off (by puting 0 as value) and release the version manually. // } } } } // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task // if it is present. // If you remove this task, sources will not be generated. task sourcesJar(type: Jar, dependsOn: classes) { classifier = 'sources' from sourceSets.main.allSource } task javadocs(type: Javadoc) { source = sourceSets.main.allJava } task javadocsJar(type: Jar, dependsOn: javadocs) { classifier = "javadocs" javadocs.failOnError false from javadocs.destinationDir } publishing { publications { MyPublication(MavenPublication) { artifact(file("${project.buildDir}/libs/${project.archivesBaseName}-${project.version}.jar")) { builtBy remapJar } artifact(sourcesJar) { builtBy remapSourcesJar } artifact javadocsJar groupId 'me.shedaniel.cloth' artifactId 'config-2' version = project.version } } // select the repositories you want to publish to repositories { // uncomment to publish to the local maven // mavenLocal() } } curseforge { apiKey = project.hasProperty('apiKey') ? project.property('apiKey') : System.getenv('CF_API_KEY') if (apiKey != null) project { id = '319057' releaseType = 'release' addGameVersion '1.15' addGameVersion '1.15.1' addGameVersion '1.15.2' addGameVersion '1.15-Snapshot' addGameVersion 'Fabric' addGameVersion 'Java 8' relations { requiredDependency 'fabric-api' } mainArtifact(file("${project.buildDir}/libs/${project.archivesBaseName}-${project.version}.jar")) { displayName = "[Fabric 1.15.x] ClothConfig2-$project.version" } addArtifact(file("${project.buildDir}/libs/${project.archivesBaseName}-${project.version}-sources.jar")) afterEvaluate { uploadTask.dependsOn("remapJar") uploadTask.dependsOn("remapSourcesJar") } } options { forgeGradleIntegration = false javaVersionAutoDetect = false } }