|
|
|
@ -51,7 +51,7 @@ public class SyncProcessorExecutor {
|
|
|
|
|
* 获取执行器实例 |
|
|
|
|
*/ |
|
|
|
|
public SyncProcessor getExecutor() { |
|
|
|
|
return ExtraDesignClassManager.getInstance().getSingle(SyncProcessor.XML_TAG, new AbstractSyncProcessor()); |
|
|
|
|
return ExtraDesignClassManager.getInstance().getSingle(SyncProcessor.XML_TAG, new AbstractSyncProcessor(){}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -60,31 +60,34 @@ public class SyncProcessorExecutor {
|
|
|
|
|
*/ |
|
|
|
|
public boolean executeJarSync(UpdateCallBack callBack, String fullBuildNo) { |
|
|
|
|
SyncProcessor processor = getExecutor(); |
|
|
|
|
if (processor.supportedSyncType().contains(SyncProcessor.SyncType.JAR_SYNC)) { |
|
|
|
|
String dir = StableUtils.pathJoin(ProjectLibrary.getInstance().getLibHome(), ProjectConstants.ASSIST_NAME, UpdateConstants.ENV_LIB); |
|
|
|
|
try { |
|
|
|
|
// 备份jar
|
|
|
|
|
Recover recoverForSync = RecoverForSync.getInstance(); |
|
|
|
|
if (fullBuildNo != null) { |
|
|
|
|
if (recoverForSync.backup()) { |
|
|
|
|
if (processor.executeJarSync(callBack, fullBuildNo, processor.DESIGNER_JARS_PATH, processor.COMMON_JARS_PATH)) { |
|
|
|
|
CommandGroup commands = getCommandGroup(processor.DESIGNER_JARS_PATH, processor.COMMON_JARS_PATH); |
|
|
|
|
return commands.execute(callBack); |
|
|
|
|
// 提前检查不支持的同步类型
|
|
|
|
|
if (!processor.supportedSyncType().contains(SyncProcessor.SyncType.JAR_SYNC)) { |
|
|
|
|
return SyncExecutor.getInstance().execute(callBack, fullBuildNo); |
|
|
|
|
} |
|
|
|
|
// 同步失败,恢复
|
|
|
|
|
recoverForSync.recover(); |
|
|
|
|
Recover recoverForSync = RecoverForSync.getInstance(); |
|
|
|
|
// 备份失败直接返回
|
|
|
|
|
if (!recoverForSync.backup()) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
String dir = StableUtils.pathJoin(ProjectLibrary.getInstance().getLibHome(), |
|
|
|
|
ProjectConstants.ASSIST_NAME, UpdateConstants.ENV_LIB); |
|
|
|
|
try { |
|
|
|
|
if (fullBuildNo == null) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
if (!processor.executeJarSync(callBack, fullBuildNo, processor.DESIGNER_JARS_PATH, processor.COMMON_JARS_PATH)) { |
|
|
|
|
recoverForSync.recover(); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
CommandGroup commands = getCommandGroup(processor.DESIGNER_JARS_PATH, processor.COMMON_JARS_PATH); |
|
|
|
|
return commands.execute(callBack); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
recoverForSync.recover(); |
|
|
|
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
|
|
|
return false; |
|
|
|
|
} finally { |
|
|
|
|
CommonIOUtils.deleteFile(new File(dir)); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
return SyncExecutor.getInstance().execute(callBack, fullBuildNo); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -134,6 +137,7 @@ public class SyncProcessorExecutor {
|
|
|
|
|
differentPlugin = new JSONObject(); |
|
|
|
|
differentPlugin.put(ID, pluginMarker.getPluginID()); |
|
|
|
|
differentPlugin.put(VERSION, pluginMarker.getVersion()); |
|
|
|
|
differentPluginsJsonArray.add(differentPlugin); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return differentPluginsJsonArray; |
|
|
|
|