1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- plugins {
- id 'application'
- id 'pmd'
- id 'org.gradlex.reproducible-builds' version '1.0'
- id 'com.github.spotbugs' version '6.0.26'
- id 'io.github.sgtsilvio.gradle.proguard' version '0.7.0'
- }
- repositories {
- mavenCentral()
- }
- dependencies {
- spotbugs 'com.github.spotbugs:spotbugs:4.8.6'
- spotbugsPlugins 'com.mebigfatguy.fb-contrib:fb-contrib:7.6.8'
- proguardClasspath 'com.guardsquare:proguard-base:7.6.0'
- implementation 'com.google.guava:guava:33.3.1-jre'
- compileOnly 'com.github.spotbugs:spotbugs-annotations:4.8.6'
- }
- version = '1.0.0'
- pmd {
- consoleOutput = true
- toolVersion = '7.8.0'
- ruleSetFiles = files 'pmd.xml'
- }
- spotbugs {
- effort = com.github.spotbugs.snom.Effort.valueOf 'MAX'
- reportLevel = com.github.spotbugs.snom.Confidence.valueOf 'LOW'
- excludeFilter = file 'spotbugs-exclude.xml'
- }
- sourceSets {
- main {
- java.srcDirs = ['src']
- resources.srcDirs = ['resources']
- }
- }
- java {
- toolchain {
- languageVersion = JavaLanguageVersion.of 21
- }
- }
- application {
- mainClass = 'battleship.Entrypoint'
- }
- task fatJar(type: Jar) {
- dependsOn check
- from {
- configurations.runtimeClasspath.collect {
- (it.isDirectory() ? it : zipTree(it)).matching {
- exclude('META-INF/versions/**')
- exclude('META-INF/maven/**')
- exclude('META-INF/proguard/**') // not currently used, see https://github.com/Guardsquare/proguard/issues/337
- exclude('META-INF/LICENSE*')
- }
- }
- }
- manifest {
- attributes 'Main-Class' : application.mainClass
- }
- duplicatesStrategy = DuplicatesStrategy.FAIL
- includeEmptyDirs = false
- archiveClassifier = 'all-in-one'
- with jar
- }
- task proguardedJar(type: io.github.sgtsilvio.gradle.proguard.ProguardTask) {
- addInput {
- classpath.from(tasks.fatJar)
- }
- addOutput {
- archiveFile.set(base.libsDirectory.file("${project.name}-${project.version}-all-in-one-proguarded.jar"))
- }
- addLibrary {
- classpath.from(configurations.compileClasspath)
- }
- jdkModules.add 'java.base'
- jdkModules.add 'java.desktop'
- jdkModules.add 'java.logging'
- jdkModules.add 'java.datatransfer'
- rulesFiles.from file('battleship.pro')
- }
|