mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-19 18:49:46 +00:00
254 lines
6.9 KiB
Groovy
254 lines
6.9 KiB
Groovy
// Gradle repositories and dependencies
|
|
buildscript {
|
|
repositories {
|
|
jcenter()
|
|
}
|
|
dependencies {
|
|
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0'
|
|
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.0'
|
|
}
|
|
}
|
|
|
|
// Apply plugin
|
|
apply plugin: 'java'
|
|
apply plugin: 'license'
|
|
apply plugin: 'checkstyle'
|
|
apply plugin: 'maven'
|
|
apply plugin: 'eclipse'
|
|
apply plugin: 'idea'
|
|
apply plugin: 'com.github.johnrengelman.shadow'
|
|
|
|
// Default tasks
|
|
defaultTasks 'licenseFormat', 'check', 'build'
|
|
|
|
// Basic project information
|
|
group = 'org.spongepowered'
|
|
archivesBaseName = 'mixin'
|
|
version = '0.3.4-SNAPSHOT'
|
|
|
|
// Extended project information
|
|
ext.projectName = 'Mixin'
|
|
ext.inceptionYear = '2014'
|
|
ext.packaging = 'jar'
|
|
ext.url = 'http://spongepowered.org'
|
|
ext.description = 'Mixin'
|
|
ext.organization = 'SpongePowered'
|
|
|
|
// Define variables
|
|
ext.buildNumber = project.hasProperty("buildNumber") ? buildNumber : '0'
|
|
ext.ciSystem = project.hasProperty("ciSystem") ? ciSystem : 'unknown'
|
|
ext.commit = project.hasProperty("commit") ? commit : 'unknown'
|
|
|
|
// Minimum version of Java required
|
|
sourceCompatibility = '1.6'
|
|
targetCompatibility = '1.6'
|
|
|
|
// Project repositories
|
|
repositories {
|
|
mavenCentral()
|
|
maven {
|
|
// for srg2source
|
|
name = "forge"
|
|
url = "http://files.minecraftforge.net/maven"
|
|
}
|
|
maven {
|
|
// because Srg2Source needs an eclipse dependency.
|
|
name = "eclipse"
|
|
url = "https://repo.eclipse.org/content/groups/eclipse/"
|
|
}
|
|
maven {
|
|
name = 'minecraft'
|
|
url = 'https://libraries.minecraft.net/'
|
|
}
|
|
}
|
|
|
|
configurations {
|
|
deployerJars // maven stuff
|
|
}
|
|
|
|
configurations.all {
|
|
// Force use of Guava 17.0 so that srg2source doesn't evict it
|
|
resolutionStrategy {
|
|
force 'com.google.guava:guava:17.0'
|
|
}
|
|
}
|
|
|
|
// Include annotation processor sourceSet
|
|
sourceSets {
|
|
ap {
|
|
compileClasspath += main.output
|
|
}
|
|
}
|
|
|
|
// Project dependencies
|
|
dependencies {
|
|
compile 'org.slf4j:slf4j-api:1.7.7'
|
|
compile 'com.google.guava:guava:17.0'
|
|
compile 'org.ow2.asm:asm-debug-all:5.0.3'
|
|
compile 'net.minecraft:launchwrapper:1.11'
|
|
compile 'com.google.code.gson:gson:2.2.4'
|
|
compile 'commons-io:commons-io:2.4'
|
|
compile 'commons-codec:commons-codec:1.9'
|
|
testCompile 'junit:junit:4.11'
|
|
testCompile 'org.hamcrest:hamcrest-library:1.3'
|
|
testCompile 'org.mockito:mockito-core:1.9.0'
|
|
|
|
// maven
|
|
deployerJars 'org.apache.maven.wagon:wagon-ftp:2.7'
|
|
|
|
// for annotation processor
|
|
compile 'net.minecraftforge.srg2source:Srg2Source:3.2-SNAPSHOT'
|
|
apCompile 'net.minecraftforge.srg2source:Srg2Source:3.2-SNAPSHOT'
|
|
}
|
|
|
|
// Filter, process, and include resources
|
|
processResources {
|
|
// Include in final JAR
|
|
from 'LICENSE.txt'
|
|
}
|
|
|
|
// License header formatting
|
|
license {
|
|
ext.name = project.name
|
|
ext.organization = project.organization
|
|
ext.url = project.url
|
|
ext.year = project.inceptionYear
|
|
exclude "**/*.info"
|
|
exclude "**/*.Processor"
|
|
exclude "assets/**"
|
|
header file("HEADER.txt")
|
|
sourceSets = project.sourceSets
|
|
ignoreFailures false
|
|
strictCheck true
|
|
mapping {
|
|
java = 'SLASHSTAR_STYLE'
|
|
}
|
|
}
|
|
|
|
checkstyle {
|
|
configProperties = [
|
|
"name" : project.name,
|
|
"organization": project.organization,
|
|
"url" : project.url,
|
|
"year" : project.inceptionYear
|
|
]
|
|
configFile = file("checkstyle.xml")
|
|
}
|
|
|
|
// Source compiler configuration
|
|
tasks.withType(JavaCompile) {
|
|
options.compilerArgs += ['-Xlint:all', '-Xlint:-path']
|
|
options.deprecation = true
|
|
options.encoding = 'utf8'
|
|
}
|
|
|
|
if (JavaVersion.current().isJava8Compatible()) {
|
|
tasks.withType(Javadoc) {
|
|
// disable the crazy super-strict doclint tool in Java 8
|
|
options.addStringOption('Xdoclint:none', '-quiet')
|
|
}
|
|
}
|
|
|
|
jar {
|
|
// Include annotation processor
|
|
from sourceSets.ap.output
|
|
|
|
// JAR manifest configuration
|
|
manifest.mainAttributes(
|
|
"Built-By": System.properties['user.name'],
|
|
"Created-By": System.properties['java.vm.version'] + " (" + System.properties['java.vm.vendor'] + ")",
|
|
"Implementation-Title": name,
|
|
"Implementation-Version": version + "+" + ciSystem + "-b" + buildNumber + ".git-" + commit,
|
|
"Implementation-Vendor": url)
|
|
}
|
|
|
|
// generate shadow jar so we can use the AP standalone
|
|
shadowJar {
|
|
from sourceSets.ap.output
|
|
exclude 'META-INF/*.DSA'
|
|
exclude 'META-INF/*.RSA'
|
|
dependencies {
|
|
include(dependency('com.google.guava:guava'))
|
|
include(dependency('com.google.code.gson:gson'))
|
|
include(dependency('commons-io:commons-io'))
|
|
include(dependency('net.minecraftforge.srg2source:Srg2Source'))
|
|
include(dependency('net.sf.jopt-simple:jopt-simple'))
|
|
include(dependency('org.ow2.asm:asm-debug-all'))
|
|
}
|
|
classifier = 'processor'
|
|
}
|
|
build.dependsOn(shadowJar)
|
|
|
|
// Run this task instead of build to generate a timestamped shadow jar (for dev)
|
|
task timestamp(type: Jar, dependsOn: build) {
|
|
if (gradle.startParameter.taskNames.contains(name)) {
|
|
shadowJar.classifier = new Date().format('yyyyMMddHHmmss')
|
|
}
|
|
}
|
|
|
|
task sourceJar(type: Jar) {
|
|
from sourceSets.main.java
|
|
from sourceSets.main.resources
|
|
from sourceSets.ap.java
|
|
from sourceSets.ap.resources
|
|
classifier = "sources"
|
|
}
|
|
|
|
task javadocJar(type: Jar, dependsOn: javadoc) {
|
|
from javadoc.destinationDir
|
|
classifier = "javadoc"
|
|
}
|
|
|
|
artifacts {
|
|
archives jar
|
|
archives sourceJar
|
|
archives javadocJar
|
|
}
|
|
|
|
uploadArchives {
|
|
repositories {
|
|
|
|
mavenDeployer {
|
|
configuration = configurations.deployerJars
|
|
|
|
if (project.hasProperty("chRepo"))
|
|
{
|
|
repository(url: project.chRepo) {
|
|
authentication(userName: project.chUsername, password: project.chPassword)
|
|
}
|
|
}
|
|
|
|
pom {
|
|
groupId = project.group
|
|
version = project.version
|
|
artifactId = project.archivesBaseName
|
|
project {
|
|
name project.archivesBaseName
|
|
packaging 'jar'
|
|
description 'Sponge API'
|
|
url 'http://www.spongepowered.org/'
|
|
|
|
scm {
|
|
url 'https://github.com/SpongePowered/Mixin'
|
|
connection 'scm:git:git://github.com/SpongePowered/Mixin.git'
|
|
developerConnection 'scm:git:[email protected]:SpongePowered/Mixin.git'
|
|
}
|
|
|
|
issueManagement {
|
|
system 'GitHub Issues'
|
|
url 'https://github.com/SpongePowered/Mixin/issues'
|
|
}
|
|
|
|
licenses {
|
|
license {
|
|
name 'MIT license'
|
|
url 'http://opensource.org/licenses/MIT'
|
|
distribution 'repo'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|