build.gradle 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. import java.util.stream.Collectors
  2. buildscript {
  3. repositories {
  4. maven { url = 'https://maven.minecraftforge.net' }
  5. mavenCentral()
  6. maven { url 'https://maven.parchmentmc.org' }
  7. maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
  8. }
  9. dependencies {
  10. classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
  11. classpath group: 'org.parchmentmc', name: 'librarian', version: '1.+'
  12. classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.7-SNAPSHOT'
  13. }
  14. }
  15. apply plugin: 'net.minecraftforge.gradle'
  16. apply plugin: 'eclipse'
  17. //apply plugin: 'org.parchmentmc.librarian.forgegradle'
  18. apply plugin: 'org.spongepowered.mixin'
  19. apply plugin: 'ferritecore.loader-conventions'
  20. def fcMixinConfigs = [
  21. "predicates",
  22. "fastmap",
  23. "mrl",
  24. "dedupmultipart",
  25. "blockstatecache",
  26. "dedupbakedquad",
  27. "threaddetec",
  28. ].stream()
  29. .<String> map({ s -> "ferritecore." + s + ".mixin.json" })
  30. .collect(Collectors.toList())
  31. // Work around what I consider a bug in FG: Common:googleimpl source set is specified as mod source, but FG tries to
  32. // compile it in this project
  33. sourceSets {
  34. googleimpl
  35. }
  36. minecraft {
  37. //mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}"
  38. mappings channel: 'official', version: "${minecraft_version}"
  39. runs {
  40. client {
  41. workingDirectory project.file('run')
  42. ideaModule "${rootProject.name}.${project.name}.main"
  43. property 'forge.logging.console.level', 'debug'
  44. mods {
  45. ferritecore {
  46. source sourceSets.main
  47. source project(":Common").sourceSets.main
  48. source project(":Common").sourceSets.googleimpl
  49. }
  50. }
  51. }
  52. server {
  53. workingDirectory project.file('run')
  54. ideaModule "${rootProject.name}.${project.name}.main"
  55. property 'forge.logging.console.level', 'debug'
  56. mods {
  57. ferritecore {
  58. source sourceSets.main
  59. source project(":Common").sourceSets.main
  60. source project(":Common").sourceSets.googleimpl
  61. }
  62. }
  63. }
  64. }
  65. }
  66. dependencies {
  67. minecraft group: 'net.minecraftforge', name: 'forge', version: "${minecraft_version}-${forge_version}"
  68. annotationProcessor group: 'org.spongepowered', name: 'mixin', version: '0.8.5', classifier: 'processor'
  69. }
  70. jar.finalizedBy('reobfJar')
  71. mixin {
  72. add project(":Common").sourceSets.main, "${mod_id}.refmap.json"
  73. configNames += fcMixinConfigs
  74. }
  75. jar {
  76. filesMatching("*.mixin.json") {
  77. expand "refmap_target": "${mod_id}."
  78. }
  79. }
  80. task speedUpPreRun {
  81. doLast {
  82. for (String s : new String[]{"Client", "Server"}) {
  83. ant.replace(
  84. file: project.rootDir.toString() + "/.idea/runConfigurations/Forge_run" + s + ".xml",
  85. // prepareRunX is prepareRuns + compile, but compiling is already handled by IntelliJ
  86. // Also (specific to FC), compiling doesn't properly see the googleimpl source set and breaks
  87. token: "prepareRun" + s,
  88. value: "prepareRuns"
  89. )
  90. }
  91. }
  92. }
  93. tasks.withType(Task) {
  94. if (it.name == "genIntellijRuns") {
  95. it.finalizedBy speedUpPreRun
  96. }
  97. }
  98. // For some reason this doesn't work when in the "convention" scripts...
  99. def customGradle = project.file('custom.gradle');
  100. if (customGradle.exists()) {
  101. apply from: customGradle;
  102. }