build.gradle 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. import java.text.SimpleDateFormat
  2. plugins {
  3. id 'fabric-loom' version '0.2.5-SNAPSHOT'
  4. id 'maven-publish'
  5. id 'net.minecrell.licenser' version '0.4.1'
  6. }
  7. sourceCompatibility = 1.8
  8. targetCompatibility = 1.8
  9. archivesBaseName = "RoughlyEnoughItems"
  10. group = "me.shedaniel"
  11. def ENV = System.getenv()
  12. def forceVersion = ""
  13. version = forceVersion != "" ? forceVersion : (((String) project.mod_version).contains("unstable") ? (project.mod_version + "." + buildTime()) : project.mod_version)
  14. def includeDep = true
  15. minecraft {
  16. }
  17. static def buildTime() {
  18. def df = new SimpleDateFormat("yyyyMMddHHmm")
  19. df.setTimeZone(TimeZone.getTimeZone("UTC"))
  20. return df.format(new Date())
  21. }
  22. license {
  23. header rootProject.file('HEADER')
  24. include '**/*.java'
  25. }
  26. repositories {
  27. maven { url "https://tehnut.info/maven/" }
  28. maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
  29. maven { url "https://dl.bintray.com/shedaniel/autoconfig1u/" }
  30. }
  31. processResources {
  32. filesMatching('fabric.mod.json') {
  33. expand 'version': project.version
  34. }
  35. inputs.property "version", project.version
  36. }
  37. dependencies {
  38. minecraft "com.mojang:minecraft:${project.minecraft_version}"
  39. mappings "net.fabricmc:yarn:${project.yarn_version}"
  40. modApi "net.fabricmc:fabric-loader:${project.fabricloader_version}"
  41. modApi "net.fabricmc.fabric-api:fabric-api:${project.fabric_api}"
  42. modApi("me.shedaniel.cloth:cloth-events:${cloth_events_version}") {
  43. transitive = false
  44. }
  45. modImplementation("me.shedaniel.cloth:config-2:${cloth_config_version}") {
  46. transitive = false
  47. }
  48. modApi("me.sargunvohra.mcmods:autoconfig1u:${project.autoconfig1u}")
  49. if (includeDep) {
  50. include("me.shedaniel.cloth:cloth-events:${cloth_events_version}") {
  51. transitive = false
  52. }
  53. include("me.shedaniel.cloth:config-2:${cloth_config_version}") {
  54. transitive = false
  55. }
  56. include("me.sargunvohra.mcmods:autoconfig1u:${project.autoconfig1u}") {
  57. transitive = false
  58. }
  59. }
  60. modImplementation "io.github.prospector:modmenu:${modmenu_version}"
  61. compile "org.lwjgl:lwjgl-jemalloc:3.2.1"
  62. compileOnly "com.google.code.findbugs:jsr305:3.0.2"
  63. implementation 'org.jetbrains:annotations:15.0'
  64. }
  65. task sourcesJar(type: Jar, dependsOn: classes) {
  66. classifier = "sources"
  67. from sourceSets.main.allSource
  68. }
  69. task remapMavenJar(type: net.fabricmc.loom.task.RemapJarTask, dependsOn: jar) {
  70. // classifier = "maven"
  71. afterEvaluate {
  72. input = file("${project.buildDir}/libs/${archivesBaseName}-${version}-dev.jar")
  73. archiveName = "${archivesBaseName}-${version}-maven.jar"
  74. addNestedDependencies = false
  75. }
  76. }
  77. publishing {
  78. publications {
  79. mavenJava(MavenPublication) {
  80. artifact(file("${project.buildDir}/libs/$archivesBaseName-${version}.jar")) {
  81. builtBy remapJar
  82. }
  83. artifact(sourcesJar) {
  84. builtBy remapSourcesJar
  85. }
  86. }
  87. }
  88. repositories {
  89. if (project.hasProperty('danielshe_pass')) {
  90. maven {
  91. url = "http://deploy.modmuss50.me/"
  92. credentials {
  93. username = "danielshe"
  94. password = project.getProperty('danielshe_pass')
  95. }
  96. }
  97. }
  98. }
  99. }