@@ -130,7 +130,9 @@ def getFileMd5(file_name):
130130 print ("JAVA_HOME set to " + jdkPath )
131131
132132# 编译jar
133- os .system ('set JAVA_HOME=' + jdkPath + '&& mvn clean compile package' )
133+ if os .system ('set JAVA_HOME=' + jdkPath + '&& mvn clean compile package' ) != 0 :
134+ print ('maven compile failed' )
135+ exit ()
134136# 获取版本
135137configs = jproperties .Properties ()
136138with open (r'.\target\maven-archiver\pom.properties' , 'rb' ) as f :
@@ -140,18 +142,33 @@ def getFileMd5(file_name):
140142# 切换到build
141143os .chdir (buildDir )
142144
143- os .system (r'xcopy ..\target\File-Engine.jar . /Y' )
145+ if os .system (r'xcopy ..\target\File-Engine.jar . /Y' ) != 0 :
146+ print ('xcopy File-Engine.jar failed.' )
147+ exit ()
144148os .system (r'del /Q /F File-Engine.zip' )
145149
146150# 生成jre
151+ # binPath = os.path.join(jdkPath, 'bin')
152+ # jdepExe = os.path.join(binPath, 'jdeps.exe')
153+ # deps = subprocess.check_output([jdepExe, '--ignore-missing-deps', '--print-module-deps', r'..\target\File-Engine-' + fileEngineVersion.data + '.jar'])
154+ # depsStr = deps.decode().strip()
147155binPath = os .path .join (jdkPath , 'bin' )
148- jdepExe = os .path .join (binPath , 'jdeps.exe' )
149- deps = subprocess .check_output ([jdepExe , '--ignore-missing-deps' , '--print-module-deps' , r'..\target\File-Engine-' + fileEngineVersion .data + '.jar' ])
150- depsStr = deps .decode ().strip ()
156+ javaExe = os .path .join (binPath , 'java.exe' )
157+ modules = subprocess .check_output ([javaExe , '--list-modules' ])
158+ modulesStr = modules .decode ().strip ()
159+ tmpModuleList = modulesStr .splitlines ()
160+ moduleList = []
161+ for each in tmpModuleList :
162+ if not each .startswith ('jdk.' ) and each .startswith ('java.' ):
163+ moduleName = each .split ('@' )
164+ moduleList .append (moduleName [0 ])
165+ depsStr = ',' .join (moduleList )
151166shutil .rmtree ('jre' )
152167jlinkExe = os .path .join (binPath , 'jlink.exe' )
153168jlinkExe = jlinkExe [0 :1 ] + '\" ' + jlinkExe [1 :] + '\" '
154- os .system (jlinkExe + r' --no-header-files --no-man-pages --compress=2 --module-path jmods --add-modules ' + depsStr + ' --output jre' )
169+ if os .system (jlinkExe + r' --no-header-files --no-man-pages --compress=2 --module-path jmods --add-modules ' + depsStr + ' --output jre' ) != 0 :
170+ print ('Generate jre failed.' )
171+ exit ()
155172
156173# 精简jar
157174delFileInZip ()
@@ -181,7 +198,9 @@ def getFileMd5(file_name):
181198with zipfile .ZipFile ('File-Engine.zip' , mode = "a" ) as f :
182199 f .write ('File-Engine.jar' )
183200
184- os .system (r'xcopy File-Engine.zip "..\C++\launcherWrap\launcherWrap\" /Y' )
201+ if os .system (r'xcopy File-Engine.zip "..\C++\launcherWrap\launcherWrap\" /Y' ) != 0 :
202+ print ('xcopy File-Engine.zip to launcherWrap directory failed.' )
203+ exit ()
185204
186205# 编译启动器
187206vsPathList = vswhere .find (
0 commit comments