| // Tasks to perform when no task is specified |
| defaultTasks 'clean', 'build', 'shadowJar' |
| |
| // Plugins used |
| apply plugin: 'java' // Specifies a java project, allows for javadoc generation etc. |
| apply plugin: 'application' // Adds the 'gradle run' task |
| apply plugin: 'project-report' // Adds project report tasks |
| apply plugin: 'shadow' // Allows for dependency shading |
| |
| // Method allowing us to run git describe |
| def getVersionName = { -> |
| def stdout = new ByteArrayOutputStream() |
| exec { |
| commandLine 'git', 'describe' |
| standardOutput = stdout |
| } |
| return stdout.toString().trim() |
| } |
| |
| // Basic project information |
| group = 'net.glowstone' |
| version = '0.0.1-SNAPSHOT' |
| description = "Glowstone" |
| mainClassName = "net.glowstone.GlowServer" |
| |
| // Extended project information |
| ext.url = 'https://github.com/SpaceManiac/Glowstone' |
| ext.bukkitVersion = '1.7.2-R0.2' |
| ext.gitDescribe = "git-Glowstone-" + getVersionName() |
| |
| // Minimum Java version required |
| sourceCompatibility = '1.6' |
| targetCompatibility = '1.6' |
| |
| // Compile encoding |
| compileJava { |
| options.encoding = 'UTF-8' |
| } |
| |
| // Simple build script information |
| buildscript { |
| repositories { |
| maven { url "http://jcenter.bintray.com" } |
| } |
| dependencies { |
| classpath 'com.github.jengelman.gradle.plugins:shadow:0.8' |
| } |
| } |
| |
| // Repositories storing our dependencies |
| repositories { |
| mavenLocal() |
| mavenCentral() |
| maven { url "http://repo.bukkit.org/content/groups/public/" } |
| maven { url "https://repository.jboss.org/nexus/content/groups/public/" } |
| } |
| |
| // Dependencies used by our project |
| dependencies { |
| compile 'com.grahamedgecombe.jterminal:jterminal:1.0.1' |
| compile 'jline:jline:0.9.94' |
| compile 'mysql:mysql-connector-java:5.1.14' |
| compile 'net.sf.trove4j:trove4j:3.0.1' |
| compile group: 'org.bukkit', name: 'bukkit', version: ext.bukkitVersion |
| compile 'org.jboss.netty:netty:3.2.4.Final' |
| compile 'org.xerial:sqlite-jdbc:3.7.2' |
| testCompile 'junit:junit:4.8.1' |
| } |
| |
| // Shadow plugin settings |
| shadow { |
| artifactAttached = false |
| } |
| |
| // Jar manifest information |
| manifest.mainAttributes( |
| 'Main-Class': mainClassName, |
| 'Implementation-Title': description, |
| 'Implementation-Version': ext.gitDescribe, |
| 'Implementation-Vendor': 'SpaceManiac', |
| 'Specification-Title': 'Bukkit', |
| 'Specification-Version': ext.bukkitVersion, |
| 'Specification-Vendor': 'Bukkit Team', |
| 'Sealed': true |
| ) |