2015-04-10 00:17:30 +02:00
|
|
|
buildscript {
|
2017-04-14 21:35:09 +02:00
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
2017-02-13 11:34:36 +01:00
|
|
|
maven {
|
2017-04-14 21:35:09 +02:00
|
|
|
name = "forge"
|
|
|
|
url = "http://files.minecraftforge.net/maven"
|
|
|
|
}
|
2017-02-23 13:29:43 +01:00
|
|
|
maven {
|
2017-04-14 21:35:09 +02:00
|
|
|
name = "sonatype"
|
|
|
|
url = "https://oss.sonatype.org/content/repositories/snapshots/"
|
|
|
|
}
|
|
|
|
maven {
|
|
|
|
url "https://plugins.gradle.org/m2/"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
dependencies {
|
2017-06-11 22:22:07 +02:00
|
|
|
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
2017-04-14 21:35:09 +02:00
|
|
|
classpath "gradle.plugin.net.minecrell:licenser:0.2.1"
|
|
|
|
}
|
2015-04-10 00:17:30 +02:00
|
|
|
}
|
|
|
|
|
2015-11-23 15:37:18 +01:00
|
|
|
apply plugin: 'net.minecraftforge.gradle.forge'
|
2015-04-10 00:17:30 +02:00
|
|
|
apply plugin: 'maven'
|
|
|
|
apply plugin: 'maven-publish'
|
2017-02-23 13:29:43 +01:00
|
|
|
apply plugin: net.minecrell.gradle.licenser.Licenser
|
2015-04-10 00:17:30 +02:00
|
|
|
|
2016-02-28 18:00:27 +01:00
|
|
|
sourceCompatibility = 1.8
|
|
|
|
targetCompatibility = 1.8
|
2015-11-24 20:37:15 +01:00
|
|
|
|
2015-04-10 10:43:45 +02:00
|
|
|
|
|
|
|
repositories {
|
2017-04-14 21:35:09 +02:00
|
|
|
maven {
|
|
|
|
name = "Modmuss50"
|
|
|
|
url = "http://maven.modmuss50.me/"
|
|
|
|
}
|
|
|
|
maven {
|
2018-01-16 15:30:13 +01:00
|
|
|
// JEI, TiC
|
2017-04-14 21:35:09 +02:00
|
|
|
name "TiC"
|
|
|
|
url "http://dvs1.progwml6.com/files/maven"
|
|
|
|
}
|
|
|
|
maven {
|
|
|
|
name = "Amadornes"
|
|
|
|
url "http://maven.amadornes.com/"
|
|
|
|
}
|
2017-06-28 21:50:00 +02:00
|
|
|
maven {
|
2018-01-16 15:30:13 +01:00
|
|
|
// CraftTweaker2
|
2017-06-28 21:50:00 +02:00
|
|
|
name "Jared"
|
|
|
|
url "http://maven.blamejared.com/"
|
2017-03-14 14:16:31 +01:00
|
|
|
}
|
2017-04-14 21:35:09 +02:00
|
|
|
maven {
|
2018-01-15 09:59:20 +01:00
|
|
|
// Tesla
|
2018-02-02 10:20:49 +01:00
|
|
|
url 'https://maven.mcmoddev.com/'
|
2017-04-14 21:35:09 +02:00
|
|
|
}
|
|
|
|
maven {
|
2018-01-15 09:59:20 +01:00
|
|
|
// TheOneProbe
|
2017-04-14 21:35:09 +02:00
|
|
|
url "http://maven.tterrag.com/"
|
|
|
|
}
|
2017-06-28 10:02:48 +02:00
|
|
|
maven {
|
2018-01-16 15:30:13 +01:00
|
|
|
// IC2
|
2017-06-28 10:02:48 +02:00
|
|
|
name = "ic2"
|
|
|
|
url = "http://maven.ic2.player.to/"
|
|
|
|
}
|
2017-04-14 21:35:09 +02:00
|
|
|
maven {
|
|
|
|
// HWYLA
|
|
|
|
name "TehNut"
|
|
|
|
url "http://tehnut.info/maven/"
|
|
|
|
}
|
|
|
|
maven {
|
2017-04-11 13:16:16 +02:00
|
|
|
name 'CB Repo'
|
|
|
|
url "http://chickenbones.net/maven/"
|
|
|
|
}
|
2017-07-07 00:49:00 +02:00
|
|
|
maven {
|
2018-01-16 15:30:13 +01:00
|
|
|
// CoFH
|
2017-07-07 00:49:00 +02:00
|
|
|
name 'Covers'
|
|
|
|
url "http://maven.covers1624.net/"
|
|
|
|
}
|
2017-06-02 16:44:00 +02:00
|
|
|
ivy {
|
|
|
|
name "BuildCraft"
|
|
|
|
artifactPattern "http://www.mod-buildcraft.com/releases/BuildCraft/[revision]/[module]-[revision].[ext]"
|
|
|
|
}
|
2018-02-14 00:56:38 +01:00
|
|
|
maven {
|
|
|
|
name "OpenComputer"
|
|
|
|
url "http://maven.cil.li/"
|
|
|
|
}
|
2015-04-10 10:43:45 +02:00
|
|
|
}
|
|
|
|
|
2015-08-27 17:29:13 +02:00
|
|
|
configurations {
|
2017-04-14 21:35:09 +02:00
|
|
|
shade
|
|
|
|
compile.extendsFrom shade
|
2015-08-27 17:29:13 +02:00
|
|
|
}
|
|
|
|
|
2018-02-13 00:11:03 +01:00
|
|
|
version = "2.12.3"
|
2015-12-30 18:23:45 +01:00
|
|
|
|
2015-04-10 00:17:30 +02:00
|
|
|
def ENV = System.getenv()
|
|
|
|
if (ENV.BUILD_NUMBER) {
|
2017-04-14 21:35:09 +02:00
|
|
|
version = version + "." + "${System.getenv().BUILD_NUMBER}"
|
2015-04-10 00:17:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
minecraft {
|
2018-02-10 12:53:11 +01:00
|
|
|
version = "1.12.2-14.23.2.2613"
|
2017-11-28 18:25:36 +01:00
|
|
|
mappings = "snapshot_20171003"
|
2017-04-14 21:35:09 +02:00
|
|
|
replace "@MODVERSION@", project.version
|
|
|
|
useDepAts = true
|
|
|
|
runDir = "run"
|
2015-04-10 00:17:30 +02:00
|
|
|
}
|
|
|
|
|
2017-02-23 13:29:43 +01:00
|
|
|
license {
|
2017-04-14 21:35:09 +02:00
|
|
|
header file('HEADER')
|
|
|
|
include '**/*.java'
|
|
|
|
ignoreFailures = true //Stops the build from failing if a file does not have a license header
|
2017-02-23 13:29:43 +01:00
|
|
|
}
|
|
|
|
|
2015-04-10 00:17:30 +02:00
|
|
|
group = 'TechReborn'
|
|
|
|
|
|
|
|
dependencies {
|
2017-09-29 00:44:16 +02:00
|
|
|
//Some dep we use wants the older jei, so this ingores it. We grab the latest anyway, so it shoudnt cause any issues.
|
2018-01-16 15:30:13 +01:00
|
|
|
def withoutOldJEI = { exclude module: 'jei_1.12.2' }
|
2017-09-29 00:44:16 +02:00
|
|
|
|
2017-09-19 00:47:07 +02:00
|
|
|
deobfCompile('RebornCore:RebornCore-1.12.2:+:universal') {
|
2017-01-31 20:26:12 +01:00
|
|
|
transitive = false
|
|
|
|
}
|
2016-11-26 23:34:54 +01:00
|
|
|
compile "mcp.mobius.waila:Hwyla:+"
|
2017-12-22 14:14:00 +01:00
|
|
|
compile "net.darkhax.tesla:Tesla-1.12:1.0.61:deobf"
|
2018-01-16 15:30:13 +01:00
|
|
|
compile "CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-4.0.12.323"
|
|
|
|
compile name: 'buildcraft', version: '7.99.14', ext: 'jar'
|
|
|
|
|
|
|
|
deobfCompile "mezz.jei:jei_1.12.2:+"
|
2017-12-22 14:14:00 +01:00
|
|
|
deobfCompile "mcjty.theoneprobe:TheOneProbe-1.12:1.12-1.4.19-11"
|
2018-01-16 15:30:13 +01:00
|
|
|
deobfCompile 'net.industrial-craft:industrialcraft-2:2.8.39-ex112'
|
|
|
|
deobfCompile 'cofh:ThermalDynamics:1.12.2-2.3.9.3:universal', withoutOldJEI
|
|
|
|
deobfCompile 'cofh:ThermalExpansion:1.12.2-5.3.9.9:universal', withoutOldJEI
|
2017-12-22 14:14:00 +01:00
|
|
|
deobfCompile 'MCMultiPart2:MCMultiPart:2.4.1'
|
2018-02-14 00:56:38 +01:00
|
|
|
deobfCompile "li.cil.oc:OpenComputers:MC1.12.1-1.7.1+"
|
2015-04-10 00:17:30 +02:00
|
|
|
}
|
|
|
|
|
2015-06-24 00:41:03 +02:00
|
|
|
|
|
|
|
processResources
|
2017-04-14 21:35:09 +02:00
|
|
|
{
|
|
|
|
// 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'
|
|
|
|
}
|
2017-06-20 19:54:45 +02:00
|
|
|
|
|
|
|
// Move access transformers to META-INF
|
|
|
|
rename '(.+_at.cfg)', 'META-INF/$1'
|
2017-04-14 21:35:09 +02:00
|
|
|
}
|
2015-07-01 17:53:03 +02:00
|
|
|
|
2015-11-26 21:43:56 +01:00
|
|
|
|
2015-04-10 00:17:30 +02:00
|
|
|
task deobfJar(type: Jar) {
|
2017-04-14 21:35:09 +02:00
|
|
|
from sourceSets.main.output
|
|
|
|
exclude "**/*.psd"
|
|
|
|
classifier = 'dev'
|
2017-06-20 19:54:45 +02:00
|
|
|
manifest {
|
|
|
|
attributes 'FMLAT': 'techreborn_at.cfg'
|
|
|
|
}
|
2016-04-16 10:02:33 +02:00
|
|
|
}
|
|
|
|
|
2015-04-10 00:17:30 +02:00
|
|
|
|
|
|
|
jar {
|
2017-04-14 21:35:09 +02:00
|
|
|
exclude "**/*.psd"
|
|
|
|
classifier = 'universal'
|
|
|
|
// configurations.shade.each { dep ->
|
|
|
|
// from(project.zipTree(dep)){
|
|
|
|
// include 'ic2/api/'
|
|
|
|
// include 'forestry/api/fuels/'
|
|
|
|
// exclude 'META-INF', 'META-INF/**', '**/*.java'
|
|
|
|
// }
|
|
|
|
// }
|
2017-06-20 19:54:45 +02:00
|
|
|
manifest {
|
|
|
|
attributes 'FMLAT': 'techreborn_at.cfg'
|
|
|
|
}
|
2015-04-10 00:17:30 +02:00
|
|
|
}
|
|
|
|
|
2015-04-26 10:07:59 +02:00
|
|
|
task apiJar(type: Jar) {
|
2017-04-14 21:35:09 +02:00
|
|
|
from sourceSets.main.allSource
|
|
|
|
from sourceSets.main.output
|
|
|
|
include 'techreborn/api/**/*'
|
2015-06-22 22:32:46 +02:00
|
|
|
|
2017-04-14 21:35:09 +02:00
|
|
|
classifier = "api"
|
2015-04-12 11:36:12 +02:00
|
|
|
}
|
|
|
|
|
2015-04-26 10:07:59 +02:00
|
|
|
apiJar.mustRunAfter deobfJar
|
2015-04-12 11:36:12 +02:00
|
|
|
|
2015-04-10 00:17:30 +02:00
|
|
|
artifacts {
|
2017-04-14 21:35:09 +02:00
|
|
|
archives deobfJar
|
|
|
|
archives apiJar
|
2015-04-10 00:17:30 +02:00
|
|
|
}
|
|
|
|
|
2016-04-17 12:59:18 +02:00
|
|
|
build.dependsOn deobfJar, apiJar
|
2015-11-22 17:24:50 +01:00
|
|
|
|
2016-05-26 18:31:02 +02:00
|
|
|
|
|
|
|
|
2015-04-10 00:17:30 +02:00
|
|
|
uploadArchives {
|
2017-04-14 21:35:09 +02:00
|
|
|
repositories {
|
|
|
|
mavenDeployer {
|
|
|
|
//This is used when the build is done on a slave node
|
|
|
|
if (project.hasProperty('mavenPass')) {
|
|
|
|
println 'Uploading to remote Maven Repo'
|
|
|
|
repository(url: "http://mavenupload.modmuss50.me/") {
|
|
|
|
authentication(userName: "buildslave", password: project.getProperty('mavenPass'))
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
//this is when the build is executed on the master node
|
|
|
|
println 'Uploading to local Maven Repo'
|
|
|
|
repository(url: "file:///var/www/maven/")
|
|
|
|
}
|
|
|
|
pom {
|
|
|
|
groupId = "TechReborn"
|
|
|
|
version = project.version
|
|
|
|
artifactId = project.archivesBaseName
|
|
|
|
project {
|
|
|
|
name project.archivesBaseName
|
|
|
|
packaging 'jar'
|
|
|
|
description 'TechReborn'
|
|
|
|
url 'https://github.com/TechReborn/TechReborn'
|
|
|
|
scm {
|
|
|
|
url 'https://github.com/TechReborn/TechReborn'
|
|
|
|
connection 'scm:git:git@github.com:TechReborn/TechReborn.git'
|
|
|
|
developerConnection 'scm:git:git@github.com:TechReborn/TechReborn.git'
|
|
|
|
}
|
|
|
|
issueManagement {
|
|
|
|
system 'github'
|
|
|
|
url 'https://github.com/TechReborn/TechReborn/issues'
|
|
|
|
}
|
|
|
|
licenses {
|
|
|
|
license {
|
|
|
|
name 'License'
|
|
|
|
url 'https://raw.githubusercontent.com/TechReborn/TechReborn/master/LICENSE.md'
|
|
|
|
distribution 'repo'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
developers {
|
|
|
|
developer {
|
|
|
|
id 'modmuss50'
|
|
|
|
name 'modmuss50'
|
|
|
|
roles {role 'developer'}
|
|
|
|
}
|
|
|
|
developer {
|
|
|
|
id 'Gigabit101'
|
|
|
|
name 'Gigabit101'
|
|
|
|
roles {role 'developer'}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-04-12 11:56:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
task wrapper(type: Wrapper) {
|
2017-04-14 21:35:09 +02:00
|
|
|
//To update the wrapper change the version bellow then run: gradle wrapper
|
|
|
|
gradleVersion = '2.13'
|
2015-10-02 08:48:44 +02:00
|
|
|
}
|
2016-05-06 23:13:24 +02:00
|
|
|
|
|
|
|
//Thanks Matthew from #ForgeGradle https://gist.github.com/matthewprenger/108265e3efc83181bd2cc2d2fc31a853
|
|
|
|
task updateMappings(dependsOn: sourceJar) {
|
|
|
|
|
2017-04-14 21:35:09 +02:00
|
|
|
def remapped = file('src_remapped/main/java')
|
|
|
|
def methods = file('methods.csv')
|
|
|
|
def fields = file('fields.csv')
|
|
|
|
|
|
|
|
doLast {
|
|
|
|
|
|
|
|
Map<String, String> map = new HashMap<>()
|
|
|
|
methods.eachLine {line ->
|
|
|
|
String[] pts = line.split(",")
|
|
|
|
map.put(pts[0], pts[1])
|
|
|
|
}
|
|
|
|
fields.eachLine {line ->
|
|
|
|
String[] pts = line.split(",")
|
|
|
|
map.put(pts[0], pts[1])
|
|
|
|
}
|
|
|
|
|
|
|
|
copy {
|
|
|
|
from zipTree(sourceJar.archivePath)
|
|
|
|
into remapped
|
|
|
|
include '**/*.java'
|
|
|
|
|
|
|
|
filter {javaLine ->
|
|
|
|
map.entrySet().each {entry ->
|
|
|
|
javaLine = javaLine.replace(entry.getKey(), entry.getValue())
|
|
|
|
}
|
|
|
|
return javaLine
|
|
|
|
}
|
|
|
|
|
|
|
|
includeEmptyDirs = false
|
|
|
|
eachFile {println "Processing: $it.name"}
|
|
|
|
}
|
|
|
|
}
|
2016-05-06 23:13:24 +02:00
|
|
|
}
|
2016-11-04 21:03:05 +01:00
|
|
|
|
2017-04-13 11:11:10 +02:00
|
|
|
|
|
|
|
task signJar(type: SignJar, dependsOn: reobfJar) {
|
|
|
|
onlyIf {
|
|
|
|
project.hasProperty('keyStore')
|
|
|
|
}
|
|
|
|
|
|
|
|
if (project.hasProperty('keyStore')) {
|
|
|
|
keyStore = project.keyStore
|
|
|
|
alias = project.keyStoreAlias
|
|
|
|
storePass = project.keyStorePass
|
|
|
|
keyPass = project.keyStoreKeyPass
|
|
|
|
inputFile = jar.archivePath
|
|
|
|
outputFile = jar.archivePath
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
build.dependsOn signJar
|
|
|
|
|
2016-11-26 20:05:10 +01:00
|
|
|
apply from: 'https://github.com/FabricMC/fabric-docs/raw/master/gradle/ideconfig.gradle'
|
|
|
|
|
2017-04-14 21:35:09 +02:00
|
|
|
import groovy.util.XmlSlurper
|
|
|
|
import org.apache.commons.io.FileUtils
|
2016-11-26 20:05:10 +01:00
|
|
|
|
2017-04-11 00:39:09 +02:00
|
|
|
task curseTools {
|
2017-04-11 01:21:30 +02:00
|
|
|
doLast {
|
2017-04-14 21:35:09 +02:00
|
|
|
def cacheFiles = new File(".gradle/curseTools")
|
|
|
|
if (!cacheFiles.exists()) {
|
|
|
|
cacheFiles.mkdirs()
|
|
|
|
}
|
2016-11-26 20:05:10 +01:00
|
|
|
|
2017-04-14 21:35:09 +02:00
|
|
|
def mavenMetadata = new File(cacheFiles, "maven-metadata.xml")
|
2016-11-26 20:05:10 +01:00
|
|
|
|
2017-04-14 21:35:09 +02:00
|
|
|
logger.lifecycle(":downloading curseTools metadata")
|
|
|
|
FileUtils.copyURLToFile(new URL("http://maven.modmuss50.me/CurseTools/CurseTools/maven-metadata.xml"), mavenMetadata)
|
2016-11-26 20:05:10 +01:00
|
|
|
|
2017-04-14 21:35:09 +02:00
|
|
|
def metadata = new XmlSlurper().parseText(FileUtils.readFileToString(mavenMetadata))
|
|
|
|
def curseToolsVersion = metadata.versioning.release
|
2016-11-26 20:05:10 +01:00
|
|
|
|
2017-04-14 21:35:09 +02:00
|
|
|
def curseTools = new File(cacheFiles, "${curseToolsVersion}.jar")
|
2016-11-26 20:05:10 +01:00
|
|
|
|
2017-04-14 21:35:09 +02:00
|
|
|
logger.lifecycle(":downloading CurseTools")
|
|
|
|
FileUtils.copyURLToFile(new URL("http://maven.modmuss50.me/CurseTools/CurseTools/${curseToolsVersion}/CurseTools-${curseToolsVersion}.jar"), curseTools)
|
2016-11-26 20:05:10 +01:00
|
|
|
|
2017-04-14 21:35:09 +02:00
|
|
|
logger.lifecycle(":launching CurseTools")
|
|
|
|
ant.java(jar: curseTools.getAbsolutePath(), fork: true, spawn: false) {
|
|
|
|
arg(value: jar.archivePath.getAbsolutePath())
|
|
|
|
arg(value: deobfJar.archivePath.getAbsolutePath())
|
|
|
|
arg(value: apiJar.archivePath.getAbsolutePath())
|
|
|
|
}
|
2017-04-11 01:21:30 +02:00
|
|
|
}
|
2017-01-15 16:14:05 +01:00
|
|
|
}
|
2018-01-29 22:14:08 +01:00
|
|
|
|
|
|
|
import com.google.gson.GsonBuilder
|
|
|
|
import com.google.gson.JsonObject
|
|
|
|
import org.apache.commons.io.IOUtils
|
|
|
|
import java.util.zip.ZipFile
|
|
|
|
|
|
|
|
//Reads the new fml_cache_annotation file built into the jar file, to find all crafttweaker methods, and saves the data to a file
|
|
|
|
task mtDocGen {
|
|
|
|
doLast{
|
|
|
|
def inputFile = new File(jar.archivePath.getAbsolutePath())
|
|
|
|
println("Reading " + inputFile.getName() + " for crafttweaker documentation")
|
|
|
|
def jarFile = new ZipFile(inputFile)
|
|
|
|
|
|
|
|
def annotation_cache = jarFile.getEntry("META-INF/fml_cache_annotation.json")
|
|
|
|
def cache_json = IOUtils.toString(jarFile.getInputStream(annotation_cache), "UTF-8")
|
|
|
|
|
|
|
|
def jsonObject = new GsonBuilder().create().fromJson(cache_json, JsonObject.class)
|
|
|
|
|
|
|
|
def builder = new StringBuilder()
|
|
|
|
|
|
|
|
for(entry in jsonObject.entrySet()){
|
|
|
|
def clzz = entry.value.asJsonObject
|
|
|
|
if(!clzz.has("annotations")){
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
def annoations = clzz.get("annotations").asJsonArray
|
|
|
|
for(annotation in annoations.toList()){
|
|
|
|
if(annotation.asJsonObject.get("type").asString.equals("METHOD") && annotation.asJsonObject.get("name").asString.equals("Lstanhebben/zenscript/annotations/ZenMethod;")){
|
|
|
|
def method = sanitsiseMethodName(annotation.asJsonObject.get("target").asString)
|
|
|
|
def zen_name = getZenMetName(clzz)
|
|
|
|
builder.append(zen_name + "." + method)
|
|
|
|
builder.append("\n")
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
def outputFile = new File(jar.archivePath.getAbsolutePath().replace(".jar", "-crafttweaker.txt"))
|
|
|
|
outputFile.write builder.toString()
|
|
|
|
|
|
|
|
println("Crafttweaker documentation saved to " + outputFile.name)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//Gets the zenMethod class name from the class json object
|
|
|
|
String getZenMetName(JsonObject jsonObject){
|
|
|
|
def annoations = jsonObject.get("annotations").asJsonArray
|
|
|
|
for(annotation in annoations.toList()){
|
|
|
|
if(annotation.asJsonObject.get("type").asString.equals("CLASS") && annotation.asJsonObject.get("name").asString.equals("Lstanhebben/zenscript/annotations/ZenClass;")){
|
|
|
|
return annotation.asJsonObject.get("value").asJsonObject.get("value").asString
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
String sanitsiseMethodName(String methodSig){
|
|
|
|
def builder = new StringBuilder()
|
|
|
|
def name = methodSig.split("\\(")[0]
|
|
|
|
builder.append(name)
|
|
|
|
builder.append("(")
|
|
|
|
|
|
|
|
def methodArgs = methodSig.split("\\(")[1].split("\\)")[0].split(";")
|
|
|
|
for(arg in methodArgs){
|
|
|
|
def argSlit = arg.split("/")
|
|
|
|
def argStr = argSlit[argSlit.length -1]
|
|
|
|
//If a class is not in a package I assume its a primitive //TODO any suggestions for a better way to do this?
|
|
|
|
if(!arg.contains("/") && !arg.isEmpty()){
|
|
|
|
argStr = humanizeArg(argStr)
|
|
|
|
}
|
|
|
|
builder.append(argStr)
|
|
|
|
//Dont add the comma to the last arg
|
|
|
|
if(arg != methodArgs[methodArgs.length - 1]){
|
|
|
|
builder.append(",")
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
builder.append(")")
|
|
|
|
|
|
|
|
return builder.toString()
|
|
|
|
}
|
|
|
|
|
|
|
|
//Argumets that are java primitives do not use a freindly name, this method replaces them with something most people will understand
|
|
|
|
String humanizeArg(String arg){
|
|
|
|
def primitiveMap = [
|
|
|
|
Z: "Boolean",
|
|
|
|
B: "Byte",
|
|
|
|
C: "Char",
|
|
|
|
D: "Double",
|
|
|
|
F: "Float",
|
|
|
|
I: "Integer",
|
|
|
|
J: "Long",
|
|
|
|
L: "Object",
|
|
|
|
S: "Short"
|
|
|
|
]
|
|
|
|
|
|
|
|
def builder = new StringBuilder()
|
|
|
|
for(cha in arg.toCharArray()){
|
|
|
|
builder.append(primitiveMap.get(cha.toString().toUpperCase()))
|
|
|
|
builder.append(",")
|
|
|
|
}
|
|
|
|
//Removes the last ,
|
|
|
|
return builder.toString().substring(0, builder.toString().length() - 1)
|
|
|
|
}
|
|
|
|
|