build.gradle 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. import java.text.SimpleDateFormat
  2. plugins {
  3. id 'fabric-loom' version '0.2.5-SNAPSHOT'
  4. id 'maven-publish'
  5. id 'maven'
  6. id 'signing'
  7. id 'com.jfrog.bintray' version '1.8.4'
  8. id 'com.matthewprenger.cursegradle' version '1.4.0'
  9. id 'java-library'
  10. }
  11. sourceCompatibility = 1.8
  12. targetCompatibility = 1.8
  13. group = "me.shedaniel.cloth"
  14. archivesBaseName = "config-2"
  15. version = ((String) project.mod_version).contains("unstable") ? (project.mod_version + "." + buildTime()) : project.mod_version
  16. minecraft {
  17. }
  18. processResources {
  19. filesMatching('fabric.mod.json') {
  20. expand 'version': project.version
  21. }
  22. inputs.property "version", project.version
  23. }
  24. static def buildTime() {
  25. def df = new SimpleDateFormat("yyyyMMddHHmm")
  26. df.setTimeZone(TimeZone.getTimeZone("UTC"))
  27. return df.format(new Date())
  28. }
  29. dependencies {
  30. minecraft "com.mojang:minecraft:${project.minecraft_version}"
  31. mappings "net.fabricmc:yarn:${project.yarn_version}"
  32. modApi "net.fabricmc:fabric-loader:${project.fabric_loader_version}"
  33. modApi "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
  34. modApi "me.shedaniel.cloth:basic-math:0.3.0"
  35. include "me.shedaniel.cloth:basic-math:0.3.0"
  36. modImplementation "io.github.prospector:modmenu:${modmenu_version}"
  37. compileOnly "com.google.code.findbugs:jsr305:3.0.2"
  38. //https://github.com/natanfudge/Not-Enough-Crashes/blob/master/README.md
  39. modCompileOnly "com.lettuce.fudge:notenoughcrashes:$nec_version"
  40. }
  41. bintray {
  42. user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
  43. key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_KEY')
  44. publications = ["MyPublication"]
  45. override = true
  46. pkg {
  47. repo = "cloth-config-2"
  48. name = "config-2"
  49. userOrg = "shedaniel"
  50. licenses = ["Unlicense"]
  51. version {
  52. name = project.version
  53. vcsTag = project.version
  54. released = new Date()
  55. desc = "Cloth Config API for Minecraft"
  56. githubRepo = 'shedaniel/ClothConfig'
  57. websiteUrl = 'https://github.com/shedaniel/ClothConfig'
  58. issueTrackerUrl = 'https://github.com/shedaniel/ClothConfig/issues'
  59. vcsUrl = 'https://github.com/shedaniel/ClothConfig.git'
  60. gpg {
  61. sign = true
  62. }
  63. // mavenCentralSync {
  64. // sync = true //[Default: true] Determines whether to sync the version to Maven Central.
  65. // user = project.hasProperty('ossToken') ? project.property('ossToken') : System.getenv('OSS_TOKEN')
  66. // OSS user token: mandatory
  67. // password = project.hasProperty('ossPass') ? project.property('ossPass') : System.getenv('OSS_PASS')
  68. //OSS user password: mandatory
  69. // close = '1'
  70. //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.
  71. // }
  72. }
  73. }
  74. }
  75. // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
  76. // if it is present.
  77. // If you remove this task, sources will not be generated.
  78. task sourcesJar(type: Jar, dependsOn: classes) {
  79. classifier = 'sources'
  80. from sourceSets.main.allSource
  81. }
  82. task javadocs(type: Javadoc) {
  83. source = sourceSets.main.allJava
  84. }
  85. task javadocsJar(type: Jar, dependsOn: javadocs) {
  86. classifier = "javadocs"
  87. javadocs.failOnError false
  88. from javadocs.destinationDir
  89. }
  90. publishing {
  91. publications {
  92. MyPublication(MavenPublication) {
  93. artifact(file("${project.buildDir}/libs/${project.archivesBaseName}-${project.version}.jar")) {
  94. builtBy remapJar
  95. }
  96. artifact(sourcesJar) {
  97. builtBy remapSourcesJar
  98. }
  99. artifact javadocsJar
  100. groupId 'me.shedaniel.cloth'
  101. artifactId 'config-2'
  102. version = project.version
  103. pom.withXml {
  104. def root = asNode()
  105. root.appendNode('description', 'Cloth Config API for Minecraft')
  106. root.appendNode('name', 'config-2')
  107. root.appendNode('url', 'https://github.com/shedaniel/ClothConfig')
  108. root.appendNode('packaging', 'jar')
  109. def license = root.appendNode('licenses').appendNode('license')
  110. license.appendNode('name', 'Unlicense')
  111. license.appendNode('url', 'http://unlicense.org')
  112. license.appendNode('distribution', 'repo')
  113. def developers = root.appendNode('developers')
  114. def shedaniel = developers.appendNode('developer')
  115. shedaniel.appendNode('id', 'shedaniel')
  116. shedaniel.appendNode('name', 'shedaniel')
  117. shedaniel.appendNode('email', 'daniel@shedaniel.me')
  118. def scm = root.appendNode('scm')
  119. scm.appendNode('url', "https://github.com/shedaniel/ClothConfig")
  120. scm.appendNode('connection', "scm:git:git://github.com/shedaniel/ClothConfig.git")
  121. scm.appendNode('developerConnection', "scm:git:ssh://github.com:shedaniel/ClothConfig.git")
  122. }
  123. }
  124. }
  125. // select the repositories you want to publish to
  126. repositories {
  127. // uncomment to publish to the local maven
  128. // mavenLocal()
  129. }
  130. }
  131. curseforge {
  132. apiKey = project.hasProperty('apiKey') ? project.property('apiKey') : System.getenv('CF_API_KEY')
  133. if (apiKey != null)
  134. project {
  135. id = '319057'
  136. releaseType = 'release'
  137. addGameVersion '1.15-Snapshot'
  138. addGameVersion 'Java 8'
  139. relations {
  140. requiredDependency 'fabric-api'
  141. }
  142. mainArtifact(file("${project.buildDir}/libs/${project.archivesBaseName}-${project.version}.jar")) {
  143. displayName = "[Fabric ${project.minecraft_version}] ClothConfig2-$project.version"
  144. }
  145. addArtifact(file("${project.buildDir}/libs/${project.archivesBaseName}-${project.version}-sources.jar"))
  146. afterEvaluate {
  147. uploadTask.dependsOn("remapJar")
  148. uploadTask.dependsOn("remapSourcesJar")
  149. }
  150. }
  151. options {
  152. forgeGradleIntegration = false
  153. javaVersionAutoDetect = false
  154. }
  155. }