Skip to content

[CORE] Add Bloop integration for faster Scala incremental compilation#11645

Merged
liuneng1994 merged 1 commit intoapache:mainfrom
liuneng1994:bloop-maven-plugin
Feb 26, 2026
Merged

[CORE] Add Bloop integration for faster Scala incremental compilation#11645
liuneng1994 merged 1 commit intoapache:mainfrom
liuneng1994:bloop-maven-plugin

Conversation

@liuneng1994
Copy link
Contributor

Summary

This PR adds Bloop build server integration to accelerate Scala development workflows. Bloop maintains a persistent JVM with warm Zinc compiler state, dramatically reducing incremental compilation times.

Key Changes

  • pom.xml: Add bloop-maven-plugin (v2.0.3) with version property, pluginManagement entry, and -Pbloop profile to skip style checks during config generation
  • dev/bloop-setup.sh: Script to generate Bloop configuration with JVM test options injection (required for Java 17+) and -release option removal for compatibility
  • dev/bloop-test.sh: Convenience wrapper with SPARK_ANSI_SQL_MODE=false default for Spark 4.x test compatibility
  • docs/developers/bloop-integration.md: Comprehensive usage guide with setup instructions and troubleshooting

Benchmark Results

Scenario Maven Bloop Speedup
gluten-core incremental 8.26s 0.23s 35.9x
gluten-core clean+compile 29.62s 14.90s 2.0x
Full project incremental ~2 min 2.82s 40.1x

Usage

# Generate bloop config (first time / when changing profiles)
./dev/bloop-setup.sh -Pspark-3.5,scala-2.12,backends-velox

# Compile with watch mode (auto-recompile on save)
bloop compile gluten-core -w

# Run tests
bloop test backends-velox -o '*VeloxHashJoinSuite*'

# Or use the convenience wrapper
./dev/bloop-test.sh -pl backends-velox -s VeloxHashJoinSuite

Test plan

  • Verified bloop config generation with ./dev/bloop-setup.sh -Pjava-17,spark-4.1,scala-2.13,backends-velox
  • Verified compilation: bloop compile gluten-core - passes
  • Verified tests: bloop test gluten-core - 6 suites, 24 tests pass
  • Verified Spark 4.1 tests with ANSI mode disabled: SPARK_ANSI_SQL_MODE=false bloop test backends-velox -o '*VeloxHashJoinSuite*' - 7 tests pass
  • Verified benchmark results show significant speedup
  • Default Maven builds remain unaffected (bloop profile is opt-in)

🤖 Generated with Claude Code

@github-actions github-actions bot added CORE works for Gluten Core BUILD DOCS labels Feb 24, 2026
@github-actions
Copy link

Run Gluten Clickhouse CI on x86

@github-actions
Copy link

Run Gluten Clickhouse CI on x86

- Add bloop-maven-plugin (v2.0.3) to pom.xml with version property and
  pluginManagement entry
- Add -Pbloop profile to skip style checks during config generation
- Add dev/bloop-setup.sh script to generate Bloop configuration with
  JVM test options injection and -release option removal
- Add dev/bloop-test.sh convenience wrapper with SPARK_ANSI_SQL_MODE=false
  default for Spark 4.x test compatibility
- Add docs/developers/bloop-integration.md with usage guide

Bloop eliminates ~52s Zinc analysis reload overhead by maintaining a
persistent JVM with warm compiler state, enabling faster iterative
development workflows.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link

Run Gluten Clickhouse CI on x86

</build>
</profile>
<profile>
<id>bloop</id>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

skipCheck seems more clear

@liuneng1994 liuneng1994 merged commit d4c6fd8 into apache:main Feb 26, 2026
59 checks passed
@baibaichen baibaichen added the AI AI Related issues and PR label Feb 26, 2026
baibaichen added a commit that referenced this pull request Feb 26, 2026
…d introduce fast-build profile

- Restore scala.recompile.mode default from 'incremental' back to 'all'
  to fix CI/clean build failures caused by Zinc's incremental compiler
  not tracking transitive Spark dependencies correctly

