winIDEA SDK
test_build_actions.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2#
3# (c) TASKING Germany GmbH, 2023
4
5import time
6
7import isystem.connect as ic
8
9
10winidea_id = ''
11
12
13def test_buildActions():
14 connMgr = ic.ConnectionMgr()
15 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
16
17 projCtrl = ic.CProjectController(connMgr)
18
19 # cannot use compile with external build script
20 # print("Action: 'Compile'...")
21 # projCtrl.compile("src/main.cpp")
22 # _waitUntilBusy(projCtrl)
23
24 print("Action: 'Make'...")
25 projCtrl.make(False)
26 _waitUntilBusy(projCtrl)
27
28 # # cannot use link and build with external build script
29 # print("Action: 'Link', interrupt immediately...")
30 # projCtrl.link(False)
31 # projCtrl.stop()
32 #
33 # print("Action: 'Build'...")
34 # projCtrl.build(False)
35 # _waitUntilBusy(projCtrl)
36
37 print(f"Is up-to-date: {projCtrl.isUpToDate()}")
38
39
40def _waitUntilBusy(projCtrl: ic.CProjectController):
41 # wait until the end
42 timeoutTimestamp = time.time() + 120
43 while projCtrl.getStatus().isActive() is True:
44 if time.time() > timeoutTimestamp:
45 assert False, f"Build timeout (120 sec)"
46
47
48if __name__ == "__main__":
49 test_buildActions()