Skip to content

Instantly share code, notes, and snippets.

@aksource
Created May 5, 2017 05:49
Show Gist options
  • Save aksource/73e8c256f916b0e5bcc67cb6409b65a3 to your computer and use it in GitHub Desktop.
Save aksource/73e8c256f916b0e5bcc67cb6409b65a3 to your computer and use it in GitHub Desktop.
1.11.2用のbuild.gradle
buildscript {
repositories {
jcenter()
maven { url = "http://files.minecraftforge.net/maven" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
}
}
//plugins {
// id "net.minecraftforge.gradle.forge" version "2.0.2"
//}
//マルチプロジェクト用。あまり気にしない。
allprojects {
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'maven'
sourceCompatibility = "1.8" // -source
targetCompatibility = "1.8" // -target
// sourceSets {
// main {
// output.resourcesDir = output.classesDir
// }
// }
minecraft {
version = "1.11.2-13.20.0.2282"
// the mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD snapshot are built nightly.
// stable_# stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not allways work.
// simply re-run your setup task after changing the mappings to update your workspace.
mappings = "snapshot_20170105"
//assetDir = "eclipse/assets"
runDir = "run"
//makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
// replacing stuff in the source
replace '@VERSION@', project.version
replace '@MC_VERSION@', version
}
//コンパイル時の文字コード指定とJavaのバージョン指定。
// [compileJava, compileTestJava].each {
// it.options.encoding = 'UTF-8'
// it.options.compilerArgs += ['-source', '1.7', '-target', '1.7']
// }
// tasks.withType(JavaCompile) {
// options.encoding = 'UTF-8'
// options.compilerArgs += ['-source', '1.7', '-target', '1.7']
// }
compileJava {
options.encoding = 'UTF-8'
options.compilerArgs += ['-source', '1.8', '-target', '1.8']
sourceCompatibility = targetCompatibility = "1.8"
}
//ビルドしたjarを共通のフォルダに打ち込む。マルチプロジェクト故致し方なし。
task copyBuiltJar(type: Copy, dependsOn: build) {
from('build/libs')
into('../Build-Mods')
}
// task copyAllJar(type: Copy) {
// from('build/libs')
// into('../Build-Mods')
// }
//
// task sourceJar(type: Jar) {
// from sourceSets.main.allSource
// classifier = 'sources'
// }
//
task deobfJar(type: Jar) {
from sourceSets.main.output
classifier = 'dev'
}
// jar {
// exclude '**/Thumbs.db'
// }
}
version = "1.0.0"
group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = project.projectDir.name
//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
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment