From 0c657764dbc96845428dfd84340048203df5a98f Mon Sep 17 00:00:00 2001 From: Swordsteel Date: Tue, 10 Dec 2024 18:42:43 +0100 Subject: [PATCH] Add copyCertificates - update README.md with certificate plugin - add Ltd_hlaeja_plugin_hlaeja_common_plugin_certificate_gradle.kts --- README.md | 6 ++++++ ...hlaeja-common-plugin.certificate.gradle.kts | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 src/main/kotlin/ltd.hlaeja.plugin.hlaeja-common-plugin.certificate.gradle.kts diff --git a/README.md b/README.md index d13a4b6..273fe96 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,12 @@ id `ltd.hlaeja.plugin.hlaeja-common-plugin.service-process-resource` Assign values to `application.yml` from Gradle. +### Plugin Certificate + +id `ltd.hlaeja.plugin.hlaeja-common-plugin.cetificat` + +Copy certificate to build resources by placing one or more of `private_key.pem`, `public_key.pem`, or `keystore.p12` in `/cert` folder. + ## Releasing plugin Run `release.sh` script from `master` branch. diff --git a/src/main/kotlin/ltd.hlaeja.plugin.hlaeja-common-plugin.certificate.gradle.kts b/src/main/kotlin/ltd.hlaeja.plugin.hlaeja-common-plugin.certificate.gradle.kts new file mode 100644 index 0000000..23970cb --- /dev/null +++ b/src/main/kotlin/ltd.hlaeja.plugin.hlaeja-common-plugin.certificate.gradle.kts @@ -0,0 +1,18 @@ +val filesToCopy = listOf( + "private_key.pem", + "public_key.pem", + "keystore.p12", +) + +tasks { + register("copyCertificates") { + group = "hlaeja" + into("${layout.buildDirectory.get()}/resources/main/cert") + filesToCopy.filter { file("cert/$it").exists() } + .forEach { file -> + from("cert/$file") { + include(file) + } + } + } +}