Skip to content

Commit 98c3d90

Browse files
committed
Add shared catalogs, portable teaching resources, and cat assets
1 parent fade9c9 commit 98c3d90

75 files changed

Lines changed: 151011 additions & 65 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.

‎.changeset/cat-mascot.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
type: minor
3+
---
4+
5+
Add the Scratch for Java cat as built-in sprites. Its animations - idle, walk, crouch, jump, fall, land, punch, hurt, ko, cheer and climb - load by name, for example `addAnimation("walk", "cat_walk_%d", 6)`. Coffee beans, a bug, a goal mug and hearts for a platformer come with it. The new Cat Platformer example shows them all in a game.

‎.changeset/release-catalogs.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
type: patch
3+
---
4+
5+
Distribute versioned API, asset and example catalogs, with stable documentation
6+
identifiers, translation overrides and offline example artifacts.

‎.changeset/safe-game-speed.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
type: patch
3+
---
4+
5+
Treat non-finite game speeds as zero and ignore negative elapsed frame time, keeping timers usable after invalid speed input.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Check browser compatibility
2+
description: Require the browser checkout, current generated contract, parity fixture and reference compilation
3+
runs:
4+
using: composite
5+
steps:
6+
- uses: actions/checkout@v7
7+
with:
8+
repository: openpatch/online-ide
9+
path: .validation/online-ide
10+
- uses: actions/setup-node@v4
11+
with:
12+
node-version: '22'
13+
cache: npm
14+
cache-dependency-path: .validation/online-ide/package-lock.json
15+
- uses: actions/setup-python@v5
16+
with:
17+
python-version: '3.12'
18+
- name: Regenerate Javadoc metadata
19+
shell: bash
20+
run: mvn -q -DskipTests prepare-package
21+
- name: Require current compatibility artifacts and parity fixture
22+
shell: bash
23+
run: |
24+
python3 scripts/browser-compatibility.py --check --online-ide .validation/online-ide
25+
python3 scripts/parity-fixture.py --check --strict --online-ide .validation/online-ide
26+
python3 scripts/release-catalogs.py --check --online-ide .validation/online-ide
27+
- name: Compile reference examples and check browser inventories
28+
shell: bash
29+
working-directory: .validation/online-ide
30+
run: |
31+
npm ci
32+
npm run test:ci -- src/test/ScratchCompatibilityTest.test.ts
33+
npm run browser:install -- --with-deps
34+
npm run test:browser
35+
- name: Match desktop lifecycle behavior
36+
shell: bash
37+
run: |
38+
sudo apt-get update
39+
sudo apt-get install -y xvfb libgl1-mesa-dri
40+
bash scripts/lifecycle-parity.sh

‎.github/workflows/docs.yml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
jobs:
99
documentation:
1010
runs-on: ubuntu-latest
11+
timeout-minutes: 20
1112

1213
permissions:
1314
pages: write # needed to publish to GitHub Pages
@@ -21,12 +22,15 @@ jobs:
2122
uses: actions/setup-java@v5
2223
with:
2324
distribution: temurin
24-
java-version: 17
25+
java-version: 25
2526
cache: maven
2627

2728
- name: Build Java Project
2829
run: mvn clean package
2930

31+
- name: Check browser compatibility before publishing
32+
uses: ./.github/actions/check-browser
33+
3034
- name: Build Docs
3135
run: bash ./build.sh
3236

‎.github/workflows/release.yml‎

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,21 @@ on:
77
- main
88

99
jobs:
10+
validate:
11+
if: github.event.pull_request.merged == true
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v7
15+
- uses: actions/setup-java@v5
16+
with:
17+
distribution: temurin
18+
java-version: 25
19+
cache: maven
20+
- run: mvn -B test
21+
- uses: ./.github/actions/check-browser
22+
1023
release:
24+
needs: validate
1125
if: github.event.pull_request.merged == true # only run if PR was merged
1226
runs-on: ubuntu-latest
1327

@@ -60,6 +74,21 @@ jobs:
6074
# to avoid paying for the full suite twice in the same job.
6175
run: mvn -B clean package -Pall -DskipTests
6276

