Skip to content

Build Script Enhancements: Performance Optimizations and Timestamp Tracking#2715

Open
hongwei1 wants to merge 6 commits intoOpenBankProject:developfrom
hongwei1:obp-develop
Open

Build Script Enhancements: Performance Optimizations and Timestamp Tracking#2715
hongwei1 wants to merge 6 commits intoOpenBankProject:developfrom
hongwei1:obp-develop

Conversation

@hongwei1
Copy link
Contributor

Summary

This PR introduces several enhancements to the build scripts to improve developer experience and build performance.

Changes

1. Maven Shade Plugin Configuration

  • Configure Maven shade plugin to generate obp-api.jar directly without version suffix
  • Eliminates need to modify build scripts when referencing the JAR file

2. Maven and Scala Compiler Performance Optimizations

  • Increased Scala compiler heap: 1GB → 3GB
  • Added G1GC garbage collector
  • Enabled tiered compilation and parallel backend compilation
  • Result: 70% faster incremental builds (138s → 42s)

3. Build Script Enhancements

  • Added build log output redirection
  • Enhanced error reporting

4. Auto-Retry with Clean Build

  • Detects incremental compilation cache issues automatically
  • Auto-retries with clean build when cache errors detected

5. Build Timestamp and Duration Tracking

  • Records build start and end timestamps
  • Calculates and displays build duration
  • macOS compatible

Performance Impact

  • Incremental builds: 70% faster (138s → 42s)
  • Clean builds: ~10% slower (acceptable trade-off)

Files Changed

  • pom.xml
  • flushall_fast_build_and_run.sh
  • flushall_build_and_run.sh

… incremental builds

Optimizations applied:
- Scala compiler: Increased heap to 3GB, stack to 4MB, enabled G1GC
- Added parallel backend compilation with 4 threads (-Ybackend-parallelism 4)
- Enabled incremental compilation with Zinc (recompileMode=incremental)
- Added 512MB code cache for JIT compilation
- Removed -explaintypes flag to reduce compilation overhead
- Adjusted MAVEN_OPTS: 3-6GB heap (was 4-8GB) for better balance

Performance improvements:
- Incremental build: 138s → 42s (70% faster, 16x faster for API module)
- Clean build: 138s → 153s (10% slower, acceptable tradeoff)
- Daily development efficiency: saves ~32 minutes per day (20 build cycles)

Build script improvements:
- Added build log output to fast_build.log
- Enhanced error reporting with last 30 lines on failure
- Updated documentation with optimization details and expected build times
Applied same performance optimizations from fast build script:
- Added optimized MAVEN_OPTS: stack 4m, G1GC, 512MB code cache
- Added tiered compilation flags for faster JIT
- Added build log output to build.log (saves tokens)
- Enhanced error reporting with last 30 lines on failure
- Updated documentation with optimization details

This ensures both build scripts benefit from the same 70% performance improvement on incremental builds.
…ion fails

Added intelligent build failure detection and auto-recovery:
- Detects incremental compilation cache issues (missing classes/packages)
- Automatically retries with clean build if cache issue detected
- Backs up failed incremental build log for debugging
- Provides user-friendly messages explaining what happened

Common error patterns detected:
- 'is not a member of package'
- 'cannot find symbol'
- 'not found: type'
- 'not found: value'

Benefits:
- Best of both worlds: fast incremental builds + automatic fallback
- No manual intervention needed for cache issues
- Saves developer time and frustration
- Only triggers clean build when necessary (not for real compilation errors)
@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant