1#!/usr/bin/env python3 2 3# Copyright (C) 2022 The Android Open Source Project 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16"""Generate module graph json data for testing purposes.""" 17 18 19def make_dep(name, tag=None, variations=None): 20 return { 21 'Name': name, 22 'Tag': tag, 23 'Variations': variations, 24 } 25 26 27def make_variation(mutator, variation): 28 return { 29 'Mutator': mutator, 30 'Variation': variation, 31 } 32 33 34def make_module(name, 35 typ, 36 deps=[], 37 blueprint='', 38 variations=None, 39 created_by='', 40 json_props=[]): 41 return { 42 'Name': name, 43 'Type': typ, 44 'Blueprint': blueprint, 45 'CreatedBy': created_by, 46 'Deps': deps, 47 'Variations': variations, 48 'Module': { 49 'Android': { 50 'SetProperties': json_props, 51 }, 52 }, 53 } 54 55 56def make_property(name, value='', values=None): 57 return { 58 'Name': name, 59 'Value': value, 60 'Values': values, 61 } 62