[tool](fe) add fast-compile-fe.sh for incremental FE compilation#61429
[tool](fe) add fast-compile-fe.sh for incremental FE compilation#61429englefly wants to merge 5 commits intoapache:masterfrom
Conversation
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
|
run buildall |
|
PR approved by at least one committer and no changes requested. |
|
PR approved by anyone and no changes requested. |
|
run buildall |
|
run buildall |
|
/review |
There was a problem hiding this comment.
Code Review Summary: tools/fast-compile-fe.sh
This PR adds a developer utility script for incremental FE compilation. The script is well-structured and useful. A few issues and suggestions below.
Critical Checkpoint Conclusions
- Goal/correctness: The script achieves its stated goal of incremental compilation for
fe-core. However, it only coversfe/fe-corewhile the FE has many sub-modules (fe-common,fe-catalog,fe-foundation,fe-type, etc.). Changes in those modules won't be picked up. This scope limitation should be clearly documented. - Modification minimal/focused: Yes, single new file, well-scoped.
- Concurrency: N/A (shell script, single-threaded).
- Lifecycle/static init: N/A.
- Configuration items: N/A.
- Incompatible changes: N/A — dev tool only, no production impact.
- Parallel code paths: N/A.
- Special conditional checks: The stale-file detection only checks mtime of the main
.classfile, not inner classes. If only an inner class is stale (e.g., due to a dependency change), it won't be detected. Acceptable trade-off for a dev tool. - Test coverage: No automated tests, which is fine for a developer utility script.
- Observability: Colored info/warn/error output is adequate.
- Performance: The
find_stale_java_filesfunction spawns one shell loop over all.javafiles inSRC_ROOT. For large source trees this is slow; afind ... -newerapproach orrsync --dry-runwould be faster, but acceptable for a dev tool.
Issues Found
-
(Medium)
javac -source 8 -target 8differs from the Maven build's<release>8</release>. The--releaseflag restricts API usage to the target JDK's boot classpath;-source/-targetdoes not. This means the fast-compile path could successfully compile code that uses JDK 17+ APIs, which would then fail in the real Maven build. Consider using--release 8instead. -
(Medium)
collect_updated_classesuses${java_file#$SRC_ROOT/}to compute class file paths. If a user passes a file that is not underSRC_ROOT(e.g., a generated-sources file, or a file resolved from a different module), the prefix stripping is a no-op and the resulting class path will be completely wrong, silently producing no matches. -
(Low) The
trap "rm -f $tmpfile" EXITon line 200 replaces any prior EXIT trap. Currently there is no prior trap so this is benign, but it's fragile for future edits. Consider using a single top-level cleanup function. -
(Low)
xargs jar ufon lines 211/217 splits on whitespace by default. If any class file path contains spaces, this will break. Usexargs -d '\n'(GNU xargs) for safety. -
(Info) The script only supports
fe/fe-core. The usage header and help text should mention this explicitly, since developers editingfe-commonorfe-catalogmight expect this tool to handle those modules too.
tools/fast-compile-fe.sh
Outdated
|
|
||
| # Compile with javac | ||
| javac \ | ||
| -source 8 -target 8 \ |
There was a problem hiding this comment.
source and target read from pom.xml is better?
Add `tools/fast-compile-fe.sh`, a developer utility that incrementally compiles only changed Java source files and patches them directly into `doris-fe.jar`, avoiding a full Maven rebuild during development. Key features: - Auto-detects stale `.java` files by comparing mtime with `.class` files - Supports explicit file arguments (by path or filename search under src/) - Caches the classpath derived from `target/lib` to skip repeated mvn calls - Updates both `target/doris-fe.jar` and `output/fe/lib/doris-fe.jar` - Handles inner classes and anonymous classes (e.g. `Foo$Bar.class`) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
run buildall |
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
Add
tools/fast-compile-fe.sh, a developer utility that incrementally compiles only changed Java source files and patches them directly intodoris-fe.jar, avoiding a full Maven rebuild during development.Key features:
.javafiles by comparing mtime with.classfilestarget/libto skip repeated mvn callstarget/doris-fe.jarandoutput/fe/lib/doris-fe.jarFoo$Bar.class)What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary:
Release note
None
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)