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