2016-01-01 23:14:46 +01:00
|
|
|
# coding: latin-1
|
|
|
|
import subprocess
|
|
|
|
import os
|
|
|
|
import glob
|
|
|
|
from colorama import *
|
|
|
|
|
|
|
|
init()
|
|
|
|
|
|
|
|
|
|
|
|
#################################################################################
|
|
|
|
def buildProject(project):
|
|
|
|
print(Fore.YELLOW + "Building " + project)
|
|
|
|
p = project.replace('.dproj', '.cfg')
|
|
|
|
if os.path.isfile(p):
|
|
|
|
if os.path.isfile(p + '.unused'):
|
|
|
|
os.remove(p + '.unused')
|
|
|
|
os.rename(p, p + '.unused')
|
|
|
|
# print os.system("msbuild /t:Build /p:Config=Debug \"" + project + "\"")
|
|
|
|
return subprocess.call("rsvars.bat & msbuild /t:Build /p:Config=Debug /p:Platform=Win32 \"" + project + "\"", shell=True) == 0
|
|
|
|
|
|
|
|
|
|
|
|
def summaryTable(builds):
|
|
|
|
print(ansi.clear_screen())
|
|
|
|
dmvc_copyright()
|
2016-09-20 16:27:17 +02:00
|
|
|
print(Fore.WHITE + "PROJECT NAME".ljust(80) + "STATUS".ljust(10))
|
|
|
|
print(Fore.YELLOW + "=" * 90)
|
2016-01-01 23:14:46 +01:00
|
|
|
good = bad = 0
|
|
|
|
for item in builds:
|
|
|
|
if item['status'] == 'ok':
|
|
|
|
#WConio.textcolor(WConio.LIGHTGREEN)
|
|
|
|
good += 1
|
|
|
|
else:
|
|
|
|
#WConio.textcolor(WConio.RED)
|
|
|
|
bad += 1
|
2016-09-20 16:27:17 +02:00
|
|
|
print(Fore.BLUE + item['project'].ljust(80) + (Fore.WHITE if item['status'] == 'ok' else Fore.RED) + item['status'].ljust(4))
|
2016-01-01 23:14:46 +01:00
|
|
|
|
|
|
|
#WConio.textcolor(WConio.WHITE)
|
2016-09-20 16:27:17 +02:00
|
|
|
print(Fore.YELLOW + "=" * 90)
|
2016-01-01 23:14:46 +01:00
|
|
|
#WConio.textcolor(WConio.GREEN)
|
2016-09-20 16:27:17 +02:00
|
|
|
print(Fore.WHITE + "GOOD :".rjust(80) + str(good).rjust(10, '.'))
|
2016-01-01 23:14:46 +01:00
|
|
|
#WConio.textcolor(WConio.RED)
|
2016-09-20 16:27:17 +02:00
|
|
|
print(Fore.RED + "BAD :".rjust(80) + str(bad).rjust(10, '.'))
|
2016-01-01 23:14:46 +01:00
|
|
|
|
|
|
|
|
|
|
|
#################################################################################
|
|
|
|
|
|
|
|
def main(projects):
|
|
|
|
dmvc_copyright()
|
|
|
|
builds = []
|
|
|
|
for project in projects:
|
|
|
|
filename = '\\'.join(project.split('\\')[-3:])
|
|
|
|
if filename.find('2007') > 0: #do not build Delphi 2007 examples not Lazarus examples
|
|
|
|
continue
|
|
|
|
list = {'project': filename}
|
|
|
|
if buildProject(project):
|
|
|
|
list["status"] = "ok"
|
|
|
|
else:
|
|
|
|
list["status"] = "ko"
|
|
|
|
builds.append(list)
|
|
|
|
summaryTable(builds)
|
|
|
|
|
|
|
|
# Store current attribute settings
|
|
|
|
#old_setting = WConio.gettextinfo()[4] & 0x00FF
|
|
|
|
|
|
|
|
def dmvc_copyright():
|
2016-09-20 16:27:17 +02:00
|
|
|
print(Style.BRIGHT + Fore.WHITE + "------------------------------------------------------------------------------------------")
|
2016-01-01 23:14:46 +01:00
|
|
|
print(Fore.RED + " ** Delphi STOMP Client Building System **")
|
|
|
|
print(Fore.WHITE + " Delphi STOMP Client is CopyRight (2010-2016) of Daniele Teti d.teti@bittime.it")
|
2016-09-20 16:27:17 +02:00
|
|
|
print(Fore.RESET + "------------------------------------------------------------------------------------------\n")
|
2016-01-01 23:14:46 +01:00
|
|
|
|
|
|
|
## MAIN ##
|
2016-09-20 16:27:17 +02:00
|
|
|
projects = glob.glob("examples\**\**\*.dproj")
|
|
|
|
projects += glob.glob("examples\**\*.dproj")
|
|
|
|
projects += glob.glob("tutorial\**\*.dproj")
|
|
|
|
|
2016-01-01 23:14:46 +01:00
|
|
|
main(projects)
|
|
|
|
print(Style.RESET_ALL)
|