Skip to content

fix ci for bazel 8.x #1340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 39 additions & 29 deletions .bazelci/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,12 @@ tasks:
- "-//test:shell_method_symlink_contents_to_dir_test"
- "-//test:shell_script_inner_fun_test"
build_flags:
- "--noenable_bzlmod"
- "--enable_workspace"
test_flags:
- "--noenable_bzlmod"
- "--enable_workspace"
ubuntu1804_examples_standalone:
ubuntu2004_examples_standalone:
name: Examples (spawn_strategy=standalone)
platform: ubuntu1804
platform: ubuntu2004
working_directory: examples
linux_targets: &linux_targets_standalone
- "//..."
Expand All @@ -51,14 +49,12 @@ tasks:
- "-c"
- "dbg"
- "--spawn_strategy=standalone"
- "--noenable_bzlmod"
- "--enable_workspace"
test_targets: *linux_targets_standalone
test_flags:
- "-c"
- "dbg"
- "--spawn_strategy=standalone"
- "--noenable_bzlmod"
- "--enable_workspace"
ubuntu2004_examples:
name: Examples
Expand All @@ -70,24 +66,9 @@ tasks:
build_targets: *linux_targets
test_targets: *linux_targets
build_flags:
- "--noenable_bzlmod"
- "--enable_workspace"
test_flags:
- "--noenable_bzlmod"
- "--enable_workspace"
ubuntu2004_examples_bzlmod:
name: Examples (bzlmod)
platform: ubuntu2004
working_directory: examples
linux_targets: &linux_targets_bzlmod
- "//..."
- "//:third_party_examples_linux_tests"
# gives error '//external:databinding_annotation_processor': target 'databinding_annotation_processor' not declared in package 'external' defined by /workdir/examples/WORKSPACE.bazel (Tip: use `query "//external:*"` to see all the targets in that package) and referenced by '@bazel_tools//tools/android:databinding_annotation_processor'
- "-//cmake_android/..."
build_targets: *linux_targets_bzlmod
test_targets: *linux_targets_bzlmod
build_flags:
- "--enable_bzlmod"
rbe_ubuntu2004_examples:
name: Examples
platform: rbe_ubuntu2004
Expand All @@ -97,10 +78,12 @@ tasks:
- "//:third_party_examples_linux_rbe_tests"
# Gives error: zipalign: error while loading shared libraries: /usr/local/lib/libc++.so: file too short
- "-//cmake_android/..."
# Python requirements not supported on Ubuntu 16.04
- "-//:requirements_test"
build_targets: *rbe_targets
test_targets: *rbe_targets
build_flags:
- "--enable_workspace"
test_flags:
- "--enable_workspace"
macos_examples_standalone:
name: Examples (spawn_strategy=standalone)
platform: macos
Expand All @@ -118,15 +101,13 @@ tasks:
- "dbg"
- "--spawn_strategy=standalone"
- "--noincompatible_enable_cc_toolchain_resolution"
- "--noenable_bzlmod"
- "--enable_workspace"
test_targets: *macos_targets_standalone
test_flags:
- "-c"
- "dbg"
- "--spawn_strategy=standalone"
- "--noincompatible_enable_cc_toolchain_resolution"
- "--noenable_bzlmod"
- "--enable_workspace"
macos_examples:
name: Examples
Expand All @@ -142,12 +123,10 @@ tasks:
build_targets: *macos_targets
build_flags:
- "--noincompatible_enable_cc_toolchain_resolution"
- "--noenable_bzlmod"
- "--enable_workspace"
test_targets: *macos_targets
test_flags:
- "--noincompatible_enable_cc_toolchain_resolution"
- "--noenable_bzlmod"
- "--enable_workspace"
windows_examples:
name: Examples
Expand Down Expand Up @@ -179,10 +158,8 @@ tasks:
build_targets: *windows_targets
test_targets: *windows_targets
build_flags:
- "--noenable_bzlmod"
- "--enable_workspace"
test_flags:
- "--noenable_bzlmod"
- "--enable_workspace"
rbe_ubuntu2004_flags:
name: Flags
Expand All @@ -202,6 +179,12 @@ tasks:
working_directory: test/standard_cxx_flags_test
test_targets:
- "//:flags_test"
macos_arm64_flags:
name: Flags (arm64)
platform: macos_arm64
working_directory: test/standard_cxx_flags_test
test_targets:
- "//:flags_test"
windows_flags:
name: Flags
platform: windows
Expand All @@ -214,26 +197,53 @@ tasks:
working_directory: test/detect_root_test
test_targets:
- "//:tests"
build_flags:
- "--enable_workspace"
test_flags:
- "--enable_workspace"
ubuntu2004_detect_root:
name: Detect root
platform: ubuntu2004
working_directory: test/detect_root_test
test_targets:
- "//:tests"
build_flags:
- "--enable_workspace"
test_flags:
- "--enable_workspace"
macos_detect_root:
name: Detect root
platform: macos
working_directory: test/detect_root_test
test_targets:
- "//:tests"
build_flags:
- "--enable_workspace"
test_flags:
- "--enable_workspace"
macos_arm64_detect_root:
name: Detect root (arm64)
platform: macos_arm64
working_directory: test/detect_root_test
test_targets:
- "//:tests"
build_flags:
- "--enable_workspace"
test_flags:
- "--enable_workspace"
windows_detect_root:
name: Detect root
platform: windows
working_directory: test/detect_root_test
test_targets:
- "//:tests"
build_flags:
- "--enable_workspace"
test_flags:
- "--enable_workspace"
docs_linux:
name: Docs
bazel: "7.4.1"
platform: ubuntu2004
working_directory: docs
build_targets:
Expand Down
1 change: 0 additions & 1 deletion .bazelversion

This file was deleted.

11 changes: 11 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,19 @@ bazel_dep(name = "rules_shell", version = "0.3.0")
# Dev dependencies
bazel_dep(name = "gazelle", version = "0.41.0", dev_dependency = True, repo_name = "bazel_gazelle")
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.7.1", dev_dependency = True)

bazel_dep(name = "bazel_ci_rules", version = "1.0.0", dev_dependency = True)

rbe_preconfig = use_repo_rule(
"@bazel_ci_rules//:rbe_repo.bzl",
"rbe_preconfig",
)

rbe_preconfig(
name = "buildkite_config",
toolchain = "ubuntu2004",
)

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(python_version = "3.12")
use_repo(python, "python_3_12")
Expand Down
Empty file added REPO.bazel
Empty file.
10 changes: 0 additions & 10 deletions WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
@@ -1,11 +1 @@
workspace(name = "rules_foreign_cc")

load("@bazel_ci_rules//:rbe_repo.bzl", "rbe_preconfig")

# Creates a default toolchain config for RBE.
# Use this as is if you are using the rbe_ubuntu16_04 container,
# otherwise refer to RBE docs.
rbe_preconfig(
name = "buildkite_config",
toolchain = "ubuntu1804-bazel-java11",
)
1 change: 0 additions & 1 deletion examples/.bazelversion

This file was deleted.

64 changes: 41 additions & 23 deletions examples/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bazel_dep(name = "rules_foreign_cc", version = "0.0.0")
bazel_dep(name = "rules_foreign_cc")
local_path_override(
module_name = "rules_foreign_cc",
path = "..",
Expand All @@ -13,13 +13,18 @@ use_repo(
)

bazel_dep(name = "platforms", version = "0.0.11")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_rust", version = "0.56.0")
bazel_dep(name = "rules_swift", version = "1.6.0", repo_name = "build_bazel_rules_swift")
bazel_dep(name = "rules_apple", version = "3.4.0", repo_name = "build_bazel_rules_apple")
bazel_dep(name = "apple_support", version = "1.12.0", repo_name = "build_bazel_apple_support")
bazel_dep(name = "rules_swift", version = "2.1.1", repo_name = "build_bazel_rules_swift")
bazel_dep(name = "rules_apple", version = "3.16.1", repo_name = "build_bazel_rules_apple")
bazel_dep(name = "apple_support", version = "1.17.1", repo_name = "build_bazel_apple_support")
bazel_dep(name = "rules_python", version = "1.2.0")
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "rules_cc", version = "0.1.1")
bazel_dep(name = "rules_shell", version = "0.3.0")
bazel_dep(name = "rules_perl", version = "0.2.5")

apple_cc_configure = use_extension("@build_bazel_apple_support//crosstool:setup.bzl", "apple_cc_configure_extension")
use_repo(apple_cc_configure, "local_config_apple_cc")

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
Expand All @@ -37,6 +42,37 @@ pip.parse(
)
use_repo(pip, "pip")

