source: 2011/24/build_games.py @ 2137

Revision 2137, 1.0 KB checked in by tekrjant, 8 years ago (diff)

Koodi jaettu aliohjelmiin. Ctrl-c hoidetaan paremmin.

Line 
1import sys
2import os
3from os.path import *
4from shutil import *
5from glob import *
6from subprocess import *
7
8lib_dir_x86 = abspath('lib\\x86')
9projects_that_did_not_build = []
10
11def build_games():
12        for root, dirs, files in os.walk('.'):
13                if '.svn' in dirs:
14                        dirs.remove('.svn')
15                projects = glob(join(root, '*.csproj'))
16                if projects:
17                        build(projects[0])
18
19
20def build(project_file_path):
21        build_cmd = 'msbuild /nologo /verbosity:quiet /p:Configuration=Release /p:"ReferencePath={0}" /t:Build "{1}"'.format(lib_dir_x86, project_file_path)
22        return_code = call(build_cmd, shell=True)
23        if return_code == 0:
24                print basename(project_file_path)
25        else:
26                projects_that_did_not_build.append(project_file_path)
27
28
29def main():
30        try:
31                build_games()
32        except KeyboardInterrupt:
33                print "BUILD CANCELLED"
34
35        print ''
36        print 'Projects that did not build ({0}):'.format(len(projects_that_did_not_build))
37        for p in projects_that_did_not_build:
38                print p
39
40
41if __name__ == '__main__':
42        sys.exit(main())
Note: See TracBrowser for help on using the repository browser.