Проверка шаблона шины для iOS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

generateImports.py 847B

10 months ago
10 months ago
10 months ago
12345678910111213141516171819
  1. def generateImports(c):
  2. fileName = f"{c.src}/../{c.module}.podspec"
  3. # Для сборного модуля используем путь к корневому podspec.
  4. if c.path != c.module:
  5. parent = c.path.split("/")[0]
  6. fileName = fileName.replace(f"{c.module}/src/../{c.module}", parent)
  7. # Для обычного модуля с окончание X учитываем такое же название podspec.
  8. if c.path[-1] == "X":
  9. fileName = fileName.replace(f"{c.module}.podspec", f"{c.module}X.podspec")
  10. lines = c.readFile(fileName)
  11. items = ["Combine", "Foundation", "UIKit"]
  12. prefix = "s.dependency '"
  13. for ln in lines:
  14. if ln.startswith(prefix):
  15. name = ln[len(prefix):-1]
  16. items.append(name)
  17. c.imports = "import " + "\nimport ".join(sorted(items))