build.gradle 6.6 KB

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