bazel_dep(name = "rules_android", version = "0.6.0")
bazel_dep(name = "rules_android_ndk", version = "0.1.2")
bazel_dep(name = "rules_jvm_external", version = "6.6")

maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.install(
name = "maven",
artifacts = [
"com.android.support.constraint:constraint-layout:aar:1.1.2",
"com.android.support:appcompat-v7:aar:26.1.0",
],
repositories = [
"https://jcenter.bintray.com/",
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
)
use_repo(maven, "maven")

bazel_dep(name = "bazel_ci_rules", version = "1.0.0", dev_dependency = True)

rbe_preconfig = use_repo_rule(
"@bazel_ci_rules//:rbe_repo.bzl",
"rbe_preconfig",
)

rbe_preconfig(
name = "buildkite_config",
toolchain = "ubuntu2004",
)

# https://bazelbuild.github.io/rules_rust/crate_universe_bzlmod.html
rust_example = use_extension("@rules_rust//crate_universe:extensions.bzl", "crate")

Expand Down Expand Up @@ -65,21 +101,3 @@ use_repo(
rust_example,
"rust_example",
)

# bazel_dep(name = "rules_android", version = "0.1.1")
# bazel_dep(name = "rules_jvm_external", version = "5.1")
#
# maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
#
# maven.install(
# name = "maven_deps",
# artifacts = [
# "com.android.support.constraint:constraint-layout:aar:1.1.2",
# "com.android.support:appcompat-v7:aar:26.1.0",
# ],
# repositories = [
# "https://jcenter.bintray.com/",
# "https://maven.google.com",
# "https://repo1.maven.org/maven2",
# ],
# )
15 changes: 11 additions & 4 deletions examples/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")

maybe(
http_archive,
name = "rules_cc",
sha256 = "abc605dd850f813bb37004b77db20106a19311a96b2da1c92b789da529d28fe1",
strip_prefix = "rules_cc-0.0.17",
urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.17/rules_cc-0.0.17.tar.gz"],
)

load("//deps:repositories.bzl", "repositories")

repositories()
Expand Down Expand Up @@ -63,8 +74,6 @@ load("@rules_foreign_cc_examples_third_party//:setup.bzl", examples_third_party_

examples_third_party_setup()

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "bazelci_rules",
sha256 = "eca21884e6f66a88c358e580fd67a6b148d30ab57b1680f62a96c00f9bc6a07e",
Expand Down Expand Up @@ -122,8 +131,6 @@ load(

apple_support_dependencies()

load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")

maybe(
http_archive,
name = "rules_rust",
Expand Down
35 changes: 0 additions & 35 deletions examples/WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
@@ -1,17 +1,5 @@
workspace(name = "rules_foreign_cc_examples")

load("//deps:repositories.bzl", "repositories")

repositories()

load("//deps:deps_android.bzl", "deps_android")

deps_android()

load("//deps:deps_jvm_external.bzl", "deps_jvm_external")

deps_jvm_external()

local_repository(
name = "rules_foreign_cc_examples_third_party",
path = "third_party",
Expand All @@ -20,26 +8,3 @@ local_repository(
load("@rules_foreign_cc_examples_third_party//:repositories.bzl", examples_third_party_repositories = "repositories")

examples_third_party_repositories()

load("@rules_foreign_cc_examples_third_party//:setup.bzl", examples_third_party_setup = "setup")

examples_third_party_setup()

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "bazelci_rules",
sha256 = "eca21884e6f66a88c358e580fd67a6b148d30ab57b1680f62a96c00f9bc6a07e",
strip_prefix = "bazelci_rules-1.0.0",
url = "https://github.com/bazelbuild/continuous-integration/releases/download/rules-1.0.0/bazelci_rules-1.0.0.tar.gz",
)

load("@bazelci_rules//:rbe_repo.bzl", "rbe_preconfig")

# Creates a default toolchain config for RBE.
# Use this as is if you are using the rbe_ubuntu16_04 container,
# otherwise refer to RBE docs.
rbe_preconfig(
name = "buildkite_config",
toolchain = "ubuntu1804-bazel-java11",
)
1 change: 0 additions & 1 deletion examples/cmake_crosstool/.bazelversion

This file was deleted.

Loading