build.gradle 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. buildscript {
  2. repositories {
  3. maven { url = 'https://files.minecraftforge.net/maven' }
  4. maven { url = 'https://maven.blamejared.com' }
  5. mavenCentral()
  6. }
  7. dependencies {
  8. classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
  9. classpath group: 'com.blamejared', name: 'ModTemplate', version: '1.+', changing: true
  10. }
  11. }
  12. plugins {
  13. id "com.matthewprenger.cursegradle" version "1.4.0"
  14. }
  15. apply plugin: 'net.minecraftforge.gradle'
  16. apply plugin: 'com.blamejared.modtemplate'
  17. apply plugin: 'eclipse'
  18. apply plugin: 'maven-publish'
  19. version = '7.0.0'
  20. group = 'com.blamejared.controlling'
  21. archivesBaseName = 'Controlling'
  22. sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'
  23. minecraft {
  24. mappings channel: 'snapshot', version: '20201028-1.16.3'
  25. accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
  26. runs {
  27. client {
  28. workingDirectory project.file('run')
  29. taskName 'ControllingClient'
  30. mods {
  31. examplemod {
  32. source sourceSets.main
  33. }
  34. }
  35. }
  36. server {
  37. workingDirectory project.file('run')
  38. taskName 'ControllingServer'
  39. mods {
  40. examplemod {
  41. source sourceSets.main
  42. }
  43. }
  44. }
  45. }
  46. }
  47. modTemplate {
  48. mcVersion "1.16.5"
  49. curseHomepage "https://www.curseforge.com/minecraft/mc-mods/controlling"
  50. displayName "Controlling"
  51. changelog {
  52. enabled true
  53. firstCommit "efff217f353e51ce43751caf94b1924818b710e8"
  54. repo "https://github.com/jaredlll08/Controlling"
  55. }
  56. versionTracker {
  57. enabled true
  58. author "Jared"
  59. projectName "controlling"
  60. }
  61. webhook {
  62. enabled true
  63. curseId "250398"
  64. avatarUrl "https://media.forgecdn.net/avatars/49/603/636079972364045115.png"
  65. }
  66. }
  67. dependencies {
  68. minecraft 'net.minecraftforge:forge:1.16.5-36.0.0'
  69. }
  70. jar {
  71. manifest {
  72. attributes([
  73. "Specification-Title" : "controlling",
  74. "Specification-Vendor" : "BlameJared",
  75. "Specification-Version" : "1",
  76. "Implementation-Title" : project.name,
  77. "Implementation-Version" : "${version}",
  78. "Implementation-Vendor" : "controlling",
  79. "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")],)
  80. }
  81. }
  82. task sourcesJar(type: Jar, dependsOn: classes) {
  83. description = 'Creates a JAR containing the source code.'
  84. from sourceSets.main.allSource
  85. classifier = 'sources'
  86. }
  87. task javadocJar(type: Jar, dependsOn: javadoc) {
  88. description = 'Creates a JAR containing the JavaDocs.'
  89. from javadoc.destinationDir
  90. classifier = 'javadoc'
  91. }
  92. task deobfJar(type: Jar) {
  93. description = 'Creates a JAR containing the non-obfuscated compiled code.'
  94. from sourceSets.main.output
  95. classifier = "deobf"
  96. }
  97. artifacts {
  98. archives sourcesJar
  99. archives javadocJar
  100. archives deobfJar
  101. }
  102. publish.dependsOn(project.tasks.getByName("assemble"))
  103. publish.mustRunAfter(project.tasks.getByName("build"))
  104. publishing {
  105. publications {
  106. mavenJava(MavenPublication) {
  107. groupId project.group
  108. artifactId project.archivesBaseName
  109. version project.version
  110. from components.java
  111. // Allows the maven pom file to be modified.
  112. pom.withXml {
  113. // Go through all the dependencies.
  114. asNode().dependencies.dependency.each { dep ->
  115. println 'Surpressing artifact ' + dep.artifactId.last().value().last() + ' from maven dependencies.'
  116. assert dep.parent().remove(dep)
  117. }
  118. }
  119. artifact sourcesJar {
  120. classifier 'sources'
  121. }
  122. artifact javadocJar {
  123. classifier 'javadoc'
  124. }
  125. artifact deobfJar {
  126. classifier 'deobf'
  127. }
  128. }
  129. }
  130. repositories {
  131. maven {
  132. url "file://" + System.getenv("local_maven")
  133. }
  134. }
  135. }
  136. curseforge {
  137. apiKey = findProperty('curseforge_api_token') ?: 0
  138. project {
  139. id = "250398"
  140. releaseType = 'release'
  141. changelog = file("changelog.md")
  142. changelogType = 'markdown'
  143. // addArtifact(sourcesJar)
  144. // addArtifact(javadocJar)
  145. addArtifact(deobfJar)
  146. }
  147. }