- Rename the 'bloop' Maven profile (added in #11645) to 'fast-build' and
  add scala.recompile.mode=incremental inside it; used by bloop-setup.sh
  and run-scala-test.sh where Zinc analysis is warm and reliable

- Simplify run-scala-test.sh: replace 5 redundant -D skip flags with
  -Pfast-build profile activation

- Add pathing JAR support in run-scala-test.sh to avoid OS command-line
  length limits when classpath is very long

Closes #11658

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
baibaichen added a commit that referenced this pull request Feb 26, 2026
…d introduce fast-build profile

- Restore scala.recompile.mode default from 'incremental' back to 'all'
  to fix CI/clean build failures caused by Zinc's incremental compiler
  not tracking transitive Spark dependencies correctly

- Rename the 'bloop' Maven profile (added in #11645) to 'fast-build' and
  add scala.recompile.mode=incremental inside it; used by bloop-setup.sh
  and run-scala-test.sh where Zinc analysis is warm and reliable

- Simplify run-scala-test.sh: replace 5 redundant -D skip flags with
  -Pfast-build profile activation

- Add pathing JAR support in run-scala-test.sh to avoid OS command-line
  length limits when classpath is very long

Closes #11658

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
baibaichen added a commit that referenced this pull request Feb 26, 2026
…d introduce fast-build profile

- Restore scala.recompile.mode default from 'incremental' back to 'all'
  to fix CI/clean build failures caused by Zinc's incremental compiler
  not tracking transitive Spark dependencies correctly

- Rename the 'bloop' Maven profile (added in #11645) to 'fast-build' and
  add scala.recompile.mode=incremental inside it; used by bloop-setup.sh
  and run-scala-test.sh where Zinc analysis is warm and reliable

- Simplify run-scala-test.sh: replace 5 redundant -D skip flags with
  -Pfast-build profile activation

- Add pathing JAR support in run-scala-test.sh to avoid OS command-line
  length limits when classpath is very long

Closes #11658

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
baibaichen added a commit that referenced this pull request Feb 26, 2026
…d introduce fast-build profile

- Restore scala.recompile.mode default from 'incremental' back to 'all'
  to fix CI/clean build failures caused by Zinc's incremental compiler
  not tracking transitive Spark dependencies correctly

- Rename the 'bloop' Maven profile (added in #11645) to 'fast-build' and
  add scala.recompile.mode=incremental inside it; used by bloop-setup.sh
  and run-scala-test.sh where Zinc analysis is warm and reliable

- Simplify run-scala-test.sh: replace 5 redundant -D skip flags with
  -Pfast-build profile activation

- Add pathing JAR support in run-scala-test.sh to avoid OS command-line
  length limits when classpath is very long

Closes #11658

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
baibaichen added a commit that referenced this pull request Feb 27, 2026
…lugin 4.9.2

scala-maven-plugin 4.9.2 introduced a behavior change in
ScalaMojoSupport.computeBytecodeVersionOptions() [1]: when
maven.compiler.target is set (e.g. "1.8"), it now injects
'-release <target>' into scalac args for Scala >= 2.12.

The '-release' flag in scalac is only supported when running on
Java 9+. Building under JDK 8 with recompileMode=all therefore
fails with:

  scalac error: -release is only supported on Java 9 and higher

This was not visible with recompileMode=incremental (the previous
default set by #11645) because Zinc's SbtIncrementalCompiler takes
a different code path that bypasses computeBytecodeVersionOptions.

Fix: in the java-8 profile (auto-activated via <jdk>1.8</jdk>),
override scala-maven-plugin's <target> with an empty string. This
makes isNotEmpty(target)=false [2], so -release is not injected.
Scalac 2.12 running under JDK 8 then uses its own default bytecode
target (JVM 1.8), which is correct.

Java 9/11/17/21 environments are unaffected: for those, -release N
is a valid scalac argument and no override is needed.

[1] https://github.com/davidB/scala-maven-plugin/blob/4.9.2/src/main/java/scala_maven/ScalaMojoSupport.java#L364-L392
[2] https://github.com/davidB/scala-maven-plugin/blob/4.9.2/src/main/java/scala_maven/ScalaMojoSupport.java#L154-L156

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
baibaichen added a commit to baibaichen/gluten that referenced this pull request Feb 27, 2026
…d introduce fast-build profile

- Restore scala.recompile.mode default from 'incremental' back to 'all'
  to fix CI/clean build failures caused by Zinc's incremental compiler
  not tracking transitive Spark dependencies correctly

- Rename the 'bloop' Maven profile (added in apache#11645) to 'fast-build' and
  add scala.recompile.mode=incremental inside it; used by bloop-setup.sh
  and run-scala-test.sh where Zinc analysis is warm and reliable

- Simplify run-scala-test.sh: replace 5 redundant -D skip flags with
  -Pfast-build profile activation

- Add pathing JAR support in run-scala-test.sh to avoid OS command-line
  length limits when classpath is very long

Closes apache#11658

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
baibaichen added a commit to baibaichen/gluten that referenced this pull request Feb 27, 2026
Problem: scala-maven-plugin 4.9.2 changed behavior for Scala >= 2.12 builds.
When maven.compiler.target is set (e.g. "1.8"), it now passes the value to
computeBytecodeVersionOptions() [1] which injects '-release 1.8' into scalac
args. The scalac '-release' flag is only supported on Java 9+, so building
under JDK 8 with recompileMode=all (restored by the parent commit) fails with:
  scalac error: -release is only supported on Java 9 and higher

Root cause: PR apache#11645 (which introduced scala-maven-plugin 4.9.2) also set
recompileMode=incremental, which routes through Zinc's SbtIncrementalCompiler
and bypasses computeBytecodeVersionOptions(). Restoring recompileMode=all
exposes the 4.9.2 regression for Java 8 builds.

Fix: in the java-8 profile, pin scala.compiler.version to 4.8.0, which does
not have this regression. Java 9+ builds continue to use 4.9.2 unaffected.

[1] https://github.com/davidB/scala-maven-plugin/blob/4.9.2/src/main/java/scala_maven/ScalaMojoSupport.java#L620-L648

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
baibaichen added a commit that referenced this pull request Feb 27, 2026
…d introduce fast-build profile (#11659)

* [GLUTEN-11658][CORE] Restore scala.recompile.mode default to 'all' and introduce fast-build profile

- Restore scala.recompile.mode default from 'incremental' back to 'all'
  to fix CI/clean build failures caused by Zinc's incremental compiler
  not tracking transitive Spark dependencies correctly

- Rename the 'bloop' Maven profile (added in #11645) to 'fast-build' and
  add scala.recompile.mode=incremental inside it; used by bloop-setup.sh
  and run-scala-test.sh where Zinc analysis is warm and reliable

- Simplify run-scala-test.sh: replace 5 redundant -D skip flags with
  -Pfast-build profile activation

- Add pathing JAR support in run-scala-test.sh to avoid OS command-line
  length limits when classpath is very long

Closes #11658

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Fix Java 8 build failure caused by scala-maven-plugin 4.9.2

Problem: scala-maven-plugin 4.9.2 changed behavior for Scala >= 2.12 builds.
When maven.compiler.target is set (e.g. "1.8"), it now passes the value to
computeBytecodeVersionOptions() [1] which injects '-release 1.8' into scalac
args. The scalac '-release' flag is only supported on Java 9+, so building
under JDK 8 with recompileMode=all (restored by the parent commit) fails with:
  scalac error: -release is only supported on Java 9 and higher

Root cause: PR #11645 (which introduced scala-maven-plugin 4.9.2) also set
recompileMode=incremental, which routes through Zinc's SbtIncrementalCompiler
and bypasses computeBytecodeVersionOptions(). Restoring recompileMode=all
exposes the 4.9.2 regression for Java 8 builds.

Fix: in the java-8 profile, pin scala.compiler.version to 4.8.0, which does
not have this regression. Java 9+ builds continue to use 4.9.2 unaffected.

[1] https://github.com/davidB/scala-maven-plugin/blob/4.9.2/src/main/java/scala_maven/ScalaMojoSupport.java#L620-L648

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI AI Related issues and PR BUILD CORE works for Gluten Core DOCS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants