feat: assign variable isDebug

This commit is contained in:
garvey-wong 2022-06-10 12:00:44 +08:00
parent 18521aaf82
commit ccdc33424e
3 changed files with 12 additions and 5 deletions

View File

@ -310,7 +310,10 @@ public class FileActions {
}
fileMap.remove(target.getAbsolutePath());
updateTime.remove(target.getAbsolutePath());
String doi = unzipIfYpk(target, dir);
boolean isDebug =
transformedParam.containsKey("isDebug")
&& Boolean.parseBoolean(transformedParam.get("isDebug"));
String doi = unzipIfYpk(target, dir, isDebug);
if (null != doi) {
retStr = retStr.replaceFirst("null", doi);
}
@ -334,7 +337,7 @@ public class FileActions {
return sb.toString();
}
private static String unzipIfYpk(File target, File dir) {
private static String unzipIfYpk(File target, File dir, boolean isDebug) {
// [FileAction] unzipIfYpk,
// target:/data/bdwaas/bdcontract/./BDWareProjectDir/private/045eeda3a001faad9d636ab1e973599ea87338a9576756eb10ceeca6083c1f76aac5cd201eab21c41342eb8aac40e9b283f0b6eae019644cdcc0a9f9aeb73de8fc/ContractUNknown.ypk targetDir:/data/bdwaas/bdcontract/./BDWareProjectDir/private/045eeda3a001faad9d636ab1e973599ea87338a9576756eb10ceeca6083c1f76aac5cd201eab21c41342eb8aac40e9b283f0b6eae019644cdcc0a9f9aeb73de8fc/ContractUNknown
LOGGER.info(
@ -364,7 +367,7 @@ public class FileActions {
+ targetDir.getAbsolutePath());
YJSPacker.unpack(target.getAbsolutePath(), targetDir.getAbsolutePath());
final File tempDir = targetDir;
ContractManager.threadPool.execute(() -> startIfManifestDetected(tempDir));
ContractManager.threadPool.execute(() -> startIfManifestDetected(tempDir, isDebug));
target.delete();
// 注册DOI并更新Manifest
@ -399,7 +402,7 @@ public class FileActions {
return null;
}
public static void startIfManifestDetected(File targetDir) {
public static void startIfManifestDetected(File targetDir, boolean isDebug) {
try {
String contractName = targetDir.getName();
String owner = targetDir.getParentFile().getName();
@ -416,6 +419,7 @@ public class FileActions {
targetDir.getParentFile().getAbsolutePath(), contractName);
c.setScript(ypkPath);
c.setOwner(owner);
c.setDebug(isDebug);
CMActions.manager.startContractAndRedirect(c, System.out); // createPS()
}
} catch (Exception e) {

View File

@ -241,6 +241,9 @@ public class MasterWSAction {
if (args.has("isPrivate")) {
request.put("isPrivate", args.get("isPrivate").getAsString());
}
if (args.has("isDebug")) {
contract.setDebug(args.get("isDebug").getAsBoolean());
}
request.put("pubKey", managerAction.getPubKey());
request.put("action", "startContractTrustfully");
request.put("requestID", requestID);

View File

@ -37,7 +37,7 @@ public class TemporyTestAction {
@Action
public void startContractForTest(JsonObject args, ResultCallback resultCallback) {
FileActions.startIfManifestDetected(
new File(args.get("path").getAsString()).getAbsoluteFile());
new File(args.get("path").getAsString()).getAbsoluteFile(), true);
resultCallback.onResult("done");
}