Skip to content

Instantly share code, notes, and snippets.

@aksource
Created May 5, 2017 04:11
Show Gist options
  • Save aksource/0f3dcae81b501904b68aab1e0673b0bd to your computer and use it in GitHub Desktop.
Save aksource/0f3dcae81b501904b68aab1e0673b0bd to your computer and use it in GitHub Desktop.
1.7.10のマルチプロジェクト用親プロジェクトのbuild.gradle
buildscript {
repositories {
mavenCentral()
//mavenLocal()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT'
}
}
//マルチプロジェクト用。あまり気にしない。
allprojects {
apply plugin: 'forge'
//mavenリポジトリにデプロイするなら、必要。
//apply plugin: 'maven'
//gradleのJavaのバージョン指定。ComplieJavaの指定のほうが重要な気がしなくもない。
sourceCompatibility = '1.7' // -source
targetCompatibility = '1.7' // -target
sourceSets {
main {
output.resourcesDir = output.classesDir
}
}
minecraft {
version = "1.7.10-10.13.4.1614-1.7.10"
runDir = "eclipse"
//ソースファイル内の、該当文字列をビルド前に置き換える。mcmod.infoは別なので注意。
replace '@VERSION@', project.version
replace '@MC_VERSION@', version
}
version = "1.0.0"
archivesBaseName = project.projectDir.name
//コンパイル時の文字コード指定とJavaのバージョン指定。
//[compileJava, compileTestJava,compileApiJava,recompMinecraft, makeStart].each{
//it.options.encoding = 'UTF-8'
//it.options.compilerArgs += ['-source', '1.7', '-target', '1.7']
//}
compileJava {
options.encoding = 'UTF-8'
options.compilerArgs += ['-source', '1.7', '-target', '1.7']
}
//ビルドしたjarを共通のフォルダに打ち込む。マルチプロジェクト故致し方なし。
task copyBuiltJar(type:Copy, dependsOn:build) {
from('build/libs')
into('../Build-Mods')
}
//Copyするだけ。ビルドしない。
task copyAllJar(type:Copy) {
from('build/libs')
into('../Build-Mods')
}
//ソースを出力。1.8では標準で出力される。
task sourceJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
//開発用jar出力。
task deobfJar(type: Jar) {
from sourceSets.main.output
classifier = 'dev'
}
}
//jarのマニフェストに記述を追加する場合。
//jar {
// manifest {
// attributes 'FMLCorePlugin' : 'ak.sampleMod.asm.SampleCorePlugin','FMLCorePluginContainsFMLMod':'ak.sampleMod.SampleMod'
//}
//}
//依存指定。
dependencies {
//compile fileTree(dir: 'Libraries', include: 'CodeChickenCore*.jar')
//compile fileTree(dir: 'Libraries', include: 'NotEnoughItems*.jar')
//compile project(':StorageBox'), files('lib/InventoryTweaks-api-1.57-116.jar')
//compile "codechicken:CodeChickenLib:1.7.10-1.1.1.106:dev"
compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env
//compile 'net.industrial-craft:industrialcraft-2:2.1.470-experimental:api'
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev'
// you may put jars on which you depend on in ./libs
// or you may define them like so..
//compile "some.group:artifact:version:classifier"
//compile "some.group:artifact:version"
// real examples
//compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env
// for more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment