Update gradle

This commit is contained in:
DanLT 2021-09-01 02:26:14 -08:00
parent b5d7e2969f
commit e5033cceec

View File

@ -15,16 +15,6 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.guardsquare:proguard-gradle:7.1.0'
}
}
plugins { plugins {
id 'java' id 'java'
id 'io.freefair.lombok' version '5.2.1' id 'io.freefair.lombok' version '5.2.1'
@ -34,9 +24,8 @@ plugins {
group 'com.volmit.iris' group 'com.volmit.iris'
version '1.8' version '1.8'
def apiVersion = '1.17' def apiVersion = '1.17'
def name = getRootProject().getName() // See settings.gradle def name = getRootProject().getName() // Defined in settings.gradle
def main = 'com.volmit.iris.Iris' def main = 'com.volmit.iris.Iris'
// You need to also set command usage, aliases and description in src/main/resources/plugin.yml
// ADD YOURSELF AS A NEW LINE IF YOU WANT YOUR OWN BUILD TASK GENERATED // ADD YOURSELF AS A NEW LINE IF YOU WANT YOUR OWN BUILD TASK GENERATED
// ============================================================== // ==============================================================
@ -47,32 +36,6 @@ registerCustomOutputTask('Coco', 'C:/Users/sjoer/Documents/Development/MCServer/
registerCustomOutputTask('Strange', 'D://Servers/1.17 Test Server/plugins', name) registerCustomOutputTask('Strange', 'D://Servers/1.17 Test Server/plugins', name)
// ============================================================== // ==============================================================
def dependsDir = "${buildDir}/libs/dependencies/" as String
task copyDepends(type: Copy) {
dependsOn(":shadowJar")
group('proguard')
from configurations.default
into "${dependsDir}"
}
task release(type: proguard.gradle.ProGuardTask) {
dependsOn(":copyDepends")
group('proguard')
configuration 'proguard.pro'
injars("${buildDir}/libs/" + name + "-" + version + "-all.jar")
outjars("${buildDir}/production/" + name + "/" + version + "/" + name + "-" + version + ".jar")
libraryjars "${System.getProperty('java.home')}/lib/rt.jar"
libraryjars "${System.getProperty('java.home')}/jmods/"
libraryjars "${dependsDir}"
dontobfuscate()
dontwarn()
dontshrink()
dontoptimize()
dontnote()
verbose()
}
def registerCustomOutputTask(name, path, plugin) { def registerCustomOutputTask(name, path, plugin) {
tasks.register('build' + name, Copy) { tasks.register('build' + name, Copy) {
group('development') group('development')
@ -86,8 +49,14 @@ def registerCustomOutputTask(name, path, plugin) {
} }
} }
/**
* Gradle is weird sometimes, we need to delete the plugin yml from the build folder to actually filter properly.
*/
file(jar.archiveFile.get().getAsFile().getParentFile().getParentFile().getParentFile().getAbsolutePath() + '/build/resources/main/plugin.yml').delete() file(jar.archiveFile.get().getAsFile().getParentFile().getParentFile().getParentFile().getAbsolutePath() + '/build/resources/main/plugin.yml').delete()
/**
* Expand properties into plugin yml
*/
processResources { processResources {
filesMatching('**/plugin.yml') { filesMatching('**/plugin.yml') {
expand( expand(
@ -99,6 +68,10 @@ processResources {
} }
} }
/**
* For performance during compilation, we specify which module groups are accessible from which repositories
* This may cause issues resolving new dependencies but normally it shouldn't.
*/
repositories { repositories {
maven { maven {
url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
@ -153,23 +126,45 @@ repositories {
// maven { allowInsecureProtocol true, url 'http://archive.arcane.art/repository/arcane'} // maven { allowInsecureProtocol true, url 'http://archive.arcane.art/repository/arcane'}
} }
/**
* We need parameter meta for the decree command system
*/
compileJava { compileJava {
options.compilerArgs << '-parameters' options.compilerArgs << '-parameters'
} }
shadowJar /**
{ * Configure Iris for shading
minimize() */
append("plugin.yml") shadowJar {
relocate 'com.dfsek.paralithic', 'com.volmit.iris.util.paralithic' minimize()
relocate 'io.papermc.lib', 'com.volmit.iris.util.paper' append("plugin.yml")
dependencies { relocate 'com.dfsek.paralithic', 'com.volmit.iris.util.paralithic'
include(dependency('io.papermc:paperlib')) relocate 'io.papermc.lib', 'com.volmit.iris.util.paper'
include(dependency('com.dfsek:Paralithic')) dependencies {
include(dependency('net.kyori:')) include(dependency('io.papermc:paperlib'))
} include(dependency('com.dfsek:Paralithic'))
} include(dependency('net.kyori:'))
}
}
configurations.all {
resolutionStrategy.cacheChangingModulesFor 60, 'minutes'
resolutionStrategy.cacheDynamicVersionsFor 60, 'minutes'
}
/**
* Dependencies.
*
* Provided or classpath dependencies are not shaded and are available on the runtime classpath
*
* Shaded dependencies are not available at runtime, nor are they available on mvn central so they
* need to be shaded into the jar (increasing binary size)
*
* Dynamically loaded dependencies are defined in the plugin.yml (updating these must be updated in the
* plugin.yml also, otherwise they wont be available). These do not increase binary size). Only declare
* these dependencies if they are available on mvn central.
*/
dependencies { dependencies {
// Provided or Classpath // Provided or Classpath
compileOnly 'org.projectlombok:lombok:1.18.20' compileOnly 'org.projectlombok:lombok:1.18.20'