permit to override the jgitver version
for packaging a tar ball, jgitver takes the default version of 0.0.0,
not practical. putting a version into a file would be possible, but
we try to produce a new version with every commit, which then can be
released if tests pass, without rebuild. this means the source code
should NOT have the version in the commit, but derived.
for tar balls, we know the name of the tar, so its easy to set the
same version in a script, or put a desired version. pay attention,
that ripme checks the version towards github, and suggests an update,
if the running version is less than the released one.
fixes #145.
2023-10-14 14:10:46 +02:00
|
|
|
// the build derives a version with the jgitver plugin out of a tag in the git history. when there is no
|
|
|
|
// git repo, the jgitver default would be 0.0.0. one can override this version with a parameter. also, permit
|
|
|
|
// to start the build setting the javac release parameter, no parameter means build for java-17:
|
|
|
|
// gradle clean build -PjavacRelease=21
|
|
|
|
// gradle clean build -PcustomVersion=1.0.0-10-asdf
|
|
|
|
val customVersion = (project.findProperty("customVersion") ?: "") as String
|
2024-03-18 09:11:02 +01:00
|
|
|
val javacRelease = (project.findProperty("javacRelease") ?: "21") as String
|
2022-02-12 10:36:28 +01:00
|
|
|
|
2020-07-26 08:40:46 +02:00
|
|
|
plugins {
|
2021-02-22 02:41:39 +01:00
|
|
|
id("fr.brouillard.oss.gradle.jgitver") version "0.9.1"
|
2020-07-26 19:41:16 +02:00
|
|
|
id("jacoco")
|
2020-07-26 08:40:46 +02:00
|
|
|
id("java")
|
|
|
|
id("maven-publish")
|
|
|
|
}
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenLocal()
|
|
|
|
mavenCentral()
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2021-12-20 02:11:06 +01:00
|
|
|
implementation("com.lmax:disruptor:3.4.4")
|
2023-06-11 02:30:11 +02:00
|
|
|
implementation("org.java-websocket:Java-WebSocket:1.5.3")
|
|
|
|
implementation("org.jsoup:jsoup:1.16.1")
|
2021-12-20 02:11:06 +01:00
|
|
|
implementation("org.json:json:20211205")
|
2023-06-11 02:30:11 +02:00
|
|
|
implementation("com.j2html:j2html:1.6.0")
|
2021-12-20 02:11:06 +01:00
|
|
|
implementation("commons-configuration:commons-configuration:1.10")
|
|
|
|
implementation("commons-cli:commons-cli:1.5.0")
|
2023-06-11 02:30:11 +02:00
|
|
|
implementation("commons-io:commons-io:2.13.0")
|
|
|
|
implementation("org.apache.httpcomponents:httpclient:4.5.14")
|
|
|
|
implementation("org.apache.httpcomponents:httpmime:4.5.14")
|
|
|
|
implementation("org.apache.logging.log4j:log4j-api:2.20.0")
|
|
|
|
implementation("org.apache.logging.log4j:log4j-core:2.20.0")
|
2023-12-09 04:54:06 -05:00
|
|
|
implementation("com.squareup.okhttp3:okhttp:4.12.0")
|
2023-06-11 02:30:11 +02:00
|
|
|
implementation("org.graalvm.js:js:22.3.2")
|
2023-09-30 16:47:11 +02:00
|
|
|
testImplementation(enforcedPlatform("org.junit:junit-bom:5.10.0"))
|
2020-07-26 08:40:46 +02:00
|
|
|
testImplementation("org.junit.jupiter:junit-jupiter")
|
2023-09-30 16:47:11 +02:00
|
|
|
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
2020-07-26 08:40:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
group = "com.rarchives.ripme"
|
|
|
|
version = "1.7.94"
|
|
|
|
description = "ripme"
|
|
|
|
|
2023-06-11 02:30:11 +02:00
|
|
|
jacoco {
|
2024-12-12 05:14:49 +01:00
|
|
|
toolVersion = "0.8.12"
|
2023-06-11 02:30:11 +02:00
|
|
|
}
|
|
|
|
|
2021-02-22 02:41:39 +01:00
|
|
|
jgitver {
|
|
|
|
gitCommitIDLength = 8
|
|
|
|
nonQualifierBranches = "main,master"
|
|
|
|
useGitCommitID = true
|
|
|
|
}
|
|
|
|
|
permit to override the jgitver version
for packaging a tar ball, jgitver takes the default version of 0.0.0,
not practical. putting a version into a file would be possible, but
we try to produce a new version with every commit, which then can be
released if tests pass, without rebuild. this means the source code
should NOT have the version in the commit, but derived.
for tar balls, we know the name of the tar, so its easy to set the
same version in a script, or put a desired version. pay attention,
that ripme checks the version towards github, and suggests an update,
if the running version is less than the released one.
fixes #145.
2023-10-14 14:10:46 +02:00
|
|
|
afterEvaluate {
|
|
|
|
if (customVersion != "") {
|
|
|
|
project.version = customVersion
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-12 10:36:28 +01:00
|
|
|
tasks.compileJava {
|
2022-02-28 00:42:06 +01:00
|
|
|
options.release.set(Integer.parseInt(javacRelease))
|
2020-07-26 08:40:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
tasks.withType<Jar> {
|
2021-05-08 16:57:52 +02:00
|
|
|
duplicatesStrategy = DuplicatesStrategy.INCLUDE
|
2020-07-26 08:40:46 +02:00
|
|
|
manifest {
|
|
|
|
attributes["Main-Class"] = "com.rarchives.ripme.App"
|
2021-02-28 15:26:27 +01:00
|
|
|
attributes["Implementation-Version"] = archiveVersion
|
2021-04-16 06:41:47 +02:00
|
|
|
attributes["Multi-Release"] = "true"
|
2020-07-26 08:40:46 +02:00
|
|
|
}
|
2023-12-09 04:54:06 -05:00
|
|
|
|
2020-07-26 08:40:46 +02:00
|
|
|
// To add all of the dependencies otherwise a "NoClassDefFoundError" error
|
|
|
|
from(sourceSets.main.get().output)
|
|
|
|
|
|
|
|
dependsOn(configurations.runtimeClasspath)
|
|
|
|
from({
|
|
|
|
configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) }
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
create<MavenPublication>("maven") {
|
|
|
|
from(components["java"])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.withType<JavaCompile> {
|
|
|
|
options.encoding = "UTF-8"
|
2023-09-30 17:28:46 +02:00
|
|
|
val compilerArgs = options.compilerArgs
|
|
|
|
compilerArgs.addAll(listOf("-Xlint:deprecation"))
|
2020-07-26 08:40:46 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
tasks.test {
|
2021-10-03 19:20:22 +02:00
|
|
|
testLogging {
|
|
|
|
showStackTraces = true
|
|
|
|
}
|
2020-07-26 08:40:46 +02:00
|
|
|
useJUnitPlatform {
|
2020-07-30 07:21:13 +02:00
|
|
|
// gradle-6.5.1 not yet allows passing this as parameter, so exclude it
|
2020-11-21 11:08:59 +01:00
|
|
|
excludeTags("flaky","slow")
|
2020-07-26 08:40:46 +02:00
|
|
|
includeEngines("junit-jupiter")
|
|
|
|
includeEngines("junit-vintage")
|
|
|
|
}
|
2020-07-26 19:41:16 +02:00
|
|
|
finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run
|
2020-07-26 08:40:46 +02:00
|
|
|
}
|
2020-07-26 19:09:15 +02:00
|
|
|
|
2021-02-28 10:59:09 +01:00
|
|
|
tasks.register<Test>("testAll") {
|
2020-07-30 07:21:13 +02:00
|
|
|
useJUnitPlatform {
|
2021-02-28 10:59:09 +01:00
|
|
|
includeTags("any()", "none()")
|
2020-07-30 07:21:13 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-28 10:36:30 +02:00
|
|
|
tasks.register<Test>("testFlaky") {
|
|
|
|
useJUnitPlatform {
|
|
|
|
includeTags("flaky")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.register<Test>("testSlow") {
|
|
|
|
useJUnitPlatform {
|
|
|
|
includeTags("slow")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tasks.register<Test>("testTagged") {
|
|
|
|
useJUnitPlatform {
|
|
|
|
includeTags("any()")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-26 19:09:15 +02:00
|
|
|
// make all archive tasks in the build reproducible
|
|
|
|
tasks.withType<AbstractArchiveTask>().configureEach {
|
|
|
|
isPreserveFileTimestamps = false
|
|
|
|
isReproducibleFileOrder = true
|
|
|
|
}
|
|
|
|
|
2023-12-09 08:19:36 -05:00
|
|
|
println("Build directory: ${file(layout.buildDirectory)}")
|
|
|
|
|
2020-07-26 19:41:16 +02:00
|
|
|
tasks.jacocoTestReport {
|
|
|
|
dependsOn(tasks.test) // tests are required to run before generating the report
|
|
|
|
reports {
|
2021-12-30 01:57:47 +01:00
|
|
|
xml.required.set(false)
|
|
|
|
csv.required.set(false)
|
2023-12-09 08:19:36 -05:00
|
|
|
html.outputLocation.set(file("${file(layout.buildDirectory)}/jacocoHtml"))
|
2020-07-26 19:41:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|