import java.text.SimpleDateFormat plugins { id 'fabric-loom' version '0.2.5-SNAPSHOT' id 'maven-publish' id 'maven' id 'signing' id 'com.jfrog.bintray' version '1.8.4' id 'com.matthewprenger.cursegradle' version '1.4.0' } sourceCompatibility = 1.8 targetCompatibility = 1.8 group = "me.shedaniel.cloth" archivesBaseName = "config-2" version = ((String) project.mod_version).contains("unstable") ? (project.mod_version + "." + buildTime()) : project.mod_version 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 { minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_version}" modApi "net.fabricmc:fabric-loader:${project.fabric_loader_version}" modApi "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" modImplementation "io.github.prospector:modmenu:${modmenu_version}" compileOnly "com.google.code.findbugs:jsr305:3.0.2" //https://github.com/natanfudge/Not-Enough-Crashes/blob/master/README.md modCompileOnly "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 pom.withXml { def root = asNode() root.appendNode('description', 'Cloth Config API for Minecraft') root.appendNode('name', 'config-2') root.appendNode('url', 'https://github.com/shedaniel/ClothConfig') root.appendNode('packaging', 'jar') def license = root.appendNode('licenses').appendNode('license') license.appendNode('name', 'Unlicense') license.appendNode('url', 'http://unlicense.org') license.appendNode('distribution', 'repo') def developers = root.appendNode('developers') def shedaniel = developers.appendNode('developer') shedaniel.appendNode('id', 'shedaniel') shedaniel.appendNode('name', 'shedaniel') shedaniel.appendNode('email', 'daniel@shedaniel.me') def scm = root.appendNode('scm') scm.appendNode('url', "https://github.com/shedaniel/ClothConfig") scm.appendNode('connection', "scm:git:git://github.com/shedaniel/ClothConfig.git") scm.appendNode('developerConnection', "scm:git:ssh://github.com:shedaniel/ClothConfig.git") } } } // 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-Snapshot' addGameVersion 'Java 8' relations { requiredDependency 'fabric-api' } mainArtifact(file("${project.buildDir}/libs/${project.archivesBaseName}-${project.version}.jar")) { displayName = "[Fabric ${project.minecraft_version}] 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 } }