Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d24c50393 | ||
|
|
c648326113 | ||
| f31cf2d860 | |||
| 01b23a1dfb | |||
| 7f668f800e | |||
| cf6ad1ade0 | |||
|
|
ce7c4a7cd8 | ||
|
|
833c86ad27 | ||
| f5ea7b05b4 | |||
| 0ac88bc52d | |||
| d7759d79d1 | |||
| e6abce764c | |||
| 44c468e546 | |||
| bc4524b77f | |||
| 4cf3fb6985 | |||
| 1683686742 | |||
| 557254b406 | |||
| 59f0ab4c58 | |||
| bff4d0812e | |||
| d6f8af4917 | |||
| c2dfd8f2cc | |||
| e80feef083 | |||
| 51558d568e | |||
| 8de493e4f6 | |||
| e5debdf436 | |||
| 5f5831c4a9 | |||
| 8f727cc262 | |||
| c26cad2ed4 | |||
| 32bfd089fd | |||
| b3bef7cd6d | |||
| cb39c7cea0 | |||
| f696e826fd | |||
| f4ab9741f3 | |||
| 607d45e4d3 | |||
| 3206412565 | |||
| 9f3b80ec31 | |||
| 04ce5522cd | |||
| e636032d13 | |||
| 9c7f7493ed | |||
| ec0106b334 |
@@ -15,18 +15,16 @@ max_line_length = 1024
|
||||
[*.bat]
|
||||
end_of_line = crlf
|
||||
|
||||
[*.sh]
|
||||
indent_size = 2
|
||||
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 }}
|
||||
30
README.md
30
README.md
@@ -4,7 +4,7 @@ Classes for the common, messages to share, Classes for the systems, harmonized i
|
||||
|
||||
## Releasing library
|
||||
|
||||
Run `release.sh` script from `master` branch.
|
||||
Run release pipeline from `master` branch.
|
||||
|
||||
## Publishing library
|
||||
|
||||
@@ -20,18 +20,22 @@ Run `release.sh` script from `master` branch.
|
||||
./gradlew clean build publish
|
||||
```
|
||||
|
||||
### Global gradle properties
|
||||
### Global Settings
|
||||
|
||||
To authenticate with Gradle to access repositories that require authentication, you can set your user and token in the `gradle.properties` file.
|
||||
This services rely on a set of global settings to configure development environments. These settings, managed through Gradle properties or environment variables.
|
||||
|
||||
Here's how you can do it:
|
||||
*Note: For more information on global properties, please refer to our [global settings](https://github.com/swordsteel/hlaeja-development/blob/master/doc/global_settings.md) documentation.*
|
||||
|
||||
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\`.
|
||||
2. Add the following lines to the `gradle.properties` file:
|
||||
```properties
|
||||
repository.user=your_user
|
||||
repository.token=your_token_value
|
||||
```
|
||||
or use environment variables `REPOSITORY_USER` and `REPOSITORY_TOKEN`
|
||||
#### Gradle Properties
|
||||
|
||||
```properties
|
||||
repository.user=your_user
|
||||
repository.token=your_token_value
|
||||
```
|
||||
|
||||
#### Environment Variables
|
||||
|
||||
```properties
|
||||
REPOSITORY_USER=your_user
|
||||
REPOSITORY_TOKEN=your_token_value
|
||||
```
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
alias(hlaeja.plugins.kotlin.jvm)
|
||||
alias(hlaeja.plugins.ltd.hlaeja.plugin.library)
|
||||
alias(hlaeja.plugins.library)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
kotlin.code.style=official
|
||||
version=0.1.0
|
||||
catalog=0.3.0
|
||||
version=0.11.0-SNAPSHOT
|
||||
catalog=0.12.0
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
9
gradlew
vendored
9
gradlew
vendored
@@ -86,8 +86,7 @@ done
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# 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
|
||||
' "$PWD" ) || exit
|
||||
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
|
||||
@@ -115,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.
|
||||
@@ -206,7 +205,7 @@ fi
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# * 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.
|
||||
@@ -214,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
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.
|
||||
|
||||
4
gradlew.bat
vendored
4
gradlew.bat
vendored
@@ -70,11 +70,11 @@ 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
|
||||
|
||||
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,24 @@
|
||||
package ltd.hlaeja.library.accountRegistry
|
||||
|
||||
import java.time.ZonedDateTime
|
||||
import java.util.UUID
|
||||
|
||||
object Account {
|
||||
|
||||
data class Request(
|
||||
val username: String,
|
||||
val password: CharSequence?,
|
||||
val enabled: Boolean,
|
||||
val roles: List<String>,
|
||||
) {
|
||||
override fun toString(): String = "Request(username=$username, password=******, enabled=$enabled, roles=$roles)"
|
||||
}
|
||||
|
||||
data class Response(
|
||||
val id: UUID,
|
||||
val timestamp: ZonedDateTime,
|
||||
val enabled: Boolean,
|
||||
val username: String,
|
||||
val roles: List<String>,
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package ltd.hlaeja.library.accountRegistry
|
||||
|
||||
object Authentication {
|
||||
data class Request(
|
||||
val username: String,
|
||||
val password: CharSequence,
|
||||
)
|
||||
|
||||
data class Response(
|
||||
val token: String,
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package ltd.hlaeja.library.accountRegistry.event
|
||||
|
||||
import java.util.UUID
|
||||
|
||||
data class AccountMessage(
|
||||
val userId: UUID,
|
||||
val change: List<String>,
|
||||
val timestamp: Long = System.currentTimeMillis(),
|
||||
)
|
||||
@@ -0,0 +1,17 @@
|
||||
package ltd.hlaeja.library.deviceConfiguration
|
||||
|
||||
import java.time.ZonedDateTime
|
||||
import java.util.UUID
|
||||
|
||||
object Node {
|
||||
|
||||
data class Request(
|
||||
val configuration: String,
|
||||
)
|
||||
|
||||
data class Response(
|
||||
val node: UUID,
|
||||
val timestamp: ZonedDateTime,
|
||||
val configuration: String,
|
||||
)
|
||||
}
|
||||
16
src/main/kotlin/ltd/hlaeja/library/deviceRegistry/Device.kt
Normal file
16
src/main/kotlin/ltd/hlaeja/library/deviceRegistry/Device.kt
Normal file
@@ -0,0 +1,16 @@
|
||||
package ltd.hlaeja.library.deviceRegistry
|
||||
|
||||
import java.util.UUID
|
||||
|
||||
object Device {
|
||||
|
||||
data class Request(
|
||||
val type: UUID,
|
||||
)
|
||||
|
||||
data class Response(
|
||||
val id: UUID,
|
||||
val type: UUID,
|
||||
val identity: String,
|
||||
)
|
||||
}
|
||||
13
src/main/kotlin/ltd/hlaeja/library/deviceRegistry/Devices.kt
Normal file
13
src/main/kotlin/ltd/hlaeja/library/deviceRegistry/Devices.kt
Normal file
@@ -0,0 +1,13 @@
|
||||
package ltd.hlaeja.library.deviceRegistry
|
||||
|
||||
import java.time.ZonedDateTime
|
||||
import java.util.UUID
|
||||
|
||||
object Devices {
|
||||
|
||||
data class Response(
|
||||
val id: UUID,
|
||||
val type: UUID,
|
||||
val timestamp: ZonedDateTime,
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package ltd.hlaeja.library.deviceRegistry
|
||||
|
||||
import java.io.Serializable
|
||||
import java.util.UUID
|
||||
|
||||
object Identity {
|
||||
|
||||
data class Response(
|
||||
val client: UUID,
|
||||
val node: UUID,
|
||||
val device: UUID,
|
||||
) : Serializable {
|
||||
companion object {
|
||||
@Suppress("ConstPropertyName")
|
||||
private const val serialVersionUID = 1L
|
||||
}
|
||||
}
|
||||
}
|
||||
19
src/main/kotlin/ltd/hlaeja/library/deviceRegistry/Node.kt
Normal file
19
src/main/kotlin/ltd/hlaeja/library/deviceRegistry/Node.kt
Normal file
@@ -0,0 +1,19 @@
|
||||
package ltd.hlaeja.library.deviceRegistry
|
||||
|
||||
import java.util.UUID
|
||||
|
||||
object Node {
|
||||
|
||||
data class Request(
|
||||
val client: UUID,
|
||||
val device: UUID,
|
||||
val name: String,
|
||||
)
|
||||
|
||||
data class Response(
|
||||
val id: UUID,
|
||||
val client: UUID,
|
||||
val device: UUID,
|
||||
val name: String,
|
||||
)
|
||||
}
|
||||
15
src/main/kotlin/ltd/hlaeja/library/deviceRegistry/Nodes.kt
Normal file
15
src/main/kotlin/ltd/hlaeja/library/deviceRegistry/Nodes.kt
Normal file
@@ -0,0 +1,15 @@
|
||||
package ltd.hlaeja.library.deviceRegistry
|
||||
|
||||
import java.time.ZonedDateTime
|
||||
import java.util.UUID
|
||||
|
||||
object Nodes {
|
||||
|
||||
data class Response(
|
||||
val id: UUID,
|
||||
val timestamp: ZonedDateTime,
|
||||
val client: UUID,
|
||||
val device: UUID,
|
||||
val name: String,
|
||||
)
|
||||
}
|
||||
19
src/main/kotlin/ltd/hlaeja/library/deviceRegistry/Type.kt
Normal file
19
src/main/kotlin/ltd/hlaeja/library/deviceRegistry/Type.kt
Normal file
@@ -0,0 +1,19 @@
|
||||
package ltd.hlaeja.library.deviceRegistry
|
||||
|
||||
import java.time.ZonedDateTime
|
||||
import java.util.UUID
|
||||
|
||||
object Type {
|
||||
|
||||
data class Request(
|
||||
val name: String,
|
||||
val description: String,
|
||||
)
|
||||
|
||||
data class Response(
|
||||
val id: UUID,
|
||||
val timestamp: ZonedDateTime,
|
||||
val name: String,
|
||||
val description: String,
|
||||
)
|
||||
}
|
||||
13
src/main/kotlin/ltd/hlaeja/library/deviceRegistry/Types.kt
Normal file
13
src/main/kotlin/ltd/hlaeja/library/deviceRegistry/Types.kt
Normal file
@@ -0,0 +1,13 @@
|
||||
package ltd.hlaeja.library.deviceRegistry
|
||||
|
||||
import java.time.ZonedDateTime
|
||||
import java.util.UUID
|
||||
|
||||
object Types {
|
||||
|
||||
data class Response(
|
||||
val id: UUID,
|
||||
val name: String,
|
||||
val timestamp: ZonedDateTime,
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user