build.gradle 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. plugins {
  2. id "architect-plugin" version "1.1.15"
  3. id "org.cadixdev.licenser" version "0.5.0"
  4. id "com.jfrog.bintray" version "1.8.4"
  5. id "com.matthewprenger.cursegradle" version "1.4.0" apply false
  6. id "maven"
  7. id "maven-publish"
  8. }
  9. architect {
  10. minecraft = rootProject.minecraft_version
  11. }
  12. allprojects {
  13. apply plugin: "java"
  14. apply plugin: "architect-plugin"
  15. apply plugin: "org.cadixdev.licenser"
  16. archivesBaseName = rootProject.archives_base_name
  17. version = rootProject.mod_version + "." + (System.getenv("GITHUB_RUN_NUMBER") == null ? "9999" : (System.getenv("GITHUB_RUN_NUMBER").toInteger() - Integer.parseInt(rootProject.last_minor_build)).toString())
  18. group = rootProject.maven_group
  19. tasks.withType(JavaCompile) {
  20. options.encoding = "UTF-8"
  21. }
  22. license {
  23. header = rootProject.file("HEADER")
  24. ext {
  25. name = "shedaniel"
  26. year = 2020
  27. }
  28. exclude "**/NbtType.java"
  29. exclude "**/*.accessWidener"
  30. ignoreFailures = true
  31. }
  32. }
  33. task licenseFormatAll
  34. subprojects { p -> licenseFormatAll.dependsOn("${p.path}:licenseFormat") }
  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 = ["mavenCommon", "mavenFabric", "mavenForge"]
  39. publish = true
  40. pkg {
  41. repo = "cloth"
  42. name = "architectury"
  43. userOrg = "shedaniel"
  44. licenses = ["Apache-2.0"]
  45. version {
  46. vcsUrl = "https://github.com/shedaniel/architectury.git"
  47. }
  48. }
  49. }
  50. def releaseChangelog = "No changelog"
  51. task curseforgePublish {
  52. def dateFormat = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm")
  53. dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"))
  54. def branch
  55. if (System.env.BRANCH_NAME) {
  56. branch = System.env.BRANCH_NAME
  57. branch = branch.substring(branch.lastIndexOf("/") + 1)
  58. } else {
  59. branch = "git rev-parse --abbrev-ref HEAD".execute().in.text.trim()
  60. }
  61. if (branch == "HEAD") {
  62. branch = "git rev-parse --short HEAD".execute().in.text.trim()
  63. }
  64. def time = dateFormat.format(new Date())
  65. def changes = new StringBuilder()
  66. 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>"
  67. def proc = "git log --max-count=200 --pretty=format:%s".execute()
  68. proc.in.eachLine { line ->
  69. def processedLine = line.toString()
  70. if (!processedLine.contains("New translations") && !processedLine.contains("Merge") && !processedLine.contains("branch")) {
  71. changes << "<br>- ${processedLine.capitalize()}"
  72. }
  73. }
  74. proc.waitFor()
  75. releaseChangelog = changes.toString()
  76. }
  77. afterEvaluate {
  78. // curseforgePublish.dependsOn project("fabric").tasks.getByName("curseforge")
  79. // curseforgePublish.dependsOn project("forge").tasks.getByName("curseforge")
  80. }