更新 build.gradle.kts
This commit is contained in:
parent
fa25eff19f
commit
f995e5c25a
@ -1,6 +1,8 @@
|
||||
|
||||
import java.security.MessageDigest
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
|
||||
plugins {
|
||||
id("java")
|
||||
id("java-library")
|
||||
@ -22,6 +24,8 @@ group = GROUPSID
|
||||
version = VERSIONS
|
||||
|
||||
val libDir = rootDir.resolve("build").resolve("libs")
|
||||
val publicationsDir =
|
||||
rootDir.resolve("build").resolve("publications").resolve("mavenJava")
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
@ -32,7 +36,8 @@ dependencies {
|
||||
testImplementation(platform("org.junit:junit-bom:5.10.0"))
|
||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
||||
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
|
||||
implementation("org.checkerframework:checker-qual:3.43.0")
|
||||
implementation("org.jetbrains:annotations:24.0.0")
|
||||
annotationProcessor("org.jetbrains:annotations:24.0.0")
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
@ -49,15 +54,15 @@ private fun generateHash(file: File, string: String): String {
|
||||
}
|
||||
}
|
||||
|
||||
private fun getHash(file: File) {
|
||||
private fun getHash(outpath: String, file: File) {
|
||||
val md5 = generateHash(file, "MD5")
|
||||
val sha1 = generateHash(file, "SHA-1")
|
||||
val sha256 = generateHash(file, "SHA-256")
|
||||
val sha512 = generateHash(file, "SHA-512")
|
||||
val md5f = File(libDir, file.getName() + ".md5")
|
||||
val sha1f = File(libDir, file.getName() + ".sha1")
|
||||
val sha256f = File(libDir, file.getName() + ".sha256")
|
||||
val sha512f = File(libDir, file.getName() + ".sha512")
|
||||
val md5f = File(outpath, file.getName() + ".md5")
|
||||
val sha1f = File(outpath, file.getName() + ".sha1")
|
||||
val sha256f = File(outpath, file.getName() + ".sha256")
|
||||
val sha512f = File(outpath, file.getName() + ".sha512")
|
||||
md5f.writeText(md5)
|
||||
sha1f.writeText(sha1)
|
||||
sha256f.writeText(sha256)
|
||||
@ -125,11 +130,13 @@ tasks.register("build-jar") {
|
||||
dependsOn(tasks["sourcesJar"])
|
||||
dependsOn(tasks["generatePomFileForMavenJavaPublication"])
|
||||
dependsOn(tasks["generateMetadataFileForMavenJavaPublication"])
|
||||
/*doLast {
|
||||
getHash(File(libDir, jarName))
|
||||
getHash(File(libDir, fatJarName))
|
||||
getHash(File(libDir, srcJarName))
|
||||
}*/
|
||||
doLast {
|
||||
getHash(libDir.toString(),File(libDir, jarName))
|
||||
getHash(libDir.toString(),File(libDir, fatJarName))
|
||||
getHash(libDir.toString(),File(libDir, srcJarName))
|
||||
getHash(publicationsDir.toString(),File(publicationsDir, "module.json"))
|
||||
getHash(publicationsDir.toString(),File(publicationsDir, "pom-default.xml"))
|
||||
}
|
||||
}
|
||||
components {
|
||||
withType<AdhocComponentWithVariants>().configureEach {
|
||||
@ -155,3 +162,4 @@ publishing {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user