перенаправление вывода сборки сапфора в файлы. Осталось сделать рассылку.

This commit is contained in:
2023-11-13 23:16:36 +03:00
parent b42fffa31b
commit 362d6b56ee
4 changed files with 32 additions and 10 deletions

5
.idea/workspace.xml generated
View File

@@ -8,8 +8,9 @@
<component name="ChangeListManager">
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/SynchronizeTestsTasks.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/SynchronizeTestsTasks.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Common/Constants.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Constants.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/InstallServerSapfor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/InstallServerSapfor.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/SSH/ConnectionPass.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/SSH/ConnectionPass.java" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />

View File

@@ -24,6 +24,7 @@ public class Constants {
public final static String parse_err_file = "parse_err.txt";
public final static String out_file = "out.txt";
public final static String err_file = "err.txt";
public final static String script = "script.sh";
public final static String time_file = "total_time";
//-служебные разделы проекта.
public static final String data = "visualiser_data";

View File

@@ -50,26 +50,27 @@ public class InstallServerSapfor extends ConnectionPass<Object> {
RemoteFile testingSystemHome = new RemoteFile(sftpChannel.pwd(), "testing_system", true);
RemoteFile repo = new RemoteFile(testingSystemHome.full_name, "Repo", true);
RemoteFile repoSapforHome = new RemoteFile(repo.full_name + "/sapfor/experts/Sapfor_2017/_bin", true);
RemoteFile old_bin = new RemoteFile(repoSapforHome.full_name, "Sapfor_F");
if (Exists(repoSapforHome.full_name, "Sapfor_F"))
sftpChannel.rm(old_bin.full_name);
ShowMessage2("Вывод в консоли визуализатора");
//-->>
//--
ShowMessage1("Синхронизация ветви DVM...");
ShellCommand("cd " + Utils.DQuotes(repo.full_name), "svn checkout " + Constants.REPOSITORY_AUTHENTICATION + " " + Constants.DVM_REPOSITORY + "\n");
ShowMessage1("Синхронизация ветви SAPFOR...");
ShellCommand("cd " + Utils.DQuotes(repo.full_name), "svn checkout " + Constants.REPOSITORY_AUTHENTICATION + " " + Constants.SAPFOR_REPOSITORY + "\n");
ShowMessage1("Сборка SAPFOR...");
ShellCommand("cd " + Utils.DQuotes(repoSapforHome.full_name), "cmake ../", "make -j 4");
//-
RemoteFile repo_bin = new RemoteFile(repoSapforHome.full_name, "Sapfor_F");
if (Exists(repoSapforHome.full_name, repo_bin.name))
sftpChannel.rm(repo_bin.full_name);
//--
performScript(repoSapforHome, "cmake ../", "make -j 4" );
// ShellCommand("cd " + Utils.DQuotes(repoSapforHome.full_name), "cmake ../", "make -j 4");
result = Exists(repoSapforHome.full_name, "Sapfor_F");
if (result) {
RemoteFile sapforsDirectory = new RemoteFile(testingSystemHome.full_name, "Sapfors", true);
//создать папку. Для того чтобы скопировать из репозитория.
RemoteFile sapforHome = new RemoteFile(sapforsDirectory.full_name, Utils.getDateName("sapfor"));
tryMKDir(sapforHome);
RemoteFile repoSapforBin = new RemoteFile(repoSapforHome, "Sapfor_F");
RemoteFile sapforBin = new RemoteFile(sapforHome, "Sapfor_F");
copy(repoSapforBin, sapforBin);
copy(repo_bin, sapforBin);
//-->>>
serverSapfor = new ServerSapfor();
serverSapfor.home_path = sapforHome.full_name;

View File

@@ -387,6 +387,25 @@ public abstract class ConnectionPass<T> extends Pass_2021<T> {
if (!Exists(dir.parent, dir.name)) sftpChannel.mkdir(dir.full_name);
}
//--
public void performScript(RemoteFile directory, String... commands) throws Exception {
RemoteFile script_file = new RemoteFile(directory.full_name, Constants.script);
RemoteFile out = new RemoteFile(directory.full_name, Constants.out_file);
RemoteFile err = new RemoteFile(directory.full_name, Constants.err_file);
//
Vector<RemoteFile> files = new Vector<>();
files.add(script_file);
files.add(out);
files.add(err);
for (RemoteFile file : files) {
if (Exists(directory.full_name, file.name))
sftpChannel.rm(file.full_name);
}
//--
writeToFile(String.join("\n", commands), script_file);
//--
ShellCommand("cd " + Utils.DQuotes(directory.full_name),
script_file.full_name + " 1>" + Constants.out_file + " 2>" + Constants.err_file);
}
}