1// Copyright (C) 2018 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    // See: http://go/android-license-faq
17    // A large-scale-change added 'default_applicable_licenses' to import
18    // all of the 'license_kinds' from "frameworks_av_license"
19    // to get the below license kinds:
20    //   SPDX-license-identifier-Apache-2.0
21    default_applicable_licenses: ["frameworks_av_license"],
22}
23
24python_defaults {
25    name: "tools_default",
26    version: {
27        py2: {
28            enabled: false,
29        },
30        py3: {
31            enabled: true,
32        },
33    },
34}
35
36//##################################################################################################
37// Tools for audio policy engine criterion type configuration file
38//
39python_binary_host {
40    name: "buildPolicyCriterionTypes.py",
41    main: "buildPolicyCriterionTypes.py",
42    srcs: [
43        "buildPolicyCriterionTypes.py",
44    ],
45    defaults: ["tools_default"],
46}
47
48genrule_defaults {
49    name: "buildpolicycriteriontypesrule",
50    tools: ["buildPolicyCriterionTypes.py"],
51    cmd: "cp $(locations :audio_policy_configuration_files) $(genDir)/. && " +
52         "cp $(location :audio_policy_configuration_top_file) $(genDir)/audio_policy_configuration.xml && " +
53         "$(location buildPolicyCriterionTypes.py) " +
54         " --androidaudiobaseheader $(location :libaudio_system_audio_base) " +
55         " --androidaudiocommonbaseheader $(location :libaudio_system_audio_common_base) " +
56         "--audiopolicyconfigurationfile $(genDir)/audio_policy_configuration.xml " +
57         "--criteriontypes $(location :audio_policy_engine_criterion_types_template) " +
58         "--outputfile $(out)",
59    srcs: [
60        // The commented inputs must be provided to use this genrule_defaults
61        // @todo uncomment if 1428659 is merged":android_audio_base_header_file",
62        ":audio_policy_engine_criterion_types_template",
63        ":libaudio_system_audio_base",
64        ":libaudio_system_audio_common_base",
65        // ":audio_policy_configuration_top_file",
66        // ":audio_policy_configuration_files",
67    ],
68    out: ["audio_policy_engine_criterion_types.xml"],
69}
70
71//##################################################################################################
72// Tools for audio policy engine parameter framework configurable domains
73//
74python_binary_host {
75    name: "domainGeneratorPolicy.py",
76    main: "domainGeneratorPolicy.py",
77    srcs: [
78        "domainGeneratorPolicy.py",
79    ],
80    defaults: ["tools_default"],
81    libs: [
82        "EddParser.py",
83        "hostConfig.py",
84        "PFWScriptGenerator.py",
85    ],
86    required: [
87        "domainGeneratorConnector",
88    ],
89}
90
91genrule_defaults {
92    name: "domaingeneratorpolicyrule",
93    tools: [
94        "domainGeneratorPolicy.py",
95        "domainGeneratorConnector",
96    ],
97    cmd: "mkdir -p $(genDir)/Structure/Policy && " +
98         "cp $(locations :audio_policy_pfw_structure_files) $(genDir)/Structure/Policy && " +
99         "cp $(location :audio_policy_pfw_toplevel) $(genDir)/top_level && " +
100         "$(location domainGeneratorPolicy.py) " +
101         "--validate " +
102         "--domain-generator-tool $(location domainGeneratorConnector) " +
103         "--toplevel-config $(genDir)/top_level " +
104         "--criteria $(location :audio_policy_engine_criteria) " +
105         "--criteriontypes $(location :audio_policy_engine_criterion_types) " +
106         "--add-edds $(locations :edd_files) " +
107         "--schemas-dir external/parameter-framework/upstream/schemas " +
108         " > $(out)",
109    srcs: [
110        // The commented inputs must be provided to use this genrule_defaults
111        // ":audio_policy_pfw_toplevel",
112        // ":audio_policy_pfw_structure_files",
113        ":audio_policy_engine_criteria",
114        // ":audio_policy_engine_criterion_types",
115        // ":edd_files",
116    ],
117    out: ["PolicyConfigurableDomains.xml"],
118}
119
120//##################################################################################################
121// Tools for policy parameter-framework product strategies structure file generation
122//
123python_binary_host {
124    name: "buildStrategiesStructureFile.py",
125    main: "buildStrategiesStructureFile.py",
126    srcs: [
127        "buildStrategiesStructureFile.py",
128    ],
129    defaults: ["tools_default"],
130}
131
132genrule_defaults {
133    name: "buildstrategiesstructurerule",
134    tools: ["buildStrategiesStructureFile.py"],
135    cmd: "cp $(locations :audio_policy_engine_configuration_files) $(genDir) && ls -l $(genDir) &&"+
136         "$(location buildStrategiesStructureFile.py) " +
137         "--audiopolicyengineconfigurationfile $(genDir)/audio_policy_engine_configuration.xml "+
138         "--productstrategiesstructurefile $(location :product_strategies_structure_template) " +
139         "--outputfile $(out)",
140    srcs: [
141        // The commented inputs must be provided to use this genrule_defaults
142        // ":audio_policy_engine_configuration_files",
143        ":product_strategies_structure_template",
144    ],
145    out: ["ProductStrategies.xml"],
146}
147
148//##################################################################################################
149// Tools for policy parameter-framework common type structure file generation
150//
151python_binary_host {
152    name: "buildCommonTypesStructureFile.py",
153    main: "buildCommonTypesStructureFile.py",
154    srcs: [
155        "buildCommonTypesStructureFile.py",
156    ],
157    defaults: ["tools_default"],
158}
159
160genrule_defaults {
161    name: "buildcommontypesstructurerule",
162    tools: ["buildCommonTypesStructureFile.py"],
163    cmd: "$(location buildCommonTypesStructureFile.py) " +
164         "--androidaudiobaseheader $(location :libaudio_system_audio_base) " +
165         "--commontypesstructure $(location :common_types_structure_template) " +
166         "--outputfile $(out)",
167    srcs: [
168        ":common_types_structure_template",
169        ":libaudio_system_audio_base",
170    ],
171    out: ["PolicySubsystem-CommonTypes.xml"],
172}
173