Skip to content

Commit 185f95a

Browse files
committed
增加注释
1 parent dd01cd3 commit 185f95a

15 files changed

+727
-150
lines changed

func.py

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,25 @@
77

88

99
def __console(_message, *_params):
10+
"""
11+
控制台输出
12+
Args:
13+
_message: 输出信息
14+
*_params: 输出参数
15+
"""
1016
print((_message % _params) if len(_params) > 0 else _message)
1117
sys.stdout.flush()
1218

1319

1420
def __unzip(_src_path, _dst_path=None):
21+
"""
22+
解压文件
23+
Args:
24+
_src_path: 源文件路径
25+
_dst_path: 目标文件路径
26+
Returns:
27+
解压后的文件路径
28+
"""
1529
if not _src_path.endswith(".apks") and not _src_path.endswith(".zip"):
1630
raise Exception("%s not an extractable file!" % _src_path)
1731
_dst_path = ".".join(_src_path.split(".")[0:-1]) if _dst_path is None else _dst_path
@@ -23,6 +37,14 @@ def __unzip(_src_path, _dst_path=None):
2337

2438

2539
def __zip(_src_path, _dst_path=None):
40+
"""
41+
压缩文件
42+
Args:
43+
_src_path: 源文件路径
44+
_dst_path: 目标文件路径
45+
Returns:
46+
压缩后的文件路径
47+
"""
2648
_dst_path = _dst_path if (_dst_path is not None and _dst_path.endswith(".zip")) else (_src_path + ".zip")
2749
if os.path.exists(_dst_path):
2850
os.remove(_dst_path)
@@ -35,6 +57,18 @@ def __zip(_src_path, _dst_path=None):
3557

3658

3759
def __copytree(src, dst, symlinks=False, ignore=None, copy_function=shutil.copy2, ignore_dangling_symlinks=False):
60+
"""
61+
复制文件夹
62+
Args:
63+
src: 源文件夹
64+
dst: 目标文件夹
65+
symlinks: 是否复制链接
66+
ignore: 忽略文件
67+
copy_function: 复制方法
68+
ignore_dangling_symlinks: 忽略链接
69+
Returns:
70+
目标文件夹
71+
"""
3872
names = os.listdir(src)
3973
if ignore is not None:
4074
ignored_names = ignore(src, names)
@@ -78,6 +112,15 @@ def __copytree(src, dst, symlinks=False, ignore=None, copy_function=shutil.copy2
78112

79113

80114
def __move_to(__src_path, __dst_path, __cover=False):
115+
"""
116+
移动文件
117+
Args:
118+
__src_path: 源文件路径
119+
__dst_path: 目标文件路径
120+
__cover: 是否覆盖
121+
Returns:
122+
目标文件路径
123+
"""
81124
__src_path = __src_path.replace("\\", "/")
82125
__dst_path = __dst_path.replace("\\", "/")
83126
if os.path.exists(__src_path):
@@ -104,6 +147,13 @@ def __move_to(__src_path, __dst_path, __cover=False):
104147

105148

106149
def __get_free_space_mb(folder):
150+
"""
151+
获取磁盘剩余空间
152+
Args:
153+
folder: 文件夹
154+
Returns:
155+
磁盘剩余空间
156+
"""
107157
if platform.system() == 'Windows':
108158
free_bytes = ctypes.c_ulonglong(0)
109159
ctypes.windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(folder), None, None, ctypes.pointer(free_bytes))
@@ -114,6 +164,13 @@ def __get_free_space_mb(folder):
114164

115165

116166
def __format_size(bytes):
167+
"""
168+
格式化文件大小
169+
Args:
170+
bytes: 文件大小
171+
Returns:
172+
格式化后的文件大小
173+
"""
117174
bytes = float(bytes)
118175
KB = bytes / 1024
119176

@@ -129,6 +186,13 @@ def __format_size(bytes):
129186

130187

