|
| 1 | +import os |
| 2 | +import subprocess |
| 3 | +import sys |
| 4 | +import time |
| 5 | + |
| 6 | +UE_VERSIONS = ['4.15', '4.16', '4.17'] |
| 7 | +PYTHON_VERSIONS = ["C:/Program Files/Python36", "C:/Program Files/Python35", "C:/Python27"] |
| 8 | + |
| 9 | +def msbuild(project, python_version): |
| 10 | + base_environ = os.environ |
| 11 | + base_environ.update({'PYTHONHOME': python_version}) |
| 12 | + vs = '"C:/Program Files (x86)/MSBuild/14.0/Bin/MSBuild.exe"' |
| 13 | + process = subprocess.Popen('{0} {1} /t:Rebuild /p:Configuration="Development Editor" /p:Platform=Win64'.format(vs, project), env=base_environ) |
| 14 | + while process.poll() is None: |
| 15 | + time.sleep(0.5) |
| 16 | + if process.returncode != 0: |
| 17 | + sys.exit(process.returncode) |
| 18 | + |
| 19 | +def commandlet(version, project): |
| 20 | + ue_editor = os.path.join('D:/', 'UE_{0}'.format(version), 'Engine/Binaries/Win64/UE4Editor-Cmd.exe') |
| 21 | + process = subprocess.Popen('{0} D:/{1}/{2}.uproject -run=PyCommandlet D:/{3}/Plugins/UnrealEnginePython/tools/release_check.py'.format(ue_editor, project, project, project)) |
| 22 | + while process.poll() is None: |
| 23 | + time.sleep(0.5) |
| 24 | + # ignore return code, has too much different meanings for commandlets |
| 25 | + |
| 26 | +def git(project): |
| 27 | + process = subprocess.Popen('git checkout master', cwd='D:/{0}/Plugins/UnrealEnginePython'.format(project)) |
| 28 | + while process.poll() is None: |
| 29 | + time.sleep(0.5) |
| 30 | + if process.returncode != 0: |
| 31 | + sys.exit(process.returncode) |
| 32 | + process = subprocess.Popen('git pull', cwd='D:/{0}/Plugins/UnrealEnginePython'.format(project)) |
| 33 | + while process.poll() is None: |
| 34 | + time.sleep(0.5) |
| 35 | + if process.returncode != 0: |
| 36 | + sys.exit(process.returncode) |
| 37 | + |
| 38 | + |
| 39 | +main_start = time.time() |
| 40 | +for ue_version in UE_VERSIONS: |
| 41 | + project = 'PyTest{0}'.format(ue_version.replace('.', '')) |
| 42 | + sln = os.path.join('D:/', project, '{0}.sln'.format(project)) |
| 43 | + git(project) |
| 44 | + for python_version in PYTHON_VERSIONS: |
| 45 | + start = time.time() |
| 46 | + print('\n\n***** building {0} for {1} *****\n\n'.format(sln, python_version)) |
| 47 | + sys.stdout.flush() |
| 48 | + msbuild(sln, python_version) |
| 49 | + commandlet(ue_version, project) |
| 50 | + end = time.time() |
| 51 | + print('\n\n***** built {0} for {1} in {2} seconds *****\n\n'.format(project, python_version, end-start)) |
| 52 | + |
| 53 | +main_end = time.time() |
| 54 | +print('release ready after {0} seconds'.format(main_end-main_start)) |
0 commit comments