1// This introduces the module type library_linking_strategy_cc_defaults
2// To use in other Android.bp files, add the following lines:
3//    soong_config_module_type_import {
4//        from: "system/apex/Android.bp",
5//        module_types: ["library_linking_strategy_cc_defaults"],
6//    }
7
8package {
9    default_applicable_licenses: ["Android-Apache-2.0"],
10}
11
12soong_config_string_variable {
13    name: "library_linking_strategy",
14    values: [
15        "prefer_static",
16    ],
17}
18
19soong_config_module_type {
20    name: "library_linking_strategy_cc_defaults",
21    module_type: "cc_defaults",
22    config_namespace: "ANDROID",
23    variables: ["library_linking_strategy"],
24    properties: [
25        "shared_libs",
26        "static_libs",
27        "stl",
28    ],
29}
30
31// TODO(b/178585590): delete this after testing linking strategy
32soong_config_module_type {
33    name: "library_linking_strategy_apex_defaults",
34    module_type: "apex_defaults",
35    config_namespace: "ANDROID",
36    variables: ["library_linking_strategy"],
37    properties: [
38        "manifest",
39        "min_sdk_version",
40    ],
41}
42
43library_linking_strategy_cc_defaults {
44    name: "library_linking_strategy_sample_defaults",
45    soong_config_variables: {
46        library_linking_strategy: {
47            prefer_static: {
48                static_libs: [
49                    "libbase",
50                    "liblog",
51                ],
52                stl: "c++_static",
53            },
54            conditions_default: {
55                shared_libs: [
56                    "libbase",
57                    "liblog",
58                ],
59            },
60        },
61    },
62}
63
64cc_binary {
65    name: "library_linking_strategy_sample_binary",
66    srcs: ["library_linking_strategy.cc"],
67    defaults: ["library_linking_strategy_sample_defaults"],
68}
69