# Copyright 2021, 2022 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-workspace :tangle WORKSPACE
workspace(name = "test")
#+END_SRC

#+BEGIN_SRC bazel-build :tangle BUILD
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
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
Loading:
Loading: 0 packages loaded
Analyzing: 2 targets (2 packages loaded, 0 targets configured)
Analyzing: 2 targets (12 packages loaded, 49 targets configured)
Analyzing: 2 targets (16 packages loaded, 62 targets configured)
ERROR: %ROOTDIR%/BUILD:1:10: in cc_binary rule //:bin: target '//lib:lib' is not visible from target '//:bin'. Check the visibility declaration of the former target if you think the dependency is legitimate
ERROR: Analysis of target '//:bin' failed; build aborted: Analysis of target '//:bin' failed
INFO: Elapsed time: 3,862s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (17 packages loaded, 143 targets configured)
FAILED: Build did NOT complete successfully (17 packages loaded, 143 targets configured)
#+END_SRC
