сохранение и публикация файлов вывода при установке сапфора на сервере.

возможность указать автоматическую сборку сапфора после публикации компонента.
This commit is contained in:
2023-11-14 00:56:05 +03:00
parent 362d6b56ee
commit 38eea01f5c
14 changed files with 102 additions and 69 deletions

View File

@@ -1,5 +1,6 @@
package Visual_DVM_2021.Passes.All;
import Common.Constants;
import Common.Current;
import Common.Global;
import Common.Utils.Utils;
import GlobalData.RemoteFile.RemoteFile;
@@ -12,6 +13,7 @@ import Visual_DVM_2021.Passes.SSH.ConnectionPass;
import Visual_DVM_2021.Passes.TestingSystemPass;
import java.util.Date;
import java.util.Vector;
public class InstallServerSapfor extends ConnectionPass<Object> {
boolean result;
ServerSapfor serverSapfor;
@@ -49,7 +51,7 @@ public class InstallServerSapfor extends ConnectionPass<Object> {
protected void ServerAction() throws Exception {
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 repoSapforHome = new RemoteFile(repo.full_name + Constants.SAPFOR_REPOSITORY_BIN, true);
//--
ShowMessage1("Синхронизация ветви DVM...");
ShellCommand("cd " + Utils.DQuotes(repo.full_name), "svn checkout " + Constants.REPOSITORY_AUTHENTICATION + " " + Constants.DVM_REPOSITORY + "\n");
@@ -61,8 +63,7 @@ public class InstallServerSapfor extends ConnectionPass<Object> {
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");
performScript(repoSapforHome, "cmake ../", "make -j 4");
result = Exists(repoSapforHome.full_name, "Sapfor_F");
if (result) {
RemoteFile sapforsDirectory = new RemoteFile(testingSystemHome.full_name, "Sapfors", true);
@@ -93,6 +94,22 @@ public class InstallServerSapfor extends ConnectionPass<Object> {
}
}.Do();
}
new TestingSystemPass() {
@Override
public String getDescription() {
return "Рассылка выходных файлов сборки SAPFOR";
}
@Override
protected void ServerAction() throws Exception {
Vector<String> info = new Vector<>();
info.add(result ? serverSapfor.version : "?");
info.add(result ? "Успешно" : "С ошибками");
Command(new ServerExchangeUnit_2021(ServerCode.EmailSapforAssembly,
Current.getAccount().email,
info
));
}
}.Do();
}
@Override
protected boolean validate() {

View File

@@ -1,9 +1,11 @@
package Visual_DVM_2021.Passes.All;
import Common.Current;
import Common.Global;
import Common.UI.UI;
import Common.Utils.Utils;
import GlobalData.Account.AccountRole;
import Repository.Component.Component;
import Repository.Component.ComponentType;
import Repository.Component.UI.PublishForm;
import Repository.EmailMessage;
import Repository.RepositoryServer;
@@ -50,6 +52,13 @@ public class PublishComponent extends ComponentsRepositoryPass<Component> {
if (!target.isValidVersion(Log, "публикуемого")) {
return false;
}
if (target.getComponentType().equals(ComponentType.Sapfor_F)) {
f.fields.cbAssemblyOnServer.setVisible(true);
f.fields.cbAssemblyOnServer.setSelected(true);
} else {
f.fields.cbAssemblyOnServer.setVisible(false);
f.fields.cbAssemblyOnServer.setSelected(false);
}
if (f.ShowDialog(code().getDescription())) {
target.needs_update_minimal_version = f.fields.cbUpdateMinimalVersion.isSelected();
return true;
@@ -103,6 +112,12 @@ public class PublishComponent extends ComponentsRepositoryPass<Component> {
if (f.fields.cbForceMail.isSelected())
message.addAttachement(target.getFile());
Pass_2021.passes.get(PassCode_2021.Email).Do(message);
//---
if (target.getComponentType().equals(ComponentType.Sapfor_F) && f.fields.cbAssemblyOnServer.isSelected()) {
UI.getMainWindow().FocusTesting();
UI.getMainWindow().getTestingWindow().FocusSapforTesting();
passes.get(PassCode_2021.InstallServerSapfor).Do();
}
}
}
@Override

View File

@@ -9,6 +9,7 @@ import ProjectData.Project.db_project_info;
import Visual_DVM_2021.Passes.PassException;
import Visual_DVM_2021.Passes.Pass_2021;
import com.jcraft.jsch.*;
import javafx.util.Pair;
import java.io.*;
import java.net.SocketException;
@@ -387,7 +388,7 @@ 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 {
public Pair<RemoteFile, RemoteFile> 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);
@@ -405,6 +406,8 @@ public abstract class ConnectionPass<T> extends Pass_2021<T> {
//--
ShellCommand("cd " + Utils.DQuotes(directory.full_name),
script_file.full_name + " 1>" + Constants.out_file + " 2>" + Constants.err_file);
return new Pair<>(out, err);
}
}

View File

@@ -18,4 +18,5 @@ public interface TestingWindow extends VisualizerForm {
void ShowCurrentSapforPackageVersion();
void ShowNoSapforPackageVersionEtalon();
void ShowNoSapforPackageVersion();
void FocusSapforTesting();
}

View File

@@ -241,7 +241,7 @@ public class MainForm extends Form implements MainWindow {
}
@Override
public void FocusTesting() {
globalTabs.setSelectedIndex(3);
globalTabs.setSelectedIndex(4);
}
@Override
public TestingWindow getTestingWindow() {

View File

@@ -175,4 +175,8 @@ public class TestingForm implements FormWithSplitters, TestingWindow {
Global.testingServer.account_db.sapforTasksPackages.mountUI(sapforTasksPackagesPanel);
Global.testingServer.account_db.sapforTasks.mountUI(sapforTasksPanel);
}
@Override
public void FocusSapforTesting() {
testingTabs.setSelectedIndex(1);
}
}