1// Copyright (C) 2023 The Android Open Source Project 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15package { 16 default_applicable_licenses: ["Android-Apache-2.0"], 17} 18 19soong_config_string_variable { 20 name: "bazel_test_string_var", 21 values: [ 22 "value1", 23 "value2", 24 ], 25} 26 27soong_config_bool_variable { 28 name: "bazel_test_bool_var", 29} 30 31soong_config_module_type { 32 name: "bazel_test_soong_config_cc_binary", 33 module_type: "cc_binary", 34 config_namespace: "my_namespace", 35 bool_variables: ["bazel_test_bool_var"], 36 variables: ["bazel_test_string_var"], 37 properties: [ 38 "target.android.cflags", 39 "target.host.cflags", 40 "cflags", 41 ], 42} 43 44bazel_test_soong_config_cc_binary { 45 name: "build.bazel.examples.soong_config_variables.plus_os", 46 srcs: ["main.cpp"], 47 host_supported: true, 48 soong_config_variables: { 49 bazel_test_string_var: { 50 value1: { 51 cflags: ["-DVALUE1"], 52 target: { 53 android: { 54 cflags: ["-DVALUE1_PLUS_ANDROID"], 55 }, 56 host: { 57 cflags: ["-DVALUE1_PLUS_HOST"], 58 }, 59 }, 60 }, 61 value2: { 62 cflags: ["-DVALUE2"], 63 target: { 64 android: { 65 cflags: ["-DVALUE2_PLUS_ANDROID"], 66 }, 67 host: { 68 cflags: ["-DVALUE2_PLUS_HOST"], 69 }, 70 }, 71 }, 72 conditions_default: { 73 cflags: ["-DDEFAULT"], 74 target: { 75 android: { 76 cflags: ["-DDEFAULT_PLUS_ANDROID"], 77 }, 78 host: { 79 cflags: ["-DDEFAULT_PLUS_HOST"], 80 }, 81 }, 82 }, 83 }, 84 bazel_test_bool_var: { 85 cflags: ["-DBOOL_VAR"], 86 target: { 87 android: { 88 cflags: ["-DBOOL_VAR_PLUS_ANDROID"], 89 }, 90 host: { 91 cflags: ["-DBOOL_VAR_PLUS_HOST"], 92 }, 93 }, 94 conditions_default: { 95 cflags: ["-DBOOL_VAR_DEFAULT"], 96 target: { 97 android: { 98 cflags: ["-DBOOL_VAR_DEFAULT_PLUS_ANDROID"], 99 }, 100 host: { 101 cflags: ["-DBOOL_VAR_DEFAULT_PLUS_HOST"], 102 }, 103 }, 104 }, 105 }, 106 }, 107} 108