| # Copyright 2022 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/bazel/bazel_build_action.gni") |
| import("//build/bazel/bazel_build_group.gni") |
| |
| # Build all target examples with Bazel all at once. |
| # This invokes a stamp_group() Bazel targets that depends on all |
| # other example targets directly in the Bazel graph. |
| bazel_build_action("target_examples") { |
| testonly = true |
| bazel_target = ":target_examples" |
| copy_outputs = [ |
| { |
| bazel = "{{BAZEL_TARGET_OUT_DIR}}/target_examples.bazel_stamp" |
| ninja = "target_examples.bazel_stamp" |
| }, |
| ] |
| } |
| |
| bazel_build_group("host_examples") { |
| host = true |
| no_sdk = true |
| subtargets = [ |
| { |
| bazel_target = "//build/bazel/examples/hello_host" |
| gn_target_name = "hello_host" |
| copy_outputs = [ |
| { |
| bazel = "{{BAZEL_TARGET_OUT_DIR}}/{{BAZEL_TARGET_NAME}}" |
| ninja = "hello_host_from_bazel" |
| }, |
| ] |
| }, |
| { |
| bazel_target = "//build/bazel/examples/hello_python" |
| gn_target_name = "hello_python" |
| copy_outputs = [ |
| { |
| bazel = "{{BAZEL_TARGET_OUT_DIR}}/bin" |
| ninja = "hello_python_bin" |
| }, |
| { |
| bazel = "{{BAZEL_TARGET_OUT_DIR}}/test" |
| ninja = "hello_python_test" |
| }, |
| ] |
| }, |
| ] |
| } |
| |
| if (host_cpu == "x64") { |
| bazel_build_group("host_examples_arm64") { |
| host = true |
| no_sdk = true |
| bazel_platform = "linux_arm64" |
| subtargets = [ |
| { |
| bazel_target = "//build/bazel/examples/hello_host" |
| gn_target_name = "hello_host_arm64" |
| copy_outputs = [ |
| { |
| bazel = "{{BAZEL_TARGET_OUT_DIR}}/{{BAZEL_TARGET_NAME}}" |
| ninja = "hello_host_arm64_from_bazel" |
| }, |
| ] |
| }, |
| ] |
| } |
| } |
| |
| group("examples") { |
| testonly = true |
| deps = [ |
| ":host_examples", |
| ":target_examples", |
| ] |
| if (host_cpu == "x64") { |
| deps += [ ":host_examples_arm64" ] |
| } |
| } |