build.gradle 5.5 KB

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