cleanup gradle stuff

This commit is contained in:
nikky 2018-07-11 23:29:02 +02:00
parent 93c86463c4
commit 58ff1a3d8f
8 changed files with 108 additions and 98 deletions

View File

@ -1,24 +1,26 @@
buildscript { buildscript {
repositories { repositories {
jcenter() jcenter()
maven { url = "http://files.minecraftforge.net/maven" } maven {
url = 'http://files.minecraftforge.net/maven'
}
mavenCentral() mavenCentral()
maven { maven {
url 'https://plugins.gradle.org/m2/' url 'https://plugins.gradle.org/m2/'
} }
} }
dependencies { dependencies {
classpath "net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT" classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '2.2-SNAPSHOT'
classpath "com.github.jengelman.gradle.plugins:shadow:2.0.0" classpath group: 'com.github.jengelman.gradle.plugins', name: 'shadow', version: shadow_version
classpath "gradle.plugin.com.matthewprenger:CurseGradle:1.0.10" classpath group: 'gradle.plugin.com.matthewprenger', name: 'CurseGradle', version: cursegradle_version
} }
} }
apply plugin: 'net.minecraftforge.gradle.forge' apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: "com.github.johnrengelman.shadow" apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'com.matthewprenger.cursegradle' apply plugin: 'com.matthewprenger.cursegradle'
version = project.mc_version + "-" + project.mod_version version = project.mc_version + '-' + project.mod_version
archivesBaseName = project.mod_name archivesBaseName = project.mod_name
@ -26,18 +28,18 @@ sourceCompatibility = targetCompatibility = '1.8'
dependencies { dependencies {
compile project(':core') compile project(':core')
compile group: "net.shadowfacts", name: "Forgelin", version: project.forgelin_version compile group: 'net.shadowfacts', name: 'Forgelin', version: project.forgelin_version
} }
shadowJar { shadowJar {
classifier '' classifier ''
relocate "blue.endless", "matterlink.repack.blue.endless" relocate 'blue.endless', 'matterlink.repack.blue.endless'
dependencies { dependencies {
include project(":core") include project(':core')
include project(":api") include project(':api')
include project(":Jankson") include project(':Jankson')
} }
exclude 'dummyThing' exclude 'dummyThing'
@ -55,7 +57,7 @@ for (set in sourceSets) {
source = set.getKotlin() source = set.getKotlin()
output = dir output = dir
} }
def compileTask = tasks[set.getCompileTaskName("kotlin")] def compileTask = tasks[set.getCompileTaskName('kotlin')]
compileTask.source = dir compileTask.source = dir
compileTask.dependsOn taskName compileTask.dependsOn taskName
def dirPath = dir.toPath() def dirPath = dir.toPath()
@ -66,8 +68,8 @@ for (set in sourceSets) {
sourceJar.from sourceSets.main.kotlin sourceJar.from sourceSets.main.kotlin
minecraft { minecraft {
version = project.mc_version + "-" + project.forge_version version = project.mc_version + '-' + project.forge_version
runDir = "run" runDir = 'run'
mappings = project.mcp_mappings mappings = project.mcp_mappings
@ -80,11 +82,11 @@ minecraft {
processResources { processResources {
// this will ensure that this task is redone when the versions change. // this will ensure that this task is redone when the versions change.
inputs.property "version", project.mod_version inputs.property 'version', project.mod_version
inputs.property "mcversion", project.minecraft.version inputs.property 'mcversion', project.minecraft.version
// replace stuff in mcmod.info, nothing else // replace stuff in mcmod.info, nothing else
from(project(":core").sourceSets.main.resources.srcDirs) { from(project(':core').sourceSets.main.resources.srcDirs) {
include 'mcmod.info' include 'mcmod.info'
// replace version and mcversion // replace version and mcversion
@ -92,7 +94,7 @@ processResources {
} }
// copy everything else except the mcmod.info // copy everything else except the mcmod.info
from(project(":core").sourceSets.main.resources.srcDirs) { from(project(':core').sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info' exclude 'mcmod.info'
} }
@ -104,7 +106,7 @@ sourceJar {
from sourceSets.main.allSource from sourceSets.main.allSource
// copy everything else except the mcmod.info // copy everything else except the mcmod.info
from(project(":core").sourceSets.main.allSource) { from(project(':core').sourceSets.main.allSource) {
exclude 'mcmod.info' exclude 'mcmod.info'
} }
} }
@ -125,7 +127,7 @@ curseforge {
releaseType = project.curse_release_type releaseType = project.curse_release_type
if (project.hasProperty('changelog_file')) { if (project.hasProperty('changelog_file')) {
println("changelog = $changelog_file") println("changelog = $changelog_file")
changelogType = "markdown" changelogType = 'markdown'
changelog = file(changelog_file) changelog = file(changelog_file)
} }
relations { relations {

View File

@ -3,27 +3,29 @@ import net.minecraftforge.gradle.user.TaskSourceCopy
buildscript { buildscript {
repositories { repositories {
jcenter() jcenter()
maven { url = "http://files.minecraftforge.net/maven" } maven {
url = 'http://files.minecraftforge.net/maven'
}
mavenCentral() mavenCentral()
maven { maven {
url = 'https://oss.sonatype.org/content/groups/public' url = 'https://oss.sonatype.org/content/groups/public'
} }
maven { maven {
url = "https://plugins.gradle.org/m2/" url = 'https://plugins.gradle.org/m2/'
} }
} }
dependencies { dependencies {
classpath "net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT" classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '2.2-SNAPSHOT'
classpath "com.github.jengelman.gradle.plugins:shadow:2.0.0" classpath group: 'com.github.jengelman.gradle.plugins', name: 'shadow', version: shadow_version
classpath "gradle.plugin.com.matthewprenger:CurseGradle:1.0.10" classpath group: 'gradle.plugin.com.matthewprenger', name: 'CurseGradle', version: cursegradle_version
} }
} }
apply plugin: 'net.minecraftforge.gradle.forge' apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: "com.github.johnrengelman.shadow" apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'com.matthewprenger.cursegradle' apply plugin: 'com.matthewprenger.cursegradle'
version = project.mc_version + "-" + project.mod_version version = project.mc_version + '-' + project.mod_version
archivesBaseName = project.mod_name archivesBaseName = project.mod_name
@ -31,18 +33,18 @@ sourceCompatibility = targetCompatibility = '1.8'
dependencies { dependencies {
compile project(':core') compile project(':core')
compile group: "net.shadowfacts", name: "Forgelin", version: project.forgelin_version compile group: 'net.shadowfacts', name: 'Forgelin', version: project.forgelin_version
} }
shadowJar { shadowJar {
classifier '' classifier = ''
relocate "blue.endless", "matterlink.repack.blue.endless" relocate 'blue.endless', 'matterlink.repack.blue.endless'
dependencies { dependencies {
include project(":core") include project(':core')
include project(":api") include project(':api')
include project(":Jankson") include project(':Jankson')
} }
exclude 'dummyThing' exclude 'dummyThing'
@ -57,7 +59,7 @@ for (set in sourceSets) {
source = set.getKotlin() source = set.getKotlin()
output = dir output = dir
} }
def compileTask = tasks[set.getCompileTaskName("kotlin")] def compileTask = tasks[set.getCompileTaskName('kotlin')]
compileTask.source = dir compileTask.source = dir
compileTask.dependsOn taskName compileTask.dependsOn taskName
def dirPath = dir.toPath() def dirPath = dir.toPath()
@ -68,8 +70,8 @@ for (set in sourceSets) {
sourceJar.from sourceSets.main.kotlin sourceJar.from sourceSets.main.kotlin
minecraft { minecraft {
version = project.mc_version + "-" + project.forge_version version = project.mc_version + '-' + project.forge_version
runDir = "run" runDir = 'run'
mappings = project.mcp_mappings mappings = project.mcp_mappings
@ -82,11 +84,11 @@ minecraft {
processResources { processResources {
// this will ensure that this task is redone when the versions change. // this will ensure that this task is redone when the versions change.
inputs.property "version", project.mod_version inputs.property 'version', project.mod_version
inputs.property "mcversion", project.minecraft.version inputs.property 'mcversion', project.minecraft.version
// replace stuff in mcmod.info, nothing else // replace stuff in mcmod.info, nothing else
from(project(":core").sourceSets.main.resources.srcDirs) { from(project(':core').sourceSets.main.resources.srcDirs) {
include 'mcmod.info' include 'mcmod.info'
// replace version and mcversion // replace version and mcversion
@ -94,19 +96,19 @@ processResources {
} }
// copy everything else except the mcmod.info // copy everything else except the mcmod.info
from(project(":core").sourceSets.main.resources.srcDirs) { from(project(':core').sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info' exclude 'mcmod.info'
} }
} }
sourceJar { sourceJar {
classifier 'sources' classifier = 'sources'
// copy all the minecraftforge specific classes // copy all the minecraftforge specific classes
from sourceSets.main.allSource from sourceSets.main.allSource
// copy everything else except the mcmod.info // copy everything else except the mcmod.info
from(project(":core").sourceSets.main.allSource) { from(project(':core').sourceSets.main.allSource) {
exclude 'mcmod.info' exclude 'mcmod.info'
} }
} }
@ -127,7 +129,7 @@ curseforge {
releaseType = project.curse_release_type releaseType = project.curse_release_type
if (project.hasProperty('changelog_file')) { if (project.hasProperty('changelog_file')) {
println("changelog = $changelog_file") println("changelog = $changelog_file")
changelogType = "markdown" changelogType = 'markdown'
changelog = file(changelog_file) changelog = file(changelog_file)
} }
relations { relations {

View File

@ -1,27 +1,29 @@
buildscript { buildscript {
repositories { repositories {
jcenter() jcenter()
maven { url = "http://files.minecraftforge.net/maven" } maven {
url = 'http://files.minecraftforge.net/maven'
}
mavenCentral() mavenCentral()
maven { maven {
url = 'https://oss.sonatype.org/content/groups/public' url = 'https://oss.sonatype.org/content/groups/public'
} }
maven { maven {
url = "https://plugins.gradle.org/m2/" url = 'https://plugins.gradle.org/m2/'
} }
} }
dependencies { dependencies {
classpath "net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT" classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '2.3-SNAPSHOT'
classpath "com.github.jengelman.gradle.plugins:shadow:2.0.0" classpath group: 'com.github.jengelman.gradle.plugins', name: 'shadow', version: shadow_version
classpath "gradle.plugin.com.matthewprenger:CurseGradle:1.0.10" classpath group: 'gradle.plugin.com.matthewprenger', name: 'CurseGradle', version: cursegradle_version
} }
} }
apply plugin: 'net.minecraftforge.gradle.forge' apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: "com.github.johnrengelman.shadow" apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'com.matthewprenger.cursegradle' apply plugin: 'com.matthewprenger.cursegradle'
version = project.mc_version + "-" + project.mod_version version = project.mc_version + '-' + project.mod_version
archivesBaseName = project.mod_name archivesBaseName = project.mod_name
@ -29,26 +31,26 @@ sourceCompatibility = targetCompatibility = '1.8'
dependencies { dependencies {
compile project(':core') compile project(':core')
compile group: "net.shadowfacts", name: "Forgelin", version: project.forgelin_version compile group: 'net.shadowfacts', name: 'Forgelin', version: project.forgelin_version
} }
shadowJar { shadowJar {
classifier '' classifier = ''
relocate "blue.endless", "matterlink.repack.blue.endless" relocate 'blue.endless', 'matterlink.repack.blue.endless'
dependencies { dependencies {
include project(':core') include project(':core')
include project(":api") include project(':api')
include project(":Jankson") include project(':Jankson')
} }
exclude 'dummyThing' exclude 'dummyThing'
} }
minecraft { minecraft {
version = project.mc_version + "-" + project.forge_version version = project.mc_version + '-' + project.forge_version
runDir = "run" runDir = 'run'
mappings = project.mcp_mappings mappings = project.mcp_mappings
@ -80,7 +82,7 @@ processResources {
} }
sourceJar { sourceJar {
classifier 'sources' classifier = 'sources'
// copy all the minecraftforge specific classes // copy all the minecraftforge specific classes
from sourceSets.main.allSource from sourceSets.main.allSource
@ -105,7 +107,7 @@ curseforge {
releaseType = project.curse_release_type releaseType = project.curse_release_type
if (project.hasProperty('changelog_file')) { if (project.hasProperty('changelog_file')) {
println("changelog = $changelog_file") println("changelog = $changelog_file")
changelogType = "markdown" changelogType = 'markdown'
changelog = file(changelog_file) changelog = file(changelog_file)
} }
relations { relations {

View File

@ -41,7 +41,6 @@ object MatterLink : IMatterLink() {
@Mod.EventHandler @Mod.EventHandler
fun preInit(event: FMLPreInitializationEvent) { fun preInit(event: FMLPreInitializationEvent) {
logger = event.modLog as org.apache.logging.log4j.core.Logger logger = event.modLog as org.apache.logging.log4j.core.Logger
logger.level = Level.DEBUG
logger.info("Building bridge!") logger.info("Building bridge!")
cfg = BaseConfig(event.modConfigurationDirectory).load() cfg = BaseConfig(event.modConfigurationDirectory).load()
@ -98,7 +97,6 @@ object MatterLink : IMatterLink() {
private fun playerByProfile(gameProfile: GameProfile): EntityPlayerMP? = FMLCommonHandler.instance().minecraftServerInstance.playerList.getPlayerByUUID(gameProfile.id) private fun playerByProfile(gameProfile: GameProfile): EntityPlayerMP? = FMLCommonHandler.instance().minecraftServerInstance.playerList.getPlayerByUUID(gameProfile.id)
private fun profileByUUID(uuid: UUID): GameProfile? = try { private fun profileByUUID(uuid: UUID): GameProfile? = try {
FMLCommonHandler.instance().minecraftServerInstance.playerProfileCache.getProfileByUUID(uuid) FMLCommonHandler.instance().minecraftServerInstance.playerProfileCache.getProfileByUUID(uuid)
} catch (e: IllegalArgumentException) { } catch (e: IllegalArgumentException) {
@ -117,9 +115,6 @@ object MatterLink : IMatterLink() {
override fun uuidToName(uuid: UUID): String? = profileByUUID(uuid)?.name override fun uuidToName(uuid: UUID): String? = profileByUUID(uuid)?.name
// override fun log(level: String, formatString: String, vararg data: Any) =
// logger.log(Level.toLevel(level, Level.INFO), formatString, *data)
override fun commandSenderFor( override fun commandSenderFor(
user: String, user: String,
env: IBridgeCommand.CommandEnvironment, env: IBridgeCommand.CommandEnvironment,

View File

@ -1,22 +1,24 @@
buildscript { buildscript {
repositories { repositories {
jcenter() jcenter()
maven { url = "http://files.minecraftforge.net/maven" } maven {
url = 'http://files.minecraftforge.net/maven'
}
mavenCentral() mavenCentral()
maven { maven {
url = "https://plugins.gradle.org/m2/" url = 'https://plugins.gradle.org/m2/'
} }
} }
dependencies { dependencies {
classpath "net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT" classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '1.2-SNAPSHOT'
classpath "gradle.plugin.com.matthewprenger:CurseGradle:1.0.10" classpath group: 'gradle.plugin.com.matthewprenger', name: 'CurseGradle', version: cursegradle_version
} }
} }
apply plugin: 'forge' apply plugin: 'forge'
apply plugin: 'com.matthewprenger.cursegradle' apply plugin: 'com.matthewprenger.cursegradle'
version = project.mc_version + "-" + project.mod_version version = project.mc_version + '-' + project.mod_version
archivesBaseName = project.mod_name archivesBaseName = project.mod_name
@ -29,28 +31,26 @@ configurations {
dependencies { dependencies {
shade project(':core') shade project(':core')
shade project(":api") shade project(':api')
shade project(":Jankson") shade project(':Jankson')
} }
minecraft { minecraft {
version = project.mc_version + "-" + project.forge_version + "-" + project.mc_version version = project.mc_version + '-' + project.forge_version + '-' + project.mc_version
runDir = "run" runDir = 'run'
mappings = project.mcp_mappings mappings = project.mcp_mappings
srgExtra "PK: kotlin matterlink/repack/kotlin" srgExtra 'PK: kotlin matterlink/repack/kotlin'
srgExtra "PK: org/jetbrains/annotations matterlink/repack/org/jetbrains/annotations" srgExtra 'PK: org/jetbrains/annotations matterlink/repack/org/jetbrains/annotations'
// srgExtra "PK: org/apache/http matterlink/repack/org/apache/http" srgExtra 'PK: org/intellij matterlink/repack/org/intellij'
// srgExtra "PK: org/apache/commons matterlink/repack/org/apache/commons" srgExtra 'PK: blue/endless matterlink/repack/blue/endless'
srgExtra "PK: org/intellij matterlink/repack/org/intellij"
srgExtra "PK: blue/endless matterlink/repack/blue/endless"
} }
compileKotlin.doFirst { compileKotlin.doFirst {
def target = "src/main/kotlin/matterlink/gen" def target = 'src/main/kotlin/matterlink/gen'
copy { copy {
from("src/templates/kotlin/matterlink/Constants.kt") from('src/templates/kotlin/matterlink/Constants.kt')
into(target) into(target)
} }
ant.replaceregexp(match: '@MODVERSION@', replace: project.mod_version, flags: 'g', byline: true) { ant.replaceregexp(match: '@MODVERSION@', replace: project.mod_version, flags: 'g', byline: true) {
@ -69,11 +69,11 @@ compileKotlin.doFirst {
processResources { processResources {
// this will ensure that this task is redone when the versions change. // this will ensure that this task is redone when the versions change.
inputs.property "version", project.mod_version inputs.property 'version', project.mod_version
inputs.property "mcversion", project.minecraft.version inputs.property 'mcversion', project.minecraft.version
// replace stuff in mcmod.info, nothing else // replace stuff in mcmod.info, nothing else
from(project(":core").sourceSets.main.resources.srcDirs) { from(project(':core').sourceSets.main.resources.srcDirs) {
include 'mcmod.info' include 'mcmod.info'
// replace version and mcversion // replace version and mcversion
@ -81,7 +81,7 @@ processResources {
} }
// copy everything else except the mcmod.info // copy everything else except the mcmod.info
from(project(":core").sourceSets.main.resources.srcDirs) { from(project(':core').sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info' exclude 'mcmod.info'
} }
} }
@ -89,8 +89,8 @@ processResources {
jar { jar {
configurations.shade.each { dep -> configurations.shade.each { dep ->
from(project.zipTree(dep)) { from(project.zipTree(dep)) {
exclude "META-INF", "META-INF/**" exclude 'META-INF', 'META-INF/**'
exclude "com/google/gson", "com/google/gson/**" exclude 'com/google/gson', 'com/google/gson/**'
} }
} }
} }
@ -104,7 +104,7 @@ curseforge {
releaseType = project.curse_release_type releaseType = project.curse_release_type
if (project.hasProperty('changelog_file')) { if (project.hasProperty('changelog_file')) {
println("changelog = $changelog_file") println("changelog = $changelog_file")
changelogType = "markdown" changelogType = 'markdown'
changelog = file(changelog_file) changelog = file(changelog_file)
} }
mainArtifact(jar) { mainArtifact(jar) {

View File

@ -1,5 +1,13 @@
buildscript {
repositories {
jcenter()
}
dependencies {
classpath group: "org.jetbrains.kotlin", name: "kotlin-gradle-plugin", version: kotlin_version
}
}
plugins { plugins {
id "org.jetbrains.kotlin.jvm" version '1.2.41'
id 'idea' id 'idea'
} }
@ -29,6 +37,11 @@ subprojects {
name = "shadowfacts" name = "shadowfacts"
url = "http://maven.shadowfacts.net/" url = "http://maven.shadowfacts.net/"
} }
ivy {
//Resolves baubles and jankson
name = "endless.blue dependency mirror"
artifactPattern "https://endless.blue/files/ivy/[module]-[revision].[ext]"
}
} }
} }

View File

@ -1,18 +1,11 @@
buildscript { buildscript {
ext.kotlin_version = '1.2.41'
repositories { repositories {
jcenter() jcenter()
mavenCentral() mavenCentral()
maven {
url = 'https://oss.sonatype.org/content/groups/public'
}
maven {
url = "https://plugins.gradle.org/m2/";
}
} }
dependencies { dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.github.jengelman.gradle.plugins:shadow:2.0.0" classpath group: "com.github.jengelman.gradle.plugins", name: "shadow", version: shadow_version
} }
} }

View File

@ -1,5 +1,8 @@
mod_name = MatterLink mod_name = MatterLink
mod_version = 1.6.3 mod_version = 1.6.3
forgelin_version = 1.6.0 forgelin_version = 1.6.0
kotlin_version = 1.2.41
shadow_version = 2.0.0
cursegradle_version = 1.0.10
curse_id = 287323 curse_id = 287323
curse_release_type = beta curse_release_type = beta