Final clean-up of all Bash scripts except examples/**/*.sh and spine-godot/build/*.sh

This commit is contained in:
Mario Zechner 2025-07-20 22:07:17 +02:00
parent f2fced8bf8
commit 1efd045a83
12 changed files with 201 additions and 346 deletions

View File

@ -68,7 +68,7 @@ log_fail() {
}
log_warn() {
echo -e "${YELLOW}!${NC}"
echo -e " ${YELLOW}!${NC} ${YELLOW}$1${NC}"
}
log_skip() {
@ -82,11 +82,10 @@ log_error_output() {
# Final summary
log_summary() {
echo ""
echo -e "${BOLD}$1${NC}"
}
# Detailed output (errors, etc.)
log_detail() {
echo -e "${GRAY}$1${NC}"
echo -e " ${GRAY}$1${NC}"
}

View File

@ -1,88 +1,25 @@
# Terminal Logging Style Guide
This guide defines the terminal output style for all bash scripts in the Spine Runtimes project.
## Design Principles
1. **Minimal visual noise** - Use color sparingly for emphasis, not decoration
2. **Clear hierarchy** - Different levels of information have distinct visual treatments
3. **Consistent spacing** - Clean vertical rhythm throughout output
4. **Accessible** - Readable and meaningful even without colors
5. **Scannable** - Easy to quickly identify successes, failures, and important information
## Visual Hierarchy
### 1. Title (`log_title`)
- **Purpose**: Main script/tool name
- **Style**: Bold with vertical spacing
- **Usage**: Once at the beginning of script execution
## Functions
```bash
log_title "Spine-C++ Build"
```
### 2. Action + Result (inline format)
- **Purpose**: Individual operations with immediate result
- **Style**: Action on same line as result for density
- **Usage**: `log_action` followed immediately by `log_ok/fail/warn/skip`
```bash
log_action "Building all variants"
log_ok # Green ✓ on same line
log_action "Testing headless-test"
log_fail # Red ✗ on same line
```
**Results**:
- `log_ok` - Green ✓ (success)
- `log_fail` - Red ✗ (failure)
- `log_warn` - Yellow ! (warning)
- `log_skip` - Gray - (skipped)
### 4. Error Output (`log_error_output`)
- **Purpose**: Full error output when operations fail
- **Style**: Normal text (not grayed), prominent
- **Usage**: Show command output after failures
```bash
log_action "Building"
if BUILD_OUTPUT=$(command 2>&1); then
log_ok
else
log_fail
log_error_output "$BUILD_OUTPUT"
fi
```
### 5. Detail (`log_detail`)
- **Purpose**: Secondary information, debug info (not errors)
- **Style**: Gray text, indented
- **Usage**: Additional context, platform info
```bash
log_detail "Platform: Darwin"
log_detail "Branch: main"
```
### 6. Summary (`log_summary`)
- **Purpose**: Final result or conclusion
- **Style**: Bold with vertical spacing
- **Usage**: End of script execution
```bash
log_summary "✓ All tests passed (5/5)"
log_summary "✗ Tests failed (3/5)"
```
## Complete Example
```bash
#!/bin/bash
source ../formatters/logging/logging.sh
log_title "Script Name" # Bold title
log_action "Doing something" # Action with inline result
log_ok # Green ✓
log_fail # Red ✗
log_warn # Yellow !
log_skip # Gray -
log_error_output "$OUTPUT" # Show command output on errors
log_detail "Extra info" # Gray secondary text
log_summary "✓ All done" # Bold conclusion
```
## Pattern
```bash
log_title "Spine-C++ Build"
log_detail "Platform: $(uname)"
log_action "Configuring debug build"
if CMAKE_OUTPUT=$(cmake --preset=debug . 2>&1); then
@ -101,88 +38,20 @@ else
log_error_output "$BUILD_OUTPUT"
exit 1
fi
log_summary "✓ Build successful"
```
## Output Preview
## Output
**Success case:**
```
Spine-C++ Build
Platform: Darwin
Configuring debug build... ✓
Building... ✓
✓ Build successful
```
**Failure case:**
```
Spine-C++ Build
Platform: Darwin
## Rules
Configuring debug build... ✗
CMake Error: Could not find cmake file...
(full error output shown prominently)
```
## Error Handling Best Practices
1. **Capture output**: Use `OUTPUT=$(command 2>&1)` to capture both stdout and stderr
2. **Check exit codes**: Always check if critical operations succeeded
3. **Show errors prominently**: Use `log_error_output` for command failures (not grayed)
4. **Fail fast**: Exit immediately on critical failures
5. **Use inline results**: `log_action` + `log_ok/fail` for dense, scannable output
## Calling Other Scripts
When calling other bash scripts that have their own logging:
1. **Trust their logging**: Don't wrap calls in redundant log actions
2. **Capture output for errors**: Use `OUTPUT=$(script.sh 2>&1)` to capture output and only show on failure
3. **Let them handle success**: Avoid "script completed" messages when the script shows its own status
**Good**:
```bash
# Let the script handle its own logging
../formatters/format.sh cpp
# Or capture output and only show on error
if output=$(./setup.sh 2>&1); then
log_ok "Setup completed"
else
log_fail "Setup failed"
log_detail "$output"
fi
```
**Avoid**:
```bash
# This creates duplicate logging
log_action "Formatting C++ files"
../formatters/format.sh cpp
log_ok "C++ formatting completed"
```
```bash
if BUILD_OUTPUT=$(./build.sh clean release 2>&1); then
log_ok "Build completed"
else
log_fail "Build failed"
log_detail "$BUILD_OUTPUT"
exit 1
fi
```
## Usage
1. Source the utilities in your script:
```bash
source ../formatters/logging/logging.sh
```
2. Follow the hierarchy patterns shown above
3. Use appropriate functions for each type of output
4. Test output both with and without color support
- Always capture command output of commands following log_action: `OUTPUT=$(command 2>&1)`
- Show errors prominently with `log_error_output`
- Use inline results: `log_action` + `log_ok/fail`
- Let sub-scripts handle their own logging, e.g. do not log "Building Spine-C++" when calling `spine-cpp/build.sh`
- Do not capture output of sub-scripts like you do for "normal" commands. That would swallow their logging.

View File

@ -5,63 +5,62 @@ cd "$(dirname "$0")"
# Source logging utilities
source ../formatters/logging/logging.sh
# Modern Central Portal Publishing Setup:
# 1. Set up PGP key for signing: gpg --generate-key
# 2. Create Central Portal account at https://central.sonatype.com/
# 3. Generate user token in Central Portal settings
# 4. Create ~/.gradle/gradle.properties with:
# MAVEN_USERNAME=<central-portal-username>
# MAVEN_PASSWORD=<central-portal-token>
# signing.gnupg.passphrase=<pgp-key-passphrase>
#
# Version Configuration:
# - Edit spine-libgdx/gradle.properties and update the 'version' property (single source of truth)
# - For releases: version=4.2.9 (no -SNAPSHOT suffix)
# - For snapshots: version=4.2.9-SNAPSHOT (with -SNAPSHOT suffix)
log_title "Spine Android Publisher"
log_detail "Modern Central Portal Publishing Setup:"
log_detail "1. Set up PGP key for signing: gpg --generate-key"
log_detail "2. Create Central Portal account at https://central.sonatype.com/"
log_detail "3. Generate user token in Central Portal settings"
log_detail "4. Create ~/.gradle/gradle.properties with:"
log_detail " MAVEN_USERNAME=<central-portal-username>"
log_detail " MAVEN_PASSWORD=<central-portal-token>"
log_detail " signing.gnupg.passphrase=<pgp-key-passphrase>"
log_detail ""
log_detail "Version Configuration:"
log_detail "- Edit spine-libgdx/gradle.properties and update the 'version' property (single source of truth)"
log_detail "- For releases: version=4.2.9 (no -SNAPSHOT suffix)"
log_detail "- For snapshots: version=4.2.9-SNAPSHOT (with -SNAPSHOT suffix)"
log_section "Reading Version Configuration"
log_action "Reading version from spine-libgdx gradle.properties"
if VERSION=$(grep '^version=' ../spine-libgdx/gradle.properties | cut -d'=' -f2); then
log_ok "Version found: $VERSION"
if VERSION=$(grep '^version=' ../spine-libgdx/gradle.properties | cut -d'=' -f2 2>&1); then
log_ok
log_detail "Version found: $VERSION"
else
log_fail "Failed to read version from ../spine-libgdx/gradle.properties"
log_fail
log_error_output "Failed to read version from ../spine-libgdx/gradle.properties"
exit 1
fi
log_section "Publishing to Central Portal"
if echo "$VERSION" | grep -q "SNAPSHOT"; then
log_detail "Detected SNAPSHOT version"
log_action "Publishing SNAPSHOT version $VERSION to Central Portal"
if output=$(./gradlew :spine-android:publishReleasePublicationToSonaTypeRepository --info 2>&1); then
log_ok "Successfully published SNAPSHOT version $VERSION"
log_summary "Android SNAPSHOT published successfully to Central Portal"
if GRADLE_OUTPUT=$(./gradlew :spine-android:publishReleasePublicationToSonaTypeRepository --info 2>&1); then
log_ok
log_summary "Android SNAPSHOT published successfully to Central Portal"
else
log_fail "Failed to publish SNAPSHOT version"
log_detail "$output"
log_fail
log_error_output "$GRADLE_OUTPUT"
exit 1
fi
else
log_detail "Detected RELEASE version"
log_action "Publishing RELEASE version $VERSION to Central Portal via JReleaser"
log_action "Publishing to SonaType repository"
if output=$(./gradlew :spine-android:publishReleasePublicationToSonaTypeRepository -PRELEASE 2>&1); then
log_ok "Successfully published to SonaType repository"
if GRADLE_OUTPUT=$(./gradlew :spine-android:publishReleasePublicationToSonaTypeRepository -PRELEASE 2>&1); then
log_ok
else
log_fail "Failed to publish to SonaType repository"
log_detail "$output"
log_fail
log_error_output "$GRADLE_OUTPUT"
exit 1
fi
log_action "Deploying via JReleaser"
if output=$(./gradlew :spine-android:jreleaserDeploy -PRELEASE --info 2>&1); then
log_ok "Successfully deployed via JReleaser"
log_summary "Android RELEASE published successfully to Central Portal"
if GRADLE_OUTPUT=$(./gradlew :spine-android:jreleaserDeploy -PRELEASE --info 2>&1); then
log_ok
log_summary "Android RELEASE published successfully to Central Portal"
else
log_fail "Failed to deploy via JReleaser"
log_detail "$output"
log_fail
log_error_output "$GRADLE_OUTPUT"
exit 1
fi
fi

View File

@ -7,30 +7,30 @@ source ../formatters/logging/logging.sh
log_title "Spine Flutter WASM Compiler"
log_section "Preparing Build Environment"
log_action "Creating assets directory"
if mkdir -p lib/assets/; then
log_ok "Assets directory created"
if MKDIR_OUTPUT=$(mkdir -p lib/assets/ 2>&1); then
log_ok
else
log_fail "Failed to create assets directory"
log_fail
log_error_output "$MKDIR_OUTPUT"
exit 1
fi
log_action "Creating pre.js module file"
if echo "const module = {};" > pre.js; then
log_ok "pre.js created successfully"
if ECHO_OUTPUT=$(echo "const module = {};" > pre.js 2>&1); then
log_ok
else
log_fail "Failed to create pre.js"
log_fail
log_error_output "$ECHO_OUTPUT"
exit 1
fi
log_section "Compiling WASM"
log_detail "Using -O2 optimization to preserve function names"
log_detail "The Closure compiler in -O3 would scramble native function names"
log_action "Compiling spine-cpp to WASM"
# Build the emscripten command
if output=$(em++ \
if EMCC_OUTPUT=$(em++ \
-Isrc/spine-cpp/include \
-O2 --closure 1 -fno-rtti -fno-exceptions \
-s STRICT=1 \
@ -47,27 +47,29 @@ if output=$(em++ \
-s EXPORT_NAME=libspine_flutter \
src/spine-cpp-lite/spine-cpp-lite.cpp $(find src/spine-cpp/src -type f) \
-o lib/assets/libspine_flutter.js 2>&1); then
log_ok "WASM compilation completed successfully"
log_ok
else
log_fail "WASM compilation failed"
log_detail "$output"
log_fail
log_error_output "$EMCC_OUTPUT"
rm -f pre.js
exit 1
fi
log_section "Build Results"
log_action "Listing generated assets"
if ls -lah lib/assets; then
log_ok "Assets generated successfully"
if LS_OUTPUT=$(ls -lah lib/assets 2>&1); then
log_ok
log_detail "$LS_OUTPUT"
else
log_warn "Could not list assets directory"
log_warn
log_detail "$LS_OUTPUT"
fi
log_action "Cleaning up temporary files"
if rm pre.js; then
log_ok "Cleaned up pre.js"
if RM_OUTPUT=$(rm pre.js 2>&1); then
log_ok
else
log_warn "Could not remove pre.js"
log_warn
log_detail "$RM_OUTPUT"
fi
log_summary "WASM compilation completed successfully"
log_summary "WASM compilation completed successfully"

View File

@ -7,41 +7,27 @@ source ../formatters/logging/logging.sh
log_title "Spine Flutter Publisher"
log_section "Preparation"
log_action "Setting up environment"
if output=$(./setup.sh 2>&1); then
log_ok "Setup completed successfully"
else
log_fail "Setup failed"
log_detail "$output"
exit 1
fi
# Let setup.sh handle its own logging
./setup.sh
log_action "Compiling WASM"
if output=$(./compile-wasm.sh 2>&1); then
log_ok "WASM compilation completed successfully"
else
log_fail "WASM compilation failed"
log_detail "$output"
exit 1
fi
# Let compile-wasm.sh handle its own logging
./compile-wasm.sh
log_section "Publishing to Dart Pub"
log_action "Running dry-run publish"
if output=$(dart pub publish --dry-run 2>&1); then
log_ok "Dry-run publish completed successfully"
if DART_OUTPUT=$(dart pub publish --dry-run 2>&1); then
log_ok
else
log_fail "Dry-run publish failed"
log_detail "$output"
log_fail
log_error_output "$DART_OUTPUT"
exit 1
fi
log_action "Publishing to Dart Pub"
if output=$(dart pub publish 2>&1); then
log_ok "Successfully published to Dart Pub"
log_summary "Flutter package published successfully"
if DART_OUTPUT=$(dart pub publish 2>&1); then
log_ok
log_summary "Flutter package published successfully"
else
log_fail "Failed to publish to Dart Pub"
log_detail "$output"
log_fail
log_error_output "$DART_OUTPUT"
exit 1
fi

View File

@ -10,38 +10,40 @@ log_title "Spine Flutter Setup"
log_detail "CocoaPods requires all source files to be under the same folder hierarchy"
log_detail "as the podspec file resides in. Copying spine-cpp sources to platform folders."
log_section "Copying Spine C++ Sources"
log_action "Copying spine-cpp to iOS Classes"
if cp -r ../spine-cpp/spine-cpp ios/Classes 2>/dev/null; then
log_ok "iOS Classes updated successfully"
if CP_OUTPUT=$(cp -r ../spine-cpp/spine-cpp ios/Classes 2>&1); then
log_ok
else
log_fail "Failed to copy spine-cpp to iOS Classes"
log_fail
log_error_output "$CP_OUTPUT"
exit 1
fi
log_action "Copying spine-cpp to macOS Classes"
if cp -r ../spine-cpp/spine-cpp macos/Classes 2>/dev/null; then
log_ok "macOS Classes updated successfully"
if CP_OUTPUT=$(cp -r ../spine-cpp/spine-cpp macos/Classes 2>&1); then
log_ok
else
log_fail "Failed to copy spine-cpp to macOS Classes"
log_fail
log_error_output "$CP_OUTPUT"
exit 1
fi
log_action "Copying spine-cpp to src directory"
if cp -r ../spine-cpp/spine-cpp src 2>/dev/null; then
log_ok "src directory updated successfully"
if CP_OUTPUT=$(cp -r ../spine-cpp/spine-cpp src 2>&1); then
log_ok
else
log_fail "Failed to copy spine-cpp to src directory"
log_fail
log_error_output "$CP_OUTPUT"
exit 1
fi
log_action "Copying spine-cpp-lite to src directory"
if cp -r ../spine-cpp/spine-cpp-lite src 2>/dev/null; then
log_ok "spine-cpp-lite copied successfully"
if CP_OUTPUT=$(cp -r ../spine-cpp/spine-cpp-lite src 2>&1); then
log_ok
else
log_fail "Failed to copy spine-cpp-lite to src directory"
log_fail
log_error_output "$CP_OUTPUT"
exit 1
fi
log_summary "Flutter setup completed successfully"
log_summary "Flutter setup completed successfully"

View File

@ -24,7 +24,6 @@ if echo "$COMMIT_MSG" | grep -qE '^\[haxe\] Release [0-9]+\.[0-9]+\.[0-9]+$'; th
log_detail "Version: $VERSION"
if [ ! -z "$HAXE_UPDATE_URL" ] && [ ! -z "$BRANCH" ]; then
log_section "Deploy"
log_action "Creating release package"
if ZIP_OUTPUT=$(zip -r "spine-haxe-$VERSION.zip" \
haxelib.json \
@ -37,7 +36,7 @@ if echo "$COMMIT_MSG" | grep -qE '^\[haxe\] Release [0-9]+\.[0-9]+\.[0-9]+$'; th
log_error_output "$ZIP_OUTPUT"
exit 1
fi
log_action "Uploading to $HAXE_UPDATE_URL$BRANCH"
if CURL_OUTPUT=$(curl -f -F "file=@spine-haxe-$VERSION.zip" "$HAXE_UPDATE_URL$BRANCH" 2>&1); then
log_ok
@ -46,7 +45,7 @@ if echo "$COMMIT_MSG" | grep -qE '^\[haxe\] Release [0-9]+\.[0-9]+\.[0-9]+$'; th
log_error_output "$CURL_OUTPUT"
exit 1
fi
log_summary "✓ Build and deployment successful"
else
log_skip "Deployment skipped (HAXE_UPDATE_URL and/or BRANCH not set)"

View File

@ -16,36 +16,44 @@ newVersion="$major.$minor.$newPatch"
log_title "Spine-Haxe Publish"
log_section "Version Update"
log_detail "Current version: $currentVersion"
log_detail "New version: $newVersion"
log_action "Updating haxelib.json"
sed -i '' "s/$currentVersion/$newVersion/" haxelib.json
log_ok "Version updated in haxelib.json"
if SED_OUTPUT=$(sed -i '' "s/$currentVersion/$newVersion/" haxelib.json 2>&1); then
log_ok
else
log_fail
log_error_output "$SED_OUTPUT"
exit 1
fi
log_section "Confirm"
echo "Write Y if you want to commit and push the new version $newVersion."
echo "This will trigger a pipeline that will publish the new version on esoteric software server."
echo "Do you want to proceed [y/n]?"
read answer
if [ "$answer" = "Y" ] || [ "$answer" = "y" ]; then
log_section "Publish"
log_action "Committing changes"
git add haxelib.json
git commit -m "[haxe] Release $newVersion"
log_ok "Changes committed"
if COMMIT_OUTPUT=$(git add haxelib.json && git commit -m "[haxe] Release $newVersion" 2>&1); then
log_ok
else
log_fail
log_error_output "$COMMIT_OUTPUT"
exit 1
fi
log_action "Pushing to origin"
if git push origin 4.2; then
log_ok "Changes pushed"
if PUSH_OUTPUT=$(git push origin 4.2 2>&1); then
log_ok
log_summary "✓ Version $newVersion published successfully"
else
log_fail "Push failed"
log_fail
log_error_output "$PUSH_OUTPUT"
exit 1
fi
else
log_skip "Commit and push cancelled"
log_action "Publishing version"
log_skip
log_summary "Version updated locally only"
fi

View File

@ -7,18 +7,18 @@ source ../formatters/logging/logging.sh
log_title "Spine iOS Setup"
log_section "Generating Swift Bindings"
log_action "Running spine-cpp-lite code generator"
if output=$(python3 ../spine-cpp/spine-cpp-lite/spine-cpp-lite-codegen.py 2>&1); then
if echo "$output" > Sources/Spine/Spine.Generated.swift; then
log_ok "Swift bindings generated successfully"
log_summary "iOS setup completed successfully"
if PYTHON_OUTPUT=$(python3 ../spine-cpp/spine-cpp-lite/spine-cpp-lite-codegen.py 2>&1); then
if WRITE_OUTPUT=$(echo "$PYTHON_OUTPUT" > Sources/Spine/Spine.Generated.swift 2>&1); then
log_ok
log_summary "iOS setup completed successfully"
else
log_fail "Failed to write generated Swift code"
log_fail
log_error_output "$WRITE_OUTPUT"
exit 1
fi
else
log_fail "Failed to run spine-cpp-lite code generator"
log_detail "$output"
log_fail
log_error_output "$PYTHON_OUTPUT"
exit 1
fi

View File

@ -5,63 +5,59 @@ cd "$(dirname "$0")"
# Source logging utilities
source ../formatters/logging/logging.sh
# Modern Central Portal Publishing Setup:
# 1. Set up PGP key for signing: gpg --generate-key
# 2. Create Central Portal account at https://central.sonatype.com/
# 3. Generate user token in Central Portal settings
# 4. Create ~/.gradle/gradle.properties with:
# MAVEN_USERNAME=<central-portal-username>
# MAVEN_PASSWORD=<central-portal-token>
# signing.gnupg.passphrase=<pgp-key-passphrase>
#
# Version Configuration:
# - Edit gradle.properties and update the 'version' property
# - For releases: version=4.2.9 (no -SNAPSHOT suffix)
# - For snapshots: version=4.2.9-SNAPSHOT (with -SNAPSHOT suffix)
log_title "Spine LibGDX Publisher"
log_detail "Modern Central Portal Publishing Setup:"
log_detail "1. Set up PGP key for signing: gpg --generate-key"
log_detail "2. Create Central Portal account at https://central.sonatype.com/"
log_detail "3. Generate user token in Central Portal settings"
log_detail "4. Create ~/.gradle/gradle.properties with:"
log_detail " MAVEN_USERNAME=<central-portal-username>"
log_detail " MAVEN_PASSWORD=<central-portal-token>"
log_detail " signing.gnupg.passphrase=<pgp-key-passphrase>"
log_detail ""
log_detail "Version Configuration:"
log_detail "- Edit gradle.properties and update the 'version' property"
log_detail "- For releases: version=4.2.9 (no -SNAPSHOT suffix)"
log_detail "- For snapshots: version=4.2.9-SNAPSHOT (with -SNAPSHOT suffix)"
log_section "Reading Version Configuration"
log_action "Reading version from gradle.properties"
if VERSION=$(grep '^version=' gradle.properties | cut -d'=' -f2); then
log_ok "Version found: $VERSION"
if VERSION=$(grep '^version=' gradle.properties | cut -d'=' -f2 2>&1); then
log_ok
log_detail "Version found: $VERSION"
else
log_fail "Failed to read version from gradle.properties"
log_fail
log_error_output "Failed to read version from gradle.properties"
exit 1
fi
log_section "Publishing to Central Portal"
if echo "$VERSION" | grep -q "SNAPSHOT"; then
log_detail "Detected SNAPSHOT version"
log_action "Publishing SNAPSHOT version $VERSION to Central Portal"
if output=$(./gradlew publishReleasePublicationToSonaTypeRepository 2>&1); then
log_ok "Successfully published SNAPSHOT version $VERSION"
log_summary "LibGDX SNAPSHOT published successfully to Central Portal"
if GRADLE_OUTPUT=$(./gradlew publishReleasePublicationToSonaTypeRepository 2>&1); then
log_ok
log_summary "✓ LibGDX SNAPSHOT published successfully to Central Portal"
else
log_fail "Failed to publish SNAPSHOT version"
log_detail "$output"
log_fail
log_error_output "$GRADLE_OUTPUT"
exit 1
fi
else
log_detail "Detected RELEASE version"
log_action "Publishing RELEASE version $VERSION to Central Portal via JReleaser"
log_action "Publishing to SonaType repository"
if output=$(./gradlew publishReleasePublicationToSonaTypeRepository -PRELEASE 2>&1); then
log_ok "Successfully published to SonaType repository"
log_action "Publishing RELEASE version $VERSION to Central Portal"
if GRADLE_OUTPUT=$(./gradlew publishReleasePublicationToSonaTypeRepository -PRELEASE 2>&1); then
log_ok
else
log_fail "Failed to publish to SonaType repository"
log_detail "$output"
log_fail
log_error_output "$GRADLE_OUTPUT"
exit 1
fi
log_action "Deploying via JReleaser"
if output=$(./gradlew jreleaserDeploy -PRELEASE 2>&1); then
log_ok "Successfully deployed via JReleaser"
log_summary "LibGDX RELEASE published successfully to Central Portal"
if GRADLE_OUTPUT=$(./gradlew jreleaserDeploy -PRELEASE 2>&1); then
log_ok
log_summary "LibGDX RELEASE published successfully to Central Portal"
else
log_fail "Failed to deploy via JReleaser"
log_detail "$output"
log_fail
log_error_output "$GRADLE_OUTPUT"
exit 1
fi
fi

View File

@ -15,11 +15,8 @@ patch=$(echo "$currentVersion" | cut -d. -f3)
newPatch=$((patch + 1))
newVersion="$major.$minor.$newPatch"
log_section "Version Management"
log_detail "Current version: $currentVersion"
log_detail "New version: $newVersion"
log_section "Updating Package Versions"
packages=(
"package.json"
"spine-canvas/package.json"
@ -37,46 +34,44 @@ packages=(
for package in "${packages[@]}"; do
log_action "Updating $package"
if sed -i '' "s/$currentVersion/$newVersion/" "$package" 2>/dev/null; then
log_ok "Updated $package"
if SED_OUTPUT=$(sed -i '' "s/$currentVersion/$newVersion/" "$package" 2>&1); then
log_ok
else
log_fail "Failed to update $package"
log_fail
log_error_output "$SED_OUTPUT"
exit 1
fi
done
log_section "Preparing for Publish"
log_action "Removing package-lock.json"
if rm package-lock.json 2>/dev/null; then
log_ok "Removed package-lock.json"
if RM_OUTPUT=$(rm package-lock.json 2>&1); then
log_ok
else
log_warn "package-lock.json not found or already removed"
log_warn
fi
log_action "Cleaning @esotericsoftware modules"
if rm -rf node_modules/@esotericsoftware 2>/dev/null; then
log_ok "Cleaned @esotericsoftware modules"
if RM_OUTPUT=$(rm -rf node_modules/@esotericsoftware 2>&1); then
log_ok
else
log_warn "@esotericsoftware modules not found or already removed"
log_warn
fi
log_section "Installing Dependencies"
log_action "Installing workspace dependencies"
if output=$(npm install --workspaces 2>&1); then
log_ok "Dependencies installed successfully"
if NPM_OUTPUT=$(npm install --workspaces 2>&1); then
log_ok
else
log_fail "Failed to install dependencies"
log_detail "$output"
log_fail
log_error_output "$NPM_OUTPUT"
exit 1
fi
log_section "Publishing to NPM"
log_action "Publishing all workspaces"
if output=$(npm publish --access public --workspaces 2>&1); then
log_ok "Successfully published all packages to NPM"
log_summary "TypeScript packages published successfully with version $newVersion"
if NPM_OUTPUT=$(npm publish --access public --workspaces 2>&1); then
log_ok
log_summary "TypeScript packages published successfully with version $newVersion"
else
log_fail "Failed to publish packages"
log_detail "$output"
log_fail
log_error_output "$NPM_OUTPUT"
exit 1
fi

View File

@ -7,19 +7,19 @@ source ../formatters/logging/logging.sh
log_title "Spine Unreal Engine Setup"
log_section "Updating Spine C++ Sources"
log_action "Removing existing spine-cpp directory"
if rm -rf Plugins/SpinePlugin/Source/SpinePlugin/Public/spine-cpp 2>/dev/null; then
log_ok "Existing spine-cpp directory removed"
if RM_OUTPUT=$(rm -rf Plugins/SpinePlugin/Source/SpinePlugin/Public/spine-cpp 2>&1); then
log_ok
else
log_warn "No existing spine-cpp directory found"
log_warn
fi
log_action "Copying updated spine-cpp sources"
if cp -r ../spine-cpp/spine-cpp Plugins/SpinePlugin/Source/SpinePlugin/Public/spine-cpp 2>/dev/null; then
log_ok "spine-cpp sources copied successfully"
log_summary "Unreal Engine setup completed successfully"
if CP_OUTPUT=$(cp -r ../spine-cpp/spine-cpp Plugins/SpinePlugin/Source/SpinePlugin/Public/spine-cpp 2>&1); then
log_ok
log_summary "Unreal Engine setup completed successfully"
else
log_fail "Failed to copy spine-cpp sources"
log_fail
log_error_output "$CP_OUTPUT"
exit 1
fi