build.gradle 6.3 KB

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