Separate non-core tizen builds for Jenkins
[iotivity.git] / auto_build.py
1 #!/usr/bin/python
2
3 import os
4 import sys
5 import platform
6 import subprocess
7 import multiprocessing
8
9
10 # help message
11 def helpmsg(script):
12     helpstr = '''
13 Usage:
14
15 To build:
16     python %s <targetbuild>
17 To clean:
18     python %s -c
19
20 EXEC_MODE=True/False (default false) to suppress running the commands.
21 VERBOSE=0/1 (default 1) to tell scons to print more information.
22
23 Allowed values for <target_build>: 
24     all linux linux_unsecured linux_secured linux_full linux_unsecured_with_tcp
25     linux_unsecured_with_rd linux_secured_with_rd linux_unsecured_with_mq
26     linux_secured_with_tcp linux_unsecured_with_java linux_secured_with_java
27     android android_universal android_universal_unsecured
28     android_unsecured android_secured android_x86 android_x86_with_ip
29     android_x86_with_bt android_x86_with_ble android_x86_with_rm_and_ip
30     android_x86_with_rm_and_bt android_x86_with_rm_and_ble android_armeabi
31     android_armeabi_with_ip android_armeabi_with_bt android_armeabi_with_ble
32     android_armeabi_with_rm_and_ip android_armeabi_with_rm_and_bt
33     android_armeabi_with_rm_and_ble
34     windows msys simulator darwin tizen tizen_unsecured tizen_secured
35     tizen_extra tizen_extra_unsecured tizen_extra_secured
36     unit_tests unit_tests_secured unit_tests_unsecured
37     unit_tests_memcheck_secured unit_tests_memcheck_unsecured
38
39     Note: nearly all of these are combination builds, which means they
40     are not useful to get a specific build to work on, rather they are
41     useful for "make sure all these build" tests as used by the Jenkins CI.
42     Any selection will build both debug and release versions of all available
43     targets in the scope you've selected except for unit tests, which by
44     their nature are debug only.
45     To choose any specific command, please use the SCons commandline directly.
46     Use \"EXEC_MODE=False %s <targetbuild>\"  to see commands to run.
47     '''
48     print (helpstr % (script, script, script))
49     sys.exit(1)
50
51
52 def call_scons(build_options, scons_options):
53     """
54     Format and run a single scons command.
55
56     Args:
57         build_options (dict): build flags with values.
58         scons_options (str): additional flags to scons.
59     """
60     cmd_line = "scons VERBOSE=" + VERBOSE
61     for key in build_options:
62         cmd_line += " " + key + "=" + str(build_options[key])
63
64     cmd_line += " " + str(scons_options)
65
66     if not EXEC_MODE:
67         print ("Would run : " + cmd_line)
68     else:
69         print ("Running : " + cmd_line)
70         sys.stdout.flush()
71         exit_code = subprocess.Popen(cmd_line, shell=True).wait()
72         if exit_code != 0:
73             sys.exit(exit_code)
74
75
76 def build_all(flag, scons_options):
77     """
78     Build all the variants appropriate for the host platform.
79
80     Args:
81         flag (bool): if True, build in Release mode.
82         scons_options (dict): additional flags to scons.
83     """
84     if platform.system() == "Linux":
85         build_linux_unsecured(flag, scons_options)
86         build_linux_secured(flag, scons_options)
87         build_linux_unsecured_with_rm(flag, scons_options)
88         build_linux_unsecured_with_rd(flag, scons_options)
89         build_linux_secured_with_rd(flag, scons_options)
90         build_linux_unsecured_with_mq(flag, scons_options)
91         build_linux_unsecured_with_tcp(flag, scons_options)
92         build_linux_secured_with_tcp(flag, scons_options)
93         build_linux_unsecured_with_java(flag, scons_options)
94         build_linux_secured_with_java(flag, scons_options)
95         build_simulator(flag, scons_options)
96
97         build_android_unsecured(flag, scons_options)
98         build_android_secured(flag, scons_options)
99         build_tizen(flag, scons_options)
100
101     # Note: supported Windows mode is to use run.bat instead
102     if platform.system() == "Windows":
103         build_windows(flag, scons_options)
104
105     if platform.system() == "Darwin":
106         build_darwin(flag, scons_options)
107
108
109 def build_linux(flag, scons_options):
110     build_linux_unsecured(flag, scons_options)
111     build_linux_secured(flag, scons_options)
112
113
114 def build_linux_secured(flag, scons_options):
115     print ("*********** Build for linux with Security *************")
116     build_options = {
117         'RELEASE': flag,
118         'ERROR_ON_WARN': 1,
119     }
120     call_scons(build_options, scons_options)
121
122
123 def build_linux_unsecured(flag, scons_options):
124     print ("*********** Build for linux ************")
125     build_options = {
126         'RELEASE': flag,
127         'SECURED': 0,
128         'ERROR_ON_WARN': 1,
129     }
130     call_scons(build_options, scons_options)
131
132
133 def build_linux_secured_with_tcp(flag, scons_options):
134     print ("*********** Build for linux with Secured TCP ************")
135     build_options = {
136         'RELEASE': flag,
137         'WITH_TCP': 1,
138         'WITH_CLOUD': 1,
139         'ERROR_ON_WARN': 1,
140     }
141     call_scons(build_options, scons_options)
142
143
144 def build_linux_unsecured_with_tcp(flag, scons_options):
145     print ("*********** Build for linux with TCP ************")
146     build_options = {
147         'RELEASE': flag,
148         'WITH_TCP': 1,
149         'TARGET_TRANSPORT': 'IP',
150         'SECURED': 0,
151         'ERROR_ON_WARN': 1,
152     }
153     call_scons(build_options, scons_options)
154
155
156 def build_linux_unsecured_with_java(flag, scons_options):
157     print ("*********** Build for linux with Java support ************")
158     build_options = {
159         'RELEASE': flag,
160         'BUILD_JAVA': 1,
161         'TARGET_TRANSPORT': 'IP',
162         'ERROR_ON_WARN': 1,
163     }
164     call_scons(build_options, scons_options)
165
166
167 def build_linux_secured_with_java(flag, scons_options):
168     print ("*********** Build for linux with Java support and secured ************")
169     build_options = {
170         'RELEASE': flag,
171         'BUILD_JAVA': 1,
172         'TARGET_TRANSPORT': 'IP',
173         'SECURED': 1,
174         'ERROR_ON_WARN': 1,
175     }
176     call_scons(build_options, scons_options)
177
178
179 def build_linux_unsecured_with_rm(flag, scons_options):
180     print ("*********** Build for linux with RoutingManager************")
181     build_options = {
182         'ROUTING': 'GW',
183         'RELEASE': flag,
184         'SECURED': 0,
185         'ERROR_ON_WARN': 1,
186     }
187     call_scons(build_options, scons_options)
188
189
190 def build_linux_full(flag, scons_options):
191     """
192     Secured build with as many options selected as possible.
193     """
194     print ("*********** Build for linux with full features *************")
195     build_options = {
196         'BUILD_JAVA': 1,
197         'MULTIPLE_OWNER': 1,
198         'RELEASE': flag,
199         'SECURED': 1,
200         'WITH_CLOUD': 1,
201         'WITH_PROXY': 1,
202         'WITH_RA': 1,
203         'WITH_RA_IBB': 1,
204         'WITH_TCP': 1,
205         'ERROR_ON_WARN': 1,
206     }
207     call_scons(build_options, scons_options)
208
209
210 def build_linux_unsecured_with_rd(flag, scons_options):
211     print ("*********** Build for linux With Resource Directory *************")
212     build_options = {
213         'RELEASE': flag,
214         'RD_MODE': 'all',
215         'SECURED': 0,
216         'ERROR_ON_WARN': 1,
217     }
218     call_scons(build_options, scons_options)
219
220
221 def build_linux_secured_with_rd(flag, scons_options):
222     print ("*********** Build for linux With Resource Directory & Security ************")
223     build_options = {
224         'RELEASE': flag,
225         'RD_MODE': 'all',
226         'ERROR_ON_WARN': 1,
227     }
228     call_scons(build_options, scons_options)
229
230
231 def build_linux_unsecured_with_mq(flag, scons_options):
232     print ("*********** Build for linux With Message Queue ************")
233     build_options = {
234         'RELEASE': flag,
235         'WITH_MQ': 'PUB,SUB,BROKER',
236         'SECURED': 0,
237         'ERROR_ON_WARN': 1,
238     }
239     call_scons(build_options, scons_options)
240
241
242 def build_android(flag, scons_options):
243     # Note: for android, as oic-resource uses C++11 feature stoi and to_string,
244     # it requires gcc-4.9, currently only android-ndk-r10(for linux)
245     # and windows android-ndk-r10(64bit target version) support these features.
246     print ("*********** Build for android armeabi *************")
247     build_options = {
248         'TARGET_OS': 'android',
249         'TARGET_ARCH': 'armeabi',
250         'RELEASE': flag,
251     }
252     call_scons(build_options, scons_options)
253
254
255 def build_android_universal(flag, scons_options):
256     print('''
257 *******************************************************************************
258     Starting Android Universal build
259     This Will take a very long time to complete. It will build the android
260     build for the following architectures.
261        - armeabi
262        - armeabi-v7a
263        - arm64-v8a
264        - x86
265        - x86_64
266     If you do not need to build a universal APK or you can target a specific
267     architecture we recommend you build android for that specific target. 
268 *******************************************************************************
269 ''')
270     print ("*********** Build for android armeabi *************")
271     build_options = {
272         'TARGET_OS': 'android',
273         'TARGET_ARCH': 'armeabi',
274         'RELEASE': flag,
275     }
276     call_scons(build_options, scons_options)
277     print ("*********** Build for android x86 *************")
278     build_options = {
279         'TARGET_OS': 'android',
280         'TARGET_ARCH': 'x86',
281         'RELEASE': flag,
282     }
283     call_scons(build_options, scons_options)
284     print ("*********** Build for android armeabi-v7a *************")
285     build_options = {
286         'TARGET_OS': 'android',
287         'TARGET_ARCH': 'armeabi-v7a',
288         'RELEASE': flag,
289     }
290     call_scons(build_options, scons_options)
291     print ("*********** Build for android x86_64 *************")
292     build_options = {
293         'TARGET_OS': 'android',
294         'TARGET_ARCH': 'x86_64',
295         'RELEASE': flag,
296     }
297     call_scons(build_options, scons_options)
298     print ("*********** Build for android arm64-v8a *************")
299     build_options = {
300         'TARGET_OS': 'android',
301         'TARGET_ARCH': 'arm64-v8a',
302         'RELEASE': flag,
303     }
304     call_scons(build_options, scons_options)
305     print ("*********** Finishing Android universal build *************")
306
307
308 def build_android_secured(flag, scons_options):
309     build_android(flag, scons_options + " SECURED=1")
310
311
312 def build_android_unsecured(flag, scons_options):
313     build_android(flag, scons_options + " SECURED=0")
314
315
316 def build_android_x86(flag, scons_options):
317     """ Build Android x86 Suite """
318     build_android_x86_with_ip(flag, scons_options)
319     build_android_x86_with_bt(flag, scons_options)
320     build_android_x86_with_ble(flag, scons_options)
321
322
323 def build_android_x86_with_ip(flag, scons_options):
324     print ("*********** Build for android x86 *************")
325     build_options = {
326         'TARGET_OS': 'android',
327         'TARGET_ARCH': 'x86',
328         'RELEASE': flag,
329         'TARGET_TRANSPORT': 'IP',
330     }
331     call_scons(build_options, scons_options)
332
333
334 def build_android_x86_with_bt(flag, scons_options):
335     print ("*********** Build for android x86 with Bluetooth *************")
336     build_options = {
337         'TARGET_OS': 'android',
338         'TARGET_ARCH': 'x86',
339         'RELEASE': flag,
340         'TARGET_TRANSPORT': 'BT',
341     }
342     call_scons(build_options, scons_options)
343
344
345 def build_android_x86_with_ble(flag, scons_options):
346     print ("*********** Build for android x86 with Bluetooth Low Energy *************")
347     build_options = {
348         'TARGET_OS': 'android',
349         'TARGET_ARCH': 'x86',
350         'RELEASE': flag,
351         'TARGET_TRANSPORT': 'BLE',
352     }
353     call_scons(build_options, scons_options)
354
355
356 def build_android_x86_with_rm(flag, scons_options):
357     """ Build Android x86 Routing Manager Suite """
358     build_android_x86_with_rm_and_ip(flag, scons_options)
359     build_android_x86_with_rm_and_bt(flag, scons_options)
360     build_android_x86_with_rm_and_ble(flag, scons_options)
361
362
363 def build_android_x86_with_rm_and_ip(flag, scons_options):
364     print ("*********** Build for android x86 with Routing Manager *************")
365     build_options = {
366         'TARGET_OS': 'android',
367         'TARGET_ARCH': 'x86',
368         'ROUTING': 'GW',
369         'RELEASE': flag,
370         'TARGET_TRANSPORT': 'IP',
371     }
372     call_scons(build_options, scons_options)
373
374
375 def build_android_x86_with_rm_and_bt(flag, scons_options):
376     print ("*********** Build for android x86 with Routing Manager and Bluetooth *************")
377     build_options = {
378         'TARGET_OS': 'android',
379         'TARGET_ARCH': 'x86',
380         'ROUTING': 'GW',
381         'RELEASE': flag,
382         'TARGET_TRANSPORT': 'BT',
383     }
384     call_scons(build_options, scons_options)
385
386
387 def build_android_x86_with_rm_and_ble(flag, scons_options):
388     print ("*********** Build for android x86 with Routing Manager and Bluetooth Low Energy *************")
389     build_options = {
390         'TARGET_OS': 'android',
391         'TARGET_ARCH': 'x86',
392         'ROUTING': 'GW',
393         'RELEASE': flag,
394         'TARGET_TRANSPORT': 'BLE',
395     }
396     call_scons(build_options, scons_options)
397
398
399 def build_android_armeabi(flag, scons_options):
400     """ Build Android Armeabi Suite """
401     build_android_armeabi_with_ip(flag, scons_options)
402     build_android_armeabi_with_bt(flag, scons_options)
403     build_android_armeabi_with_ble(flag, scons_options)
404
405
406 def build_android_armeabi_with_ip(flag, scons_options):
407     print ("*********** Build for android armeabi *************")
408     build_options = {
409         'TARGET_OS': 'android',
410         'TARGET_ARCH': 'armeabi',
411         'RELEASE': flag,
412         'TARGET_TRANSPORT': 'IP',
413     }
414     call_scons(build_options, scons_options)
415
416
417 def build_android_armeabi_with_bt(flag, scons_options):
418     print ("*********** Build for android armeabi with Bluetooth *************")
419     build_options = {
420         'TARGET_OS': 'android',
421         'TARGET_ARCH': 'armeabi',
422         'RELEASE': flag,
423         'TARGET_TRANSPORT': 'BT',
424     }
425     call_scons(build_options, scons_options)
426
427
428 def build_android_armeabi_with_ble(flag, scons_options):
429     print ("*********** Build for android armeabi with Bluetooth Low Energy *************")
430     build_options = {
431         'TARGET_OS': 'android',
432         'TARGET_ARCH': 'armeabi',
433         'RELEASE': flag,
434         'TARGET_TRANSPORT': 'BLE',
435     }
436     call_scons(build_options, scons_options)
437
438
439 def build_android_armeabi_with_rm(flag, scons_options):
440     """ Build Android Armeabi Routing Manager Suite """
441     build_android_armeabi_with_rm_and_ip(flag, scons_options)
442     build_android_armeabi_with_rm_and_bt(flag, scons_options)
443     build_android_armeabi_with_rm_and_ble(flag, scons_options)
444
445
446 def build_android_armeabi_with_rm_and_ip(flag, scons_options):
447     print ("*********** Build for android armeabi with Routing Manager *************")
448     build_options = {
449         'TARGET_OS': 'android',
450         'TARGET_ARCH': 'armeabi',
451         'ROUTING': 'GW',
452         'RELEASE': flag,
453         'TARGET_TRANSPORT': 'IP',
454     }
455     call_scons(build_options, scons_options)
456
457
458 def build_android_armeabi_with_rm_and_bt(flag, scons_options):
459     print ("*********** Build for android armeabi with Routing Manager and Bluetooth *************")
460     build_options = {
461         'TARGET_OS': 'android',
462         'TARGET_ARCH': 'armeabi',
463         'ROUTING': 'GW',
464         'RELEASE': flag,
465         'TARGET_TRANSPORT': 'BT',
466     }
467     call_scons(build_options, scons_options)
468
469
470 def build_android_armeabi_with_rm_and_ble(flag, scons_options):
471     print ("*********** Build for android armeabi with Routing Manager and Bluetooth Low Energy *************")
472     build_options = {
473         'TARGET_OS': 'android',
474         'TARGET_ARCH': 'armeabi',
475         'ROUTING': 'GW',
476         'RELEASE': flag,
477         'TARGET_TRANSPORT': 'BLE',
478     }
479     call_scons(build_options, scons_options)
480
481
482 def build_tizen(flag, scons_options):
483     print ("*********** Build for Tizen with options *************")
484     cmd_line = os.getcwd() + "/gbsbuild.sh" + " " + scons_options
485     if not EXEC_MODE:
486         print ("Would run : " + cmd_line)
487     else:
488         print ("Running : " + cmd_line)
489         exit_code = subprocess.Popen([cmd_line], shell=True).wait()
490         if exit_code != 0:
491             sys.exit(exit_code)
492
493
494 def build_tizen_extra(flag, scons_options):
495     print ("*********** Build for Tizen octbstack lib and sample *************")
496     # make sure the following file as been updated for these builds:
497     # resource/csdk/stack/samples/tizen/build/gbsbuild.sh
498     build_extra_options = "-f resource/csdk/stack/samples/tizen/build/SConscript " + scons_options
499     build_options = {
500         'TARGET_OS': 'tizen',
501         'TARGET_TRANSPORT': 'IP',
502         'LOGGING': 'true',
503         'RELEASE': flag,
504     }
505     call_scons(build_options, build_extra_options)
506
507     print ("*********** Build for Tizen octbstack lib and sample with Routing Manager*************")
508     build_options['ROUTING'] = 'GW'
509     call_scons(build_options, build_extra_options)
510
511     print ("*********** Build for Tizen Easy-Setup sample *************")
512     # make sure the following file has been updated for these builds:
513     # service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/gbsbuild.sh
514     build_options['ROUTING'] = 'EP'
515     build_options['ES_TARGET_ENROLLEE'] = 'tizen'
516     build_extra_options = "-f service/easy-setup/sampleapp/enrollee/tizen-sdb/EnrolleeSample/build/tizen/SConscript " + scons_options
517     call_scons(build_options, build_extra_options)
518
519     print ("*********** Build for Tizen Easy-Setup sample with multiple owner *************")
520     build_options['MULTIPLE_OWNER'] = 1
521     call_scons(build_options, build_extra_options)
522
523
524 def build_tizen_secured(flag, scons_options):
525     build_tizen(flag, scons_options + " SECURED=1")
526
527
528 def build_tizen_unsecured(flag, scons_options):
529     build_tizen(flag, scons_options + " SECURED=0")
530
531
532 def build_tizen_extra_secured(flag, scons_options):
533     build_tizen_extra(flag, scons_options + " SECURED=1")
534
535
536 def build_tizen__extraunsecured(flag, scons_options):
537     build_tizen_extra(flag, scons_options + " SECURED=0")
538
539
540 # Mac OS and iOS
541 def build_darwin(flag, scons_options):
542     print ("*********** Build for OSX *************")
543     build_options = {
544         'TARGET_OS': 'darwin',
545         'SYS_VERSION': '10.9',
546         'RELEASE': flag,
547     }
548     call_scons(build_options, scons_options)
549
550     print ("*********** Build for IOS i386 *************")
551     build_options = {
552         'TARGET_OS': 'ios',
553         'TARGET_ARCH': 'i386',
554         'SYS_VERSION': '7.0',
555         'RELEASE': flag,
556     }
557     call_scons(build_options, scons_options)
558
559     print ("*********** Build for IOS x86_64 *************")
560     build_options['TARGET_ARCH'] = 'x86_64'
561     call_scons(build_options, scons_options)
562
563     print ("*********** Build for IOS armv7 *************")
564     build_options['TARGET_ARCH'] = 'armv7'
565     call_scons(build_options, scons_options)
566
567     print ("*********** Build for IOS armv7s *************")
568     build_options['TARGET_ARCH'] = 'armv7s'
569     call_scons(build_options, scons_options)
570
571     print ("*********** Build for IOS arm64 *************")
572     build_options['TARGET_ARCH'] = 'arm64'
573     call_scons(build_options, scons_options)
574
575
576 # Windows
577 def build_windows(flag, scons_options):
578     print ("*********** Build for Windows *************")
579     os.environ["SCONSFLAGS"] = ""
580     build_options = {
581         'TARGET_OS': 'windows',
582         'TARGET_ARCH': 'amd64',
583         'RELEASE': flag,
584         'TARGET_TRANSPORT': 'IP',
585         'WITH_TCP': 0,
586         'BUILD_SAMPLE': 'ON',
587         'LOGGING': 'off',
588         'TEST': 1,
589         'RD_MODE': 'all',
590     }
591     call_scons(build_options, scons_options)
592
593
594 # Windows msys
595 def build_msys(flag, scons_options):
596     print ("*********** Build for msys_nt *************")
597     os.environ["SCONSFLAGS"] = ""
598     build_options = {
599         'TARGET_OS': 'msys_nt',
600         'TARGET_ARCH': 'x86_64',
601         'RELEASE': flag,
602         'TARGET_TRANSPORT': 'IP',
603         'WITH_TCP': 0,
604         'BUILD_SAMPLE': 'ON',
605         'LOGGING': 'off',
606         'TEST': 1,
607         'RD_MODE': 'all',
608     }
609     call_scons(build_options, scons_options)
610
611
612 def build_simulator(flag, scons_options):
613     print ("*********** Build for simulator plugin *************")
614     build_options = {
615         'SIMULATOR': 1,
616         'RELEASE': flag,
617         'SECURED': 0,
618         'TARGET_TRANSPORT': 'IP',
619     }
620     call_scons(build_options, scons_options)
621
622
623 def do_unit_tests(secured=True, memcheck=False):
624     """ build full stack and run unit tests in selected mode.
625
626     All the unit test builders have to run in test (non-release) mode.
627     This option is used by the CI system, which is a virtual machine -
628     thus it should be built with only the IP transport to avoid timeouts
629     setting up infrastructure that is not present (i.e. BT and NFC).
630
631     Args:
632         secured (bool): build in secured mode.
633         memcheck (bool): run tests under control of memory checker.
634     """
635
636     build_options = {
637         'TEST': 1,
638         'RELEASE': 'false',
639         'TARGET_TRANSPORT': 'IP',
640         'SECURED': secured,
641         'VALGRIND_CHECKS': memcheck,
642     }
643     print ("*********** Unit test Start *************")
644     call_scons(build_options, "-c")  # clean first
645     call_scons(build_options, "")
646     print ("*********** Unit test Stop *************")
647
648
649 def unit_tests_secured():
650     do_unit_tests(secured=1)
651
652
653 def unit_tests_unsecured():
654     do_unit_tests(secured=0)
655
656
657 def unit_tests_memcheck_secured():
658     do_unit_tests(secured=1, memcheck=True)
659
660
661 def unit_tests_memcheck_unsecured():
662     do_unit_tests(secured=0, memcheck=True)
663
664
665 def unit_tests():
666     unit_tests_secured()
667     unit_tests_unsecured()
668
669
670 # Main module starts here
671 if os.getenv("SCONSFLAGS", "") == "":
672     os.environ["SCONSFLAGS"] = "-Q -j " + str(multiprocessing.cpu_count())
673
674 arg_num = len(sys.argv)
675 script_name = sys.argv[0]
676
677 # May be overridden in user's shell
678 VERBOSE = os.getenv("VERBOSE", "1")
679 EXEC_MODE = os.getenv("EXEC_MODE", True)
680 if EXEC_MODE in ['false', 'False', '0']:
681     EXEC_MODE = False
682
683 if arg_num == 1:
684     build_all("true", "")
685     build_all("false", "")
686     unit_tests()
687
688 elif arg_num == 2:
689     if str(sys.argv[1]) == '-c':
690         build_all("true", "-c")
691         build_all("false", "-c")
692
693     elif str(sys.argv[1]) == "all":
694         build_all("true", "")
695         build_all("false", "")
696         unit_tests()
697
698     elif str(sys.argv[1]) == "linux":
699         build_linux("true", "")
700         build_linux("false", "")
701
702     elif str(sys.argv[1]) == "linux_unsecured":
703         build_linux_unsecured("true", "")
704         build_linux_unsecured("false", "")
705         build_linux_unsecured_with_rm("true", "")
706         build_linux_unsecured_with_rm("false", "")
707
708     elif str(sys.argv[1]) == "linux_secured":
709         build_linux_secured("true", "")
710         build_linux_secured("false", "")
711
712     elif str(sys.argv[1]) == "linux_full":
713         build_linux_full("true", "")
714         build_linux_full("false", "")
715
716     elif str(sys.argv[1]) == "linux_unsecured_with_rd":
717         build_linux_unsecured_with_rd("true", "")
718         build_linux_unsecured_with_rd("false", "")
719
720     elif str(sys.argv[1]) == "linux_secured_with_rd":
721         build_linux_secured_with_rd("true", "")
722         build_linux_secured_with_rd("false", "")
723
724     elif str(sys.argv[1]) == "linux_unsecured_with_mq":
725         build_linux_unsecured_with_mq("true", "")
726         build_linux_unsecured_with_mq("false", "")
727
728     elif str(sys.argv[1]) == "linux_unsecured_with_tcp":
729         build_linux_unsecured_with_tcp("true", "")
730         build_linux_unsecured_with_tcp("false", "")
731
732     elif str(sys.argv[1]) == "linux_secured_with_tcp":
733         build_linux_secured_with_tcp("false", "")
734         build_linux_secured_with_tcp("true", "")
735
736     elif str(sys.argv[1]) == "linux_unsecured_with_java":
737         build_linux_unsecured_with_java("false", "")
738         build_linux_unsecured_with_java("true", "")
739
740     elif str(sys.argv[1]) == "linux_secured_with_java":
741         build_linux_secured_with_java("false", "")
742         build_linux_secured_with_java("true", "")
743
744     elif str(sys.argv[1]) == "android":
745         build_android("true", "")
746         build_android("false", "")
747
748     elif str(sys.argv[1]) == "android_universal":
749         # only build the release version due to long amount of time to build.
750         build_android_universal("true", "")
751
752     elif str(sys.argv[1]) == "android_universal_unsecured":
753         # only build the release version due to long amount of time to build.
754         build_android_universal("true", "SECURED=0")
755
756     elif str(sys.argv[1]) == "android_unsecured":
757         build_android_unsecured("true", "")
758         build_android_unsecured("false", "")
759
760     elif str(sys.argv[1]) == "android_secured":
761         build_android_secured("true", "")
762         build_android_secured("false", "")
763
764     elif str(sys.argv[1]) == "android_x86":
765         build_android_x86("true", "")
766         build_android_x86("false", "")
767         build_android_x86_with_rm("true", "")
768         build_android_x86_with_rm("false", "")
769
770     elif str(sys.argv[1]) == "android_x86_with_ip":
771         build_android_x86_with_ip("true", "")
772         build_android_x86_with_ip("false", "")
773
774     elif str(sys.argv[1]) == "android_x86_with_bt":
775         build_android_x86_with_bt("true", "")
776         build_android_x86_with_bt("false", "")
777
778     elif str(sys.argv[1]) == "android_x86_with_ble":
779         build_android_x86_with_ble("true", "")
780         build_android_x86_with_ble("false", "")
781
782     elif str(sys.argv[1]) == "android_x86_with_rm_and_ip":
783         build_android_x86_with_rm_and_ip("true", "")
784         build_android_x86_with_rm_and_ip("false", "")
785
786     elif str(sys.argv[1]) == "android_x86_with_rm_and_bt":
787         build_android_x86_with_rm_and_bt("true", "")
788         build_android_x86_with_rm_and_bt("false", "")
789
790     elif str(sys.argv[1]) == "android_x86_with_rm_and_ble":
791         build_android_x86_with_rm_and_ble("true", "")
792         build_android_x86_with_rm_and_ble("false", "")
793
794     elif str(sys.argv[1]) == "android_armeabi":
795         build_android_armeabi("true", "")
796         build_android_armeabi("false", "")
797         build_android_armeabi_with_rm("true", "")
798         build_android_armeabi_with_rm("false", "")
799
800     elif str(sys.argv[1]) == "android_armeabi_with_ip":
801         build_android_armeabi_with_ip("true", "")
802         build_android_armeabi_with_ip("false", "")
803
804     elif str(sys.argv[1]) == "android_armeabi_with_bt":
805         build_android_armeabi_with_bt("true", "")
806         build_android_armeabi_with_bt("false", "")
807
808     elif str(sys.argv[1]) == "android_armeabi_with_ble":
809         build_android_armeabi_with_ble("true", "")
810         build_android_armeabi_with_ble("false", "")
811
812     elif str(sys.argv[1]) == "android_armeabi_with_rm_and_ip":
813         build_android_armeabi_with_rm_and_ip("true", "")
814         build_android_armeabi_with_rm_and_ip("false", "")
815
816     elif str(sys.argv[1]) == "android_armeabi_with_rm_and_bt":
817         build_android_armeabi_with_rm_and_bt("true", "")
818         build_android_armeabi_with_rm_and_bt("false", "")
819
820     elif str(sys.argv[1]) == "android_armeabi_with_rm_and_ble":
821         build_android_armeabi_with_rm_and_ble("true", "")
822         build_android_armeabi_with_rm_and_ble("false", "")
823
824     elif str(sys.argv[1]) == "windows":
825         build_windows("true", "")
826         build_windows("false", "")
827
828     elif str(sys.argv[1]) == "msys":
829         build_msys("true", "")
830         build_msys("false", "")
831
832     elif str(sys.argv[1]) == "tizen":
833         build_tizen("true", "")
834         build_tizen("false", "")
835
836     elif str(sys.argv[1]) == "tizen_extra":
837         build_tizen_extra("true", "")
838         build_tizen_extra("false", "")
839
840     elif str(sys.argv[1]) == "tizen_unsecured":
841         build_tizen_unsecured("true", "")
842         build_tizen_unsecured("false", "")
843
844     elif str(sys.argv[1]) == "tizen_secured":
845         build_tizen_secured("true", "")
846         build_tizen_secured("false", "")
847
848     elif str(sys.argv[1]) == "tizen_extra_unsecured":
849         build_tizen_extra_unsecured("true", "")
850         build_tizen_extra_unsecured("false", "")
851
852     elif str(sys.argv[1]) == "tizen_extra_secured":
853         build_tizen_extra_secured("true", "")
854         build_tizen_extra_secured("false", "")
855
856     elif str(sys.argv[1]) == "simulator":
857         build_simulator("true", "")
858         build_simulator("false", "")
859
860     elif str(sys.argv[1]) == "darwin":
861         build_darwin("true", "")
862         build_darwin("false", "")
863
864     elif str(sys.argv[1]) == "unit_tests_secured":
865         unit_tests_secured()
866
867     elif str(sys.argv[1]) == "unit_tests_unsecured":
868         unit_tests_unsecured()
869
870     elif str(sys.argv[1]) == "unit_tests_memcheck_secured":
871         unit_tests_memcheck_secured()
872
873     elif str(sys.argv[1]) == "unit_tests_memcheck_unsecured":
874         unit_tests_memcheck_unsecured()
875
876     elif str(sys.argv[1]) == "unit_tests":
877         unit_tests()
878
879     else:
880         helpmsg(script_name)
881 else:
882     helpmsg(script_name)
883
884 print ("===================== done =====================")