build.gradle 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. buildscript {
  2. repositories {
  3. jcenter()
  4. maven { url = "http://files.minecraftforge.net/maven" }
  5. }
  6. dependencies {
  7. classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
  8. }
  9. }
  10. apply plugin: 'net.minecraftforge.gradle.forge'
  11. //Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
  12. version = "${version_minecraft}-${version_mod}"
  13. group = "${mod_group}.${mod_id}" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
  14. archivesBaseName = "${mod_id}"
  15. sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
  16. compileJava {
  17. sourceCompatibility = targetCompatibility = '1.8'
  18. }
  19. minecraft {
  20. version = "${version_minecraft}-${version_forge}"
  21. runDir = "run"
  22. // the mappings can be changed at any time, and must be in the following format.
  23. // snapshot_YYYYMMDD snapshot are built nightly.
  24. // stable_# stables are built at the discretion of the MCP team.
  25. // Use non-default mappings at your own risk. they may not always work.
  26. // simply re-run your setup task after changing the mappings to update your workspace.
  27. mappings = "${version_mcp}"
  28. // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
  29. replace '@VERSION@', project.version
  30. replace '@FINGERPRINT@', project.findProperty('signSHA1')
  31. replaceIn "${mod_class}.java"
  32. }
  33. dependencies {
  34. // you may put jars on which you depend on in ./libs
  35. // or you may define them like so..
  36. //compile "some.group:artifact:version:classifier"
  37. //compile "some.group:artifact:version"
  38. // real examples
  39. //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
  40. //compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
  41. // the 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime.
  42. //provided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
  43. // the deobf configurations: 'deobfCompile' and 'deobfProvided' are the same as the normal compile and provided,
  44. // except that these dependencies get remapped to your current MCP mappings
  45. //deobfCompile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
  46. //deobfProvided 'com.mod-buildcraft:buildcraft:6.0.8:dev'
  47. // for more info...
  48. // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
  49. // http://www.gradle.org/docs/current/userguide/dependency_management.html
  50. }
  51. sourceSets {
  52. main {
  53. resources {
  54. srcDirs += 'docs'
  55. }
  56. }
  57. }
  58. processResources {
  59. // this will ensure that this task is redone when the versions change.
  60. inputs.property "version", project.version
  61. inputs.property "mcversion", project.minecraft.version
  62. // replace stuff in mcmod.info, nothing else
  63. from(sourceSets.main.resources.srcDirs) {
  64. include 'mcmod.info'
  65. // replace version and mcversion
  66. expand 'version':project.version, 'mcversion':project.minecraft.version
  67. }
  68. // copy everything else except the mcmod.info
  69. from(sourceSets.main.resources.srcDirs) {
  70. exclude 'mcmod.info'
  71. }
  72. }
  73. task signJar(type: SignJar, dependsOn: reobfJar) {
  74. // Skips if the keyStore property is missing.
  75. onlyIf {
  76. project.hasProperty('keyStore')
  77. }
  78. // findProperty allows us to reference the property without it existing.
  79. // Using project.propName would cause the script to fail validation if
  80. // the property did not exist.
  81. keyStore = project.findProperty('keyStore')
  82. alias = project.findProperty('keyStoreAlias')
  83. storePass = project.findProperty('keyStorePass')
  84. keyPass = project.findProperty('keyStoreKeyPass')
  85. inputFile = jar.archivePath
  86. outputFile = jar.archivePath
  87. }
  88. build.dependsOn signJar