forked from paulocoutinhox/pdfium-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.py
executable file
·245 lines (188 loc) · 4.84 KB
/
make.py
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Make tool
Usage:
make.py <task-name>
make.py [options]
make.py -h | --help
Options:
-h --help Show this screen.
-d --debug Enable debug mode.
--version Show version.
Examples:
python3 make.py -h
Tasks:
- format
- build-depot-tools
- build-emsdk
- build-pdfium-ios
- patch-ios
- build-ios
- install-ios
- test-ios
- archive-ios
- build-pdfium-macos
- patch-macos
- build-macos
- install-macos
- test-macos
- archive-macos
- build-pdfium-android
- patch-android
- build-android
- install-android
- test-android
- archive-android
- build-pdfium-wasm
- patch-wasm
- build-wasm
- install-wasm
- test-wasm
- generate-wasm
- publish-wasm
- publish-to-web-wasm
- archive-wasm
"""
from docopt import docopt
from pygemstones.system import bootstrap as b
from pygemstones.util import log as l
import modules.android as android
import modules.common as common
import modules.config as c
import modules.ios as ios
import modules.macos as macos
import modules.wasm as wasm
def main(options):
# show all params for debug
if ("--debug" in options and options["--debug"]) or (
"-d" in options and options["-d"]
):
c.debug = True
if c.debug:
l.bold("You have executed with options:", l.YELLOW)
l.m(str(options))
l.nl()
# bind options
if "<task-name>" in options:
task = options["<task-name>"]
# validate task
if not task:
l.e("Task is invalid. Use 'python3 make.py -h' for help.")
#######################
# Common
#######################
# format
if task == "format":
common.run_task_format()
# build depot tools
elif task == "build-depot-tools":
common.run_task_build_depot_tools()
# build emsdk
elif task == "build-emsdk":
common.run_task_build_emsdk()
#######################
# iOS
#######################
# build pdfium - ios
elif task == "build-pdfium-ios":
ios.run_task_build_pdfium()
# patch - ios
elif task == "patch-ios":
ios.run_task_patch()
# build - ios
elif task == "build-ios":
ios.run_task_build()
# install - ios
elif task == "install-ios":
ios.run_task_install()
# test - ios
elif task == "test-ios":
ios.run_task_test()
# archive - ios
elif task == "archive-ios":
ios.run_task_archive()
#######################
# macOS
#######################
# build pdfium - macos
elif task == "build-pdfium-macos":
macos.run_task_build_pdfium()
# patch - macos
elif task == "patch-macos":
macos.run_task_patch()
# build - macos
elif task == "build-macos":
macos.run_task_build()
# install - macos
elif task == "install-macos":
macos.run_task_install()
# test - macos
elif task == "test-macos":
macos.run_task_test()
# archive - macos
elif task == "archive-macos":
macos.run_task_archive()
#######################
# Android
#######################
# build pdfium - android
elif task == "build-pdfium-android":
android.run_task_build_pdfium()
# patch - android
elif task == "patch-android":
android.run_task_patch()
# build - android
elif task == "build-android":
android.run_task_build()
# install - android
elif task == "install-android":
android.run_task_install()
# test - android
elif task == "test-android":
android.run_task_test()
# archive - android
elif task == "archive-android":
android.run_task_archive()
#######################
# WASM
#######################
# build pdfium - wasm
elif task == "build-pdfium-wasm":
wasm.run_task_build_pdfium()
# patch - wasm
elif task == "patch-wasm":
wasm.run_task_patch()
# build - wasm
elif task == "build-wasm":
wasm.run_task_build()
# install - wasm
elif task == "install-wasm":
wasm.run_task_install()
# test - wasm
elif task == "test-wasm":
wasm.run_task_test()
# generate - wasm
elif task == "generate-wasm":
wasm.run_task_generate()
# publish - wasm
elif task == "publish-wasm":
wasm.run_task_publish()
# publish to web - wasm
elif task == "publish-to-web-wasm":
wasm.run_task_publish_to_web()
# archive - wasm
elif task == "archive-wasm":
wasm.run_task_archive()
#######################
# Invalid
#######################
# invalid
else:
l.e("Task is invalid")
if __name__ == "__main__":
# initialization
b.init()
# main CLI entrypoint
args = docopt(__doc__, version="2.0.0")
main(args)