131188
def __get_file_size(path):
189+
"""
190+
获取文件大小
191+
Args:
192+
path: 文件路径
193+
Returns:
194+
文件大小
195+
"""
132196
try:
133197
size = os.path.getsize(path)
134198
return __format_size(size)

params.py

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55

66

77
class JenkinsClass:
8+
"""
9+
Jenkins参数类
10+
Attributes:
11+
WORKSPACE: Jenkins工作目录
12+
JENKINS_HOME: Jenkins主目录
13+
JOB_NAME: Jenkins任务名称
14+
BUILD_NUMBER: Jenkins构建编号
15+
"""
816
WORKSPACE = ""
917
JENKINS_HOME = ""
1018
JOB_NAME = ""
@@ -22,6 +30,16 @@ def __str__(self):
2230

2331

2432
class SystemClass:
33+
"""
34+
系统参数类
35+
Attributes:
36+
UNITY_EXE: Unity.exe路径
37+
UNITY_PROJECT: Unity工程路径
38+
UNITY_USER_NAME: Unity用户名
39+
UNITY_USER_PASSWORD: Unity用户密码
40+
UNITY_USER_SERIAL: Unity用户序列号
41+
UNITY_VERSION: Unity版本号
42+
"""
2543
UNITY_EXE = ""
2644
UNITY_PROJECT = ""
2745
UNITY_USER_NAME = ""
@@ -49,6 +67,28 @@ def __str__(self):
4967

5068

5169
class PathClass:
70+
"""
71+
路径参数类
72+
Attributes:
73+
UNITY_EXE: Unity.exe路径
74+
PROJECT_PATH: Unity工程路径
75+
PATCH_PATH: 热更工程路径
76+
ANDROID_STUDIO_PATH: Android Studio工程路径
77+
ANDROID_APP_PATH: Android Studio App工程路径
78+
INSTALL_TIME_ASSET_PACK_PATH: Android Studio InstallTimeAssetPack工程路径
79+
GRADLE_PATH: Android Studio Gradle路径
80+
CLEAN_PATH: 清理路径
81+
UNITY_LOG_PATH: Unity日志路径
82+
SYMBOLS_ZIP_PATH: Symbols.zip路径
83+
LIB_IL2CPP_SO_PATH: libil2cpp.so路径
84+
UPLOAD_SYMBOLS_JAR_PATH: 上传Symbols.jar路径
85+
BUNDLE_TOOL_JAR_PATH: BundleTool.jar路径
86+
MAIN_ZIP_PATH: Main.zip路径
87+
KEYSTORE_PATH: KeyStore路径
88+
BUILD_GRADLE_PATH: Build.gradle路径
89+
ANDROID_LAUNCHER_PATH: Android Launcher路径
90+
ANDROID_UNITYLIBRARY_PATH: Android UnityLibrary路径
91+
"""
5292
UNITY_EXE = ""
5393
PROJECT_PATH = ""
5494
PATCH_PATH = ""
@@ -102,6 +142,21 @@ def __str__(self):
102142

103143

104144
class UnityClass:
145+
"""
146+
Unity参数类
147+
Attributes:
148+
enableGM: 是否开启GM
149+
enableGuide: 是否开启新手引导
150+
enableSDK: 是否开启SDK
151+
enableConsole: 是否开启Console
152+
enableLog: 是否开启Log
153+
enablePatching: 是否开启热更
154+
loginServer: 登录服务器
155+
enableQAServerCDN: 是否开启QA服务器CDN
156+
enableFPS: 是否开启FPS
157+
isAuthenticationServer: 是否是战斗校验服务器
158+
enableBuildResources: 是否开启资源打包
159+
"""
105160
enableGM = ""
106161
enableGuide = ""
107162
enableSDK = ""
@@ -135,6 +190,22 @@ def __str__(self):
135190

136191

