You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

131 lines
5.3 KiB

import os
from PyModules.BuildLogTail import PrintLogASAP
_BlackList = ["RawResources", "StreamingAssets"]
class PrepareParallelProj4Win64():
def __init__(self, originClientPath, tempAppClientPath,):
if (not os.path.isdir(originClientPath)) or os.path.isdir(tempAppClientPath):
PrintLogASAP("[PrepareParallelProj4Android] Error! 原工程目录 {} 不存在或临时工程目录 {} 已存在!".format(originClientPath, tempAppClientPath))
os._exit(-1)
self._originPath = originClientPath
self._destPath = tempAppClientPath
self._cmdFilelink = 'cmd /c mklink'
self._cmdDirlink = '{} /d'.format(self._cmdFilelink)
def MakeMKLink(self, cmdLink, relativePath):
dest = "{}/{}".format(self._destPath, relativePath)
src = "{}/{}".format(self._originPath, relativePath)
destDir = os.path.dirname(dest)
if (not os.path.isdir(destDir)):
os.makedirs(destDir)
srcDir = os.path.dirname(src)
if (not os.path.isdir(srcDir)):
os.makedirs(srcDir)
os.system('{} "{}" "{}"'.format(cmdLink, dest, src))
PrintLogASAP("{} - > {}".format(src, dest))
def Run(self, isWin64=True):
self._subDir = "Assets"
self.MakeMKLink(self._cmdDirlink, "ProjectSettings")
self.MakeMKLink(self._cmdDirlink, "Packages")
self.MakeMKLink(self._cmdDirlink, "Assets")
# for root, dirs, files in os.walk("{}/{}".format(self._originPath, self._subDir)):
# # 去除黑名单中的文件夹
# dirs[:] = [d for d in dirs if d not in _BlackList]
# # 遍历文件夹
# for dirname in dirs:
# self.MakeMKLink(self._cmdDirlink, "{}/{}".format(self._subDir, dirname))
#
# break
# print(os.path.join(root, dirname))
#
# self.MakeMKLink(self._cmdDirlink, _SettingsDir)
# self.MakeMKLink(self._cmdDirlink, _PackagesDir)
# self.MakeMKLink(self._cmdDirlink, _PackConfigDir)
#
# # assets 目录考虑绕开资源目录建立链接
# self.MakeMKLink(self._cmdDirlink, _EditorDir)
# self.MakeMKLink(self._cmdDirlink, _EditorDataDir)
# self.MakeMKLink(self._cmdDirlink, _EngineDir)
# self.MakeMKLink(self._cmdDirlink, _FrameworkDir)
# self.MakeMKLink(self._cmdDirlink, _PluginsDir)
# self.MakeMKLink(self._cmdDirlink, _ScenesDir)
# self.MakeMKLink(self._cmdDirlink, _TMPDir)
# self.MakeMKLink(self._cmdDirlink, _ProductDemoScriptsDir)
# self.MakeMKLink(self._cmdDirlink, _URPAssetsDir)
# self.MakeMKLink(self._cmdDirlink, _UWADir)
# self.MakeMKLink(self._cmdDirlink, 'IFixToolKit')
# 下为 Win64 特定
if isWin64:
self.MakeMKLink(self._cmdDirlink, '{}/{}'.format("_BuildDir", 'build-win64-output'))
PrintLogASAP("[PrepareParallelProj4Win64] 所有路径和链接已建立完成。")
class PrepareParallelProj4Android(PrepareParallelProj4Win64):
def __init__(self, originClientPath, tempAppClientPath, keystoreRelPath):
PrepareParallelProj4Win64.__init__(self, originClientPath, tempAppClientPath)
self._keystoreRelPath = keystoreRelPath
def Run(self):
PrepareParallelProj4Win64.Run(self, False)
# 下为安卓特定
PrepareParallelProj4Win64.MakeMKLink(self, self._cmdFilelink, self._keystoreRelPath)
# PrepareParallelProj4Win64.MakeMKLink(self, self._cmdDirlink, '{}/{}'.format("_BuildDir", 'build-android-output'))
PrintLogASAP("[PrepareParallelProj4Android] 所有路径和链接已建立完成。")
class PrepareParallelProj4IOS():
def __init__(self, originClientPath, tempAppClientPath):
if (not os.path.isdir(originClientPath)) or os.path.isdir(tempAppClientPath):
PrintLogASAP("[PrepareParallelProj4IOS] Error! 原工程目录 {} 不存在或临时工程目录 {} 已存在!".format(originClientPath, tempAppClientPath))
os._exit(-1)
self._originPath = originClientPath
self._destPath = tempAppClientPath
def MakeLink(self, relativePath):
dest = "{}/{}".format(self._destPath, relativePath)
src = "{}/{}".format(self._originPath, relativePath)
destDir = os.path.dirname(dest)
if (not os.path.isdir(destDir)):
os.makedirs(destDir)
srcDir = os.path.dirname(src)
if (not os.path.isdir(srcDir)):
os.makedirs(srcDir)
os.system('ln -s "{}" "{}"'.format(src, dest))
def Run(self):
self.MakeLink("ProjectSettings")
self.MakeLink("Packages")
self.MakeLink("Assets")
# self.MakeLink(_PackConfigDir)
#
# # assets 目录考虑绕开资源目录建立链接
# self.MakeLink(_EditorDir)
# self.MakeLink(_EditorDataDir)
# self.MakeLink(_EngineDir)
# self.MakeLink(_FrameworkDir)
# self.MakeLink(_PluginsDir)
# self.MakeLink(_ScenesDir)
# self.MakeLink(_TMPDir)
# self.MakeLink(_ProductDemoScriptsDir)
# self.MakeLink(_URPAssetsDir)
# self.MakeLink(_UWADir)
#
# # 下为 iOS 特定
# self.MakeLink('{}/{}'.format(_BuildDir, 'build-ios-output'))
#
PrintLogASAP("[PrepareParallelProj4IOS] 所有路径和链接已建立完成。")