# Copyright 2021-2022, 2026 Google LLC
#
# 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
#
#     https://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.

#+PROPERTY: header-args :mkdirp yes :main no

* Test data for the ~bazel-fix-visibility~ test

#+BEGIN_SRC bazel-module :tangle MODULE.bazel
bazel_dep(name = "rules_cc", version = "0.2.17")
#+END_SRC

#+BEGIN_SRC bazel-build :tangle BUILD
load("@rules_cc//cc:cc_binary.bzl", "cc_binary")

cc_binary(
    name = "bin",
    srcs = ["bin.cc"],
    deps = ["//lib"],
)
#+END_SRC

#+BEGIN_SRC c++ :tangle bin.cc
// Dummy C++ file
#+END_SRC

#+BEGIN_SRC bazel-build :tangle lib/BUILD
load("@rules_cc//cc:cc_library.bzl", "cc_library")

cc_library(
    name = "lib",
    srcs = ["lib.cc"],
)
#+END_SRC

#+BEGIN_SRC c++ :tangle lib/lib.cc
// Dummy C++ file
#+END_SRC

** Merged standard output and error from Bazel

#+BEGIN_SRC fundamental :tangle bazel.out
INFO: Invocation ID: 45ef1223-d52c-4b40-b0d5-5101fc5f0086
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 1 packages loaded
Analyzing: 2 targets (7 packages loaded, 6 targets configured)
Analyzing: 2 targets (59 packages loaded, 7 targets configured)
Analyzing: 2 targets (78 packages loaded, 430 targets configured)
Analyzing: 2 targets (82 packages loaded, 445 targets configured)
Analyzing: 2 targets (82 packages loaded, 445 targets configured)
ERROR: %ROOTDIR%/BUILD:3:10: in cc_binary rule //:bin: Visibility error:
target '//lib:lib' is not visible from
target '//:bin'
Recommendation: modify the visibility declaration if you think the dependency is legitimate. For more info see https://bazel.build/concepts/visibility
ERROR: %ROOTDIR%/BUILD:3:10: Analysis of target '//:bin' (config: 2e55aa3) failed
ERROR: Analysis of target '//:bin' failed; build aborted
INFO: Elapsed time: 10.294s
INFO: 0 processes.
ERROR: Build did NOT complete successfully
#+END_SRC
