Advertisement
akSource

build.gradle file(マルチプロジェクト用)

Jul 15th, 2014
532
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Groovy 3.77 KB | None | 0 0
  1. buildscript {
  2.     repositories {
  3.         mavenCentral()
  4.         //mavenLocal()
  5.         maven {
  6.             name = "forge"
  7.             url = "http://files.minecraftforge.net/maven"
  8.         }
  9.         maven {
  10.             name = "sonatype"
  11.             url = "https://oss.sonatype.org/content/repositories/snapshots/"
  12.         }
  13.     }
  14.     dependencies {
  15.         classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
  16.     }
  17. }
  18. //マルチプロジェクト用。あまり気にしない。
  19. allprojects {
  20.     apply plugin: 'forge'
  21.     //mavenリポジトリにデプロイするなら、必要。
  22.     //apply plugin: 'maven'
  23.  
  24.     //gradleのJavaのバージョン指定。ComplieJavaの指定のほうが重要な気がしなくもない。
  25.     sourceCompatibility = '1.7' // -source
  26.     targetCompatibility = '1.7' // -target
  27.  
  28.     sourceSets {
  29.         main {
  30.             output.resourcesDir = output.classesDir
  31.         }
  32.     }
  33.  
  34.     minecraft {
  35.         version = "1.7.10-10.13.4.1564-1.7.10"
  36.         runDir = "eclipse"
  37.  
  38.         //ソースファイル内の、該当文字列をビルド前に置き換える。mcmod.infoは別なので注意。
  39.         replace '@VERSION@', project.version
  40.         replace '@MC_VERSION@', version
  41.     }
  42.  
  43.     version = "1.0.0"
  44.  
  45.     archivesBaseName = project.projectDir.name
  46.     //コンパイル時の文字コード指定とJavaのバージョン指定。
  47.   //[compileJava, compileTestJava,compileApiJava,recompMinecraft, makeStart].each{
  48.         //it.options.encoding = 'UTF-8'
  49.         //it.options.compilerArgs += ['-source', '1.7', '-target', '1.7']
  50.     //}
  51.     //上と同じ。記述法が違うだけ。
  52.     compileJava {
  53.         options.encoding = 'UTF-8'
  54.         options.compilerArgs += ['-source', '1.7', '-target', '1.7']
  55.     }
  56.     //ビルドしたjarを共通のフォルダに打ち込む。マルチプロジェクト故致し方なし。
  57.      task  copyBuiltJar(type:Copy, dependsOn:build) {
  58.         from('build/libs')
  59.         into('../Build-Mods')
  60.     }
  61.     //Copyするだけ。ビルドしない。
  62.     task copyAllJar(type:Copy) {
  63.         from('build/libs')
  64.         into('../Build-Mods')
  65.     }
  66.     //ソースを出力。1.8では標準で出力される。
  67.     task sourceJar(type: Jar) {
  68.         from sourceSets.main.allSource
  69.         classifier = 'sources'
  70.     }
  71.     //開発用jar出力。
  72.     task deobfJar(type: Jar) {
  73.         from sourceSets.main.output
  74.         classifier = 'dev'
  75.     }
  76.  
  77. }
  78.  
  79. //jarのマニフェストに記述を追加する場合。
  80. //jar {
  81.    // manifest {
  82.        // attributes 'FMLCorePlugin' : 'ak.sampleMod.asm.SampleCorePlugin','FMLCorePluginContainsFMLMod':'ak.sampleMod.SampleMod'
  83.     //}
  84. //}
  85. //依存指定。
  86. dependencies {
  87.     //compile fileTree(dir: 'Libraries', include: 'CodeChickenCore*.jar')
  88.     //compile fileTree(dir: 'Libraries', include: 'NotEnoughItems*.jar')
  89.     //compile project(':StorageBox'), files('lib/InventoryTweaks-api-1.57-116.jar')
  90.     //compile "codechicken:CodeChickenLib:1.7.10-1.1.1.106:dev"
  91.     compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
  92.     //compile 'net.industrial-craft:industrialcraft-2:2.1.470-experimental:api'
  93.     //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
  94.    
  95.         // you may put jars on which you depend on in ./libs
  96.     // or you may define them like so..
  97.     //compile "some.group:artifact:version:classifier"
  98.     //compile "some.group:artifact:version"
  99.      
  100.     // real examples
  101.     //compile 'com.mod-buildcraft:buildcraft:6.0.8:dev'  // adds buildcraft to the dev env
  102.  
  103.  
  104.     // for more info...
  105.     // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
  106.     // http://www.gradle.org/docs/current/userguide/dependency_management.html
  107. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement