Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d51d446671 | ||
|
|
2ffabb8ff8 | ||
| 8d0f949a69 | |||
| 2862ead9fc | |||
|
|
69a73a228b | ||
|
|
1cddac917a | ||
| 4ace501f82 | |||
| 092252a2f9 | |||
| 1abdb6fe18 | |||
| 7f02ac6b26 | |||
| d808fe3573 | |||
| 8bb23a7d55 | |||
| 684b4c001e |
@@ -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: plugin
|
||||
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 }}
|
||||
100
README.md
100
README.md
@@ -2,72 +2,108 @@
|
||||
|
||||
Plugins for the libraries, lofty and grand, Plugins for the services, steadfast as stone, Plugins for the common, bound to their fate, Using the one plugin to rule them all, and in automation bind them, In the realm of code, where the builds take form.
|
||||
|
||||
<!-- TOC -->
|
||||
* [Hlæja Common Plugin](#hlæja-common-plugin)
|
||||
* [Plugins](#plugins)
|
||||
* [Common](#common)
|
||||
* [Plugin Common](#plugin-common)
|
||||
* [Gradle Tasks](#gradle-tasks)
|
||||
* [Plugin Common Detekt](#plugin-common-detekt)
|
||||
* [Plugin Common Ktlint](#plugin-common-ktlint)
|
||||
* [Library](#library)
|
||||
* [Plugin Library](#plugin-library)
|
||||
* [Plugin Library Manifest](#plugin-library-manifest)
|
||||
* [Plugin Library publish](#plugin-library-publish)
|
||||
* [Service](#service)
|
||||
* [Plugin Service](#plugin-service)
|
||||
* [Plugin Service Container](#plugin-service-container)
|
||||
* [Configuration](#configuration)
|
||||
* [Gradle Tasks](#gradle-tasks-1)
|
||||
* [Plugin Service Test Integration](#plugin-service-test-integration)
|
||||
* [Plugin Service Process Resource](#plugin-service-process-resource)
|
||||
* [Plugin Certificate](#plugin-certificate)
|
||||
* [UI Service](#ui-service)
|
||||
* [Plugin UI Service](#plugin-ui-service)
|
||||
* [Plugin UI Service Thymeleaf Minify](#plugin-ui-service-thymeleaf-minify)
|
||||
* [Releasing Plugin](#releasing-plugin)
|
||||
* [Publishing plugin](#publishing-plugin)
|
||||
* [Publish plugin locally](#publish-plugin-locally)
|
||||
* [Publish plugin to repository](#publish-plugin-to-repository)
|
||||
* [Global gradle properties](#global-gradle-properties)
|
||||
<!-- TOC -->
|
||||
|
||||
## Plugins
|
||||
|
||||
### Plugin Common
|
||||
### Common
|
||||
|
||||
#### Plugin Common
|
||||
|
||||
id `ltd.hlaeja.plugin.hlaeja-common-plugin.common`
|
||||
|
||||
Set core Java and Kotlin settings and overweight project version with git version.
|
||||
|
||||
#### Gradle Tasks
|
||||
##### Gradle Tasks
|
||||
|
||||
* `buildInfo` display name and version, add to `build` task.
|
||||
* `projectInfo` display project, Gradle, and Java information
|
||||
|
||||
### Plugin Common Detekt
|
||||
#### Plugin Common Detekt
|
||||
|
||||
id `ltd.hlaeja.plugin.hlaeja-common-plugin.common-detekt`
|
||||
|
||||
Detect is a code smell analysis for your Kotlin projects.
|
||||
|
||||
### Plugin Common Ktlint
|
||||
#### Plugin Common Ktlint
|
||||
|
||||
id `ltd.hlaeja.plugin.hlaeja-common-plugin.common-ktlint`
|
||||
|
||||
Ktlint enforces consistent code style and formatting across Kotlin codebases.
|
||||
|
||||
### Plugin Library
|
||||
### Library
|
||||
|
||||
#### Plugin Library
|
||||
|
||||
id `ltd.hlaeja.plugin.hlaeja-common-plugin.library`
|
||||
|
||||
Default setting and tasks for libraries.
|
||||
|
||||
### Plugin Library Manifest
|
||||
#### Plugin Library Manifest
|
||||
|
||||
id `ltd.hlaeja.plugin.hlaeja-common-plugin.library-manifest`
|
||||
|
||||
Extend manifest in library jar file.
|
||||
|
||||
### Plugin Library publish
|
||||
#### Plugin Library publish
|
||||
|
||||
id `ltd.hlaeja.plugin.hlaeja-common-plugin.library-publish`
|
||||
|
||||
Configuration for publishing project artifacts to a remote Maven repository.
|
||||
|
||||
### Plugin Service
|
||||
### Service
|
||||
|
||||
#### Plugin Service
|
||||
|
||||
id `ltd.hlaeja.plugin.hlaeja-common-plugin.service`
|
||||
|
||||
Default setting and tasks for services.
|
||||
|
||||
### Plugin Service Container
|
||||
#### Plugin Service Container
|
||||
|
||||
id `ltd.hlaeja.plugin.hlaeja-common-plugin.service-container`
|
||||
|
||||
Configuration for running project in docker locally during development.
|
||||
|
||||
#### Configuration
|
||||
##### Configuration
|
||||
|
||||
* properties `container.network`, environment `CONTAINER_NETWORK`, or default `develop`
|
||||
* properties `container.port.expose`, environment `CONTAINER_PORT_EXPOSE`, or default `8080`
|
||||
* properties `container.port.host`, environment `CONTAINER_PORT_HOST`, or default `8080`
|
||||
* properties `container.profiles`, environment `CONTAINER_PROFILES`, or default `docker`
|
||||
* properties `docker.port.expose`, environment `DOCKER_PORT_EXPOSE`, or default `8080`
|
||||
* properties `docker.port.expose`, environment `DOCKER_PORT_EXPOSE`, or default `8080`
|
||||
|
||||
container and docker ports can be a single port (e.g., 8080) or multiple ports separated by commas (e.g., 8080,8443)
|
||||
|
||||
#### Gradle Tasks
|
||||
##### Gradle Tasks
|
||||
|
||||
* `containerCreate` create docker container with network and spring boot profile.
|
||||
* `containerStart` starts docker container.
|
||||
@@ -76,31 +112,45 @@ container and docker ports can be a single port (e.g., 8080) or multiple ports s
|
||||
* `containerNetworkCreate` creates network.
|
||||
* `containerNetworkRemove` removes network.
|
||||
|
||||
### Plugin Service Integration Test
|
||||
#### Plugin Service Test Integration
|
||||
|
||||
id `ltd.hlaeja.plugin.hlaeja-common-plugin.service-integration-test`
|
||||
id `ltd.hlaeja.plugin.hlaeja-common-plugin.service-test-integration`
|
||||
|
||||
Adding task `integrationTest` to run integration test, add to `verification` group and add to task `check`.
|
||||
Adding task `testIntegration` to run integration test, add to `verification` group and add to task `check`.
|
||||
|
||||
Adding intellij support `src/integration-test/java`, `src/integration-test/kotlin`, and `src/integration-test/resources` as test module in intellij.
|
||||
Adding intellij support `src/test-integration/java`, `src/test-integration/kotlin`, and `src/test-integration/resources` as test module in intellij.
|
||||
|
||||
Adding dependencies support `integrationTestImplementation()`, and `integrationTestRuntimeOnly()` as part of Gradle.
|
||||
Adding dependencies support `testIntegrationImplementation()`, and `testIntegrationRuntimeOnly()` as part of Gradle.
|
||||
|
||||
### Plugin Service Process Resource
|
||||
#### Plugin Service Process Resource
|
||||
|
||||
id `ltd.hlaeja.plugin.hlaeja-common-plugin.service-process-resource`
|
||||
|
||||
Assign values to `application.yml` from Gradle.
|
||||
|
||||
### Plugin Certificate
|
||||
#### 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.
|
||||
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
|
||||
### UI Service
|
||||
|
||||
Run `release.sh` script from `master` branch.
|
||||
#### Plugin UI Service
|
||||
|
||||
id `ltd.hlaeja.plugin.hlaeja-common-plugin.ui-service`
|
||||
|
||||
Default setting and tasks for thymeleaf ui services.
|
||||
|
||||
#### Plugin UI Service Thymeleaf Minify
|
||||
|
||||
id `ltd.hlaeja.plugin.hlaeja-common-plugin.ui-service-thymeleaf.minify`
|
||||
|
||||
minimize all templates files during processResources. skips html tags pre, textarea, script, style, and template
|
||||
|
||||
## Releasing Plugin
|
||||
|
||||
Run release pipeline from `master` branch.
|
||||
|
||||
## Publishing plugin
|
||||
|
||||
@@ -113,7 +163,7 @@ Run `release.sh` script from `master` branch.
|
||||
### Publish plugin to repository
|
||||
|
||||
```shell
|
||||
./gradlew clean build publish
|
||||
./gradlew clean build publishAllPublicationsToGitHubPackagesRepository
|
||||
```
|
||||
|
||||
### Global gradle properties
|
||||
@@ -123,8 +173,8 @@ To authenticate with Gradle to access repositories that require authentication,
|
||||
Here's how you can do it:
|
||||
|
||||
1. Open or create the `gradle.properties` file in your Gradle user home directory:
|
||||
- On Unix-like systems (Linux, macOS), this directory is typically `~/.gradle/`.
|
||||
- On Windows, this directory is typically `C:\Users\<YourUsername>\.gradle\`.
|
||||
- On Unix-like systems (Linux, macOS), this directory is typically `~/.gradle/`.
|
||||
- On Windows, this directory is typically `C:\Users\<YourUsername>\.gradle\`.
|
||||
2. Add the following lines to the `gradle.properties` file:
|
||||
```properties
|
||||
repository.user=your_user
|
||||
|
||||
@@ -2,9 +2,9 @@ import io.gitlab.arturbosch.detekt.Detekt
|
||||
import io.gitlab.arturbosch.detekt.extensions.DetektExtension.Companion.DEFAULT_SRC_DIR_KOTLIN
|
||||
|
||||
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`
|
||||
@@ -47,7 +47,6 @@ publishing {
|
||||
}
|
||||
}
|
||||
}
|
||||
publications.create<MavenPublication>("mavenJava") { from(components["java"]) }
|
||||
}
|
||||
|
||||
tasks {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
kotlin.code.style=official
|
||||
version=0.2.0
|
||||
catalog=0.6.0
|
||||
version=0.5.0-SNAPSHOT
|
||||
catalog=0.12.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'
|
||||
@@ -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")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import kotlin.text.RegexOption.IGNORE_CASE
|
||||
|
||||
tasks {
|
||||
register("minifyTemplates") {
|
||||
val srcTemplates = file("src/main/resources/templates")
|
||||
val outTemplates = layout.buildDirectory.dir("resources/main/templates")
|
||||
val preserveTags = listOf("pre", "textarea", "script", "style", "template")
|
||||
inputs.dir(srcTemplates)
|
||||
outputs.dir(outTemplates)
|
||||
doLast {
|
||||
fileTree(srcTemplates).matching { include("**/*.html") }
|
||||
.forEach { srcFile ->
|
||||
val preserve = preserveTags.joinToString("|")
|
||||
val preservedBlocks = mutableListOf<String>()
|
||||
Regex("<(?:$preserve)\\b[^>]*>[\\s\\S]*?<\\/\\s*(?:$preserve)>", IGNORE_CASE)
|
||||
.replace(srcFile.readText()) {
|
||||
val id = preservedBlocks.size
|
||||
preservedBlocks += it.value
|
||||
"%%%PRESERVE_BLOCK_$id%%%"
|
||||
}
|
||||
.replace(Regex("<!--([\\s\\S]*?)-->"), "")
|
||||
.replace(Regex("[\\r\\n]+"), "")
|
||||
.replace(Regex("\\s{2,}"), " ")
|
||||
.replace(Regex(">\\s+<"), "><")
|
||||
.replace(Regex("\\s*%%%PRESERVE_BLOCK_(\\d+)%%%\\s*")) {
|
||||
preservedBlocks[it.groupValues[1].toInt()]
|
||||
}
|
||||
.let { stripped ->
|
||||
outTemplates.get().asFile.resolve(srcFile.relativeTo(srcTemplates)).also { file ->
|
||||
file.parentFile.mkdirs()
|
||||
file.writeText(stripped)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
named<ProcessResources>("processResources") {
|
||||
exclude("templates/**")
|
||||
dependsOn(findByPath("minifyTemplates"))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
plugins {
|
||||
id("ltd.hlaeja.plugin.hlaeja-common-plugin.service")
|
||||
id("ltd.hlaeja.plugin.hlaeja-common-plugin.ui-service-thymeleaf-minify")
|
||||
}
|
||||
Reference in New Issue
Block a user