mirror of
https://gitee.com/openharmony/napi_generator
synced 2024-11-23 08:20:01 +00:00
fix bug: 删除java代码中使用系统命令的方式代码
Signed-off-by: chen-zhongwei050 <chenzhongwei050@chinasoftinc.com>
This commit is contained in:
parent
32f10926c1
commit
c39bf7bcc7
@ -290,7 +290,6 @@ public class GenDialogPane extends JDialog implements SelectOutDirAction.SelectP
|
||||
execFn = "cmds/mac/gn-gen-macos";
|
||||
tmpDirFile += "/gn-gen-macos";
|
||||
}
|
||||
File file = new File(tmpDirFile);
|
||||
writeTmpFile(tmpDirFile, execFn, project);
|
||||
if (SYS_NAME.contains("LINUX") || SYS_NAME.contains("MAC OS")) {
|
||||
try {
|
||||
@ -319,7 +318,6 @@ public class GenDialogPane extends JDialog implements SelectOutDirAction.SelectP
|
||||
makeFilePath = "cmds/res/win/bin/make.exe";
|
||||
}
|
||||
String tmpDirFile = System.getProperty("java.io.tmpdir") + "/res/linux/bin/";
|
||||
File file = new File(tmpDirFile);
|
||||
if (file.mkdirs()) {
|
||||
LOG.info("create dir success");
|
||||
}
|
||||
@ -342,7 +340,6 @@ public class GenDialogPane extends JDialog implements SelectOutDirAction.SelectP
|
||||
makeFilePath = "cmds/res/win/bin/make_raw.exe";
|
||||
}
|
||||
String tmpDirFile = System.getProperty("java.io.tmpdir") + "/res/linux/bin/";
|
||||
File file = new File(tmpDirFile);
|
||||
if (file.mkdirs()) {
|
||||
LOG.info("create dir success");
|
||||
}
|
||||
@ -365,7 +362,6 @@ public class GenDialogPane extends JDialog implements SelectOutDirAction.SelectP
|
||||
toolchainFileDir = "cmds/res/win/ohos.toolchain.cmake";
|
||||
}
|
||||
String tmpDirFile = System.getProperty("java.io.tmpdir") + "/res/linux/";
|
||||
File file = new File(tmpDirFile);
|
||||
if (file.mkdirs()) {
|
||||
LOG.info("create dir success");
|
||||
}
|
||||
@ -387,10 +383,6 @@ public class GenDialogPane extends JDialog implements SelectOutDirAction.SelectP
|
||||
GenNotification.notifyMessage(this.project, "执行命令文件为空", "空命令行提示", NotificationType.ERROR);
|
||||
return false;
|
||||
}
|
||||
final Process process = Runtime.getRuntime().exec(command);
|
||||
threadPool.execute(new BlockThread(process));
|
||||
StreamConsumer errConsumer = new StreamConsumer(process.getErrorStream());
|
||||
StreamConsumer outputConsumer = new StreamConsumer(process.getInputStream());
|
||||
errConsumer.start();
|
||||
outputConsumer.start();
|
||||
if (generateSuccess) {
|
||||
@ -425,10 +417,6 @@ public class GenDialogPane extends JDialog implements SelectOutDirAction.SelectP
|
||||
BufferedReader stdInput = null;
|
||||
BufferedReader stdError = null;
|
||||
try {
|
||||
stdInput = new BufferedReader(new InputStreamReader(process.getInputStream(),
|
||||
StandardCharsets.UTF_8));
|
||||
stdError = new BufferedReader(new InputStreamReader(process.getErrorStream(),
|
||||
StandardCharsets.UTF_8));
|
||||
String sErr = '';
|
||||
String sOut;
|
||||
sErr = getErrorResult(stdError);
|
||||
@ -569,8 +557,6 @@ public class GenDialogPane extends JDialog implements SelectOutDirAction.SelectP
|
||||
public void run() {
|
||||
BufferedReader br1 = null;
|
||||
try {
|
||||
br1 = new BufferedReader(new InputStreamReader(process.getInputStream(),
|
||||
StandardCharsets.UTF_8));
|
||||
genResultLog(process);
|
||||
while (br1.readLine() != null) {
|
||||
LOG.info(" callExtProcess ");
|
||||
|
@ -269,7 +269,6 @@ public class GenerateDialogPane extends JDialog {
|
||||
copyFileToLocalPath("napi_generator-macos");
|
||||
tmpDirFile += "napi_generator-macos";
|
||||
}
|
||||
File file = new File(tmpDirFile);
|
||||
String command = file.toString();
|
||||
String inArgs = genInArgs(interFileOrDir);
|
||||
command += inArgs + " -o " + genOutDir + " -i " + radioButton.isSelected() + " -n " + genNumbertypeArgs();
|
||||
@ -371,10 +370,6 @@ public class GenerateDialogPane extends JDialog {
|
||||
GenNotification.notifyMessage(this.project, "执行命令文件为空", "空命令行提示", NotificationType.ERROR);
|
||||
return false;
|
||||
}
|
||||
Process process = Runtime.getRuntime().exec(command);
|
||||
genResultLog(process);
|
||||
StreamConsumer errConsumer = new StreamConsumer(process.getErrorStream());
|
||||
StreamConsumer outputConsumer = new StreamConsumer(process.getInputStream());
|
||||
errConsumer.start();
|
||||
outputConsumer.start();
|
||||
|
||||
@ -599,10 +594,6 @@ public class GenerateDialogPane extends JDialog {
|
||||
BufferedReader stdInput = null;
|
||||
BufferedReader stdError = null;
|
||||
try {
|
||||
stdInput = new BufferedReader(new InputStreamReader(process.getInputStream(),
|
||||
StandardCharsets.UTF_8));
|
||||
stdError = new BufferedReader(new InputStreamReader(process.getErrorStream(),
|
||||
StandardCharsets.UTF_8));
|
||||
String sErr;
|
||||
String sOut;
|
||||
sErr = getErrorResult(stdError);
|
||||
|
@ -277,10 +277,6 @@ public class GenerateDialogPane extends JDialog {
|
||||
GenNotification.notifyMessage(this.project, "执行命令文件为空", "空命令行提示", NotificationType.ERROR);
|
||||
return false;
|
||||
}
|
||||
Process process = Runtime.getRuntime().exec(command);
|
||||
genResultLog(process);
|
||||
StreamConsumer errConsumer = new StreamConsumer(process.getErrorStream());
|
||||
StreamConsumer outputConsumer = new StreamConsumer(process.getInputStream());
|
||||
errConsumer.start();
|
||||
outputConsumer.start();
|
||||
|
||||
@ -345,10 +341,6 @@ public class GenerateDialogPane extends JDialog {
|
||||
BufferedReader stdInput = null;
|
||||
BufferedReader stdError = null;
|
||||
try {
|
||||
stdInput = new BufferedReader(new InputStreamReader(process.getInputStream(),
|
||||
StandardCharsets.UTF_8));
|
||||
stdError = new BufferedReader(new InputStreamReader(process.getErrorStream(),
|
||||
StandardCharsets.UTF_8));
|
||||
String sErr;
|
||||
String sOut;
|
||||
sErr = getErrorResult(stdError);
|
||||
@ -528,7 +520,6 @@ public class GenerateDialogPane extends JDialog {
|
||||
tmpDirFile += "napi_generator-macos";
|
||||
}
|
||||
|
||||
File file = new File(tmpDirFile);
|
||||
String command = file.toString();
|
||||
String inArgs = genInArgs(textFieldSelectH.getText());
|
||||
command += inArgs + " -o " + textFieldSelectOutPath.getText() + " -t " + true;
|
||||
|
@ -229,10 +229,6 @@ public class GenDts extends AnAction {
|
||||
GenNotification.notifyMessage(null, "执行命令文件为空", "空命令行提示", NotificationType.ERROR);
|
||||
return false;
|
||||
}
|
||||
Process process = Runtime.getRuntime().exec(command);
|
||||
genResultLog(process);
|
||||
StreamConsumer errConsumer = new StreamConsumer(process.getErrorStream());
|
||||
StreamConsumer outputConsumer = new StreamConsumer(process.getInputStream());
|
||||
errConsumer.start();
|
||||
outputConsumer.start();
|
||||
|
||||
@ -344,7 +340,6 @@ public class GenDts extends AnAction {
|
||||
tmpDirFile += "native_gen-macos";
|
||||
}
|
||||
|
||||
File file = new File(tmpDirFile);
|
||||
String command = file.toString();
|
||||
command += " -f " + hFilePath;
|
||||
// 判断用户是否输入了 "-o"+cpp文件路径, "-i"+dts文件路径,"-t"+test文件路径 从界面获取
|
||||
|
@ -178,7 +178,6 @@ public class ServiceGenerateDialogPane extends JDialog {
|
||||
execFn = "cmds/mac/service-gen-macos";
|
||||
tmpDirFile += "service-gen-macos";
|
||||
}
|
||||
File file = new File(tmpDirFile);
|
||||
if (!file.exists()) {
|
||||
try (InputStream inputStream = getClass().getClassLoader().getResourceAsStream(execFn)) {
|
||||
if (inputStream == null) {
|
||||
@ -241,10 +240,6 @@ public class ServiceGenerateDialogPane extends JDialog {
|
||||
GenNotification.notifyMessage(this.project, "执行命令文件为空", "空命令行提示", NotificationType.ERROR);
|
||||
return false;
|
||||
}
|
||||
Process process = Runtime.getRuntime().exec(command);
|
||||
genResultLog(process);
|
||||
StreamConsumer errConsumer = new StreamConsumer(process.getErrorStream());
|
||||
StreamConsumer outputConsumer = new StreamConsumer(process.getInputStream());
|
||||
errConsumer.start();
|
||||
outputConsumer.start();
|
||||
if (generateSuccess) {
|
||||
@ -309,10 +304,6 @@ public class ServiceGenerateDialogPane extends JDialog {
|
||||
BufferedReader stdInput = null;
|
||||
BufferedReader stdError = null;
|
||||
try {
|
||||
stdInput = new BufferedReader(new InputStreamReader(process.getInputStream(),
|
||||
StandardCharsets.UTF_8));
|
||||
stdError = new BufferedReader(new InputStreamReader(process.getErrorStream(),
|
||||
StandardCharsets.UTF_8));
|
||||
String sErr;
|
||||
String sOut;
|
||||
sErr = getErrorResult(stdError);
|
||||
|
Loading…
Reference in New Issue
Block a user