-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCompileServiceAgent.py
More file actions
executable file
·89 lines (76 loc) · 2.83 KB
/
CompileServiceAgent.py
File metadata and controls
executable file
·89 lines (76 loc) · 2.83 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
#!/usr/bin/env python
import os
import sys
import commands
import subprocess
import getpass
from pylib.print_color import *
PAPYRUSRT = "obigo-sdk/Papyrus-RT/papyrusrt"
SA_FOLDER = "SA"
CDT_PROJECT = "ServiceAgent_CDTProject"
BINARY_NAME = "ServiceAgent_CDTProject"
INSTALL_FOLDER = "ServiceAgentBM"
CLONE_FOLDER = "serviceagent-bm"
CLONE_FOLDER_SA = "serviceagent"
BUILD_FOLDER = "build"
BUILD_SCRIPT = "sa_build.sh"
BUILD_TARGET = "-bt"
CONFIGURATION = ''
CONFIGURATION_DEBUG = 'Debug'
CLEANBUILD = '-build'
CWD = os.path.dirname(os.path.realpath(__file__))
os.chdir(CWD)
def checkPath(path, exist):
if exist == True:
if os.path.exists(path) == False:
printfail(path + " doesn't exist")
sys.exit()
else:
return
if exist == False:
if os.path.exists(path) == True:
printfail(path + " already exist")
sys.exit()
else:
return
if len(sys.argv) < 2:
message = __file__ + " <Configuration Name> [clean]"
printfail(message)
sys.exit()
if len(sys.argv) > 2:
if sys.argv[2] == 'clean':
CLEANBUILD = '-cleanBuild'
else:
message = __file__ + " <Configuration Name> [clean]"
printfail(message)
sys.exit()
CONFIGURATION = sys.argv[1]
printheader("##########################################################")
printheader("### Looking for PapyrusRT ")
printheader("### " + os.path.join('/home', getpass.getuser(), PAPYRUSRT))
printheader("##########################################################")
checkPath(os.path.join('/home', getpass.getuser(), PAPYRUSRT), True)
DEPENDECY_LIBRARY = os.path.join(CWD, INSTALL_FOLDER, CLONE_FOLDER, CLONE_FOLDER_SA,SA_FOLDER, 'external/armv7-a/lib/libsvchttp.a')
if CONFIGURATION != CONFIGURATION_DEBUG:
printheader("##########################################################")
printheader("### Looking for dependecy library ")
printheader("### " + DEPENDECY_LIBRARY)
printheader("##########################################################")
checkPath(DEPENDECY_LIBRARY, True)
SOURCE_CODE_GENERATED = os.path.join(CWD, INSTALL_FOLDER, CLONE_FOLDER, CLONE_FOLDER_SA, SA_FOLDER, CDT_PROJECT, 'src')
printheader("##########################################################")
printheader("### Looking for source code generated ")
printheader("### " + SOURCE_CODE_GENERATED)
printheader("##########################################################")
checkPath(SOURCE_CODE_GENERATED, True)
printheader("##########################################################")
printheader("### Compiling CDT Project ")
printheader("##########################################################")
subprocess.call([os.path.join('/home', getpass.getuser(), PAPYRUSRT),
'--launcher.suppressErrors', '-nosplash', '-application',
'org.eclipse.cdt.managedbuilder.core.headlessbuild',
'-import',
os.path.join(CWD, INSTALL_FOLDER, CLONE_FOLDER, CLONE_FOLDER_SA,
SA_FOLDER, CDT_PROJECT),
CLEANBUILD,
CDT_PROJECT + '/' + CONFIGURATION]);