Skip to content

Commit

Permalink
fix ci for bazel 8.x
Browse files Browse the repository at this point in the history
  • Loading branch information
jsharpe committed Dec 14, 2024
1 parent 21e463e commit 6083750
Show file tree
Hide file tree
Showing 9 changed files with 133 additions and 91 deletions.
63 changes: 36 additions & 27 deletions .bazelci/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ 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:
name: Examples (spawn_strategy=standalone)
Expand All @@ -45,14 +43,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 @@ -64,24 +60,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 @@ -91,10 +72,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 @@ -112,15 +95,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 @@ -136,12 +117,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 @@ -172,10 +151,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 @@ -195,6 +172,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 @@ -207,24 +190,50 @@ 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_oarm64_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
platform: ubuntu2004
Expand Down
14 changes: 12 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ module(
)

bazel_dep(name = "bazel_features", version = "1.15.0")
bazel_dep(name = "bazel_skylib", version = "1.3.0")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "platforms", version = "0.0.5")
bazel_dep(name = "rules_python", version = "0.23.1")
bazel_dep(name = "rules_python", version = "1.0.0")
bazel_dep(name = "rules_shell", version = "0.3.0")

# Dev dependencies
Expand All @@ -22,6 +22,16 @@ bazel_dep(name = "bazel_ci_rules", version = "1.0.0", dev_dependency = True)
# depends on it. If you are not using bazel_ci_rules; ideally we'd be able to remove this.
bazel_dep(name = "rules_cc", version = "0.0.9", 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.9")
use_repo(python, "python_3_9")
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: 1 addition & 0 deletions docs/.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
common --incompatible_allow_tags_propagation

common --noenable_bzlmod
common --enable_workspace
build --workspace_status_command=tools/workspace_status.sh
57 changes: 36 additions & 21 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,12 +13,14 @@ use_repo(
)

bazel_dep(name = "platforms", version = "0.0.6")
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 = "bazel_skylib", version = "1.7.1")
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 = "0.23.0")
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "rules_shell", version = "0.3.0")
bazel_dep(name = "rules_java", version = "8.6.2")

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
Expand All @@ -36,20 +38,33 @@ pip.parse(
)
use_repo(pip, "pip")

# 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",
# ],
# )
bazel_dep(name = "rules_android", version = "0.6.0-alpha1.bcr.1")
bazel_dep(name = "rules_android_ndk", version = "0.1.2")
bazel_dep(name = "rules_jvm_external", version = "5.1")

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",
)
31 changes: 0 additions & 31 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 @@ -24,22 +12,3 @@ 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",
)
24 changes: 24 additions & 0 deletions test/detect_root_test/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_foreign_cc")
local_path_override(
module_name = "rules_foreign_cc",
path = "../..",
)

bazel_dep(name = "platforms", version = "0.0.5")

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

# note that this dev_dependency is only needed because bazel_ci_rules
# depends on it. If you are not using bazel_ci_rules; ideally we'd be able to remove this.
bazel_dep(name = "rules_cc", version = "0.0.9", dev_dependency = True)

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

rbe_preconfig(
name = "buildkite_config",
toolchain = "ubuntu2004",
)
24 changes: 24 additions & 0 deletions test/standard_cxx_flags_test/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_foreign_cc")
local_path_override(
module_name = "rules_foreign_cc",
path = "../..",
)

bazel_dep(name = "platforms", version = "0.0.5")

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

# note that this dev_dependency is only needed because bazel_ci_rules
# depends on it. If you are not using bazel_ci_rules; ideally we'd be able to remove this.
bazel_dep(name = "rules_cc", version = "0.0.9", dev_dependency = True)

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

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

0 comments on commit 6083750

Please sign in to comment.