137192
class BuildClass:
193+
"""
194+
构建参数类
195+
Attributes:
196+
channel: 渠道
197+
enableAndroidAppBundle: 是否开启AndroidAppBundle模式
198+
buildType: 构建类型
199+
buildTarget: 构建目标
200+
startBuildingDirectly: 是否直接开始构建
201+
enableUniversal: 是否开启Universal模式
202+
disableSvnUpdateCleanUnityProject: 是否跳过svn更新和清理Unity工程
203+
androidChannel: Android工程渠道
204+
androidVersion: Android工程版本号
205+
targetSdkVersion: Android工程targetSdkVersion
206+
enableOfficial: 是否开启官服
207+
enableBlend: 是否开启混服
208+
"""
138209
channel = ""
139210

140211
enableAndroidAppBundle = ""
@@ -177,6 +248,19 @@ def __str__(self):
177248

178249

179250
class PatchClass:
251+
"""
252+
热更参数类
253+
Attributes:
254+
empty_patch: 是否空热更
255+
clean_update_project: 是否清理更新工程
256+
channel: 渠道
257+
platform: 平台
258+
patch_version: 热更版本号
259+
start_svn_version: 开始svn版本号
260+
end_svn_version: 结束svn版本号
261+
version: 版本号
262+
no_safe_fast: 是否跳过安全检查
263+
"""
180264
empty_patch = ""
181265
clean_update_project = ""
182266
channel = ""
@@ -205,6 +289,19 @@ def __str__(self):
205289

206290

207291
class CDNClass:
292+
"""
293+
CDN参数类
294+
Attributes:
295+
version: 版本号
296+
channel: 渠道
297+
upload_type: 上传类型
298+
patch_type: 热更类型
299+
delete_other: 是否删除其他版本
300+
cdn_address: CDN地址
301+
account_information: 账号信息
302+
remote_path: 远程路径
303+
upload_channel_list: 上传渠道列表
304+
"""
208305
version = ""
209306
channel = ""
210307
upload_type = ""
@@ -237,6 +334,21 @@ def __str__(self):
237334

238335

239336
class VersionClass:
337+
"""
338+
版本号相关参数类
339+
Attributes:
340+
version: 版本号
341+
modify_type: 修改类型
342+
cdn_address: CDN地址
343+
account_information: 账号信息
344+
modify_path: 修改路径
345+
platform: 平台
346+
all_platform_modify_field: 所有平台修改字段
347+
all_platform_modify_value: 所有平台修改目标值
348+
platform_modify_info: 平台修改信息
349+
is_check: 是否是check文件
350+
check_value: check文件值
351+
"""
240352
version = ""
241353
modify_type = ""
242354
cdn_address = ""
@@ -276,6 +388,23 @@ def __str__(self):
276388

277389

278390
class XCodeClass:
391+
"""
392+
Xcode参数类
393+
Attributes:
394+
channel: 渠道
395+
buildType: 构建类型
396+
export_options_plist_name: 导出选项名称
397+
xcode_version_build: Xcode版本号
398+
CODE_SIGN_IDENTITY: 证书
399+
PROVISIONING_PROFILE: 描述文件
400+
PROVISIONING_PROFILE_SPECIFIER: 描述文件名称
401+
DEVELOPMENT_TEAM: 开发团队
402+
APP: APP名称
403+
enable_apple_sign: 是否开启苹果签名
404+
upload_symbols: 是否上传符号表
405+
bundle_identifier: 包名
406+
automatic: 是否自动化
407+
"""
279408
channel = ""
280409
buildType = ""
281410
export_options_plist_name = ""
@@ -320,6 +449,16 @@ def __str__(self):
320449

321450

322451
class COSClass:
452+
"""
453+
Cos参数类
454+
Attributes:
455+
version: 版本号
456+
secretId: secretId
457+
secretKey: secretKey
458+
bucket: 桶
459+
region: 地区
460+
remote_path: 远程路径
461+
"""
323462
version = ""
324463
secretId = ""
325464
secretKey = ""

test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# -*- coding: UTF-8 -*-
2+
import hashlib
3+
import os
4+
25
import util
36
import sys
47

0 commit comments

Comments
 (0)