Skip to content

Commit 0dbbffd

Browse files
committed
Improve API dumping script
* Ensure it runs from the intended directory. * Clean old API files. * Stop collapsing overloaded method signatures (done in later step now). * Invoke implementation-agnostic post-processing script after dumping. * Make miscellaneous small tweaks.
1 parent b83be98 commit 0dbbffd

2 files changed

Lines changed: 110 additions & 234 deletions

File tree

bin/api.sh

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,32 @@
11
#!/bin/sh
22

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+
313
if [ ! -d target/dependency ]; then
414
echo "Copying dependencies..." >&2
515
mvn -q dependency:copy-dependencies -DincludeScope=test
616
fi
717

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
921

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
1924

2025
# 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
2227
java \
23-
-cp 'target/dependency/*':"$testJar" \
28+
-cp 'target/dependency/*:target/test-classes' \
2429
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

Comments
 (0)