2023-01-27 02:34:46 +00:00
|
|
|
|
|
|
|
plugins {
|
2024-02-28 07:36:31 +00:00
|
|
|
id 'org.beryx.jlink' version '3.0.1'
|
2024-03-21 05:28:19 +00:00
|
|
|
id "org.asciidoctor.jvm.convert" version "4.0.2"
|
2023-09-27 00:47:51 +00:00
|
|
|
id 'org.jreleaser' version '1.8.0'
|
2024-03-21 06:14:50 +00:00
|
|
|
id("com.netflix.nebula.ospackage") version "11.8.1"
|
2023-10-05 15:19:48 +00:00
|
|
|
id 'org.gradle.crypto.checksum' version '1.4.0'
|
2024-03-21 04:48:05 +00:00
|
|
|
id 'signing'
|
2023-01-27 02:34:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
}
|
|
|
|
|
|
|
|
task dist(type: DefaultTask) {}
|
|
|
|
|
|
|
|
|
|
|
|
distTar {
|
|
|
|
enabled = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
distZip {
|
|
|
|
enabled = false;
|
|
|
|
}
|
|
|
|
|
2024-01-03 09:15:53 +00:00
|
|
|
|
2023-10-05 15:58:54 +00:00
|
|
|
import org.gradle.crypto.checksum.Checksum
|
2024-01-03 09:15:53 +00:00
|
|
|
|
|
|
|
import java.util.stream.Collectors
|
|
|
|
|
2023-10-05 15:58:54 +00:00
|
|
|
def distDir = layout.buildDirectory.get().dir('dist')
|
|
|
|
task createChecksums(type: Checksum) {
|
|
|
|
inputFiles.setFrom(distDir.dir('artifacts').getAsFileTree().files)
|
2024-01-03 09:15:53 +00:00
|
|
|
outputDirectory.set(layout.buildDirectory.dir("dist/checksums/artifacts"))
|
2023-10-05 15:58:54 +00:00
|
|
|
checksumAlgorithm.set(Checksum.Algorithm.SHA256)
|
|
|
|
|
|
|
|
doLast {
|
2024-01-03 09:15:53 +00:00
|
|
|
def artifactChecksumsSha256Hex = new HashMap<String, String>()
|
|
|
|
for (final def file in outputDirectory.get().getAsFileTree().files) {
|
2024-03-21 04:48:05 +00:00
|
|
|
if (file.toString().endsWith('mapping.map') || file.toString().endsWith('.asc')) {
|
2024-01-18 17:15:35 +00:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2024-01-03 09:15:53 +00:00
|
|
|
def name = file.name.lastIndexOf('.').with {it != -1 ? file.name[0..<it] : file.name}
|
|
|
|
artifactChecksumsSha256Hex.put(name, file.text.trim())
|
2023-10-05 15:58:54 +00:00
|
|
|
}
|
2024-01-03 09:15:53 +00:00
|
|
|
|
|
|
|
file(layout.buildDirectory.dir("dist/checksums/sha256sums.txt")).text = artifactChecksumsSha256Hex.entrySet().stream()
|
|
|
|
.map(e -> e.getValue() + ' ' + e.getKey())
|
|
|
|
.collect(Collectors.joining('\n'))
|
2023-10-05 15:58:54 +00:00
|
|
|
}
|
|
|
|
}
|
2023-10-16 10:53:32 +00:00
|
|
|
|
2024-01-03 18:56:33 +00:00
|
|
|
def getArtifactChecksumSha256Hex(String name) {
|
|
|
|
var file = layout.buildDirectory.file("dist/checksums/artifacts/${name}.sha256")
|
|
|
|
return file.get().getAsFile().exists() ? file.get().getAsFile().text : "";
|
|
|
|
}
|
|
|
|
|
|
|
|
def getArtifactChecksumSha256Base64(String name) {
|
|
|
|
return Base64.getEncoder().encodeToString(HexFormat.of().parseHex(getArtifactChecksumSha256Hex(name)))
|
|
|
|
}
|
|
|
|
|
2023-10-16 10:53:32 +00:00
|
|
|
clean {
|
|
|
|
doFirst {
|
|
|
|
// Fix clean failing when file is read-only
|
|
|
|
if (file("$distDir").exists()) {
|
|
|
|
file("$distDir").traverse { f -> if (f.exists() && f.isFile()) f.writable = true }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-27 02:34:46 +00:00
|
|
|
apply from: 'base.gradle'
|
|
|
|
apply from: 'jpackage.gradle'
|
|
|
|
|
|
|
|
if (rootProject.fullVersion) {
|
2023-02-10 18:35:32 +00:00
|
|
|
apply from: 'cli.gradle'
|
2023-01-27 02:34:46 +00:00
|
|
|
apply from: 'portable.gradle'
|
|
|
|
apply from: 'proguard.gradle'
|
|
|
|
|
|
|
|
if (org.gradle.internal.os.OperatingSystem.current().isLinux()) {
|
|
|
|
apply from: 'linux_packages.gradle'
|
|
|
|
} else if (org.gradle.internal.os.OperatingSystem.current().isWindows()) {
|
|
|
|
apply from: 'msi.gradle'
|
|
|
|
} else if (org.gradle.internal.os.OperatingSystem.current().isMacOsX()) {
|
|
|
|
apply from: 'pkg.gradle'
|
|
|
|
}
|
|
|
|
|
2023-10-05 15:58:54 +00:00
|
|
|
apply from: 'jreleaser.gradle'
|
|
|
|
apply from: 'aur.gradle'
|
|
|
|
apply from: 'nix.gradle'
|
|
|
|
apply from: 'choco.gradle'
|
2024-03-09 03:56:54 +00:00
|
|
|
apply from: 'winget.gradle'
|
2024-02-28 07:36:31 +00:00
|
|
|
apply from: 'install.gradle'
|
2024-03-21 04:48:05 +00:00
|
|
|
|
|
|
|
signing {
|
|
|
|
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
|
|
|
|
}
|
|
|
|
|
|
|
|
task signArtifacts(type: Sign) {
|
|
|
|
def dir = layout.buildDirectory.dir("dist/artifacts").get()
|
|
|
|
dir.asFileTree.files.forEach {sign(it)}
|
|
|
|
}
|
|
|
|
|
|
|
|
task signChecksums(type: Sign) {
|
|
|
|
def checksums = layout.buildDirectory.file("dist/checksums/sha256sums.txt").get().asFile
|
|
|
|
sign(checksums)
|
|
|
|
}
|
2023-10-05 15:19:48 +00:00
|
|
|
}
|