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"/>
|
||||
</attributes>
|
||||
</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">
|
||||
<attributes>
|
||||
<attribute name="gradle_scope" value="test"/>
|
||||
@@ -19,13 +13,6 @@
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</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.buildship.core.gradleclasspathcontainer"/>
|
||||
<classpathentry kind="output" path="bin/default"/>
|
||||
|
||||
@@ -3,7 +3,7 @@ name: Release
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'conflux@*'
|
||||
- 'release@*'
|
||||
|
||||
jobs:
|
||||
release:
|
||||
@@ -12,6 +12,8 @@ jobs:
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Java 21
|
||||
uses: actions/setup-java@v3
|
||||
@@ -38,9 +40,50 @@ jobs:
|
||||
name: conflux
|
||||
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
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: build/libs/*.jar
|
||||
tag_name: ${{ github.ref_name }}
|
||||
name: Release ${{ github.ref_name }}
|
||||
body_path: /tmp/release_notes.md
|
||||
|
||||
13
build.gradle
13
build.gradle
@@ -6,7 +6,7 @@ plugins {
|
||||
}
|
||||
|
||||
group 'org.egothor'
|
||||
version gitVersion(prefix:'conflux@')
|
||||
version gitVersion(prefix:'release@')
|
||||
|
||||
repositories {
|
||||
// Use Maven Central for resolving dependencies.
|
||||
@@ -25,6 +25,9 @@ java {
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(21)
|
||||
}
|
||||
|
||||
withJavadocJar()
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
javadoc {
|
||||
@@ -36,6 +39,11 @@ tasks.named('test') {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
tasks.withType(Javadoc).configureEach {
|
||||
options.bottom = "Copyright © 2025 Egothor"
|
||||
}
|
||||
|
||||
if (project.hasProperty('giteaToken') && project.giteaToken) {
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
@@ -58,6 +66,9 @@ publishing {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
println "No giteaToken defined - skipping publishing configuration"
|
||||
}
|
||||
|
||||
gradle.taskGraph.whenReady { taskGraph ->
|
||||
def banner = """
|
||||
|
||||
@@ -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
|
||||
|
||||
[versions]
|
||||
commons-math3 = "3.6.1"
|
||||
guava = "33.1.0-jre"
|
||||
junit-jupiter = "5.10.2"
|
||||
|
||||
[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" }
|
||||
|
||||
@@ -57,7 +57,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||
* Usage:
|
||||
*
|
||||
* <pre>
|
||||
* Key<Integer> COUNT = Key.of("count", Integer.class);
|
||||
* Key<Integer> COUNT = Key.of("count", Integer.class);
|
||||
* Ctx.INSTANCE.put(COUNT, 42);
|
||||
* int v = Ctx.INSTANCE.get(COUNT);
|
||||
* </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