Skip to content

Commit 9dc3bb7

Browse files
committed
Java SDK of Messagevisor
0 parents  commit 9dc3bb7

85 files changed

Lines changed: 10172 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.editorconfig‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.{yml,yaml}]
12+
indent_size = 2

‎.github/workflows/checks.yml‎

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Checks
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
permissions:
10+
contents: read
11+
12+
concurrency:
13+
group: checks-${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
java:
18+
name: Java ${{ matrix.java }}
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 15
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
java: ["17", "25"]
25+
steps:
26+
- name: Check out repository
27+
uses: actions/checkout@v7
28+
29+
- name: Set up Java
30+
uses: actions/setup-java@v5
31+
with:
32+
distribution: temurin
33+
java-version: ${{ matrix.java }}
34+
cache: gradle
35+
36+
- name: Set up Gradle
37+
uses: gradle/actions/setup-gradle@v4
38+
39+
- name: Build, test, and verify artifacts
40+
run: make verify-artifacts
41+
42+
project:
43+
name: Messagevisor project-1
44+
runs-on: ubuntu-latest
45+
timeout-minutes: 20
46+
steps:
47+
- name: Check out Java SDK
48+
uses: actions/checkout@v7
49+
50+
- name: Set up Java
51+
uses: actions/setup-java@v5
52+
with:
53+
distribution: temurin
54+
java-version: "25"
55+
cache: gradle
56+
57+
- name: Set up Gradle
58+
uses: gradle/actions/setup-gradle@v4
59+
60+
- name: Set up Node.js
61+
uses: actions/setup-node@v7
62+
with:
63+
node-version-file: .nvmrc
64+
65+
- name: Initialize Messagevisor project-1
66+
env:
67+
npm_config_yes: "true"
68+
run: |
69+
mkdir project-1
70+
cd project-1
71+
npx @messagevisor/cli init --project=1
72+
npm install
73+
npx messagevisor lint
74+
npx messagevisor build
75+
npx messagevisor test
76+
77+
- name: Run project tests against Java SDK
78+
run: >-
79+
./gradlew :cli:run
80+
--args='test --projectDirectoryPath=project-1 --onlyFailures --target=java
81+
--normalizeSpaces --withIcuModule --withInterpolationModule'

‎.github/workflows/publish.yml‎

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read
9+
10+
concurrency:
11+
group: publish-${{ github.ref }}
12+
cancel-in-progress: false
13+
14+
jobs:
15+
publish:
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 15
18+
steps:
19+
- name: Check out repository
20+
uses: actions/checkout@v7
21+
22+
- name: Set up Java
23+
uses: actions/setup-java@v5
24+
with:
25+
distribution: temurin
26+
java-version: "25"
27+
cache: gradle
28+
29+
- name: Set up Gradle
30+
uses: gradle/actions/setup-gradle@v4
31+
32+
- name: Validate release version
33+
id: version
34+
shell: bash
35+
run: |
36+
if [[ ! "$GITHUB_REF_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z][0-9A-Za-z.-]*)?$ ]]; then
37+
echo "Expected a semantic version tag with a v prefix" >&2
38+
exit 1
39+
fi
40+
41+
version="${GITHUB_REF_NAME#v}"
42+
configured_version="$(sed -n 's/^version=//p' gradle.properties)"
43+
44+
if [[ "$configured_version" != "$version" ]]; then
45+
echo "Tag $GITHUB_REF_NAME does not match gradle.properties ($configured_version)" >&2
46+
exit 1
47+
fi
48+
49+
if ! grep -Fq "messagevisor-sdk:$version" README.md; then
50+
echo "README installation version does not match $GITHUB_REF_NAME" >&2
51+
exit 1
52+
fi
53+
54+
if ! grep -Fq "## $version" CHANGELOG.md; then
55+
echo "CHANGELOG does not contain a $version release" >&2
56+
exit 1
57+
fi
58+
59+
echo "version=$version" >> "$GITHUB_OUTPUT"
60+
echo "Publishing Messagevisor Java $version"
61+
62+
- name: Build and test release artifacts
63+
run: >-
64+
./gradlew clean build generatePomFileForMavenJavaPublication
65+
-Pversion=${{ steps.version.outputs.version }}
66+
67+
- name: Verify published artifact boundaries
68+
run: bash scripts/verify-artifacts.sh
69+
70+
- name: Publish signed release artifacts
71+
env:
72+
MAVEN_REPOSITORY_URL: ${{ secrets.MAVEN_REPOSITORY_URL }}
73+
MAVEN_REPOSITORY_USERNAME: ${{ secrets.MAVEN_REPOSITORY_USERNAME }}
74+
MAVEN_REPOSITORY_PASSWORD: ${{ secrets.MAVEN_REPOSITORY_PASSWORD }}
75+
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
76+
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
77+
run: ./gradlew publish -Pversion=${{ steps.version.outputs.version }}

‎.gitignore‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.gradle/
2+
build/
3+
out/
4+
*.class

‎.nvmrc‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
24.16.0

‎AGENTS.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Messagevisor Java
2+
3+
This repository contains the Java 17 Messagevisor SDK and conformance tooling.
4+
5+
Treat the current `messagevisor` TypeScript monorepo as the behavioral authority. Keep the Java implementation generic and portable. Never add locale-specific output rewrites to satisfy a fixture. Use ICU4J APIs, target format overrides that preserve meaning, or `expectedByRuntime.java` for legitimate platform differences.
6+
7+
Run `./gradlew test`, `./gradlew build`, `make test-project-1`, and `make examples-project-1` after behavior changes.

‎CHANGELOG.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changelog
2+
3+
## 0.1.0
4+
5+
- Revived the Java SDK against the current Messagevisor datafile and runtime contracts.
6+
- Added generic ICU4J number, date, time, range, relative, plural, list, and display-name formatting.
7+
- Added ICU, interpolation, and missing-translation modules.
8+
- Added a conformance CLI that executes message, segment, locale, and target tests.

‎CODE_OF_CONDUCT.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our pledge
4+
5+
We pledge to make participation in the Messagevisor community harassment-free for everyone. We will act in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
6+
7+
## Our standards
8+
9+
Positive behavior includes empathy, respect for different viewpoints, constructive feedback, accountability, and focusing on what is best for the community. Unacceptable behavior includes harassment, sexualized conduct, trolling, personal attacks, publishing private information, or other conduct inappropriate in a professional setting.
10+
11+
## Scope and enforcement
12+
13+
This Code applies in project spaces and whenever someone officially represents the project. Maintainers may remove or reject contributions and participation that violate these standards.
14+
15+
Report unacceptable behavior to [messagevisor-conduct@googlegroups.com](mailto:messagevisor-conduct@googlegroups.com). Reports will be reviewed promptly, fairly, and with respect for the reporter's privacy and security.
16+
17+
This Code is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.

‎CONTRIBUTING.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Contributing
2+
3+
Thanks for helping improve Messagevisor Java. Please open an issue before a large API or portability change so its relationship with the JavaScript source of truth can be agreed first. By participating, you agree to follow the [Code of Conduct](CODE_OF_CONDUCT.md). Report vulnerabilities through the process in [SECURITY.md](SECURITY.md), not a public issue.
4+
5+
Use Java 17 compatible APIs and keep formatter behavior generic. Locale names, translated labels, named-zone branches, fixture-specific output rewrites, and silent test skipping do not belong in the SDK.
6+
7+
Before opening a change, run:
8+
9+
```sh
10+
./gradlew test
11+
./gradlew build
12+
make test-project-1
13+
make examples-project-1
14+
```
15+
16+
Use `expectedByRuntime.java` for legitimate ICU or CLDR differences. A Java target format override is appropriate only when it preserves authored semantics and expresses an explicit platform formatter choice.

‎LICENSE‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2026 Fahad Heylaal (https://fahad19.com)
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

0 commit comments

Comments
 (0)