Skip to content

Commit be64c0f

Browse files
NightlyBuildsNightlyBuilds
authored andcommitted
Update P4V converted to python.
0 parents  commit be64c0f

File tree

4 files changed

+155
-0
lines changed

4 files changed

+155
-0
lines changed

Build_Game.bat

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
@echo off
2+
rem Build the Game
3+
rem *Original from TexMech - C28
4+
5+
rem Here it could be useful to echo the build log to a text file so you can see the error if the build fails.
6+
echo ----------------------------------------------------------------------
7+
echo Step 2: Packaging unreal project into archive
8+
echo ----------------------------------------------------------------------
9+
10+
set base_dir=C:\AutomatedBuilds\C29\TGP2\
11+
set project_dir=%base_dir%Project_Files\HaberDashers\
12+
set uproject_file="%project_dir%TGP2Racer.uproject"
13+
set builds_dir=%base_dir%Build_Dir\
14+
set build_maps="/Game/Maps/Main/Track2/PLVL_Track_2_Main"
15+
16+
call "C:\Program Files\Epic Games\UE_4.23\Engine\Build\BatchFiles\RunUAT.bat" BuildCookRun -project=%uproject_file% -noP4 -nocompile -nocompileeditor -installed -cook -stage -archive -archivedirectory=%builds_dir% -package -clientconfig=Development -ue4exe="C:\Program Files\Epic Games\UE_4.23\Engine\Binaries\Win64\UE4Editor-Cmd.exe" -pak -prereqs -nodebuginfo -targetplatform=Win64 -build -CrashReporter -utf8output
17+
REM call "C:\Program Files\Epic Games\UE_4.23\Engine\Build\BatchFiles\RunUAT.bat" BuildCookRun -project=%uproject_file% -noP4 -clientconfig=Development -serverconfig=Development -ue4exe=UE4Editor-Cmd.exe -utf8output -installed -platform=Win64 -build -cook -map=%build_maps% -unversionedcookedcontent -pak -SkipCookingEditorContent -compressed -prereqs -stage -package -stagingdirectory=%builds_dir% -archive -archivedirectory=%builds_dir%
18+
REM call "C:\Program Files\Epic Games\UE_4.23\Engine\Build\BatchFiles\RunUAT.bat" BuildCookRun -project=%uproject_file% -noP4 -clientconfig=Shipping -serverconfig=Shipping -nocompile -nocompileeditor -installed -ue4exe=UE4Editor-Cmd.exe -utf8output -platform=Win64 -build -cook -map=%build_maps% -unversionedcookedcontent -encryptinifiles -pak -createreleaseversion= -SkipCookingEditorContent -compressed -prereqs -stage -package -stagingdirectory=%builds_dir% -archive -archivedirectory=%builds_dir%
19+
rem call "C:\Program Files\Epic Games\UE_4.22\Engine\Build\BatchFiles\RunUAT.bat" BuildCookRun -project=%uproject_file% -noP4 -platform=Win64 -clientconfig=Shipping -serverconfig=Shipping -cook -maps=%build_maps% -build -stage -pak -archive -archivedirectory=%builds_dir%
20+
echo:
21+
echo:
22+
23+
pause
24+
25+
rem Here I do a check to ensure the build was successful
26+
rem With these programs, they return 0 on success, so if non-zero return code, just go to fail case below and DON'T make an installer
27+
rem Otherwise it will create an installer with the last working build.
28+
IF %ERRORLEVEL% NEQ 0 (
29+
echo ----------BUILD FAILED - HALTING BATCH PROCESS----------
30+
echo PUSHING A TXT FILE TO DELETED NIGHTLY TO SIGNAL BAD BUILD
31+
net use F: "%network_dir%" gKv52w!* /USER:smu\dummy /PERSISTENT:NO
32+
echo. 2>%network_dir%/BUILD_BROKEN.txt
33+
net use F: /d
34+
echo. 2>%builds_dir%/BUILD_BROKEN.txt
35+
)
36+
37+
pause
38+
39+
rem Adding the steam file to the made build and writing our steam app ID
40+
rem SteamAppID > PathToCreateTextFileAt
41+
rem echo ----------------------------------------------------------------------
42+
rem echo Step 2.5: Adding steam file to build
43+
rem echo ----------------------------------------------------------------------
44+
rem echo 934840 > C:\AutomatedBuilds\C27\Capstone\ThinkArcade\Build_Dir\WindowsNoEditor\FrostRunner\Binaries\Win64\steam_appid.txt

