Enable CI tests
diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index fde63a7..b416cb8 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml
@@ -1,14 +1,41 @@ --- +build_targets: &build_targets + - "//..." + # TODO: Look into broken targets in //toolchains + - "-//toolchains/..." + +build_targets_bzlmod: &build_targets_bzlmod + - "//..." + - "-//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: - - "//..." + build_targets: *build_targets macos: - build_targets: - - "//..." + build_targets: *build_targets windows: - build_targets: - - "//..." + build_targets: *build_targets + ubuntu2004_bzlmod: + bazel: last_green + platform: ubuntu2004 + build_flags: + - "--config=bzlmod" + build_targets: *build_targets_bzlmod + macos_bzlmod: + bazel: last_green + platform: macos + build_flags: + - "--config=bzlmod" + build_targets: *build_targets_bzlmod + windows_bzlmod: + bazel: last_green + platform: windows + build_flags: + - "--config=bzlmod" + build_targets: *build_targets_bzlmod
diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 0000000..1127338 --- /dev/null +++ b/.bazelrc
@@ -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
diff --git a/examples/hello-world/BUILD b/examples/hello-world/BUILD new file mode 100644 index 0000000..8fe9eef --- /dev/null +++ b/examples/hello-world/BUILD
@@ -0,0 +1,7 @@ +load("//java:defs.bzl", "java_binary") + +java_binary( + name = "hello-world", + srcs = ["HelloWorld.java"], + main_class = "HelloWorld", +)
diff --git a/examples/hello-world/HelloWorld.java b/examples/hello-world/HelloWorld.java new file mode 100644 index 0000000..b033ce7 --- /dev/null +++ b/examples/hello-world/HelloWorld.java
@@ -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!"); + } +} \ No newline at end of file