fp: Setup website deploy script
This commit is contained in:
		
							parent
							
								
									84314221b8
								
							
						
					
					
						commit
						d03d4b285d
					
				
							
								
								
									
										11
									
								
								deploy_website.bat
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								deploy_website.bat
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,11 @@ | ||||
| @echo off | ||||
| setlocal | ||||
| 
 | ||||
| set script_dir_backslash=%~dp0 | ||||
| set script_dir=%script_dir_backslash:~0,-1% | ||||
| set build_dir=%script_dir%\Build | ||||
| 
 | ||||
| scp -P 8110 %build_dir%\Terry_Cherry_Emscripten\Terry_Cherry.html doylet@doylet.dev:/selfhost/Terry_Cherry/index.html | ||||
| scp -P 8110 %build_dir%\Terry_Cherry_Emscripten\Terry_Cherry.data doylet@doylet.dev:/selfhost/Terry_Cherry/Terry_Cherry.data | ||||
| scp -P 8110 %build_dir%\Terry_Cherry_Emscripten\Terry_Cherry.js doylet@doylet.dev:/selfhost/Terry_Cherry/Terry_Cherry.js | ||||
| scp -P 8110 %build_dir%\Terry_Cherry_Emscripten\Terry_Cherry.wasm doylet@doylet.dev:/selfhost/Terry_Cherry/Terry_Cherry.wasm | ||||
| @ -88,7 +88,7 @@ int main(int argc, char const **argv) | ||||
|     bool dry_run    = false; | ||||
|     bool target_web = false; | ||||
|     for (Dqn_usize arg_index = 1; arg_index < argc; arg_index++) { | ||||
|         Dqn_String8 arg = Dqn_String8_InitCString8(argv[1]); | ||||
|         Dqn_String8 arg = Dqn_String8_InitCString8(argv[arg_index]); | ||||
|         if (arg == DQN_STRING8("--help")) { | ||||
|             PRINT_HELP; | ||||
|             return 0; | ||||
| @ -428,9 +428,10 @@ int main(int argc, char const **argv) | ||||
|                 Dqn_CPPBuildCompileFile{{}, Dqn_FsPath_ConvertF(scratch.arena, "%.*s/feely_pona_unity_nodll.cpp", DQN_STRING_FMT(code_dir)) }, | ||||
|             }); | ||||
| 
 | ||||
|             Dqn_String8 prefix          = DQN_STRING8("Terry_Cherry"); | ||||
|             build_context.compile_flags = Dqn_Slice_InitCArrayCopy(scratch.arena, { | ||||
|                 DQN_STRING8("cmd"), DQN_STRING8("/C"), DQN_STRING8("emcc.bat"), | ||||
|                 DQN_STRING8("-o"), DQN_STRING8("feely_pona.html"), | ||||
|                 DQN_STRING8("-o"), Dqn_String8_InitF(scratch.allocator, "%.*s.html", DQN_STRING_FMT(prefix)), | ||||
|                 // DQN_STRING8("-Os"), // Optimize for size
 | ||||
|                 DQN_STRING8("-Wall"), | ||||
|                 DQN_STRING8("--shell-file"), Dqn_FsPath_ConvertF(scratch.arena, "%.*s/External/raylib/shell.html", DQN_STRING_FMT(tely_dir)), | ||||
| @ -459,6 +460,31 @@ int main(int argc, char const **argv) | ||||
|             } else { | ||||
|                 Dqn_CPPBuild_ExecOrAbort(build_context, Dqn_CPPBuildMode_CacheBuild); | ||||
|             } | ||||
| 
 | ||||
|             // NOTE: Move the files to a directory
 | ||||
|             Dqn_String8 folder_path = Dqn_FsPath_ConvertF(scratch.arena, "%.*s/%.*s_Emscripten", DQN_STRING_FMT(build_dir), DQN_STRING_FMT(prefix)); | ||||
|             if (!Dqn_Fs_DirExists(folder_path)) { | ||||
|                 Dqn_String8 mkdir_cmd = Dqn_String8_InitF(scratch.allocator, "mkdir %.*s", DQN_STRING_FMT(folder_path)); | ||||
|                 Dqn_OS_ExecOrAbort(mkdir_cmd, {}); | ||||
|             } | ||||
| 
 | ||||
|             Dqn_String8 const generated_file_extension[] = { | ||||
|                 DQN_STRING8("data"), | ||||
|                 DQN_STRING8("html"), | ||||
|                 DQN_STRING8("js"), | ||||
|                 DQN_STRING8("wasm"), | ||||
|             }; | ||||
| 
 | ||||
|             for (Dqn_String8 file_ext : generated_file_extension) { | ||||
|                 Dqn_String8 src_path  = Dqn_FsPath_ConvertF(scratch.arena, "%.*s/%.*s.%.*s", DQN_STRING_FMT(build_dir), DQN_STRING_FMT(prefix), DQN_STRING_FMT(file_ext)); | ||||
|                 Dqn_String8 dest_path = Dqn_FsPath_ConvertF(scratch.arena, "%.*s/%.*s.%.*s", DQN_STRING_FMT(folder_path), DQN_STRING_FMT(prefix), DQN_STRING_FMT(file_ext)); | ||||
|                 Dqn_String8 cmd       = Dqn_String8_InitF(scratch.allocator, "cmd /C move /Y %.*s %.*s", DQN_STRING_FMT(src_path), DQN_STRING_FMT(dest_path)); | ||||
|                 if (dry_run) { | ||||
|                     Dqn_Print_StdLnF(Dqn_PrintStd_Out, "%.*s\n", DQN_STRING_FMT(cmd)); | ||||
|                 } else { | ||||
|                     Dqn_OS_ExecOrAbort(cmd, build_dir); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										
											BIN
										
									
								
								project.rdbg
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								project.rdbg
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user