Launch.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@echo off
2+
3+
python Update_From_P4.py

Update_From_P4.bat

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@echo off
2+
rem Update the local perforce directory from the depot
3+
rem *Original from TexMech - C28
4+
5+
echo ----------------------------------------------------------------------
6+
echo Step 1: Getting latest changes from Perforce
7+
echo ----------------------------------------------------------------------\
8+
9+
set sertver=129.119.63.244:1666
10+
set user=daily_builds
11+
set password=gKv52w!*
12+
set workspace=NightlyBuild_HaberDashers
13+
14+
p4 -p %sertver% -u %user% -P %password% -c %workspace% sync -f
15+
echo:
16+
echo:

Update_From_P4.py

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
from P4 import P4
2+
3+
import time
4+
import threading
5+
6+
# Threaded P4V Sync function
7+
def p4_sync():
8+
global synced_files
9+
synced_files = p4.run( 'sync', '-f' )
10+
return synced_files
11+
12+
# Threaded P$v Sync callback
13+
def p4_sync_callback( synced_files_from_p4 ):
14+
global files_synced
15+
synced_files = synced_files_from_p4
16+
files_synced = True
17+
18+
#
19+
threaded_callback_lock = threading.Lock()
20+
class Threaded_Callback (threading.Thread):
21+
def __init__(self, thread_id, function, callback):
22+
threading.Thread.__init__(self)
23+
self.thread_id = thread_id
24+
self.function = function
25+
self.callback = callback
26+
27+
def run(self):
28+
returnValue = self.function()
29+
30+
threaded_callback_lock.acquire()
31+
self.callback( returnValue )
32+
threaded_callback_lock.release()
33+
34+
game_name = 'HaberDashers'
35+
synced_files = {}
36+
files_synced = False
37+
38+
if __name__ == '__main__':
39+
40+
print( '----------------------------------------------------------------------------------------------------' )
41+
print( '{} - Step 1: Update the local workspcae for P4'.format( game_name ) )
42+
print( '----------------------------------------------------------------------------------------------------' )
43+
44+
# Perforce Settings
45+
p4 = P4()
46+
p4.user = 'daily_builds'
47+
p4.password = 'gKv52w!*'
48+
p4.client = 'NightlyBuild_HaberDashers'
49+
50+
# Connect to the perforce server
51+
success = p4.connect()
52+
print( success )
53+
54+
p4_thread = Threaded_Callback(1, p4_sync, p4_sync_callback)
55+
p4_thread.start()
56+
57+
start_time = time.time()
58+
while( not files_synced ):
59+
print( "Time Elapsed: {:.2f}".format( time.time() - start_time ), end='\r')
60+
61+
print( 'Completed Perfoce Sync in {:.2f} seconds'.format( time.time() - start_time ) )
62+
63+
files_updated = 0
64+
files_deleted = 0
65+
for file in synced_files:
66+
if file['action'] == 'refreshed':
67+
continue
68+
69+
if file['action'] == 'deleted':
70+
files_deleted += 1
71+
continue
72+
73+
files_updated += 1
74+
update_message = str(files_updated) + ": "
75+
76+
relative_file_name = file['clientFile']
77+
name_loc = relative_file_name.find( game_name )
78+
relative_file_name = relative_file_name[ name_loc + len(game_name):]
79+
80+
update_message += relative_file_name + " ( "
81+
update_message += file['rev'] + " ) - "
82+
update_message += file['action']
83+
84+
print(update_message)
85+
86+
if files_deleted > 0:
87+
print( '{} files marked for deleted in total'.format( files_deleted ) )
88+
if files_updated == 0:
89+
print( 'All files are current' )
90+
91+
print( '{} - Step 1: Complete'.format( game_name ) )
92+
input( 'Press Enter to continue...')

0 commit comments

Comments
 (0)