Skip to content

Commit e313227

Browse files
committed
Fix Central release artifacts
1 parent d05670a commit e313227

13 files changed

Lines changed: 384 additions & 426 deletions

File tree

.github/workflows/release.yml

Lines changed: 66 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -182,33 +182,44 @@ jobs:
182182
text = re.sub(r"(<project\b[^>]*>\s*)", r"\1 <modelVersion>4.0.0</modelVersion>\n", text, count=1, flags=re.S)
183183
return text
184184
185+
def maven_property(name):
186+
return "${" + name + "}"
187+
185188
junit_version = property_value("junit.version")
186189
log4j2_version = property_value("log4j2.version")
190+
exec_maven_plugin_version = property_value("exec-maven-plugin.version")
191+
spotbugs_maven_plugin_version = property_value("spotbugs-maven-plugin.version")
192+
maven_jar_plugin_version = property_value("maven-jar-plugin.version")
193+
maven_source_plugin_version = property_value("maven-source-plugin.version")
194+
maven_javadoc_plugin_version = property_value("maven-javadoc-plugin.version")
195+
maven_surefire_plugin_version = property_value("maven-surefire-plugin.version")
196+
maven_gpg_plugin_version = property_value("maven-gpg-plugin.version")
197+
maven_assembly_plugin_version = "3.7.1"
187198
188199
root_text = central_compatible_pom(root_text)
189200
root_text = root_text.replace("<version>${revision}</version>", f"<version>{revision}</version>", 1)
190201
root_text = re.sub(r"<revision>[^<]+</revision>", f"<revision>{revision}</revision>", root_text, count=1)
191-
root_modules = """ <modules>\n <module>godot-java-code-generator</module>\n <module>godot-java-core</module>\n <module>godot-java-examples</module>\n <module>godot-java-native</module>\n </modules>\n\n"""
202+
root_modules = """ <modules>\n <module>godot-java-code-generator</module>\n <module>godot-java-core</module>\n <module>godot-java-native</module>\n </modules>\n\n"""
192203
if "<modules>" not in root_text:
193204
root_text = root_text.replace(" <licenses>", root_modules + " <licenses>", 1)
194205
root.write_text(root_text)
195206
196207
parent_with_coordinates = f""" <parent>\n <groupId>io.github.youngledo</groupId>\n <artifactId>godot-java</artifactId>\n <version>{revision}</version>\n </parent>"""
197208
for path in [
198209
Path("godot-java-code-generator/pom.xml"),
199-
Path("godot-java-core/pom.xml"),
200-
Path("godot-java-examples/pom.xml"),
201-
Path("godot-java-native/pom.xml"),
202210
]:
203211
text = central_compatible_pom(path.read_text())
204212
if "<parent/>" not in text:
205213
raise RuntimeError(f"Unexpected parent block in {path}")
206214
path.write_text(re.sub(r"\s*<parent/>\s*", "\n" + parent_with_coordinates + "\n\n", text, count=1))
207215
208216
core = Path("godot-java-core/pom.xml")
209-
core_text = core.read_text()
217+
core_text = central_compatible_pom(core.read_text())
218+
if "<parent/>" not in core_text:
219+
raise RuntimeError("Unexpected parent block in godot-java-core/pom.xml")
220+
core_text = re.sub(r"\s*<parent/>\s*", "\n", core_text, count=1)
210221
core_coordinates = f""" <groupId>io.github.youngledo</groupId>\n <version>{revision}</version>\n"""
211-
core_text = core_text.replace(" <artifactId>godot-java-core</artifactId>", core_coordinates + " <artifactId>godot-java-core</artifactId>", 1)
222+
core_text = re.sub(r"(\s*)<artifactId>godot-java-core</artifactId>", "\n" + core_coordinates + r"\1<artifactId>godot-java-core</artifactId>", core_text, count=1)
212223
core_metadata = """
213224
214225
<url>https://github.com/youngledo/godot-java</url>
@@ -237,19 +248,63 @@ jobs:
237248
core_text = core_text.replace(""" <artifactId>junit-jupiter</artifactId>""", f""" <artifactId>junit-jupiter</artifactId>\n <version>{junit_version}</version>\n <scope>test</scope>""", 1)
238249
core_text = core_text.replace(""" <artifactId>log4j-api</artifactId>""", f""" <artifactId>log4j-api</artifactId>\n <version>{log4j2_version}</version>""", 1)
239250
core_text = core_text.replace(""" <artifactId>log4j-core</artifactId>""", f""" <artifactId>log4j-core</artifactId>\n <version>{log4j2_version}</version>\n <scope>runtime</scope>""", 1)
251+
core_text = core_text.replace("${exec-maven-plugin.version}", exec_maven_plugin_version)
252+
core_text = core_text.replace("${spotbugs-maven-plugin.version}", spotbugs_maven_plugin_version)
253+
for artifact_id, version in [
254+
("maven-jar-plugin", maven_jar_plugin_version),
255+
("maven-surefire-plugin", maven_surefire_plugin_version),
256+
("maven-source-plugin", maven_source_plugin_version),
257+
("maven-javadoc-plugin", maven_javadoc_plugin_version),
258+
]:
259+
marker = f" <artifactId>{artifact_id}</artifactId>"
260+
replacement = marker + f"\n <version>{version}</version>"
261+
if marker in core_text and replacement not in core_text:
262+
core_text = core_text.replace(marker, replacement, 1)
263+
core_text = core_text.replace(" </plugins>", f""" <plugin>\n <groupId>org.apache.maven.plugins</groupId>\n <artifactId>maven-gpg-plugin</artifactId>\n <version>{maven_gpg_plugin_version}</version>\n <configuration>\n <skip>{maven_property("gpg.skip")}</skip>\n <passphrase>{maven_property("env.GPG_PASSPHRASE")}</passphrase>\n <gpgArguments>\n <arg>--pinentry-mode</arg>\n <arg>loopback</arg>\n </gpgArguments>\n </configuration>\n <executions>\n <execution>\n <id>sign-artifacts</id>\n <phase>verify</phase>\n <goals>\n <goal>sign</goal>\n </goals>\n </execution>\n </executions>\n </plugin>\n </plugins>""", 1)
240264
core.write_text(core_text)
241265
242-
examples = Path("godot-java-examples/pom.xml")
243-
examples_text = examples.read_text()
244-
examples_text = examples_text.replace(""" <artifactId>godot-java-core</artifactId>""", f""" <artifactId>godot-java-core</artifactId>\n <version>{revision}</version>""", 1)
245-
examples.write_text(examples_text)
266+
native = Path("godot-java-native/pom.xml")
267+
native_text = central_compatible_pom(native.read_text())
268+
if "<parent/>" not in native_text:
269+
raise RuntimeError("Unexpected parent block in godot-java-native/pom.xml")
270+
native_text = re.sub(r"\s*<parent/>\s*", "\n", native_text, count=1)
271+
native_coordinates = f""" <groupId>io.github.youngledo</groupId>\n <version>{revision}</version>\n"""
272+
native_text = re.sub(r"(\s*)<artifactId>godot-java-native</artifactId>", "\n" + native_coordinates + r"\1<artifactId>godot-java-native</artifactId>", native_text, count=1)
273+
native_metadata = """
274+
275+
<url>https://github.com/youngledo/godot-java</url>
276+
277+
<licenses>
278+
<license>
279+
<name>Apache-2.0</name>
280+
<url>https://www.apache.org/licenses/LICENSE-2.0</url>
281+
<distribution>repo</distribution>
282+
</license>
283+
</licenses>
284+
285+
<developers>
286+
<developer>
287+
<id>youngledo</id>
288+
</developer>
289+
</developers>
290+
291+
<scm>
292+
<connection>scm:git:git@github.com:youngledo/godot-java.git</connection>
293+
<developerConnection>scm:git:git@github.com:youngledo/godot-java.git</developerConnection>
294+
<url>https://github.com/youngledo/godot-java</url>
295+
</scm>"""
296+
native_text = native_text.replace(" <description>Platform native GDExtension library for godot-java</description>", " <description>Platform native GDExtension library for godot-java</description>" + native_metadata, 1)
297+
native_text = native_text.replace(""" <artifactId>maven-assembly-plugin</artifactId>""", f""" <artifactId>maven-assembly-plugin</artifactId>\n <version>{maven_assembly_plugin_version}</version>""", 1)
298+
native_text = native_text.replace(" </plugins>", f""" <plugin>\n <groupId>org.apache.maven.plugins</groupId>\n <artifactId>maven-gpg-plugin</artifactId>\n <version>{maven_gpg_plugin_version}</version>\n <configuration>\n <skip>{maven_property("gpg.skip")}</skip>\n <passphrase>{maven_property("env.GPG_PASSPHRASE")}</passphrase>\n <gpgArguments>\n <arg>--pinentry-mode</arg>\n <arg>loopback</arg>\n </gpgArguments>\n </configuration>\n <executions>\n <execution>\n <id>sign-artifacts</id>\n <phase>verify</phase>\n <goals>\n <goal>sign</goal>\n </goals>\n </execution>\n </executions>\n </plugin>\n </plugins>""", 1)
299+
native.write_text(native_text)
300+
246301
PY
247302
248303
- name: Build and publish
249304
env:
250305
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
251306
CENTRAL_TOKEN: ${{ secrets.CENTRAL_TOKEN }}
252-
run: ./mvnw deploy -P release -Drevision="$REVISION" -Dgodot.java.native.attach.dir="$PWD/dist/native" -DskipTests -B
307+
run: ./mvnw deploy -pl godot-java-core,godot-java-native -am -P release -Drevision="$REVISION" -Dgodot.java.native.attach.dir="$PWD/dist/native" -DskipTests -B
253308

254309
- name: Attach native fallback artifacts to GitHub Release
255310
uses: softprops/action-gh-release@v2

README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ ENGLISH | [中文](README_ZH.md)
99
Java bindings for [Godot](https://godotengine.org/).
1010
Built on top of GDExtension and Panama FFI to make Java a first-class citizen in the Godot ecosystem.
1111

12-
> Status: 0.1.0 – production-ready with scoped memory management and full GDExtension feature coverage.
12+
> Status: 0.1.2 – production-ready with scoped memory management, full GDExtension feature coverage, and Maven Central desktop runtime artifacts.
1313
1414
Project examples:
15+
- [godot-java-template](https://github.com/youngledo/godot-java-template) — recommended starting point for new desktop projects
1516
- [godot-java-examples](godot-java-examples/README.md) — 10 small examples in this repo
1617
- [godot-java-demo-projects](https://github.com/youngledo/godot-java-demo-projects) — 107 official Godot demos ported to Java (2D, 3D, audio, GUI, networking, XR, and more)
1718
- [godot-java-3d-demo](https://github.com/youngledo/godot-java-3d-demo) — a 3D character demo
@@ -313,20 +314,21 @@ Then verify:
313314

314315
## Where to start?
315316

316-
To get a demo running:
317+
To start a new Godot Java project, use the standalone template:
317318

318-
1. Make sure you have:
319-
- JDK 25+
320-
- Maven 4.0.x
321-
- Godot
319+
```bash
320+
git clone https://github.com/youngledo/godot-java-template.git my-godot-game
321+
cd my-godot-game
322+
./mvnw package
323+
godot --path godot
324+
```
322325

323-
2. Read:
324-
- [docs/en/user/getting-started.md](docs/en/user/getting-started.md)
326+
The template consumes released Maven artifacts and syncs `app.jar` plus the
327+
matching native desktop library into the Godot project during `mvn package`.
325328

326-
3. Then:
327-
- Build `godot-java-core` and `godot-java-code-generator`
328-
- Load the built GDExtension into a new Godot project
329-
- Create a simple `@GodotClass`-annotated Java script and experiment
329+
Then read [docs/en/user/getting-started.md](docs/en/user/getting-started.md).
330+
Use this repository directly only when contributing to the framework or running
331+
the internal examples.
330332

331333
---
332334

README_ZH.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88

99
[Godot](https://godotengine.org/zh-cn/) 的 Java 绑定,通过 GDExtension + Panama FFI 让 Java 在 Godot 生态中成为一等公民。
1010

11-
> 状态:0.1.0——生产就绪,具备 scoped 内存管理和完整的 GDExtension 功能覆盖。
11+
> 状态:0.1.2——生产就绪,具备 scoped 内存管理、完整 GDExtension 功能覆盖,以及 Maven Central 桌面运行时发布物
1212
1313
项目示例:
14+
- [godot-java-template](https://github.com/youngledo/godot-java-template) — 新桌面项目推荐起点
1415
- [godot-java-examples](godot-java-examples/README_ZH.md) — 本仓库内的 10 个小示例
1516
- [godot-java-demo-projects](https://github.com/youngledo/godot-java-demo-projects) — 107 个 Godot 官方示例的 Java 移植版(2D、3D、音频、GUI、网络、XR 等)
1617
- [godot-java-3d-demo](https://github.com/youngledo/godot-java-3d-demo) — 3D 角色演示
@@ -300,20 +301,19 @@ godot-java/
300301

301302
## 我应该从哪开始?
302303

303-
如果你想快速跑起来
304+
新 Godot Java 项目建议从独立模板开始
304305

305-
1. 确保本地有:
306-
- JDK 25+
307-
- Maven 4.0.x
308-
- Godot
306+
```bash
307+
git clone https://github.com/youngledo/godot-java-template.git my-godot-game
308+
cd my-godot-game
309+
./mvnw package
310+
godot --path godot
311+
```
309312

310-
2. 阅读:
311-
- [docs/zh/user/getting-started.md](docs/zh/user/getting-started.md)
313+
模板使用已发布的 Maven artifacts,并在 `mvn package` 时把 `app.jar` 和匹配平台的 native 库同步到 Godot 项目。
312314

313-
3. 然后根据文档:
314-
- 构建 `godot-java-core``godot-java-code-generator`
315-
- 在一个新的 Godot 项目中加载生成的 GDExtension
316-
- 创建一个简单的 `@GodotClass` Java 脚本进行试验
315+
然后阅读 [docs/zh/user/getting-started.md](docs/zh/user/getting-started.md)
316+
只有在贡献框架或运行仓库内部示例时,才需要直接使用本仓库源码。
317317

318318
---
319319

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ENGLISH | [中文](README_ZH.md)
88

99
> Write Godot 4.6 game logic in Java 25+ using Panama FFI
1010
11-
- [Getting Started](en/user/getting-started.md) -- Prerequisites, Maven setup, first class
11+
- [Getting Started](en/user/getting-started.md) -- Template project, Maven setup, first Java class
1212
- [API Reference](en/user/api.md) -- Annotations, types, core classes
1313
- [Development Guide](en/user/guide.md) -- Step-by-step game entity, virtual methods, signals
1414
- [Troubleshooting](en/user/troubleshooting.md) -- Common errors and solutions

docs/README_ZH.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
> 使用 Java 25+ 和 Panama FFI 编写 Godot 4.6 游戏逻辑
1010
11-
- [快速入门](zh/user/getting-started.md) -- 环境准备、Maven 配置、第一个类
11+
- [快速入门](zh/user/getting-started.md) -- 模板项目、Maven 配置、第一个 Java 类
1212
- [API 参考](zh/user/api.md) -- 注解、类型、核心类
1313
- [开发指南](zh/user/guide.md) -- 逐步构建游戏实体、虚方法、信号
1414
- [常见问题](zh/user/troubleshooting.md) -- 常见错误及解决方案

0 commit comments

Comments
 (0)