build.gradle 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. buildscript {
  2. repositories {
  3. maven { url = 'https://files.minecraftforge.net/maven' }
  4. maven { url 'https://plugins.gradle.org/m2/' }
  5. jcenter()
  6. mavenCentral()
  7. }
  8. dependencies {
  9. classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
  10. classpath 'gradle.plugin.com.matthewprenger:CurseGradle:1.4.0'
  11. }
  12. }
  13. apply plugin: 'net.minecraftforge.gradle'
  14. apply plugin: 'com.matthewprenger.cursegradle'
  15. version = "${mod_version}"
  16. group = "${mod_group}"
  17. archivesBaseName = "${mod_id}-forge"
  18. sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
  19. minecraft {
  20. mappings channel: 'snapshot', version: "${version_mcp}".toString()
  21. runs {
  22. client {
  23. workingDirectory project.file('run')
  24. property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
  25. property 'forge.logging.console.level', 'debug'
  26. mods {
  27. customfov {
  28. source sourceSets.main
  29. }
  30. }
  31. }
  32. server {
  33. workingDirectory project.file('run')
  34. property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
  35. property 'forge.logging.console.level', 'debug'
  36. mods {
  37. customfov {
  38. source sourceSets.main
  39. }
  40. }
  41. }
  42. }
  43. }
  44. dependencies {
  45. minecraft "net.minecraftforge:forge:${version_forge}"
  46. }
  47. sourceSets {
  48. main {
  49. resources {
  50. srcDirs += 'docs'
  51. }
  52. }
  53. }
  54. jar {
  55. manifest {
  56. attributes(["Specification-Title": "${mod_name}",
  57. "Specification-Vendor": "${mod_author}",
  58. "Specification-Version": "${getArchiveVersion()}",
  59. "Implementation-Title": "${mod_name}",
  60. "Implementation-Version": "${getArchiveVersion()}",
  61. "Implementation-Vendor" :"${mod_author}",
  62. "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")],)
  63. }
  64. }
  65. task sourcesJar(type: Jar) {
  66. archiveClassifier.set('sources')
  67. from sourceSets.main.allJava
  68. }
  69. tasks.build.dependsOn sourcesJar
  70. processResources {
  71. from(sourceSets.main.resources.srcDirs) {
  72. include 'META-INF/mods.toml'
  73. expand 'version': project.version, 'mod_id' : mod_id, 'mod_name': mod_name, 'mod_url': mod_url, 'mod_author': mod_author, 'mod_description': mod_description, 'mod_icon': mod_icon
  74. }
  75. from(sourceSets.main.resources.srcDirs) {
  76. exclude 'META-INF/mods.toml'
  77. }
  78. }
  79. curseforge {
  80. project {
  81. apiKey = findProperty('curseKey') ?: 0
  82. id = "${curse_id}"
  83. releaseType = "${curse_release}"
  84. changelogType = 'markdown'
  85. changelog = file('docs/CHANGELOG.md')
  86. addArtifact(sourcesJar)
  87. }
  88. }