Compare commits
12 Commits
conflux@1.
...
release@1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
1e8fdb52dd
|
|||
|
3d2cf37a17
|
|||
|
e2d08d7b70
|
|||
|
e8e6a24065
|
|||
|
ad8c2a6752
|
|||
|
c2c1e26a7c
|
|||
|
5d8e533eff
|
|||
|
432b705327
|
|||
|
4968cc516d
|
|||
|
02cd2acd6e
|
|||
|
90d4e063af
|
|||
|
288fbfe0cc
|
13
.classpath
13
.classpath
@@ -6,12 +6,6 @@
|
|||||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="src" output="bin/main" path="src/main/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="gradle_scope" value="main"/>
|
|
||||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="bin/test" path="src/test/java">
|
<classpathentry kind="src" output="bin/test" path="src/test/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="gradle_scope" value="test"/>
|
<attribute name="gradle_scope" value="test"/>
|
||||||
@@ -19,13 +13,6 @@
|
|||||||
<attribute name="test" value="true"/>
|
<attribute name="test" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="src" output="bin/test" path="src/test/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="gradle_scope" value="test"/>
|
|
||||||
<attribute name="gradle_used_by_scope" value="test"/>
|
|
||||||
<attribute name="test" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21/"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21/"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
||||||
<classpathentry kind="output" path="bin/default"/>
|
<classpathentry kind="output" path="bin/default"/>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ name: Release
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- 'conflux@*'
|
- 'release@*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
@@ -12,6 +12,8 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set up Java 21
|
- name: Set up Java 21
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
@@ -38,9 +40,50 @@ jobs:
|
|||||||
name: conflux
|
name: conflux
|
||||||
path: build/libs/*.jar
|
path: build/libs/*.jar
|
||||||
|
|
||||||
|
- name: Generate release notes
|
||||||
|
id: notes
|
||||||
|
run: |
|
||||||
|
current_tag="${{ github.ref_name }}"
|
||||||
|
|
||||||
|
# strip the prefix for sorting, keep prefix for matching
|
||||||
|
prefix="release@"
|
||||||
|
|
||||||
|
# get all matching tags, strip prefix, sort them
|
||||||
|
all_versions=$(git tag --list "${prefix}*" | sed "s/^${prefix}//" | sort -V)
|
||||||
|
|
||||||
|
# find previous version
|
||||||
|
previous_tag=""
|
||||||
|
for v in $all_versions; do
|
||||||
|
if [[ "$prefix$v" == "$current_tag" ]]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
previous_tag="$prefix$v"
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z "$previous_tag" ]]; then
|
||||||
|
range=""
|
||||||
|
else
|
||||||
|
range="$previous_tag..$current_tag"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Comparing range: $range"
|
||||||
|
|
||||||
|
body="## What's New"
|
||||||
|
|
||||||
|
for category in "feat: Features" "fix: Bug Fixes" "docs: Documentation" "chore: Chores"; do
|
||||||
|
prefix="${category%%:*}"
|
||||||
|
title="${category##*: }"
|
||||||
|
entries=$(git log $range --pretty=format:"- %s" --grep="^$prefix" --no-merges)
|
||||||
|
# echo -e "Found:\n\n$entries\n\n"
|
||||||
|
if [[ -n "$entries" ]]; then
|
||||||
|
body="$body\n\n### $title\n$entries"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo -e "$body" > /tmp/release_notes.md
|
||||||
|
|
||||||
- name: Create Gitea Release
|
- name: Create Gitea Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
files: build/libs/*.jar
|
files: build/libs/*.jar
|
||||||
tag_name: ${{ github.ref_name }}
|
body_path: /tmp/release_notes.md
|
||||||
name: Release ${{ github.ref_name }}
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ values and react to their changes in a clean and decoupled way.
|
|||||||
|
|
||||||
## Key Features
|
## Key Features
|
||||||
|
|
||||||
- Shared context for storing and retrieving named values
|
- Shared context for storing and retrieving named values
|
||||||
- Publish/subscribe event bus for listening to value changes
|
- Publish/subscribe event bus for listening to value changes
|
||||||
- Simple API for easy integration into existing projects
|
- Simple API for easy integration into existing projects
|
||||||
- Enables modular design by decoupling components through events
|
- Enables modular design by decoupling components through events
|
||||||
|
|||||||
47
build.gradle
47
build.gradle
@@ -6,7 +6,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group 'org.egothor'
|
group 'org.egothor'
|
||||||
version gitVersion(prefix:'conflux@')
|
version gitVersion(prefix:'release@')
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
// Use Maven Central for resolving dependencies.
|
// Use Maven Central for resolving dependencies.
|
||||||
@@ -25,6 +25,9 @@ java {
|
|||||||
toolchain {
|
toolchain {
|
||||||
languageVersion = JavaLanguageVersion.of(21)
|
languageVersion = JavaLanguageVersion.of(21)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
withJavadocJar()
|
||||||
|
withSourcesJar()
|
||||||
}
|
}
|
||||||
|
|
||||||
javadoc {
|
javadoc {
|
||||||
@@ -36,27 +39,35 @@ tasks.named('test') {
|
|||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
tasks.withType(Javadoc).configureEach {
|
||||||
publications {
|
options.bottom = "Copyright © 2025 Egothor"
|
||||||
mavenJava(MavenPublication) {
|
}
|
||||||
from components.java
|
|
||||||
}
|
|
||||||
}
|
|
||||||
repositories {
|
|
||||||
maven {
|
|
||||||
name = "GiteaMaven"
|
|
||||||
url = uri("https://gitea.egothor.org/api/packages/Egothor/maven")
|
|
||||||
|
|
||||||
credentials(HttpHeaderCredentials) {
|
|
||||||
name = "Authorization"
|
|
||||||
value = "token ${giteaToken}"
|
|
||||||
}
|
|
||||||
|
|
||||||
authentication {
|
if (project.hasProperty('giteaToken') && project.giteaToken) {
|
||||||
header(HttpHeaderAuthentication)
|
publishing {
|
||||||
|
publications {
|
||||||
|
mavenJava(MavenPublication) {
|
||||||
|
from components.java
|
||||||
|
}
|
||||||
|
}
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = "GiteaMaven"
|
||||||
|
url = uri("https://gitea.egothor.org/api/packages/Egothor/maven")
|
||||||
|
|
||||||
|
credentials(HttpHeaderCredentials) {
|
||||||
|
name = "Authorization"
|
||||||
|
value = "token ${giteaToken}"
|
||||||
|
}
|
||||||
|
|
||||||
|
authentication {
|
||||||
|
header(HttpHeaderAuthentication)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
println "No giteaToken defined - skipping publishing configuration"
|
||||||
}
|
}
|
||||||
|
|
||||||
gradle.taskGraph.whenReady { taskGraph ->
|
gradle.taskGraph.whenReady { taskGraph ->
|
||||||
|
|||||||
@@ -1,12 +1,7 @@
|
|||||||
# This file was generated by the Gradle 'init' task.
|
|
||||||
# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
|
# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
|
||||||
|
|
||||||
[versions]
|
[versions]
|
||||||
commons-math3 = "3.6.1"
|
|
||||||
guava = "33.1.0-jre"
|
|
||||||
junit-jupiter = "5.10.2"
|
junit-jupiter = "5.10.2"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
commons-math3 = { module = "org.apache.commons:commons-math3", version.ref = "commons-math3" }
|
|
||||||
guava = { module = "com.google.guava:guava", version.ref = "guava" }
|
|
||||||
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
|
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
|||||||
* Usage:
|
* Usage:
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* Key<Integer> COUNT = Key.of("count", Integer.class);
|
* Key<Integer> COUNT = Key.of("count", Integer.class);
|
||||||
* Ctx.INSTANCE.put(COUNT, 42);
|
* Ctx.INSTANCE.put(COUNT, 42);
|
||||||
* int v = Ctx.INSTANCE.get(COUNT);
|
* int v = Ctx.INSTANCE.get(COUNT);
|
||||||
* </pre>
|
* </pre>
|
||||||
|
|||||||
32
src/main/java/conflux/package-info.java
Normal file
32
src/main/java/conflux/package-info.java
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/**
|
||||||
|
* Provides a lightweight, type-safe, application-wide context mechanism for
|
||||||
|
* sharing strongly typed data among otherwise decoupled classes.
|
||||||
|
* <p>
|
||||||
|
* The {@link conflux.Ctx} class acts as a central, generic context storage
|
||||||
|
* supporting key-based put/get operations. Each {@link conflux.Key} defines a
|
||||||
|
* unique, strongly typed entry in the context, ensuring type consistency and
|
||||||
|
* preventing misuse. {@link conflux.Listener} interfaces allow clients to
|
||||||
|
* observe value changes for specific keys. Listeners are held with weak
|
||||||
|
* references to avoid memory leaks.
|
||||||
|
* <p>
|
||||||
|
* Typical usage involves defining {@link conflux.Key} instances with explicit
|
||||||
|
* types, storing values through {@code Ctx.INSTANCE.put()}, and retrieving them
|
||||||
|
* with {@code Ctx.INSTANCE.get()}. Listeners can be attached via
|
||||||
|
* {@code Ctx.INSTANCE.addListener()} to react to context changes in a decoupled
|
||||||
|
* and thread-safe manner. Values and listeners can be removed individually or
|
||||||
|
* the entire context can be cleared.
|
||||||
|
* <p>
|
||||||
|
* <b>Best Practices:</b>
|
||||||
|
* <ul>
|
||||||
|
* <li>Define keys as constants to maintain consistency and avoid
|
||||||
|
* collisions.</li>
|
||||||
|
* <li>Remove listeners when no longer needed (although weak references help
|
||||||
|
* prevent leaks).</li>
|
||||||
|
* <li>Use unique key names to ensure no accidental type conflicts.</li>
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* @see conflux.Ctx
|
||||||
|
* @see conflux.Key
|
||||||
|
* @see conflux.Listener
|
||||||
|
*/
|
||||||
|
package conflux;
|
||||||
Reference in New Issue
Block a user