build.gradle 6.1 KB

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