77+
- name: Require current catalogs and assemble offline examples
78+
run: |
79+
python3 scripts/browser-compatibility.py --check
80+
python3 scripts/release-catalogs.py --check
81+
python3 scripts/release-catalogs.py --archive dist/scratch-catalogs.zip
82+
83+
- name: Checkout curriculum for the release course pack
84+
uses: actions/checkout@v7
85+
with:
86+
repository: openpatch/hyperbook-informatik
87+
path: .validation/curriculum
88+
89+
- name: Assemble offline course pack
90+
run: python3 scripts/build-course-pack.py --curriculum .validation/curriculum --output dist/scratch-to-java-course.zip
91+
6392
- name: Get project version
6493
id: get-version
6594
run: |
@@ -91,9 +120,9 @@ jobs:
91120
files: |
92121
target/*.jar
93122
dist/*.jar
123+
dist/*.zip
94124
95125
- name: Delete changeset branch
96126
run: |
97127
echo "Deleting branch 'changeset'"
98128
git push origin --delete changeset || true
99-

‎.github/workflows/test.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
jobs:
1212
test:
1313
runs-on: ubuntu-latest
14+
timeout-minutes: 15
1415

1516
steps:
1617
- name: Checkout repository
@@ -29,3 +30,6 @@ jobs:
2930

3031
- name: Run tests
3132
run: mvn -B test
33+
34+
- name: Check browser compatibility and generated references
35+
uses: ./.github/actions/check-browser

‎README.md‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ npx hyperbook dev
2222

2323
## Library
2424

25+
Browser versions, API availability and synchronization commands are documented in
26+
[compatibility/README.md](compatibility/README.md). The generated contract is
27+
[compatibility/contract.json](compatibility/contract.json).
28+
2529
If you want to work on the library. You need a Java environment and Maven. Then you can use the following command to build
2630
the library.
2731

@@ -132,3 +136,23 @@ Scratch for Java is maintained by [OpenPatch](https://openpatch.org), an organiz
132136
The Scratch for Java library is profiled using [Java Profiler](https://www.ej-technologies.com/products/jprofiler/overview.html)
133137

134138
[![Java Profiler](https://www.ej-technologies.com/images/product_banners/jprofiler_large.png)](https://www.ej-technologies.com/products/jprofiler/overview.html)
139+
140+
141+
## Shared release data and offline course
142+
143+
Javadoc generates the API catalog; atlas and example sources generate the asset
144+
and project catalogs. Run `scripts/release-catalogs.py` after documentation
145+
metadata generation. `--check`, `--studio` and `--online-ide` verify consumer
146+
snapshots without requiring a particular checkout layout. `--archive` creates
147+
an offline artifact used by Studio's template synchronizer.
148+
149+
Build the tutorial/Spielwerkstatt pack with:
150+
151+
```sh
152+
python3 scripts/build-course-pack.py --curriculum /path/to/hyperbook-informatik \
153+
--output target/scratch-to-java-course.zip
154+
```
155+
156+
See `compatibility/portable-project.md`, `compatibility/behavioral-checks.md`
157+
and `course/` for transfer/test formats, teacher notes and the pending pilot form.
158+
The canonical behavioral check runs unchanged in desktop JUnit and Chromium.

‎build.sh‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ done
3636
# pages as they were after the last `mvn package`, which is how pages for
3737
# deleted methods used to survive.
3838
mvn -q -DskipTests prepare-package
39+
python3 scripts/browser-compatibility.py
40+
python3 scripts/release-catalogs.py
41+
python3 scripts/build-course-pack.py --output docs/public/scratch-to-java-course.zip
3942

4043
# Any jar linked in for local testing by scripts/link-jar.sh is taken out again
4144
# here. Zipping one in would put a 19 MB library inside every project download.

‎catalogs/README.md‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Release catalogs
2+
3+
The doclet supplies public overloads, parameter names and documentation.
4+
Availability comes from the reviewed compatibility contract. Translation
5+
overrides use stable identifiers: documentation group plus erased parameters.
6+
Do not overwrite translated descriptions when regenerating English Javadoc.
7+
8+
Generate after the doclet and compatibility artifacts. Pass explicit consumer
9+
paths to synchronize their committed snapshots:
10+
11+
mvn -q -DskipTests prepare-package
12+
python3 scripts/browser-compatibility.py --online-ide /path/to/online-ide
13+
python3 scripts/release-catalogs.py --online-ide /path/to/online-ide --studio /path/to/studio
14+
python3 scripts/release-catalogs.py --check --online-ide /path/to/online-ide --studio /path/to/studio
15+
16+
The same JSON is distributed in the library JAR, documentation, Studio and
17+
browser assets. Example entries include checksums for source and asset files.
18+
The --archive option packages those ordinary files:
19+
20+
python3 scripts/release-catalogs.py --archive target/scratch-catalogs.zip
21+
22+
Studio can update templates from the release artifact without a sibling checkout:
23+
24+
python3 scripts/sync-templates.py --artifact /path/to/scratch-catalogs.zip --check
25+
26+
Older libraries can use local source JARs. Without source metadata, Studio filters
27+
the current descriptions against the project's actual public binary signatures.
28+
No network request or class initialization is needed to select help.
29+
30+
CI checks consumer snapshots against the library's default branch. Coordinated
31+
changes must merge their generated snapshots together before these gates pass.

0 commit comments

Comments
 (0)