mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
39 lines
1.0 KiB
Bash
Executable File
39 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
# Format Java files with Eclipse formatter
|
|
echo "Formatting Java files..."
|
|
|
|
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
|
|
|
# Store original directory
|
|
pushd "$dir" > /dev/null
|
|
|
|
# Build the Eclipse formatter if needed
|
|
if [ ! -f "eclipse-formatter/target/eclipse-formatter-1.0.0-jar-with-dependencies.jar" ]; then
|
|
echo "Building Eclipse formatter..."
|
|
pushd eclipse-formatter > /dev/null
|
|
mvn clean package
|
|
popd > /dev/null
|
|
fi
|
|
|
|
# Find all Java files
|
|
java_files=$(find ../spine-libgdx ../spine-android -name "*.java" -type f \
|
|
-not -path "*/build/*" \
|
|
-not -path "*/.gradle/*" \
|
|
-not -path "*/bin/*" \
|
|
-not -path "*/gen/*" \
|
|
-not -path "*/target/*")
|
|
|
|
# Run the formatter
|
|
if [ -n "$java_files" ]; then
|
|
echo "Running Eclipse formatter on Java files..."
|
|
java -jar eclipse-formatter/target/eclipse-formatter-1.0.0-jar-with-dependencies.jar \
|
|
eclipse-formatter.xml \
|
|
$java_files
|
|
fi
|
|
|
|
echo "Java formatting complete"
|
|
|
|
# Return to original directory
|
|
popd > /dev/null |