85 lines
2 KiB
Groovy
85 lines
2 KiB
Groovy
|
import java.nio.file.Paths
|
||
|
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 {
|
||
|
implementation 'org.jetbrains:annotations:20.1.0'
|
||
|
implementation 'junit:junit:4.13.1'
|
||
|
implementation 'org.junit.jupiter:junit-jupiter:5.7.0'
|
||
|
}
|
||
|
|
||
|
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()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
jar {
|
||
|
doLast {
|
||
|
File jar = new File("build/libs/tuddylib.jar")
|
||
|
File loc = new File("TuddyLIB.jar")
|
||
|
jar.renameTo(loc)
|
||
|
|
||
|
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.dependsOn("javadoc")
|
||
|
|
||
|
publishing {
|
||
|
publications {
|
||
|
maven(MavenPublication) {
|
||
|
artifact('TuddyLIB.jar')
|
||
|
}
|
||
|
}
|
||
|
repositories {
|
||
|
maven {
|
||
|
url = "${System.getenv('CI_API_V4_URL')}/groups/<group>/-/packages/maven"
|
||
|
name = "GitLab"
|
||
|
credentials(HttpHeaderCredentials) {
|
||
|
name = 'Job-Token'
|
||
|
value = System.getenv("CI_JOB_TOKEN")
|
||
|
}
|
||
|
authentication {
|
||
|
header(HttpHeaderAuthentication)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|