Skip to content

Commit 1704bb9

Browse files
committed
dev server improvement
1 parent 49d0c46 commit 1704bb9

13 files changed

Lines changed: 379 additions & 555 deletions

File tree

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
- Dependency aliases and dependency, plugin, release, and snapshot versions are centralized in
5555
`gradle/libs.versions.toml`.
5656
- Local source paths and composite-build switches remain in `gradle.properties`.
57-
- Root `build.gradle.kts` applies shared Java 11 settings and Maven repositories to subprojects.
57+
- Root `build.gradle.kts` applies shared Java 17 settings and Maven repositories to subprojects.
5858
- `gradle.properties` can enable composite builds for local libGDX or TeaVM source:
5959
- `includeLibgdxSource`
6060
- `includeTeaVMSource`

README.md

Lines changed: 6 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The project provides two build styles:
1616
| gdx-teavm | libGDX | TeaVM |
1717
|:---------:|:------:|:------:|
1818
| -SNAPSHOT | 1.14.2 | 0.15.0 |
19-
| 1.6.0 | 1.14.2 | 0.15.0 |
19+
| 1.6.1 | 1.14.2 | 0.15.0 |
2020
| 1.5.5 | 1.14.0 | 0.14.0 |
2121
| 1.5.4 | 1.14.0 | 0.13.1 |
2222

@@ -43,40 +43,17 @@ The project provides two build styles:
4343
- [Examples](examples/README.md): portable cores and runnable platform implementations.
4444
- [Desktop C native build guide](examples/basic/platforms/desktop/teavm-c/builder/README.md): native toolchain requirements and manual CMake workflow.
4545

46-
## Repositories
46+
## Setup
4747

