Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1cddac917a | ||
| 4ace501f82 | |||
| 092252a2f9 | |||
| 1abdb6fe18 | |||
| 7f02ac6b26 | |||
| d808fe3573 | |||
| 8bb23a7d55 | |||
| 684b4c001e | |||
| 7fbf278fc4 | |||
| 0c657764db | |||
| 867b07575c | |||
| 9cae6198ad |
@@ -21,12 +21,14 @@ tab_width = 2
|
||||
|
||||
# noinspection EditorConfigKeyCorrectness
|
||||
[*.{kt,kts}]
|
||||
ij_kotlin_packages_to_use_import_on_demand = unset
|
||||
ij_kotlin_allow_trailing_comma_on_call_site = true
|
||||
ij_kotlin_allow_trailing_comma = true
|
||||
ktlint_standard_import-ordering = disabled
|
||||
ktlint_standard_no-empty-first-line-in-class-body = disabled
|
||||
ij_kotlin_allow_trailing_comma_on_call_site = true
|
||||
ij_kotlin_packages_to_use_import_on_demand = unset
|
||||
ktlint_standard_chain-method-continuation = disabled
|
||||
ktlint_standard_class-signature = disabled
|
||||
ktlint_standard_function-signature = disabled
|
||||
ktlint_standard_parameter-list-wrapping = disabled
|
||||
ktlint_standard_import-ordering = disabled
|
||||
ktlint_standard_multiline-expression-wrapping = disabled
|
||||
ktlint_standard_no-empty-first-line-in-class-body = disabled
|
||||
ktlint_standard_parameter-list-wrapping = disabled
|
||||
ktlint_standard_string-template-indent = disabled
|
||||
|
||||
12
.github/workflows/release.yml
vendored
Normal file
12
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
release:
|
||||
uses: swordsteel/hlaeja-common-workflows/.github/workflows/release.yml@master
|
||||
secrets:
|
||||
CI_BOT_PAT: ${{ secrets.CI_BOT_PAT }}
|
||||
with:
|
||||
TYPE: artifact
|
||||
12
.github/workflows/run-checks.yml
vendored
Normal file
12
.github/workflows/run-checks.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
name: Pull request validation
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- '.github/**'
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
uses: swordsteel/hlaeja-common-workflows/.github/workflows/run-checks.yml@master
|
||||
secrets:
|
||||
CI_BOT_PAT: ${{ secrets.CI_BOT_PAT }}
|
||||
@@ -92,9 +92,15 @@ 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.
|
||||
Run release pipeline from `master` branch.
|
||||
|
||||
## Publishing plugin
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import io.gitlab.arturbosch.detekt.Detekt
|
||||
import io.gitlab.arturbosch.detekt.extensions.DetektExtension.Companion.DEFAULT_SRC_DIR_KOTLIN
|
||||
import java.lang.System.getenv
|
||||
|
||||
plugins {
|
||||
alias(hlaeja.plugins.io.gitlab.arturbosch.detekt)
|
||||
alias(hlaeja.plugins.gradle.detekt)
|
||||
alias(hlaeja.plugins.kotlin.jvm)
|
||||
alias(hlaeja.plugins.ltd.hlaeja.plugin.core)
|
||||
alias(hlaeja.plugins.core)
|
||||
|
||||
`kotlin-dsl`
|
||||
`maven-publish`
|
||||
@@ -39,18 +38,12 @@ kotlin.compilerOptions.freeCompilerArgs.addAll("-Xjsr305=strict")
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
|
||||
fun retrieveConfiguration(
|
||||
property: String,
|
||||
environment: String,
|
||||
): String? = project.findProperty(property)?.toString() ?: getenv(environment)
|
||||
|
||||
maven {
|
||||
url = uri("https://maven.pkg.github.com/swordsteel/${project.name}")
|
||||
name = "GitHubPackages"
|
||||
credentials {
|
||||
username = retrieveConfiguration("repository.user", "REPOSITORY_USER")
|
||||
password = retrieveConfiguration("repository.token", "REPOSITORY_TOKEN")
|
||||
username = config.find("repository.user", "REPOSITORY_USER")
|
||||
password = config.find("repository.token", "REPOSITORY_TOKEN")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
kotlin.code.style=official
|
||||
version=0.1.0
|
||||
catalog=0.2.0
|
||||
version=0.3.0
|
||||
catalog=0.11.0
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
5
gradle/wrapper/gradle-wrapper.properties
vendored
5
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,7 @@
|
||||
#Mon Oct 21 14:08:46 BST 2024
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
47
gradlew
vendored
Normal file → Executable file
47
gradlew
vendored
Normal file → Executable file
@@ -15,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@@ -55,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -80,13 +82,11 @@ do
|
||||
esac
|
||||
done
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -114,7 +114,7 @@ case "$( uname )" in #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
CLASSPATH="\\\"\\\""
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
@@ -133,22 +133,29 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -193,18 +200,28 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
|
||||
41
gradlew.bat
vendored
41
gradlew.bat
vendored
@@ -13,8 +13,10 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@@ -25,7 +27,8 @@
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@@ -40,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
@@ -56,32 +59,34 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
set CLASSPATH=
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
89
release.sh
89
release.sh
@@ -1,89 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
### This should be a pipeline, but for this example let use this ###
|
||||
|
||||
check_active_branch() {
|
||||
if [ "$(git rev-parse --abbrev-ref HEAD)" != "$1" ]; then
|
||||
echo "Error: The current branch is not $1."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_uncommitted_changes() {
|
||||
if [ -n "$(git status --porcelain)" ]; then
|
||||
echo "Error: There are uncommitted changes in the repository."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
prepare_environment() {
|
||||
git fetch origin
|
||||
}
|
||||
|
||||
check_last_commit() {
|
||||
last_commit_message=$(git log -1 --pretty=format:%s)
|
||||
if [ "$last_commit_message" = "[RELEASE] - bump version" ]; then
|
||||
echo "Warning: Nothing to release!!!"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_differences() {
|
||||
if ! git diff --quiet origin/"$1" "$1"; then
|
||||
echo "Error: The branches origin/$1 and $1 have differences."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
un_snapshot_version() {
|
||||
sed -i "s/\($1\s*=\s*[0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/" gradle.properties
|
||||
}
|
||||
|
||||
current_version() {
|
||||
awk -F '=' '/version\s*=\s*[0-9.]*/ {gsub(/^ +| +$/,"",$2); print $2}' gradle.properties
|
||||
}
|
||||
|
||||
stage_files() {
|
||||
for file in "$@"; do
|
||||
if git diff --exit-code --quiet -- "$file"; then
|
||||
echo "No changes in $file"
|
||||
else
|
||||
git add "$file"
|
||||
echo "Changes in $file staged for commit"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
commit_change() {
|
||||
stage_files gradle.properties
|
||||
git commit -m "[RELEASE] - $1"
|
||||
git push --porcelain origin master
|
||||
}
|
||||
|
||||
add_release_tag() {
|
||||
gitTag="v$(current_version)"
|
||||
git tag -a "$gitTag" -m "Release version $gitTag"
|
||||
git push --porcelain origin "$gitTag"
|
||||
}
|
||||
|
||||
snapshot_version() {
|
||||
new_version="$(current_version | awk -F '.' '{print $1 "." $2+1 ".0"}')"
|
||||
sed -i "s/\(version\s*=\s*\)[0-9.]*/\1$new_version-SNAPSHOT/" gradle.properties
|
||||
}
|
||||
|
||||
# check and prepare for release
|
||||
check_active_branch master
|
||||
check_uncommitted_changes
|
||||
prepare_environment
|
||||
check_last_commit
|
||||
check_differences master
|
||||
|
||||
# un-snapshot version for release
|
||||
un_snapshot_version version
|
||||
un_snapshot_version catalog
|
||||
|
||||
# release changes and prepare for next release
|
||||
commit_change "release version: $(current_version)"
|
||||
add_release_tag
|
||||
snapshot_version
|
||||
commit_change 'bump version'
|
||||
@@ -0,0 +1,18 @@
|
||||
val filesToCopy = listOf(
|
||||
"private_key.pem",
|
||||
"public_key.pem",
|
||||
"keystore.p12",
|
||||
)
|
||||
|
||||
tasks {
|
||||
register<Copy>("copyCertificates") {
|
||||
group = "hlaeja"
|
||||
into("${layout.buildDirectory.get()}/resources/main/cert")
|
||||
filesToCopy.filter { file("cert/$it").exists() }
|
||||
.forEach { file ->
|
||||
from("cert/$file") {
|
||||
include(file)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +1,16 @@
|
||||
import java.lang.System.getenv
|
||||
|
||||
plugins {
|
||||
id("ltd.hlaeja.plugin.hlaeja-core-plugin")
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
|
||||
fun retrieveConfiguration(
|
||||
property: String,
|
||||
environment: String,
|
||||
): String? = project.findProperty(property)?.toString() ?: getenv(environment)
|
||||
|
||||
maven {
|
||||
url = uri("https://maven.pkg.github.com/swordsteel/${project.name}")
|
||||
name = "GitHubPackages"
|
||||
credentials {
|
||||
username = retrieveConfiguration("repository.user", "REPOSITORY_USER")
|
||||
password = retrieveConfiguration("repository.token", "REPOSITORY_TOKEN")
|
||||
username = config.find("repository.user", "REPOSITORY_USER")
|
||||
password = config.find("repository.token", "REPOSITORY_TOKEN")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,22 +4,16 @@ import com.bmuschko.gradle.docker.tasks.container.DockerStopContainer
|
||||
import com.bmuschko.gradle.docker.tasks.network.DockerCreateNetwork
|
||||
import com.bmuschko.gradle.docker.tasks.network.DockerInspectNetwork
|
||||
import com.bmuschko.gradle.docker.tasks.network.DockerRemoveNetwork
|
||||
import java.lang.System.getenv
|
||||
|
||||
plugins {
|
||||
id("ltd.hlaeja.plugin.hlaeja-core-plugin")
|
||||
id("com.bmuschko.docker-spring-boot-application")
|
||||
}
|
||||
|
||||
fun configuration(
|
||||
property: String,
|
||||
environment: String,
|
||||
default: String,
|
||||
): String = project.findProperty(property)?.toString() ?: getenv(environment) ?: default
|
||||
|
||||
fun configurationPorts(
|
||||
property: String,
|
||||
environment: String,
|
||||
): List<String> = configuration(property, environment, "8080").split(',')
|
||||
): List<String> = config.findOrDefault(property, environment, "8080").split(',')
|
||||
|
||||
fun exposeDockerPorts(): List<Int> = configurationPorts("docker.port.expose", "DOCKER_PORT_EXPOSE")
|
||||
.mapNotNull { it.toIntOrNull() }
|
||||
@@ -40,9 +34,12 @@ tasks {
|
||||
targetImageId("${project.name}:${project.version}")
|
||||
containerName.set(project.name)
|
||||
hostConfig.autoRemove.set(true)
|
||||
hostConfig.network.set(configuration("container.network", "CONTAINER_NETWORK", "develop"))
|
||||
hostConfig.network.set(config.findOrDefault("container.network", "CONTAINER_NETWORK", "develop"))
|
||||
hostConfig.portBindings.set(exposeContainerPorts())
|
||||
withEnvVar("SPRING_PROFILES_ACTIVE", configuration("container.profiles", "CONTAINER_PROFILES", "docker"))
|
||||
withEnvVar(
|
||||
"SPRING_PROFILES_ACTIVE",
|
||||
config.findOrDefault("container.profiles", "CONTAINER_PROFILES", "docker")
|
||||
)
|
||||
}
|
||||
register("containerStart", DockerStartContainer::class) {
|
||||
group = "hlaeja"
|
||||
@@ -55,15 +52,15 @@ tasks {
|
||||
}
|
||||
register("containerNetworkCheck", DockerInspectNetwork::class) {
|
||||
group = "hlaeja"
|
||||
targetNetworkId(configuration("container.network", "CONTAINER_NETWORK", "develop"))
|
||||
targetNetworkId(config.findOrDefault("container.network", "CONTAINER_NETWORK", "develop"))
|
||||
onError { println("Network does not exist.") }
|
||||
}
|
||||
register("containerNetworkCreate", DockerCreateNetwork::class) {
|
||||
group = "hlaeja"
|
||||
networkName.set(configuration("container.network", "CONTAINER_NETWORK", "develop"))
|
||||
networkName.set(config.findOrDefault("container.network", "CONTAINER_NETWORK", "develop"))
|
||||
}
|
||||
register("containerNetworkRemove", DockerRemoveNetwork::class) {
|
||||
group = "hlaeja"
|
||||
targetNetworkId(configuration("container.network", "CONTAINER_NETWORK", "develop"))
|
||||
targetNetworkId(config.findOrDefault("container.network", "CONTAINER_NETWORK", "develop"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
plugins {
|
||||
id("idea")
|
||||
|
||||
kotlin("jvm")
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun DependencyHandler.integrationTestImplementation(
|
||||
dependencyNotation: Any,
|
||||
): Dependency? = add("integrationTestImplementation", dependencyNotation)
|
||||
|
||||
@Suppress("unused")
|
||||
fun DependencyHandler.integrationTestRuntimeOnly(
|
||||
dependencyNotation: Any,
|
||||
): Dependency? = add("integrationTestRuntimeOnly", dependencyNotation)
|
||||
|
||||
sourceSets.create("integration-test") {
|
||||
compileClasspath += sourceSets["main"].output
|
||||
runtimeClasspath += sourceSets["main"].output
|
||||
idea.module {
|
||||
testSources.from(sourceSets["integration-test"].kotlin.srcDirs, sourceSets["integration-test"].java.srcDirs)
|
||||
testResources.from(sourceSets["integration-test"].resources.srcDirs)
|
||||
}
|
||||
configurations.let {
|
||||
it["integrationTestImplementation"].extendsFrom(configurations.implementation.get())
|
||||
it["integrationTestRuntimeOnly"].extendsFrom(configurations.runtimeOnly.get())
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
register<Test>("integrationTest") {
|
||||
description = "Runs integration tests."
|
||||
group = "verification"
|
||||
testClassesDirs = sourceSets["integration-test"].output.classesDirs
|
||||
classpath = sourceSets["integration-test"].runtimeClasspath
|
||||
}
|
||||
check { dependsOn(getByName("integrationTest")) }
|
||||
}
|
||||
@@ -6,14 +6,16 @@ plugins {
|
||||
|
||||
tasks {
|
||||
withType<ProcessResources> {
|
||||
val projectName = project.name
|
||||
val projectVersion = project.version
|
||||
filesMatching("**/application.yml") {
|
||||
filter {
|
||||
it.replace(
|
||||
"%APP_NAME%",
|
||||
project.name.split("-").joinToString(" ") { word -> word.uppercaseFirstChar() },
|
||||
projectName.split("-").joinToString(" ") { word -> word.uppercaseFirstChar() },
|
||||
)
|
||||
}
|
||||
filter { it.replace("%APP_VERSION%", project.version as String) }
|
||||
filter { it.replace("%APP_VERSION%", projectVersion as String) }
|
||||
filter { it.replace("%APP_BUILD_TIME%", info.utcTimestamp) }
|
||||
filter { it.replace("%APP_BUILD_OS_NAME%", System.getProperty("os.name")) }
|
||||
filter { it.replace("%APP_BUILD_OS_VERSION%", System.getProperty("os.version")) }
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
plugins {
|
||||
id("idea")
|
||||
|
||||
kotlin("jvm")
|
||||
}
|
||||
|
||||
@Suppress("unused")
|
||||
fun DependencyHandler.testIntegrationImplementation(
|
||||
dependencyNotation: Any,
|
||||
): Dependency? = add("testIntegrationImplementation", dependencyNotation)
|
||||
|
||||
@Suppress("unused")
|
||||
fun DependencyHandler.testIntegrationRuntimeOnly(
|
||||
dependencyNotation: Any,
|
||||
): Dependency? = add("testIntegrationRuntimeOnly", dependencyNotation)
|
||||
|
||||
sourceSets.create("test-integration") {
|
||||
compileClasspath += sourceSets["main"].output
|
||||
runtimeClasspath += sourceSets["main"].output
|
||||
idea.module {
|
||||
testSources.from(sourceSets["test-integration"].kotlin.srcDirs, sourceSets["test-integration"].java.srcDirs)
|
||||
testResources.from(sourceSets["test-integration"].resources.srcDirs)
|
||||
}
|
||||
configurations.let {
|
||||
it["testIntegrationImplementation"].extendsFrom(configurations.implementation.get())
|
||||
it["testIntegrationRuntimeOnly"].extendsFrom(configurations.runtimeOnly.get())
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
register<Test>("testIntegration") {
|
||||
description = "Runs test integration."
|
||||
group = "verification"
|
||||
testClassesDirs = sourceSets["test-integration"].output.classesDirs
|
||||
classpath = sourceSets["test-integration"].runtimeClasspath
|
||||
}
|
||||
check { dependsOn(getByName("testIntegration")) }
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
id("ltd.hlaeja.plugin.hlaeja-common-plugin.common")
|
||||
id("ltd.hlaeja.plugin.hlaeja-common-plugin.service-container")
|
||||
id("ltd.hlaeja.plugin.hlaeja-common-plugin.service-integration-test")
|
||||
id("ltd.hlaeja.plugin.hlaeja-common-plugin.service-process-resource")
|
||||
id("ltd.hlaeja.plugin.hlaeja-common-plugin.service-test-integration")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user