89 lines
2.1 KiB
Groovy
89 lines
2.1 KiB
Groovy
import java.nio.file.Paths
|
|
import java.nio.file.Files
|
|
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 {
|
|
}
|
|
|
|
test {
|
|
}
|
|
|
|
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()
|
|
}
|
|
}
|
|
|
|
jar {
|
|
doLast {
|
|
File jar = new File("build/libs/tuddylib.jar")
|
|
File loc = new File("TuddyLIB.jar")
|
|
loc.delete()
|
|
Files.copy(jar.toPath(), loc.toPath())
|
|
}
|
|
}
|
|
|
|
//jar.dependsOn("javadoc")
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
mavenJava(MavenPublication) {
|
|
groupId = "de.tudbut"
|
|
version = System.getenv("TL_VERSION")
|
|
from components.java
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
maven {
|
|
name = "Forgejo"
|
|
url = uri("https://git.tudbut.de/api/packages/TudbuT/maven")
|
|
|
|
credentials(HttpHeaderCredentials) {
|
|
name = "Authorization"
|
|
value = "token " + System.getenv("PUBLISH_TOKEN")
|
|
}
|
|
|
|
authentication {
|
|
header(HttpHeaderAuthentication)
|
|
}
|
|
}
|
|
}
|
|
}
|