Skip to content

[WIP] BTAPI-based incremental compilation#1449

Draft
agluszak wants to merge 142 commits intobazelbuild:masterfrom
agluszak:btapi-wip
Draft

[WIP] BTAPI-based incremental compilation#1449
agluszak wants to merge 142 commits intobazelbuild:masterfrom
agluszak:btapi-wip

Conversation

@agluszak
Copy link
Contributor

@agluszak agluszak commented Jan 23, 2026

(This branch contains all my recent PRs pre-merged, for a diff of BTAPI/IC only see agluszak#17)

erikkerber and others added 30 commits June 16, 2025 15:55
Replace commented out snapshot generation code

Add new jar dependencies needed for incremental compilation

Temporarily force persistent working directory for incremental compilation
Invalidate snapshot when underlying (abi) jar changes
Properly hook up flags to control build tool API / incremental compilation enabling
Do not create snapshots for non-incremental scenario
Restore temporary working directory logic
# Conflicts:
#	kotlin/internal/toolchains.bzl
#	src/main/protobuf/kotlin_model.proto
#	src/main/starlark/core/repositories/versions.bzl
# Conflicts:
#	kotlin_rules_maven_install.json
#	src/main/kotlin/io/bazel/kotlin/builder/tasks/BUILD.bazel
# Conflicts:
#	src/main/kotlin/io/bazel/kotlin/builder/BUILD
# Conflicts:
#	kotlin_rules_maven_install.json
#	src/main/kotlin/io/bazel/kotlin/compiler/BuildToolsAPICompiler.kt
- Eliminated `BazelK2JVMCompiler` and replaced its functionality with `BuildToolsAPICompiler`.
- Removed `experimental_build_tools_api` flag and its associated dependencies, including Bazel and Starlark definitions.
- Updated the Kotlin toolchain to include the `kotlin_compiler_embeddable` dependency.
- Adjusted documentation, tests, and build configuration to reflect these changes.
# Conflicts:
#	README.md
#	kotlin/internal/jvm/compile.bzl
#	kotlin/internal/toolchains.bzl
#	kotlin/settings/BUILD.bazel
#	kotlin/settings/BUILD.release.bazel
#	src/main/kotlin/BUILD.release.bazel
#	src/main/kotlin/io/bazel/kotlin/builder/cmd/BUILD.bazel
#	src/main/kotlin/io/bazel/kotlin/builder/tasks/KotlinBuilder.kt
#	src/main/protobuf/kotlin_model.proto
#	src/main/starlark/core/repositories/initialize.release.bzl
#	src/main/starlark/core/repositories/versions.bzl
#	src/test/kotlin/io/bazel/kotlin/defs.bzl
This change enables Windows builds and tests in the CI pipeline and fixes
various Windows compatibility issues throughout the codebase.

Platform-specific path handling:
- Replace /dev/null with ctx.actions.declare_file for null outputs on Windows
- Use platform-appropriate path separators in classpath construction
- Fix bzlmod classpath resolution for Kotlin compiler on Windows

Ktlint fixes:
- Simplify ktlint_fix and ktlint_test implementations
- Use proper argument files instead of shell-specific constructs
- Remove windows.bzl utility in favor of inline platform checks

Test infrastructure:
- Convert integration test runner to java_binary for cross-platform support
- Fix temporary file handling in tests for Windows compatibility
- Update test assertions to handle platform-specific path formats

CI configuration:
- Enable Windows builds in presubmit.yml
- Add Windows-specific bazelrc configurations
- Update MODULE.bazel with Windows toolchain support
… kotlin-compiler-arguments-description artifact from JetBrains.

  - Auto-generated options: WriteKotlincCapabilities generates both capabilities.bzl (flag existence/stability metadata) and generated_opts.bzl (full typed Starlark options) from the compiler metadata artifact.
  - Simplified maintenance: Manual _KOPTS dict replaced with GENERATED_KOPTS import, with _MANUAL_KOPTS for special cases only.

  Changes:

  - Add kotlin-compiler-arguments-description dependency (version must match kotlin compiler version)
  - Rewrite WriteKotlincCapabilities to use the new artifact
  - Generate generated_opts_X.Y.bzl with attr.bool for booleans, attr.string for strings, attr.string_list for arrays
  - Simplify opts.kotlinc.bzl to merge generated + manual options
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.

4 participants