1//
2// Copyright (C) 2017 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16package {
17    default_applicable_licenses: ["device_google_cuttlefish_license"],
18}
19
20// Added automatically by a large-scale-change that took the approach of
21// 'apply every license found to every target'. While this makes sure we respect
22// every license restriction, it may not be entirely correct.
23//
24// e.g. GPL in an MIT project might only apply to the contrib/ directory.
25//
26// Please consider splitting the single license below into multiple licenses,
27// taking care not to lose any license_kind information, and overriding the
28// default license using the 'licenses: [...]' property on targets as needed.
29//
30// For unused files, consider creating a 'fileGroup' with "//visibility:private"
31// to attach the license to, and including a comment whether the files may be
32// used in the current project.
33// See: http://go/android-license-faq
34license {
35    name: "device_google_cuttlefish_license",
36    visibility: [":__subpackages__"],
37    license_kinds: [
38        "SPDX-license-identifier-Apache-2.0",
39        "SPDX-license-identifier-MIT",
40    ],
41    // large-scale-change unable to identify any license_text files
42}
43
44cc_library_headers {
45    name: "cuttlefish_common_headers",
46    vendor_available: true,
47    product_available: true,
48    export_include_dirs: ["."],
49    host_supported: true,
50    apex_available: [
51        "//apex_available:platform",
52        "com.android.virt",
53    ],
54    target: {
55        windows: {
56            enabled: true,
57        },
58    },
59}
60
61cc_defaults {
62    name: "cuttlefish_base",
63    gnu_extensions: false,
64    header_libs: [
65        "cuttlefish_common_headers",
66    ],
67    target: {
68        host: {
69            cflags: ["-DCUTTLEFISH_HOST"],
70            compile_multilib: "64",
71            strip: {
72                keep_symbols_and_debug_frame: true,
73            },
74        },
75        linux: {
76            host_ldlibs: ["-lrt"],
77        },
78        // We don't need Darwin host-side builds
79        darwin: {
80            enabled: false,
81        },
82    },
83    cflags: [
84        "-DNODISCARD_EXPECTED=true",
85        "-D_FILE_OFFSET_BITS=64",
86        "-Wall",
87        "-Werror",
88        "-Wno-error=unused-result", // TODO(b/314526051): Fix Result<> uses
89    ],
90    apex_available: [
91        "//apex_available:platform",
92        "com.android.virt",
93    ],
94}
95
96soong_config_module_type {
97    name: "cf_cc_defaults",
98    module_type: "cc_defaults",
99    config_namespace: "cvdhost",
100    bool_variables: ["enforce_mac80211_hwsim"],
101    value_variables: [
102        "board_f2fs_blocksize",
103        "default_userdata_fs_type",
104    ],
105    properties: ["cflags"],
106}
107
108// This is the customization layer driven by soong config variables.
109cf_cc_defaults {
110    name: "cvd_cc_defaults",
111    soong_config_variables: {
112        // PRODUCT_ENFORCE_MAC80211_HWSIM sets this
113        enforce_mac80211_hwsim: {
114            cflags: ["-DENFORCE_MAC80211_HWSIM=true"],
115            conditions_default: {
116                cflags: [],
117            },
118        },
119        // TARGET_USERDATAIMAGE_FILE_SYSTEM_TYPE sets this from BoardConfig.mk
120        // The only user is the page agnostic cf target
121        default_userdata_fs_type: {
122            cflags: ["-DUSERDATA_FILE_SYSTEM_TYPE=\"%s\""],
123            conditions_default: {
124                cflags: ["-DUSERDATA_FILE_SYSTEM_TYPE=\"f2fs\""],
125            },
126        },
127        // PRODUCT_F2FS_BLOCKSIZE sets this
128        board_f2fs_blocksize: {
129            cflags: ["-DF2FS_BLOCKSIZE=\"%s\""],
130            conditions_default: {
131                cflags: ["-DF2FS_BLOCKSIZE=\"4096\""],
132            },
133        },
134    },
135}
136
137// Defaults for cuttlefish modules that are available only in the guest OS (i.e. cuttlefish running
138// in a guest VM).
139cc_defaults {
140    name: "cuttlefish_guest_only",
141    vendor: true,
142    defaults: ["cuttlefish_base"],
143}
144
145// Same as cuttlefish_guest_only, but modules are placed in /product partition.
146cc_defaults {
147    name: "cuttlefish_guest_product_only",
148    product_specific: true,
149    defaults: ["cuttlefish_base"],
150}
151
152// Defaults for cuttlefish modules that are available only in the host-side OS. Here "host" includes
153// both (1) non-Android OS like gLinux or Ubuntu, and (2) Android OS that is capable of running
154// guest VM(s) in it. Note that, in the context of the Android build system - Soong - (1) is called
155// as "host" and (2) is called as "target". But here, the term "host" is in the context of VMs. If a
156// module is for the host-side VM (either Android or non-Android), "cuttlefish_host" shall be used.
157cc_defaults {
158    name: "cuttlefish_host",
159    host_supported: true, // this "host" means (1)
160    device_supported: true, // this is for (2)
161    vendor_available: true,
162    defaults: [
163        "cuttlefish_base",
164        "cvd_cc_defaults",
165    ],
166}
167
168// Same as "cuttlefish_host", but only for non-Android OS.
169cc_defaults {
170    name: "cuttlefish_buildhost_only",
171    host_supported: true,
172    device_supported: false,
173    defaults: ["cuttlefish_base"],
174}
175
176java_test_host {
177    name: "tombstone_transmit_tests",
178
179    libs: ["tradefed"],
180
181    srcs: ["tests/src/**/TombstoneTransmitTest.java"],
182
183    test_config: "tests/tombstone-transmit-tests.xml",
184
185    test_suites: ["general-tests"],
186}
187