Skip to content

Drop support for custom pre-built release archives - #1674

Open
Bencodes wants to merge 6 commits into
masterfrom
drop-support-for-custom-pre-built-release-archives
Open

Bencodes wants to merge 6 commits into
masterfrom
drop-support-for-custom-pre-built-release-archives

Conversation

@Bencodes

@Bencodes Bencodes commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Consumers now compile the rules_kotlin tools from source. The release uses the same MODULE.bazel and build definitions as a development checkout, replacing the precompiled archive and its separate release-only BUILD/MODULE files.

Changes

  • Package the required sources with rules_pkg; omit compiled JARs, repository tests, examples, and development tooling.
  • Keep consumer dependencies public and development dependencies private to root builds. Move test-only Maven artifacts and helpers out of the production dependency graph and repin both Maven installs.
  • Test examples against the actual release archive, including bazel query '@rules_kotlin//...', and have BCR presubmit build the entire published package.
  • Update release automation and documentation for source releases. New releases require Bzlmod; legacy WORKSPACE setup is removed.
  • Preserve the Build Tools API runtime and embeddable compiler plugins introduced by Toolchain btapi runtime #1724, including their sources in the archive. Document the distinction between the single CLI compiler override and multiple named Build Tools API runtimes.

Rebased onto origin/master at 593bfa2c (#1724), resolving conflicts in the removed release-only files, source BUILD files, repository initialization, and README. Updated the new runtime repository tests to load initialize.bzl.

Release archive size

Measured the precompiled release built from origin/master (593bfa2c) against this PR's source release:

Before After
Compressed archive 50,244,759 bytes (50.24 MB) 158,260 bytes (158.26 kB)
Uncompressed file contents 56,243,780 bytes 703,156 bytes
Bundled JARs 11 0

The compressed download is 99.685% smaller (about 317× smaller). Consumers compile the required tools instead of downloading bundled precompiled rules_kotlin tools.

Validation after rebasing

  • Passed 40 focused tests covering archive contents, Build Tools API release records and runtime selection, plugin dialects and reshading, worker runtime flags, builder execution, KAPT, and KSP.
  • Passed the trivial and KSP example integration suites on Bazel 9.2.0. Both exercise the legacy and Build Tools API backends, example tests, coverage, and the whole-package query against the actual archive.
  • Queried the entire final archive from the trivial example using archive_override in MODULE.bazel: 188 targets, no errors.
  • Fully built @rules_kotlin//... from that external consumer on Bazel 9.2.0: 180 targets, including execution rather than only analysis.
  • Rebuilt both archives for the size comparison and passed formatting/diff checks. The full expensive example/Bazel-version matrix was not run.

Comment thread MODULE.bazel
"com.google.truth:truth:0.45",
"com.google.auto.service:auto-service:1.1.1",
"com.google.auto.service:auto-service-annotations:1.1.1",
"com.eed3si9n.jarjar:jarjar:1.17.0",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

There is a Bazel module for this that we can lean into

Comment thread MODULE.bazel Outdated
"com.google.auto.service:auto-service:1.1.1",
"com.google.auto.service:auto-service-annotations:1.1.1",
"com.eed3si9n.jarjar:jarjar:1.17.0",
"com.google.auto.value:auto-value:1.11.0",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

If we drop Dagger we'd be mostly vanilla Kotlin here

Comment thread MODULE.bazel Outdated
android_sdk_repository_extension = use_extension(
"@rules_android//rules/android_sdk_repository:rule.bzl",
"android_sdk_repository_extension",
dev_dependency = True,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Breaks querying @rules_kotlin.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This ships the cli rules as part of the release. Confusing to say the least.

Comment thread BUILD

# Integration tests reference this repository with paths relative to their fixture workspace.
# Keep the repository sources as declared test inputs so those paths resolve within runfiles.
filegroup(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Um, this is pretty horrible patch for integration tests. At the least the release archive creates a clean target instead of exporting... well, everything?

Comment thread CONTRIBUTING.md
New versions of kotlin that change the API should be added to [versions.bzl](src/main/starlark/repositories/versions.bzl), under `CORE` following the
existing naming convention.

Multiple versions of kotlin are not currently handled.(_help wanted_)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Still unhandled

Comment thread MODULE.bazel Outdated
"com.google.dagger:dagger-compiler:2.57.2",
"com.google.dagger:dagger-producers:2.57.2",
"com.google.errorprone:error_prone_annotations:2.23.0",
"com.google.guava:guava:33.0.0-jre",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Guava is a non-trivial dep, and can cause all sorted of havoc when two versions are present in a repo. There is no enforcement to separate multiple maven dependency versions... which leaves a potentially nasty rake in the grass.

Comment thread MODULE.bazel Outdated
)
use_repo(maven, "kotlin_rules_maven", "unpinned_kotlin_rules_maven")

dev_maven = use_extension(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

... and now bazel build @rules_kotlin//... breaks as well.

Something that would become a standard target for CI to seed cache. Instead, there ends up being a deep link to the build target, extending the public api.

}
}
}
val rulesKotlin = workspace.resolve("../..").normalize().toAbsolutePath()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

A tar archive is much cleaner than adding stack of directories. It's almost RBE antagonistic.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I agree

*commandFlags,
"@rules_kotlin//...",
).onFailThrow()
listOf(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This reruns the unit and integration tests for every example and every bazel version.

@Bencodes
Bencodes force-pushed the drop-support-for-custom-pre-built-release-archives branch 4 times, most recently from 2416d0f to d916a65 Compare September 15, 2026 14:20
@Bencodes
Bencodes force-pushed the drop-support-for-custom-pre-built-release-archives branch from d916a65 to c50dab7 Compare September 15, 2026 16:29
@Bencodes
Bencodes requested a review from eugenezh as a code owner September 15, 2026 16:29
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.

2 participants