Skip to content

[maintenance] Windows CI#1439

Open
agluszak wants to merge 6 commits intobazelbuild:masterfrom
agluszak:windows-ci
Open

[maintenance] Windows CI#1439
agluszak wants to merge 6 commits intobazelbuild:masterfrom
agluszak:windows-ci

Conversation

@agluszak
Copy link
Contributor

@agluszak agluszak commented Jan 4, 2026

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

@agluszak agluszak force-pushed the windows-ci branch 3 times, most recently from 0e1d972 to 3066829 Compare January 6, 2026 00:56
executable_name = executable_name + ".exe"
return ctx.actions.declare_file(executable_name)

def _create_windows_exe_launcher(ctx, executable, java_executable, classpath, main_class, jvm_flags_for_launcher, runfiles_enabled, coverage_main_class = None):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup

@agluszak agluszak marked this pull request as ready for review January 9, 2026 12:18
@Bencodes
Copy link
Collaborator

@agluszak this one has a bunch of merge conflicts in it, can you take a look at resolving these?

@agluszak
Copy link
Contributor Author

@Bencodes merged master!

// Canonicalize the path for proper lookup (handles K2's forward-slash paths on Windows)
val canonicalJarPath =
try {
File(jarPath).canonicalPath
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does this fail on windows?

# Toolchain type for the Windows launcher maker
_LAUNCHER_MAKER_TOOLCHAIN_TYPE = "@bazel_tools//tools/launcher:launcher_maker_toolchain_type"

def _is_windows(ctx):
Copy link
Collaborator

Choose a reason for hiding this comment

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

These functions look like they are defined twice in this PR, was that intentional? I'm also seeing that _LAUNCHER_MAKER_TOOLCHAIN_TYPE is defined twice.

.map { p -> Flag("--bazelrc=$p") }
.toList()
.takeIf { it.isNotEmpty() }
?: listOf(Flag("--bazelrc=/dev/null")),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Removing this could allow any existing the .bazelrc to take effect.

What was the intent?

load("//kotlin:jvm.bzl", "kt_jvm_library")

kt_jvm_binary(
java_binary(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why the switch to java_binary, as it the other part of the pr is making kt_jvm_binary work?

@agluszak agluszak force-pushed the windows-ci branch 2 times, most recently from 609929f to 56ade49 Compare February 7, 2026 16:13
@agluszak
Copy link
Contributor Author

agluszak commented Feb 7, 2026

GitHub seems to be having a hard time now :/

(21:08:51) WARNING: Download from https://github.com/bazelbuild/rules_pkg/releases/download/1.0.1/rules_pkg-1.0.1.tar.gz failed: class java.io.IOException GET returned 502 Bad Gateway or Proxy Error
(21:08:51) INFO: Repository rules_pkg+ instantiated at:
  <builtin>: in <toplevel>
Repository rule http_archive defined at:
  C:/b/hejvqjrb/external/bazel_tools/tools/build_defs/repo/http.bzl:431:31: in <toplevel>
(21:08:51) ERROR: C:/b/hejvqjrb/external/bazel_tools/tools/build_defs/repo/http.bzl:155:45: An error occurred during the fetch of repository 'rules_pkg+':
   Traceback (most recent call last):
	File "C:/b/hejvqjrb/external/bazel_tools/tools/build_defs/repo/http.bzl", line 155, column 45, in _http_archive_impl
		download_info = ctx.download_and_extract(
Error in download_and_extract: java.io.IOException: Error downloading [https://github.com/bazelbuild/rules_pkg/releases/download/1.0.1/rules_pkg-1.0.1.tar.gz] to C:/b/hejvqjrb/external/rules_pkg+/temp13767907055791222701/rules_pkg-1.0.1.tar.gz: GET returned 502 Bad Gateway or Proxy Error
(21:08:51) WARNING: Target pattern parsing failed.
(21:08:51) ERROR: Skipping '//src/...': error loading package under directory 'src': no such package '@@rules_pkg+//': java.io.IOException: Error downloading [https://github.com/bazelbuild/rules_pkg/releases/download/1.0.1/rules_pkg-1.0.1.tar.gz] to C:/b/hejvqjrb/external/rules_pkg+/temp13767907055791222701/rules_pkg-1.0.1.tar.gz: GET returned 502 Bad Gateway or Proxy Error
(21:08:51) ERROR: error loading package under directory 'src': no such package '@@rules_pkg+//': java.io.IOException: Error downloading [https://github.com/bazelbuild/rules_pkg/releases/download/1.0.1/rules_pkg-1.0.1.tar.gz] to C:/b/hejvqjrb/external/rules_pkg+/temp13767907055791222701/rules_pkg-1.0.1.tar.gz: GET returned 502 Bad Gateway or Proxy Error

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.

3 participants