Files
check-ios-bus/Utilities/platform/2/generation/generateImports.py
Михаил Капелько 853686f441 d
2023-12-28 14:04:37 +03:00

20 lines
847 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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