1#!/usr/bin/env python 2# Copyright 2014 The Chromium Authors. All rights reserved. 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6import argparse 7import os.path 8import sys 9 10def main(): 11 parser = argparse.ArgumentParser( 12 description="GYP helper script for mapping mojoms => generated outputs.") 13 parser.add_argument("--basedir", required=True) 14 parser.add_argument("--variant", required=True) 15 parser.add_argument("mojom", nargs="*") 16 17 args = parser.parse_args() 18 19 variant = args.variant if args.variant != "none" else None 20 21 for mojom in args.mojom: 22 full = os.path.join("<(SHARED_INTERMEDIATE_DIR)", args.basedir, mojom) 23 base, ext = os.path.splitext(full) 24 25 # Ignore non-mojom files. 26 if ext != ".mojom": 27 continue 28 29 # Fix filename escaping issues on Windows. 30 base = base.replace("\\", "/") 31 if variant: 32 print base + ".mojom-%s.cc" % variant 33 print base + ".mojom-%s.h" % variant 34 print base + ".mojom-%s-internal.h" % variant 35 else: 36 print base + ".mojom.cc" 37 print base + ".mojom.h" 38 print base + ".mojom-internal.h" 39 print base + ".mojom.js" 40 41 return 0 42 43if __name__ == "__main__": 44 sys.exit(main()) 45