tuddylib/build.gradle

87 lines
2 KiB
Groovy
Raw Normal View History

2020-08-22 14:26:35 +02:00
import java.nio.file.Paths
2024-06-25 03:32:03 +02:00
import java.nio.file.Files
2020-08-22 14:26:35 +02:00
import java.util.zip.ZipEntry
import java.util.zip.ZipOutputStream
plugins {
id 'java'
id 'maven-publish'
}
repositories {
mavenCentral()
}
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
compileJava {
options.encoding = "UTF-8"
}
dependencies {
}
javadoc {
options.encoding = "UTF-8"
source = sourceSets.main.allJava
classpath = configurations.compile
}
javadoc {
doLast {
def f; (f = new FileOutputStream("build/docs/javadoc/stylesheet.css")).write(
new URL("https://raw.githubusercontent.com/TudbuT/tools/master/dark_javadoc.css").newInputStream().
readLines().join("\n").getBytes()
); f.close()
ZipOutputStream out = new ZipOutputStream(new FileOutputStream("TuddyLIB-javadoc.zip"))
new File("build/docs/javadoc").eachFileRecurse(groovy.io.FileType.FILES) {
out.putNextEntry(new ZipEntry(Paths.get("build/docs/javadoc").relativize(it.toPath()).toString()))
byte[] bytes = new byte[it.length() as int]
new FileInputStream(it).read(bytes)
out.write(bytes)
out.closeEntry()
}
out.close()
}
}
2024-06-09 17:01:33 +02:00
jar {
doLast {
File jar = new File("build/libs/tuddylib.jar")
File loc = new File("TuddyLIB.jar")
2024-06-25 03:32:03 +02:00
loc.delete()
Files.copy(jar.toPath(), loc.toPath())
2024-06-09 17:01:33 +02:00
}
}
2020-08-22 14:26:35 +02:00
//jar.dependsOn("javadoc")
publishing {
2024-06-25 03:32:03 +02:00
2020-08-22 14:26:35 +02:00
publications {
2024-06-25 03:32:03 +02:00
mavenJava(MavenPublication) {
groupId = "de.tudbut"
version = System.getenv("TL_VERSION")
from components.java
2020-08-22 14:26:35 +02:00
}
}
2024-06-25 03:32:03 +02:00
2020-08-22 14:26:35 +02:00
repositories {
maven {
2024-06-25 03:32:03 +02:00
name = "Forgejo"
url = uri("https://git.tudbut.de/api/packages/TudbuT/maven")
2020-08-22 14:26:35 +02:00
credentials(HttpHeaderCredentials) {
2024-06-25 03:32:03 +02:00
name = "Authorization"
value = "token " + System.getenv("PUBLISH_TOKEN")
2020-08-22 14:26:35 +02:00
}
2024-06-25 03:32:03 +02:00
2020-08-22 14:26:35 +02:00
authentication {
header(HttpHeaderAuthentication)
}
}
}
}