48-
Release artifacts are published to Maven Central. Snapshots are published to Central Portal snapshots.
49-
50-
```kotlin
51-
repositories {
52-
mavenCentral()
53-
maven("https://central.sonatype.com/repository/maven-snapshots/")
54-
55-
// TeaVM artifacts may be needed while using TeaVM snapshots or non-central builds.
56-
maven("https://teavm.org/maven/repository/")
57-
}
58-
```
59-
60-
When using the Gradle plugin from Maven, add the same repositories to `pluginManagement` in `settings.gradle.kts`.
61-
62-
```kotlin
63-
pluginManagement {
64-
repositories {
65-
mavenCentral()
66-
maven("https://central.sonatype.com/repository/maven-snapshots/")
67-
}
68-
}
69-
```
70-
71-
The gdx-teavm plugin marker is published to Maven with the rest of the artifacts, so Gradle Plugin Portal is not required for this plugin.
48+
Release artifacts are available from Maven Central. Snapshot and plugin repository configuration is documented once in the [usage guide](docs/usage.md#repositories).
7249

7350
## Gradle Plugin Quick Start
7451

7552
Apply the plugin in the TeaVM target module:
7653

7754
```kotlin
7855
plugins {
79-
id("com.github.xpenatan.gdx-teavm") version "-SNAPSHOT"
56+
id("com.github.xpenatan.gdx-teavm") version "<latest-release>"
8057
}
8158

8259
dependencies {
@@ -111,51 +88,11 @@ For native targets and every available property, see the [usage guide](docs/usag
11188

11289
## Manual Builder Quick Start
11390

114-
Use the builder API when you need full programmatic control or a custom build launcher. See the [usage guide](docs/usage.md) for complete builder examples.
115-
116-
```kotlin
117-
dependencies {
118-
implementation("com.github.xpenatan.gdx-teavm:backend-web:-SNAPSHOT")
119-
implementation(project(":core"))
120-
}
121-
```
122-
123-
Run the Java launcher from Gradle or your IDE. Builder projects add the concrete backend dependency they use, such as `backend-web` or `backend-glfw`.
91+
Use the builder API when you need full programmatic control or a custom build launcher. The [manual builder guide](docs/usage.md#manual-builder-api) contains dependencies and complete Web and GLFW examples.
12492

12593
## Examples In This Repository
12694

127-
```shell
128-
# Plugin workflow
129-
./gradlew :examples:basic:platforms:web:plugin:gdx_teavm_web_js_run
130-
./gradlew :examples:basic:platforms:web:plugin:gdx_teavm_web_wasm_run
131-
./gradlew :examples:basic:platforms:desktop:teavm-c:plugin:gdx_teavm_glfw_generate
132-
./gradlew :examples:basic:platforms:ios:gdx_teavm_ios_generate
133-
./gradlew :examples:basic:platforms:ios:gdx_teavm_ios_init_xcode
134-
135-
# Android TeaVM C examples
136-
./gradlew :examples:basic:platforms:android:assembleDebug
137-
./gradlew :examples:freetype:platforms:android:assembleDebug
138-
./gradlew :examples:controllers:platforms:android:assembleDebug
139-
140-
# iOS TeaVM C examples (simulator builds require macOS)
141-
./gradlew :examples:basic:platforms:ios:gdx_teavm_ios_build_simulator
142-
./gradlew :examples:freetype:platforms:ios:gdx_teavm_ios_build_simulator
143-
./gradlew :examples:controllers:platforms:ios:gdx_teavm_ios_build_simulator
144-
145-
# FreeType plugin workflow
146-
./gradlew :examples:freetype:platforms:web:plugin:gdx_teavm_web_js_run
147-
./gradlew :examples:freetype:platforms:web:plugin:gdx_teavm_web_wasm_run
148-
149-
# gdx-controllers plugin workflow
150-
./gradlew :examples:controllers:platforms:web:plugin:gdx_teavm_web_js_run
151-
./gradlew :examples:controllers:platforms:web:plugin:gdx_teavm_web_wasm_run
152-
153-
# Manual builder workflow
154-
./gradlew :examples:basic:platforms:web:builder:basic_web_run
155-
./gradlew :examples:freetype:platforms:web:builder:freetype_web_run
156-
./gradlew :examples:controllers:platforms:web:builder:controllers_web_run
157-
./gradlew :examples:basic:platforms:desktop:teavm-c:builder:basic_desktop_c_debug_build
158-
```
95+
The [examples index](examples/README.md) describes the project layout and links to the task inventory for each example.
15996

16097
## Support
16198

docs/backend-architecture.md

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,13 @@ Android projects use a dedicated path instead: the Android Gradle Plugin remains
6060

6161
Target blocks are opt-in. If a build file declares only `wasm {}`, only Wasm gdx-teavm tasks are created. Native TeaVM C settings live inside target blocks such as `glfw {}` because logical targets can have different launchers and native options. Android projects currently support only the `android {}` target.
6262

63-
## Gradle Plugin Tasks
63+
## Gradle Task Integration
6464

65-
| Target block | Tasks |
66-
| --- | --- |
67-
| `js {}` | `gdx_teavm_web_js_build`, `gdx_teavm_web_js_run` |
68-
| `wasm {}` | `gdx_teavm_web_wasm_build`, `gdx_teavm_web_wasm_run` |
69-
| `glfw {}` | `gdx_teavm_glfw_generate`, `gdx_teavm_glfw_build`, `gdx_teavm_glfw_run` |
70-
| `ios {}` | `gdx_teavm_ios_generate`, `gdx_teavm_ios_prepare_angle`, `gdx_teavm_ios_init_xcode`, `gdx_teavm_ios_regenerate_xcode`, `gdx_teavm_ios_open_xcode`, `gdx_teavm_ios_build_simulator`, `gdx_teavm_ios_run_simulator` |
71-
| `android {}` | `gdx_teavm_android_generate` |
65+
Each declared target registers only its own public `gdx_teavm_*` tasks. The [usage guide](usage.md#web-targets) is the user-facing task reference; this section covers the implementation behind web run tasks.
7266

73-
Web run tasks use `GdxTeaVMRunWebTask` by default, loading `backend-web`'s `JettyServer` by reflection from the target runtime classpath. When the target's `devServer.enabled` property is true, the same public run task delegates compilation to TeaVM's `javaScriptDevServer` or `wasmGCDevServer` task. With `autoBuild` enabled, the run task registers a Gradle `DeploymentHandle`; Gradle detects that reloadable deployment, automatically enters continuous-build mode for the same invocation, and reruns Java compilation and TeaVM generation when task inputs change. With `autoBuild` disabled, the task blocks directly to keep both servers alive without registering a reloadable deployment. Local project class directories precede external JARs on the development classpath so TeaVM observes recompiled classes, and the plugin invalidates TeaVM's compiler cache before each rebuild. Cancelling the overall Gradle invocation stops both the TeaVM server and entry adapter in either mode.
67+
Web run tasks use `GdxTeaVMRunWebTask` and `backend-web`'s `JettyServer` unless `devServer.enabled` selects the TeaVM server. In development-server mode, the public run task starts TeaVM compilation, an entry-page adapter, and an optional file watcher. The watcher invokes only the target project's `classes` task, then requests an incremental build from the existing TeaVM process. Local project output directories precede external JARs so the compiler sees the updated classes.
7468

75-
The entry adapter supplies the generated page at `/` with an HTML content type, working around TeaVM serving generated `.html` files as plain text. When `autoReload` is enabled, it also installs a shared JS/Wasm client for TeaVM's build-status WebSocket. The plugin applies the same backend-filtered classpath and gdx-teavm properties to normal generation and development-server compilation.
69+
The entry adapter serves the generated page as HTML at `/`. With `autoReload` enabled, it also injects a JS/Wasm client for TeaVM's build-status WebSocket. Cancelling the run task stops both servers and releases the public port.
7670

7771
## TeaVM Runtime Plugins
7872

@@ -200,14 +194,4 @@ This is required for facade/helper types such as DOM extension wrappers and `Web
200194

201195
## Output Layout
202196

203-
Plugin defaults:
204-
205-
| Target | Root | Generated files |
206-
| --- | --- | --- |
207-
| JS | `build/dist/js` | `webapp` |
208-
| Wasm | `build/dist/wasm` | `webapp` |
209-
| GLFW | `build/dist/glfw` | `c/src`, `c/release`, build scripts |
210-
| iOS | `build/dist/ios` | `c/src`, `c/release`, generated Xcode project |
211-
| Android | `build/generated/gdx-teavm/android` | `c/src`, `CMakeLists.txt`, native resources |
212-
213-
Builder defaults depend on the `build(new File(...))` output directory and the concrete backend. `WebBackend` defaults to a `webapp` folder, while `TeaGLFWBackend` defaults to `c/src` plus `c/release`.
197+
Plugin defaults are maintained in the [property reference](plugin-properties.md#common-teavm-target-properties). Builder output is rooted at the directory passed to `build(File)` and organized by the concrete backend.

0 commit comments

Comments
 (0)