build.gradle 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. plugins {
  2. id "architectury-plugin" version "2.0.57"
  3. id "forgified-fabric-loom" version "0.6.49" apply false
  4. id "org.cadixdev.licenser" version "0.5.0"
  5. id "com.jfrog.bintray" version "1.8.4"
  6. id "com.matthewprenger.cursegradle" version "1.4.0" apply false
  7. id "maven"
  8. id "maven-publish"
  9. }
  10. architectury {
  11. minecraft = rootProject.minecraft_version
  12. }
  13. subprojects {
  14. apply plugin: "forgified-fabric-loom"
  15. loom {
  16. silentMojangMappingsLicense()
  17. useFabricMixin = true
  18. }
  19. }
  20. allprojects {
  21. apply plugin: "java"
  22. apply plugin: "architectury-plugin"
  23. apply plugin: "org.cadixdev.licenser"
  24. archivesBaseName = rootProject.archives_base_name
  25. version = rootProject.mod_version + "." + (System.getenv("GITHUB_RUN_NUMBER") == null ? "9999" : System.getenv("GITHUB_RUN_NUMBER"))
  26. group = rootProject.maven_group
  27. tasks.withType(JavaCompile) {
  28. options.encoding = "UTF-8"
  29. // The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too
  30. // JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used.
  31. // We'll use that if it's available, but otherwise we'll use the older option.
  32. def targetVersion = 8
  33. if (JavaVersion.current().isJava9Compatible()) {
  34. options.release = targetVersion
  35. }
  36. }
  37. license {
  38. header = rootProject.file("HEADER")
  39. ext {
  40. name = "shedaniel"
  41. year = "2020, 2021"
  42. }
  43. include "**/*.java"
  44. exclude "**/NbtType.java"
  45. ignoreFailures = true
  46. }
  47. ext {
  48. releaseChangelog = {
  49. def dateFormat = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm")
  50. dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"))
  51. def branch
  52. if (System.env.BRANCH_NAME) {
  53. branch = System.env.BRANCH_NAME
  54. branch = branch.substring(branch.lastIndexOf("/") + 1)
  55. } else {
  56. branch = "git rev-parse --abbrev-ref HEAD".execute().in.text.trim()
  57. }
  58. if (branch == "HEAD") {
  59. branch = "git rev-parse --short HEAD".execute().in.text.trim()
  60. }
  61. def time = dateFormat.format(new Date())
  62. def changes = new StringBuilder()
  63. changes << "<h2>Architectury v$project.version for $project.supported_version</h2>Updated at <b>$time</b>.<br><a href=\"https://www.github.com/architectury/architectury/commits/$branch\">Click here for changelog</a>"
  64. def proc = "git log --max-count=200 --pretty=format:%s".execute()
  65. proc.in.eachLine { line ->
  66. def processedLine = line.toString()
  67. if (!processedLine.contains("New translations") && !processedLine.contains("Merge") && !processedLine.contains("branch")) {
  68. changes << "<br>- ${processedLine.capitalize()}"
  69. }
  70. }
  71. proc.waitFor()
  72. return changes.toString()
  73. }
  74. }
  75. }
  76. task licenseFormatAll
  77. subprojects { p -> licenseFormatAll.dependsOn("${p.path}:licenseFormat") }
  78. bintray {
  79. user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
  80. key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_KEY')
  81. publications = ["mavenCommon", "mavenFabric", "mavenForge"]
  82. publish = true
  83. pkg {
  84. repo = "cloth"
  85. name = "architectury"
  86. userOrg = "shedaniel"
  87. licenses = ["Apache-2.0"]
  88. version {
  89. vcsUrl = "https://github.com/shedaniel/architectury.git"
  90. }
  91. }
  92. }
  93. task curseforgePublish