[do not merge/review] BTAPI-based incremental compilation#1449
Draft
agluszak wants to merge 172 commits intobazel-contrib:masterfrom
Draft
[do not merge/review] BTAPI-based incremental compilation#1449agluszak wants to merge 172 commits intobazel-contrib:masterfrom
agluszak wants to merge 172 commits intobazel-contrib:masterfrom
Conversation
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
This replaces org.pantsbuild:jarjar with com.eed3si9n.jarjarabrams and updates jarjar_runner wiring for both bzlmod and WORKSPACE flows. The old jarjar emitted Unsupported class file major version 65 during shading, and this change removes that warning path under Java 21 builds.
# Conflicts: # .bazelrc # MODULE.bazel # MODULE.release.bazel # examples/anvil/MODULE.bazel # examples/associates/MODULE.bazel # examples/dagger/MODULE.bazel # examples/deps/MODULE.bazel # examples/multiplex/MODULE.bazel # examples/plugin/MODULE.bazel # kotlin/internal/jvm/impl.bzl # kotlin/internal/lint/ktlint_fix.bzl # kotlin/internal/lint/ktlint_test.bzl # kotlin_rules_maven_install.json # src/main/kotlin/io/bazel/kotlin/plugin/jdeps/BaseJdepsGenExtension.kt # src/main/kotlin/io/bazel/kotlin/test/BazelIntegrationTestRunner.kt # src/main/starlark/core/compile/cli/compile.bzl # src/main/starlark/core/compile/rules.bzl # src/main/starlark/core/repositories/kotlin/capabilities_2.3.bzl.com_github_jetbrains_kotlin.bazel
# Conflicts: # MODULE.bazel # docs/kotlin.md # examples/jetpack_compose/maven_install.json # kotlin/internal/jvm/impl.bzl # kotlin_rules_maven_install.json # src/main/starlark/core/repositories/initialize.release.bzl
# Conflicts: # kotlin_rules_maven_install.json # src/main/starlark/core/repositories/kotlin/capabilities_2.3.bzl.com_github_jetbrains_kotlin.bazel
Fail fast for compiler versions below 2.0, restrict toolchain api/language versions to 2.x, and document the x_use_k2 breaking change.
Refine generator filtering and enum extraction, refresh generated opts templates/docs, and update tests/examples for new option behavior.
# Conflicts: # docs/kotlin.md # src/main/starlark/core/options/opts.kotlinc.bzl
# Conflicts: # docs/kotlin.md # src/main/starlark/core/repositories/kotlin/capabilities_2.3.bzl.com_github_jetbrains_kotlin.bazel
# Conflicts: # kotlin/internal/jvm/impl.bzl # src/test/starlark/internal/jvm/jvm_deps_tests.bzl
Add test-first coverage for unresolved review feedback and only fix issues reproduced by tests. What changed: - Add Starlark unit test for trailing-slash resource strip prefix behavior. - Fix resource path stripping to avoid leading slash after prefix removal. - Add test coverage for incremental base dir derivation from configured output jar path. - Fix KotlinJvmTestBuilder incrementalCompilation() to derive IC dir from the actual output jar setting. - Add verification tests showing plugin payload JSON encoding works and missing IC base dir is created during compile. - Refactor one incremental-dir assertion to use java.nio.file.Path operations for robustness. Validation: - bazel test //src/test/starlark:resource_path_adjust_tests //src/test/kotlin/io/bazel/kotlin/builder/tasks:KotlinBuilderIncrementalDirTest - bazel test //src/test/starlark:resource_strip_prefix_tests - bazel test //src/test/starlark:plugin_payload_tests //src/test/starlark:resource_path_adjust_tests //src/test/kotlin/io/bazel/kotlin/builder/tasks:KotlinBuilderIncrementalDirTest - bazel test //src/test/kotlin/io/bazel/kotlin/builder/tasks:IncrementalCompilationTest --test_filter='missing incremental base dir is created during compilation'
Address PR #24 snapshot invalidation issues using a test-first workflow. Reproduced failures first: - snapshot_flag_wiring_java_only_dep_test: Java-only deps were missing from --classpath_snapshots. - snapshot_flag_wiring_exports_transitive_test: snapshots from exported deps were not propagated downstream. Fixes: - Include exports in snapshot source traversal in jvm_deps. - Surface non_kotlin_classpath_snapshot_jars from jvm_deps for deps without KtJvmInfo. - Generate classpath snapshots for those non-Kotlin dependency jars in compile.bzl. - Pass generated non-Kotlin snapshots to KotlinCompile alongside KtJvmInfo-provided snapshots. - Include exports when computing transitive_classpath_snapshots for rule providers. Validation: - bazel test //src/test/starlark/internal/jvm:snapshot_action_tests - bazel test //src/test/starlark/internal/jvm:jvm_tests
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(This branch contains all my recent PRs pre-merged, for a diff of BTAPI/IC only see agluszak#17)