scarab_cant_clash.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import _common as common
  2. def onacceleo(unit, *args):
  3. if unit.get("YMAKE_JAVA_MODULES") == "yes":
  4. return
  5. flat, kv = common.sort_by_keywords(
  6. {'XSD': -1, 'MTL': -1, 'MTL_ROOT': 1, 'LANG': -1, 'OUT': -1, 'OUT_NOAUTO': -1, 'OUTPUT_INCLUDES': -1, 'DEBUG': 0},
  7. args
  8. )
  9. try:
  10. mtlroot = kv['MTL_ROOT'][0]
  11. except Exception:
  12. mtlroot = unit.path().replace('$S/', '')
  13. classpath = ['$SCARAB', ] # XXX special word for ya make to replace following paths with real classpath
  14. classpath.append('tools/acceleo')
  15. depends = []
  16. if not unit.get('IDE_MSVS_CALL'):
  17. for jar in classpath[1:]:
  18. depends.append(jar)
  19. classpath = ':'.join(classpath)
  20. # Generate java cmd
  21. cmd = [
  22. '-classpath',
  23. classpath,
  24. '-Dfile.encoding=UTF-8',
  25. 'ru.yandex.se.logsng.tool.Cli',
  26. ]
  27. for xsd in kv.get('XSD', []):
  28. cmd += ['--xsd', xsd]
  29. for mtl in kv.get('MTL', []):
  30. cmd += ['--mtl', mtl]
  31. for lang in kv.get('LANG', []):
  32. cmd += ['--lang', lang]
  33. cmd += ['--output-dir', unit.path().replace('$S/', '${ARCADIA_BUILD_ROOT}/')]
  34. cmd += ['--build-root', '${ARCADIA_BUILD_ROOT}']
  35. cmd += ['--source-root', '${ARCADIA_ROOT}']
  36. cmd += ['--mtl-root', mtlroot]
  37. # Generate RUN_JAVA args
  38. run_java = cmd
  39. if 'DEBUG' not in kv:
  40. run_java += ['HIDE_OUTPUT']
  41. inputs = kv.get('XSD', []) + kv.get('MTL', []) + kv.get('LANG', [])
  42. if inputs:
  43. run_java += ['IN'] + inputs
  44. for k in 'OUT', 'OUT_NOAUTO', 'OUTPUT_INCLUDES':
  45. if kv.get(k):
  46. run_java += [k] + kv[k]
  47. if depends:
  48. run_java += ['TOOL'] + depends
  49. unit.on_run_java(run_java)