|
1 | 1 | #!/bin/sh |
2 | 2 |
|
| 3 | +cd "$(dirname "$0")/.." |
| 4 | + |
| 5 | +# Check for required cross-implementation script. |
| 6 | +postprocessScript="../appose/bin/postprocess-api.py" |
| 7 | +if [ ! -f "$postprocessScript" ]; then |
| 8 | + echo "Error: $postprocessScript not found" >&2 |
| 9 | + echo "Please ensure appose repository is cloned as a sibling directory." >&2 |
| 10 | + exit 1 |
| 11 | +fi |
| 12 | + |
3 | 13 | if [ ! -d target/dependency ]; then |
4 | 14 | echo "Copying dependencies..." >&2 |
5 | 15 | mvn -q dependency:copy-dependencies -DincludeScope=test |
6 | 16 | fi |
7 | 17 |
|
8 | | -testJar=$(ls target/appose-*-SNAPSHOT-tests.jar 2>/dev/null | head -1) |
| 18 | +# Recompile DumpApi.java to ensure latest changes are used. |
| 19 | +echo "Compiling DumpApi..." >&2 |
| 20 | +mvn -q test-compile |
9 | 21 |
|
10 | | -# Build the test JAR if necessary (contains DumpApi). |
11 | | -if [ ! -f "$testJar" ]; then |
12 | | - echo "Compiling Java code..." >&2 |
13 | | - mvn -q -DskipTests package |
14 | | - testJar=$(ls target/appose-*-SNAPSHOT-tests.jar 2>/dev/null | head -1) |
15 | | - if [ -f "$testJar" ]; then |
16 | | - ls -l "$testJar" >&2 |
17 | | - fi |
18 | | -fi |
| 22 | +# Clean old api files. |
| 23 | +rm -rf api |
19 | 24 |
|
20 | 25 | # Run DumpApi on source directories. |
21 | | -# Output will be written to api/appose/*.pyi files |
| 26 | +# Output will be written to api/appose/*.api files |
22 | 27 | java \ |
23 | | - -cp 'target/dependency/*':"$testJar" \ |
| 28 | + -cp 'target/dependency/*:target/test-classes' \ |
24 | 29 | org.apposed.appose.DumpApi api src/main/java src/test/java |
| 30 | + |
| 31 | +# Post-process API: normalize | None to ?, expand optional parameters. |
| 32 | +python3 "$postprocessScript" api |
0 commit comments