build.gradle 6.0 KB

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