Skip to content

Commit 12116b5

Browse files
committedJul 20, 2024··
feat!: update to 1.21, rework payload registration
1 parent 9b8d6c3 commit 12116b5

38 files changed

+1019
-186
lines changed
 

‎.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@JustPyrrha

‎.github/dependabot.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "gradle"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
ignore:
8+
- dependency-name: com.mojang:minecraft
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
interval: "weekly"

‎.github/funding.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: JustPyrrha

‎.github/workflows/build.yml

+154
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
name: Build and Test
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Setup JDK
19+
uses: actions/setup-java@v4
20+
with:
21+
distribution: temurin
22+
java-version: 21
23+
24+
- name: Setup Gradle
25+
uses: gradle/actions/setup-gradle@v3
26+
with:
27+
dependency-graph: generate-and-submit
28+
artifact-retention-days: 1
29+
30+
- name: Set Gradle Wrapper Executable
31+
run: chmod +x gradlew
32+
33+
- name: Build and Test
34+
run: ./gradlew build test spotlessCheck
35+
36+
publish:
37+
name: Publish
38+
runs-on: ubuntu-latest
39+
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'wanderia/netlib'
40+
needs:
41+
- build
42+
permissions:
43+
contents: write
44+
pull-requests: write
45+
pages: write
46+
id-token: write
47+
environment:
48+
name: github-pages
49+
url: ${{ steps.deployment.outputs.page_url }}
50+
steps:
51+
- name: Checkout
52+
uses: actions/checkout@v4
53+
54+
- name: Setup JDK
55+
uses: actions/setup-java@v4
56+
with:
57+
distribution: temurin
58+
java-version: 21
59+
60+
- name: Set Gradle Wrapper Executable
61+
run: chmod +x gradlew
62+
63+
- name: Setup Gradle
64+
uses: gradle/actions/setup-gradle@v3
65+
66+
- name: Prepare Changelog
67+
id: changelog
68+
run: |
69+
CHANGELOG=$(./gradlew getChangelog --console=plain -q --no-header --no-summary --unreleased --no-empty-sections)
70+
71+
CHANGELOG="${CHANGELOG//$'\n'/'\\n'}"
72+
CHANGELOG="${CHANGELOG//$'\r'/''}"
73+
CHANGELOG=$(sed -E 's/Downloading https:\/\/services\.gradle\.org\/distributions\/gradle-[0-9\\.]*-bin\.zip\\\\n[\\.0-9%]*\\\\n//' <<< $CHANGELOG)
74+
75+
echo "changelog=$CHANGELOG" >> "$GITHUB_OUTPUT"
76+
77+
echo "# Changelog" >> "$GITHUB_STEP_SUMMARY"
78+
echo "" >> "$GITHUB_STEP_SUMMARY"
79+
echo "$CHANGELOG" >> "$GITHUB_STEP_SUMMARY"
80+
81+
- name: Publish to Modrinth
82+
env:
83+
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
84+
run: ./gradlew modrinth modrinthSyncBody
85+
86+
- name: Publish to GitHub
87+
env:
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
run: |
90+
CHANGELOG="${{ steps.changelog.outputs.changelog }}"
91+
NL=$'\n'
92+
CHANGELOG=${CHANGELOG//$'\\n'/"${NL}"}
93+
echo "$CHANGELOG" >> "notes.txt"
94+
gh release create ${{ github.ref_name }} **/build/libs/**.jar --notes-file notes.txt
95+
96+
- name: Patch Changelog
97+
run: ./gradlew patchChangelog
98+
99+
- name: Create Patched Changelog Pull Request
100+
env:
101+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102+
run: |
103+
VERSION="${{ github.ref_name }}"
104+
BRANCH="changelog-patch/$VERSION"
105+
106+
git config user.email "github-actions@github.com"
107+
git config user.name "github-actions"
108+
109+
git checkout -b $BRANCH
110+
git add CHANGELOG.md
111+
git commit -m "docs(changelog): patch changelog for $VERSION"
112+
git push -u origin $BRANCH
113+
114+
gh pr create \
115+
--title "docs(changelog): patch changelog for $VERSION" \
116+
--body-file notes.txt \
117+
--base main \
118+
--head "$BRANCH"
119+
120+
- name: Build Documentation (DokkaHtml)
121+
run: ./gradlew dokkaHtml
122+
123+
- name: Create Documentation Pull Request
124+
env:
125+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
126+
run: |
127+
VERSION="${{ github.ref_name }}"
128+
BRANCH="documentation-patch/$VERSION"
129+
130+
git config user.email "github-actions@github.com"
131+
git config user.name "github-actions"
132+
133+
git checkout -b $BRANCH
134+
git add docs/
135+
git commit -m "docs(dokka): patch docs for $VERSION"
136+
git push -u origin $BRANCH
137+
138+
gh pr create \
139+
--title "docs(dokka): patch docs for $VERSION" \
140+
--body "Adds published documentation for $VERSION" \
141+
--base main \
142+
--head "$BRANCH"
143+
144+
- name: Setup Pages
145+
uses: actions/configure-pages@v5
146+
147+
- name: Upload Dokka Artifact
148+
uses: actions/upload-pages-artifact@v3
149+
with:
150+
path: ./docs-publishing/
151+
152+
- name: Deploy Dokka Artifact to GitHub Pages
153+
id: deployment
154+
uses: actions/deploy-pages@v4
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Build (Pull Request)
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
build:
8+
name: Build
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
14+
- name: Setup JDK
15+
uses: actions/setup-java@v4
16+
with:
17+
distribution: temurin
18+
java-version: 21
19+
20+
- name: Setup Gradle
21+
uses: gradle/actions/setup-gradle@v3
22+
23+
- name: Validate Wrapper
24+
uses: gradle/actions/wrapper-validation@v3
25+
26+
- name: Set Gradle Wrapper Executable
27+
run: chmod +x gradlew
28+
29+
- name: Build, Test, and Check
30+
run: ./gradlew build test spotlessCheck

‎.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.gradle/
22
.idea/
3+
.kotlin/
34
build/
4-
run/
5+
docs-publishing/
6+
runs/
57
*.iml

‎CHANGELOG.md

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Changelog
2+
3+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
4+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
5+
6+
## [Unreleased]
7+
8+
### Added
9+
- `wanderia-netlib` entrypoint as new standard for registering payload types.
10+
- `WanderiaSerializersModule` used by default in payload serialization.
11+
- `UUIDSerializer` as a default contextual serializer.
12+
- `IdentifierSerialzier` as a default contextual serializer.
13+
- Spotless formatting and checking.
14+
15+
### Changed
16+
- Updated to Minecraft `1.21`
17+
- Updated to Kotlin `2.0.0`
18+
- Updated to Kotlinx Serialization `1.7.1`
19+
- Updated to Fabric Loom `1.7-SNAPSHOT`
20+
- Updated to Fabric Loader `0.16.0`
21+
- Updated to Fabric API `0.100.7+1.21`
22+
23+
### Deprecated
24+
25+
### Removed
26+
- `dev.wanderia.netlib.samples` has been replaced with a full example test mod in `src/testmod`.
27+
- Yumi licenser (replaced by spotless)
28+
29+
### Fixed
30+
31+
### Security
32+
33+
## [1.0.0] - 2024-02-16
34+
35+
### Added
36+
- Initial release

‎HEADER

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
Copyright (C) ${YEAR} Wanderia - All Rights Reserved
2-
3-
This Source Code Form is subject to the terms of the Mozilla Public
4-
License, v. 2.0. If a copy of the MPL was not distributed with this
5-
file, You can obtain one at https://mozilla.org/MPL/2.0/.
6-
7-
#type YEAR YEAR_LENIENT_RANGE
1+
/*
2+
* Copyright (C) 2024 Wanderia - All Rights Reserved
3+
*
4+
* This Source Code Form is subject to the terms of the Mozilla Public
5+
* License, v. 2.0. If a copy of the MPL was not distributed with this
6+
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
7+
*/

‎README.md

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
# netlib
2-
Wanderia's networking utility library.
2+
Kotlinx Serialization for Minecraft Payloads.
33

44
### Features
55
- Kotlinx Serialization encoder/decoder for Minecraft's FriendlyByteBuf/PacketByteBuf.
6-
- Abstract `SerializedPacket` for easy packet creation.
6+
- Abstract `SerializedPayload` for easy packet creation.
77

88
### Developer Usage
9-
Usage samples can be found in the [`dev.wanderia.netlib.samples`](https://github.com/wanderia/netlib/tree/main/src/main/kotlin/dev/wanderia/netlib/sample/) package.\
109
This project is intended to be included via Jar-in-Jar.
10+
netlib is available on the wanderia maven.
11+
```kotlin
12+
repositories {
13+
maven("https://maven.wanderia.dev/releases") { name = "Wanderia" }
14+
}
15+
dependencies {
16+
include("dev.wanderia:netlib:$version")
17+
modImplementation("dev.wanderia:netlib:$version")
18+
}
19+
```
20+
See the [testmod](src/testmod/) for example usage.
21+
22+
## Attribution
23+
Logo icon by [Iconoir](https://iconoir.com/) which is licensed under MIT.

‎artSrc/icon.afdesign

28.6 KB
Binary file not shown.

‎artSrc/logo-icon.svg

+14
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.