Skip to content

Instantly share code, notes, and snippets.

@AbrarSyed
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AbrarSyed/8e02f80cb6d0b5b09c93 to your computer and use it in GitHub Desktop.
Save AbrarSyed/8e02f80cb6d0b5b09c93 to your computer and use it in GitHub Desktop.
A Starter build.gradle for people to use for Modjam
buildscript {
repositories {
mavenCentral()
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'
}
}
apply plugin: 'forge'
version = "Modjam5Edition"
group= "com.yourname.modid" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "modjam5_modid"
sourceCompatibility = 1.6
targetCompatibility = 1.6
minecraft {
version = "1.7.2-10.12.1.1082" // or some version
assetsDir = "run/assets" // or any place
}
configurations {
packed
compile.extendsFrom packed
}
dependencies {
// 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
//compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml 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
// all hail annotations, becuase you can and its free
//compile 'org.projectlombok:lombok:1.12.6'
//compile 'com.google.gag:gag:1.0.1'
// example of a dependency to be packed into the output jar
//packed 'com.github.jponge:lzma-java:1.3' // lzma
}
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'
}
}
jar {
// copy in dependencies
configurations.packed.each { dep ->
from(project.zipTree(dep)){
exclude 'META-INF', 'META-INF/**'
}
}
}
// because the normal output has been made to be obfuscated
task deobfJar(type: Jar) {
from sourceSets.main.output
classifier = 'dev'
}
// add a source jar
task sourceJar(type: Jar, dependsOn: "sourceMainJava") {
from "build/sources/java"
classifier = 'sources'
}
// add a javadoc jar
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from 'build/docs/javadoc'
}
artifacts {
archives sourceJar
archives deobfJar
archives javadocJar
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment