-
-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathMakefile
More file actions
89 lines (69 loc) · 3.14 KB
/
Makefile
File metadata and controls
89 lines (69 loc) · 3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
PYTHON = python
SPHINX_BUILD = sphinx-build
SPHINX_AUTOBUILD = sphinx-autobuild
TOWNCRIER = towncrier
HYDROGRAM_DIR = hydrogram
DOCS_DIR = docs
DOCS_SOURCE = $(DOCS_DIR)/source
DOCS_BUILD = $(DOCS_DIR)/build
API_DIRS = $(HYDROGRAM_DIR)/errors/exceptions $(HYDROGRAM_DIR)/raw/all.py $(HYDROGRAM_DIR)/raw/base $(HYDROGRAM_DIR)/raw/functions $(HYDROGRAM_DIR)/raw/types
DOCS_API_DIRS = $(DOCS_SOURCE)/api/bound-methods $(DOCS_SOURCE)/api/methods $(DOCS_SOURCE)/api/types $(DOCS_SOURCE)/telegram
.PHONY: all clean clean-api clean-docs api api-raw api-errors docs docs-compile docs-serve live-docs towncrier towncrier-draft dev-tools check-api-schema generate-docs-json compare-bot-api cherry-pick-pyro help
all: api docs
clean: clean-api clean-docs
@echo "All directories cleaned successfully"
clean-api:
@echo "Cleaning generated API files..."
@rm -rf $(API_DIRS)
clean-docs:
@echo "Cleaning generated documentation..."
@rm -rf $(DOCS_BUILD) $(DOCS_API_DIRS)
api: api-raw api-errors
@echo "API compilation finished"
api-raw:
@echo "Compiling raw API..."
@$(PYTHON) -c "from compiler.api.compiler import start; start()"
api-errors:
@echo "Compiling API errors..."
@$(PYTHON) -c "from compiler.errors.compiler import start; start()"
docs: docs-compile docs-serve
docs-compile:
@echo "Compiling documentation..."
@$(PYTHON) -c "from compiler.docs.compiler import start; start()"
docs-serve:
@echo "Building and serving documentation..."
@$(SPHINX_BUILD) -b html $(DOCS_SOURCE) $(DOCS_BUILD)/html -j auto
live-docs:
@echo "Starting documentation server with live reload..."
@$(SPHINX_AUTOBUILD) $(DOCS_SOURCE) $(DOCS_BUILD)/html -j auto --watch $(HYDROGRAM_DIR)
towncrier:
@echo "Generating release notes..."
@$(TOWNCRIER) build --yes
towncrier-draft:
@echo "Generating draft release notes..."
@$(TOWNCRIER) build --draft
check-api-schema:
@echo "Checking Telegram API schema for updates..."
@$(PYTHON) dev_tools/check_api_schema_updates.py
generate-docs-json:
@echo "Generating API documentation JSON..."
@$(PYTHON) dev_tools/generate_docs_json.py
compare-bot-api:
@echo "Comparing implementation against Bot API..."
@$(PYTHON) dev_tools/compare_to_bot_api.py
cherry-pick-pyro:
@echo "Usage: make cherry-pick-pyro TYPE=<pr|branch|commit> ID=<number|name|hash>"
@[ "$(TYPE)" ] && [ "$(ID)" ] && $(PYTHON) dev_tools/cherry_pick_pyro.py $(TYPE) $(ID) || echo "Please provide TYPE and ID parameters"
help:
@echo "Available targets:"
@echo " all : Compile API and documentation"
@echo " clean : Remove all generated files"
@echo " api : Compile all API components"
@echo " docs : Compile and serve documentation"
@echo " live-docs : Start documentation server with live reload"
@echo " towncrier : Generate release notes"
@echo " towncrier-draft: Generate draft release notes"
@echo " check-api-schema: Check Telegram API schema for updates"
@echo " generate-docs-json: Generate API documentation JSON"
@echo " compare-bot-api: Compare implementation against Bot API"
@echo " cherry-pick-pyro: Cherry-pick code from Pyrogram (usage: make cherry-pick-pyro TYPE=<pr|branch|commit> ID=<number|name|hash>)"