apply plugin: 'org.jetbrains.kotlin.jvm' apply plugin: 'java' apply plugin: 'application' apply plugin: 'idea' apply plugin: 'jacoco' String genDir = "$projectDir/src-gen" sourceSets { main { java { srcDir 'src/main/java' srcDir genDir } resources { srcDir 'src/main/resources' } } } java { toolchain { languageVersion.set(JavaLanguageVersion.of(11)) } } kotlin { jvmToolchain { languageVersion.set(JavaLanguageVersion.of(11)) } } repositories { mavenCentral() maven { url 'https://jitpack.io' } } dependencies { implementation group: 'us.monoid.web', name: 'resty', version: '0.3.2' implementation group: 'org.eclipse.jgit', name: 'org.eclipse.jgit', version: '6.9.0.202403050737-r' implementation group: 'org.eclipse.jgit', name: 'org.eclipse.jgit.ssh.apache', version: '6.9.0.202403050737-r' implementation 'com.fasterxml.jackson.core:jackson-databind:2.17.0' implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.17.0' implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.17.0' implementation 'com.github.frotty:SwingDarkFlatTable:1d9ae26e69' implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation 'io.github.microutils:kotlin-logging:3.0.5' implementation 'com.github.Frotty:SimpleRegistry:f96dda96bd' implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.32' implementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.4.14' testImplementation 'org.testng:testng:7.8.0' testImplementation group: 'com.github.stefanbirkner', name: 'system-lambda', version: '1.2.1' } test { useTestNG() } jacocoTestReport { reports { xml.required.set(true) } } configurations.all { exclude group: "org.slf4j", module: "slf4j-log4j12" exclude group: "log4j", module: "log4j" } buildscript { ext.kotlin_version = '1.9.23' repositories { flatDir dirs: 'src/main/resources/' mavenCentral() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } version '1.4.0.0' task versionInfoFile { description "Generates a file CompileTimeInfo.java with version number etc." doLast { def dir = new File("$projectDir/src-gen/file/") dir.mkdirs() def f = new File(dir, 'CompileTimeInfo.kt') String gitRevision = "unknown-version" String gitRevisionlong = "unknown-version" new ByteArrayOutputStream().withStream { os -> exec { executable = 'git' args = ['describe', '--tags', '--always'] standardOutput = os } gitRevision = os.toString().trim() } new ByteArrayOutputStream().withStream { os -> exec { executable = 'git' args = ['describe', '--tags', '--always', '--abbrev=0'] standardOutput = os } gitRevisionlong = os.toString().trim() } String setupVersion = "${version}-${gitRevision}" String currentTime = new Date().format("yyyy/MM/dd KK:mm:ss") f.text = """ package file object CompileTimeInfo { \tval time="${currentTime}" \tval revision="${gitRevision}" \tval revisionLong="${gitRevisionlong}" \tval version="${setupVersion}" }""" } } compileKotlin.dependsOn versionInfoFile task dist(type: Jar) { from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA' manifest { attributes 'Implementation-Title': 'Wurst Setup', 'Implementation-Version': version, 'Main-Class': 'file.SetupMain' } with jar duplicatesStrategy = DuplicatesStrategy.EXCLUDE } dist.dependsOn classes dist.dependsOn versionInfoFile dist.archiveFileName = "WurstSetup.jar" task copy_jar(type: Copy) { mkdir("downloads/") from 'build/libs/' into 'downloads/' duplicatesStrategy = DuplicatesStrategy.INCLUDE } task proguardDist(type: Copy) { } proguardDist.dependsOn dist processResources { duplicatesStrategy = DuplicatesStrategy.INCLUDE } copy_jar.dependsOn(dist) mainClassName = "file.SetupMain" compileKotlin { kotlinOptions { jvmTarget = "11" } } compileTestKotlin { kotlinOptions { jvmTarget = "11" } }