build.gradle 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. plugins {
  2. id 'fabric-loom' version "0.4.3"
  3. id 'maven-publish'
  4. id 'maven'
  5. id 'signing'
  6. id 'com.jfrog.bintray' version '1.8.4'
  7. id 'com.matthewprenger.cursegradle' version '1.4.0'
  8. id 'java-library'
  9. id 'net.corda.plugins.jar-filter' version "5.0.8" apply false
  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
  23. minecraft {
  24. }
  25. processResources {
  26. filesMatching('fabric.mod.json') {
  27. expand 'version': project.version
  28. }
  29. inputs.property "version", project.version
  30. }
  31. dependencies {
  32. compile("org.jetbrains:annotations:18.0.0")
  33. minecraft("com.mojang:minecraft:${project.minecraft_version}")
  34. mappings("net.fabricmc:yarn:${project.yarn_mappings}:v2")
  35. modApi("net.fabricmc:fabric-loader:${project.loader_version}")
  36. modApi("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}")
  37. modApi("me.shedaniel.cloth:basic-math:0.5.0")
  38. include("me.shedaniel.cloth:basic-math:0.5.0")
  39. modCompileOnly("io.github.prospector:modmenu:${modmenu_version}")
  40. modRuntime("io.github.prospector:modmenu:${modmenu_version}")
  41. }
  42. task jarFilter(type: net.corda.gradle.jarfilter.JarFilterTask) {
  43. jars remapJar
  44. annotations {
  45. forRemove = [
  46. "org.jetbrains.annotations.NotNull",
  47. "org.jetbrains.annotations.Nullable",
  48. "org.jetbrains.annotations.ApiStatus\$Experimental",
  49. "org.jetbrains.annotations.ApiStatus\$Internal",
  50. "org.jetbrains.annotations.ApiStatus\$ScheduledForRemoval",
  51. "org.jetbrains.annotations.ApiStatus\$AvailableSince",
  52. "org.jetbrains.annotations.ApiStatus\$NonExtendable",
  53. "org.jetbrains.annotations.ApiStatus\$OverrideOnly"
  54. ]
  55. }
  56. }
  57. task copyJarFilter(type: Copy) {
  58. from jarFilter
  59. into "${project.buildDir}/filtered-libs/"
  60. rename { "${project.archivesBaseName}-${project.version}.jar" }
  61. }
  62. bintray {
  63. user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
  64. key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_KEY')
  65. publications = ["MyPublication"]
  66. publish = true
  67. pkg {
  68. repo = "cloth-config-2"
  69. name = "config-2"
  70. userOrg = "shedaniel"
  71. licenses = ["Unlicense"]
  72. version {
  73. name = project.version
  74. vcsTag = project.version
  75. released = new Date()
  76. desc = "Cloth Config API for Minecraft"
  77. githubRepo = 'shedaniel/ClothConfig'
  78. websiteUrl = 'https://github.com/shedaniel/ClothConfig'
  79. issueTrackerUrl = 'https://github.com/shedaniel/ClothConfig/issues'
  80. vcsUrl = 'https://github.com/shedaniel/ClothConfig.git'
  81. gpg {
  82. sign = true
  83. }
  84. }
  85. }
  86. }
  87. // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
  88. // if it is present.
  89. // If you remove this task, sources will not be generated.
  90. task sourcesJar(type: Jar, dependsOn: classes) {
  91. classifier = 'sources'
  92. from sourceSets.main.allSource
  93. }
  94. task javadocs(type: Javadoc) {
  95. source = sourceSets.main.allJava
  96. }
  97. task javadocsJar(type: Jar, dependsOn: javadocs) {
  98. classifier = "javadocs"
  99. javadocs.failOnError false
  100. from javadocs.destinationDir
  101. }
  102. publishing {
  103. publications {
  104. MyPublication(MavenPublication) {
  105. artifact(file("${project.buildDir}/libs/${project.archivesBaseName}-${project.version}.jar")) {
  106. builtBy remapJar
  107. }
  108. artifact(sourcesJar) {
  109. builtBy remapSourcesJar
  110. }
  111. artifact javadocsJar
  112. groupId 'me.shedaniel.cloth'
  113. artifactId 'config-2'
  114. version = project.version
  115. }
  116. }
  117. // select the repositories you want to publish to
  118. repositories {
  119. // uncomment to publish to the local maven
  120. // mavenLocal()
  121. }
  122. }
  123. curseforge {
  124. apiKey = project.hasProperty('apiKey') ? project.property('apiKey') : System.getenv('CF_API_KEY')
  125. if (apiKey != null)
  126. project {
  127. id = '319057'
  128. releaseType = 'beta'
  129. addGameVersion '1.16-Snapshot'
  130. addGameVersion 'Fabric'
  131. addGameVersion 'Java 8'
  132. relations {
  133. requiredDependency 'fabric-api'
  134. }
  135. mainArtifact(file("${project.buildDir}/filtered-libs/${project.archivesBaseName}-${project.version}.jar")) {
  136. displayName = "[Fabric ${project.supported_version}] ClothConfig2-$project.version"
  137. }
  138. addArtifact(file("${project.buildDir}/libs/${project.archivesBaseName}-${project.version}-sources.jar"))
  139. afterEvaluate {
  140. uploadTask.dependsOn("copyJarFilter")
  141. uploadTask.dependsOn("remapSourcesJar")
  142. }
  143. }
  144. options {
  145. forgeGradleIntegration = false
  146. javaVersionAutoDetect = false
  147. }
  148. }