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