54 lines
1.3 KiB
Groovy
54 lines
1.3 KiB
Groovy
import proguard.gradle.ProGuardTask
|
|
|
|
buildscript {
|
|
repositories {
|
|
mavenCentral()
|
|
google()
|
|
}
|
|
dependencies {
|
|
classpath 'com.guardsquare:proguard-gradle:7.3.0'
|
|
}
|
|
}
|
|
|
|
plugins {
|
|
id 'application'
|
|
id 'java'
|
|
}
|
|
|
|
group = 'com.example'
|
|
version = '0.0.1'
|
|
|
|
application {
|
|
mainClass.set('com.example.App')
|
|
}
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
dependencies {
|
|
implementation 'com.google.guava:guava:30.1.1-jre'
|
|
}
|
|
|
|
ext.baseCoordinates = "${project.name}-${project.version}"
|
|
|
|
tasks.register('proguard', ProGuardTask) {
|
|
configuration file('proguard.pro')
|
|
|
|
injars(tasks.named('jar', Jar).flatMap { it.archiveFile })
|
|
|
|
// Automatically handle the Java version of this build.
|
|
if (System.getProperty('java.version').startsWith('1.')) {
|
|
// Before Java 9, the runtime classes were packaged in a single jar file.
|
|
libraryjars "${System.getProperty('java.home')}/lib/rt.jar"
|
|
} else {
|
|
// As of Java 9, the runtime classes are packaged in modular jmod files.
|
|
libraryjars "${System.getProperty('java.home')}/jmods/java.base.jmod", jarfilter: '!**.jar', filter: '!module-info.class'
|
|
//libraryjars "${System.getProperty('java.home')}/jmods/....."
|
|
}
|
|
|
|
verbose
|
|
|
|
outjars(layout.buildDirectory.file("libs/${baseCoordinates}-minified.jar"))
|
|
}
|