mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-21 01:36:02 +08:00
Fix TypeScript dependencies and optimize Eclipse formatter build
- Install npm dependencies if node_modules missing - Only rebuild Eclipse formatter if source is newer than JAR - Make Eclipse formatter less verbose
This commit is contained in:
parent
6a7707282e
commit
62b38f9da8
@ -27,20 +27,21 @@ public class EclipseFormatter {
|
||||
CodeFormatter formatter = new DefaultCodeFormatter(options);
|
||||
|
||||
// Format each file
|
||||
int successCount = 0;
|
||||
int changedCount = 0;
|
||||
int errorCount = 0;
|
||||
|
||||
for (int i = 1; i < args.length; i++) {
|
||||
try {
|
||||
formatFile(formatter, args[i]);
|
||||
successCount++;
|
||||
if (formatFile(formatter, args[i])) {
|
||||
changedCount++;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.err.println("Error formatting " + args[i] + ": " + e.getMessage());
|
||||
errorCount++;
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("Formatting complete: " + successCount + " files formatted, " + errorCount + " errors");
|
||||
System.out.println("Formatting complete: " + changedCount + " files changed, " + errorCount + " errors");
|
||||
|
||||
if (errorCount > 0) {
|
||||
System.exit(1);
|
||||
@ -83,12 +84,12 @@ public class EclipseFormatter {
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("Loaded " + settings.size() + " formatter settings from " + xmlPath);
|
||||
// Removed verbose output
|
||||
|
||||
return settings;
|
||||
}
|
||||
|
||||
private static void formatFile(CodeFormatter formatter, String filePath) throws Exception {
|
||||
private static boolean formatFile(CodeFormatter formatter, String filePath) throws Exception {
|
||||
Path path = Paths.get(filePath);
|
||||
|
||||
if (!Files.exists(path)) {
|
||||
@ -119,8 +120,10 @@ public class EclipseFormatter {
|
||||
if (!content.equals(formatted)) {
|
||||
Files.writeString(path, formatted);
|
||||
System.out.println("Formatted: " + filePath);
|
||||
return true;
|
||||
} else {
|
||||
System.out.println("No changes: " + filePath);
|
||||
// Silent when no changes
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10,7 +10,10 @@ dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||
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
|
||||
jar_file="eclipse-formatter/target/eclipse-formatter-1.0.0-jar-with-dependencies.jar"
|
||||
src_file="eclipse-formatter/src/main/java/com/esotericsoftware/spine/formatter/EclipseFormatter.java"
|
||||
|
||||
if [ ! -f "$jar_file" ] || [ "$src_file" -nt "$jar_file" ]; then
|
||||
echo "Building Eclipse formatter..."
|
||||
pushd eclipse-formatter > /dev/null
|
||||
mvn -q clean package
|
||||
|
||||
@ -19,10 +19,18 @@ fi
|
||||
|
||||
# Format TypeScript files
|
||||
pushd ../spine-ts > /dev/null
|
||||
if [ ! -d "node_modules" ]; then
|
||||
echo "Installing spine-ts dependencies..."
|
||||
npm install
|
||||
fi
|
||||
npm run format
|
||||
popd > /dev/null
|
||||
|
||||
pushd ../tests > /dev/null
|
||||
if [ ! -d "node_modules" ]; then
|
||||
echo "Installing tests dependencies..."
|
||||
npm install
|
||||
fi
|
||||
npm run format
|
||||
popd > /dev/null
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ Bone::Bone(Bone &bone, Bone *parent)
|
||||
}
|
||||
|
||||
Bone *Bone::getParent() {
|
||||
return _parent;
|
||||
return _parent ;
|
||||
}
|
||||
|
||||
Array<Bone *> &Bone::getChildren() {
|
||||
|
||||
@ -73,7 +73,7 @@ namespace Spine {
|
||||
bone = new Bone(boneData, parent);
|
||||
parent.children.Add(bone);
|
||||
}
|
||||
this.bones.Add(bone);
|
||||
this.bones.Add(bone) ;
|
||||
}
|
||||
|
||||
slots = new ExposedList<Slot>(data.slots.Count);
|
||||
|
||||
@ -102,7 +102,7 @@ class Skeleton {
|
||||
* See Skeleton.update(). */
|
||||
public var time:Float = 0;
|
||||
|
||||
public var windX:Float = 1;
|
||||
public var windX:Float = 1 ;
|
||||
public var windY:Float = 0;
|
||||
public var gravityX:Float = 0;
|
||||
public var gravityY:Float = 1;
|
||||
|
||||
@ -53,7 +53,7 @@ public class Bone extends PosedActive<BoneData, BoneLocal, BonePose> {
|
||||
/** Copy constructor. Does not copy the {@link #getChildren()} bones. */
|
||||
public Bone (Bone bone, @Null Bone parent) {
|
||||
this(bone.data, parent);
|
||||
pose.set(bone.pose);
|
||||
pose.set(bone.pose) ;
|
||||
}
|
||||
|
||||
/** The parent bone, or null if this is the root bone. */
|
||||
|
||||
@ -57,7 +57,7 @@ export class Bone extends PosedActive<BoneData, BoneLocal, BonePose> {
|
||||
copy (parent: Bone | null): Bone {
|
||||
const copy = new Bone(this.data, parent);
|
||||
copy.pose.set(this.pose);
|
||||
return copy;
|
||||
return copy ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user