build.gradle 5.4 KB

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