build.gradle 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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. modApi "com.lettuce.fudge:notenoughcrashes-api:1.0.0"
  46. include "com.lettuce.fudge:notenoughcrashes-api:1.0.0"
  47. modRuntime "com.lettuce.fudge:notenoughcrashes:$nec_version"
  48. }
  49. bintray {
  50. user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
  51. key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_KEY')
  52. publications = ["MyPublication"]
  53. override = true
  54. pkg {
  55. repo = "cloth-config-2"
  56. name = "config-2"
  57. userOrg = "shedaniel"
  58. licenses = ["Unlicense"]
  59. version {
  60. name = project.version
  61. vcsTag = project.version
  62. released = new Date()
  63. desc = "Cloth Config API for Minecraft"
  64. githubRepo = 'shedaniel/ClothConfig'
  65. websiteUrl = 'https://github.com/shedaniel/ClothConfig'
  66. issueTrackerUrl = 'https://github.com/shedaniel/ClothConfig/issues'
  67. vcsUrl = 'https://github.com/shedaniel/ClothConfig.git'
  68. gpg {
  69. sign = true
  70. }
  71. // mavenCentralSync {
  72. // sync = true //[Default: true] Determines whether to sync the version to Maven Central.
  73. // user = project.hasProperty('ossToken') ? project.property('ossToken') : System.getenv('OSS_TOKEN')
  74. // OSS user token: mandatory
  75. // password = project.hasProperty('ossPass') ? project.property('ossPass') : System.getenv('OSS_PASS')
  76. //OSS user password: mandatory
  77. // close = '1'
  78. //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.
  79. // }
  80. }
  81. }
  82. }
  83. // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
  84. // if it is present.
  85. // If you remove this task, sources will not be generated.
  86. task sourcesJar(type: Jar, dependsOn: classes) {
  87. classifier = 'sources'
  88. from sourceSets.main.allSource
  89. }
  90. task javadocs(type: Javadoc) {
  91. source = sourceSets.main.allJava
  92. }
  93. task javadocsJar(type: Jar, dependsOn: javadocs) {
  94. classifier = "javadocs"
  95. javadocs.failOnError false
  96. from javadocs.destinationDir
  97. }
  98. publishing {
  99. publications {
  100. MyPublication(MavenPublication) {
  101. artifact(file("${project.buildDir}/libs/${project.archivesBaseName}-${project.version}.jar")) {
  102. builtBy remapJar
  103. }
  104. artifact(sourcesJar) {
  105. builtBy remapSourcesJar
  106. }
  107. artifact javadocsJar
  108. groupId 'me.shedaniel.cloth'
  109. artifactId 'config-2'
  110. version = project.version
  111. }
  112. }
  113. // select the repositories you want to publish to
  114. repositories {
  115. // uncomment to publish to the local maven
  116. // mavenLocal()
  117. }
  118. }
  119. curseforge {
  120. apiKey = project.hasProperty('apiKey') ? project.property('apiKey') : System.getenv('CF_API_KEY')
  121. if (apiKey != null)
  122. project {
  123. id = '319057'
  124. releaseType = 'release'
  125. addGameVersion '1.15'
  126. addGameVersion '1.15.1'
  127. addGameVersion '1.15.2'
  128. addGameVersion '1.15-Snapshot'
  129. addGameVersion 'Fabric'
  130. addGameVersion 'Java 8'
  131. relations {
  132. requiredDependency 'fabric-api'
  133. }
  134. mainArtifact(file("${project.buildDir}/libs/${project.archivesBaseName}-${project.version}.jar")) {
  135. displayName = "[Fabric 1.15.x] ClothConfig2-$project.version"
  136. }
  137. addArtifact(file("${project.buildDir}/libs/${project.archivesBaseName}-${project.version}-sources.jar"))
  138. afterEvaluate {
  139. uploadTask.dependsOn("remapJar")
  140. uploadTask.dependsOn("remapSourcesJar")
  141. }
  142. }
  143. options {
  144. forgeGradleIntegration = false
  145. javaVersionAutoDetect = false
  146. }
  147. }