source: 2011/24/build_games.py @ 2138

Revision 2138, 1.2 KB checked in by tekrjant, 8 years ago (diff)

More error checking.

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 check_requirements():
12        if not exists("lib\\x86\\Jypeli4.dll"):
13                raise Exception("lib\\x86\\Jypeli4.dll expected")
14
15
16def build_games():
17        for root, dirs, files in os.walk('.'):
18                if '.svn' in dirs:
19                        dirs.remove('.svn')
20                projects = glob(join(root, '*.csproj'))
21                if projects:
22                        build(projects[0])
23
24
25def build(project_file_path):
26        build_cmd = 'msbuild /nologo /verbosity:quiet /p:Configuration=Release /p:"ReferencePath={0}" /t:Build "{1}"'.format(lib_dir_x86, project_file_path)
27        return_code = call(build_cmd, shell=True)
28        if return_code == 0:
29                print basename(project_file_path)
30        else:
31                projects_that_did_not_build.append(project_file_path)
32
33
34def main():
35        try:
36                check_requirements()
37                build_games()
38        except KeyboardInterrupt:
39                print "BUILD CANCELLED"
40        except Exception as e:
41                print
42                print "NOT SUCCESSFUL:", e
43                return 1
44
45        print
46        print 'Projects that did not build ({0}):'.format(len(projects_that_did_not_build))
47        for p in projects_that_did_not_build:
48                print p
49
50
51if __name__ == '__main__':
52        sys.exit(main())
Note: See TracBrowser for help on using the repository browser.