Skip to content

Commit

Permalink
Enable CI test with Bzlmod
Browse files Browse the repository at this point in the history
  • Loading branch information
meteorcloudy committed Nov 11, 2021
1 parent bf429fa commit ea5e9bb
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 9 deletions.
41 changes: 32 additions & 9 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,40 @@
---

build_targets: &build_targets
- "//..."
# TODO: Look into broken targets in //toolchains
- "-//toolchains/..."


build_targets_bzlmod: &build_targets
- "//..."
- "-//toolchains/..."
# TODO(pcloudy): pkg_tar doesn't work with Bzlmod due to https://github.com/bazelbuild/bazel/issues/14259
# Enable once the issue is fixed.
- "-//distro/..."

buildifier:
version: latest
warnings: "all"
tasks:
ubuntu2004:
build_targets:
- "//..."
- "-//toolchains/..."
build_targets: *build_targets
macos:
build_targets:
- "//..."
- "-//toolchains/..."
build_targets: *build_targets
windows:
build_targets:
- "//..."
- "-//toolchains/..."
build_targets: *build_targets
ubuntu2004_bzlmod:
bazel: last_green
build_flags:
"--config=bzlmod"
build_targets: *build_targets_bzlmod
macos_bzlmod:
bazel: last_green
build_flags:
"--config=bzlmod"
build_targets: *build_targets_bzlmod
windows_bzlmod:
bazel: last_green
build_flags:
"--config=bzlmod"
build_targets: *build_targets_bzlmod
6 changes: 6 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
build:bzlmod --experimental_enable_bzlmod
# @local_config_cc and @local_config_xcode are no longer available as canonical repo name,
# therefore we have to override the default value of the following flags.
# TODO: Figure out a way to get rid of this.
build:bzlmod --crosstool_top=@rules_cc.0.0.1.cc_configure.local_config_cc//:toolchain
build:bzlmod --xcode_version_config=@rules_cc.0.0.1.cc_configure.local_config_xcode//:host_xcodes
2 changes: 2 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ use_repo(toolchains, "local_jdk")
# Declare all remote jdk toolchain config repos
[use_repo(toolchains, repo + "_toolchain_config_repo") for repo in REMOTE_JDK_REPOS]

# Dev dependencies
bazel_dep(name = "rules_pkg", version = "0.5.1", dev_dependency = True)
1 change: 1 addition & 0 deletions WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# A completely empty WORKSPACE file to replace the original WORKSPACE content
7 changes: 7 additions & 0 deletions examples/hello-world/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
load("//java:defs.bzl", "java_binary")

java_binary(
name = "hello-world",
srcs = ["HelloWorld.java"],
main_class = "HelloWorld",
)
19 changes: 19 additions & 0 deletions examples/hello-world/HelloWorld.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2021 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

public class HelloWorld {
public static void main (String[] args) {
System.out.println("Hello World!");
}
}

0 comments on commit ea5e9bb

Please sign in to comment.