сборка сапфора для тестирования пользователем
This commit is contained in:
@@ -31,7 +31,7 @@ public class BuildComponent extends ProcessPass<Component> {
|
||||
ShowMessage1("Сборка " + target.getComponentType().getDescription());
|
||||
PerformScript(target.getAssemblyCommand());
|
||||
if (!target.getAssemblyFile().exists())
|
||||
throw new PassException("Сборка не найдена");
|
||||
throw new PassException("Сборка не найдена");
|
||||
Files.copy(target.getAssemblyFile().toPath(),
|
||||
target.getNewFile().toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
if (!target.getNewFile().exists())
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Constants.Constants;
|
||||
import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import GlobalData.SVN.SVN;
|
||||
import Visual_DVM_2021.Passes.ProcessPass;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Paths;
|
||||
public class DownloadRepository extends ProcessPass {
|
||||
|
||||
File dvmHome;
|
||||
File sapforHome;
|
||||
@Override
|
||||
@@ -20,23 +19,23 @@ public class DownloadRepository extends ProcessPass {
|
||||
return true;
|
||||
}
|
||||
private void synchronize(String src, File dst) throws Exception {
|
||||
File loadedFile = Paths.get(dst.getAbsolutePath(), SVN.LOADED).toFile();
|
||||
File loadedFile = Paths.get(dst.getAbsolutePath(), Constants.LOADED).toFile();
|
||||
if (loadedFile.exists()) {
|
||||
PerformScript("cd " +
|
||||
dst.getAbsolutePath() +
|
||||
"\nsvn update " + SVN.REPOSITORY_AUTHENTICATION + "\n");
|
||||
"\nsvn update " + Constants.REPOSITORY_AUTHENTICATION + "\n");
|
||||
} else {
|
||||
Utils.CleanDirectory(dst);
|
||||
PerformScript("cd Repo\nsvn checkout " + SVN.REPOSITORY_AUTHENTICATION + " " + src + "\n"); //export
|
||||
PerformScript("cd Repo\nsvn checkout " + Constants.REPOSITORY_AUTHENTICATION + " " + src + "\n"); //export
|
||||
FileUtils.write(loadedFile, "+");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
ShowProgress(2, 0, true);
|
||||
synchronize(SVN.DVM_REPOSITORY, dvmHome);
|
||||
synchronize(Constants.DVM_REPOSITORY, dvmHome);
|
||||
ShowProgress(2, 1, true);
|
||||
synchronize(SVN.SAPFOR_REPOSITORY, sapforHome);
|
||||
synchronize(Constants.SAPFOR_REPOSITORY, sapforHome);
|
||||
ShowProgress(2, 2, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,93 +0,0 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import GlobalData.Machine.MachineType;
|
||||
import GlobalData.RemoteFile.RemoteFile;
|
||||
import GlobalData.RemoteSapfor.RemoteSapfor;
|
||||
import GlobalData.SVN.SVN;
|
||||
import ProjectData.LanguageName;
|
||||
import Visual_DVM_2021.Passes.SSH.CurrentConnectionPass;
|
||||
public class InstallRemoteSapfor extends CurrentConnectionPass<RemoteSapfor> {
|
||||
boolean result;
|
||||
String version_text;
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/DownloadAll.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) {
|
||||
result = false;
|
||||
version_text = "";
|
||||
target = null;
|
||||
if (super.canStart(args)) {
|
||||
if (Current.getMachine().type.equals(MachineType.Server)) {
|
||||
return true;
|
||||
} else
|
||||
Log.Writeln_("Установка системы SAPFOR разрешена только на одиночном сервере.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
RemoteFile repo = new RemoteFile(user.workspace, "repo");
|
||||
tryMKDir(repo);
|
||||
ShowMessage1("Синхронизация ветви DVM...");
|
||||
ShellCommand(
|
||||
"cd " + Utils.DQuotes(repo.full_name),
|
||||
"svn checkout " + SVN.REPOSITORY_AUTHENTICATION + " " + SVN.DVM_REPOSITORY + "\n"
|
||||
);
|
||||
ShowMessage1("Синхронизация ветви SAPFOR...");
|
||||
ShellCommand(
|
||||
"cd " + Utils.DQuotes(repo.full_name),
|
||||
"svn checkout " + SVN.REPOSITORY_AUTHENTICATION + " " + SVN.SAPFOR_REPOSITORY + "\n"
|
||||
);
|
||||
RemoteFile repoSapforHome = new RemoteFile(repo.full_name + "/sapfor/experts/Sapfor_2017/_bin", true);
|
||||
ShowMessage1("Сборка SAPFOR...");
|
||||
ShellCommand(
|
||||
"cd " + Utils.DQuotes(repoSapforHome.full_name),
|
||||
"cmake ../",
|
||||
"make -j 4"
|
||||
);
|
||||
result = Exists(repoSapforHome.full_name, "Sapfor_F");
|
||||
if (result) {
|
||||
//создать папку. Для того чтобы скопировать из репозитория.
|
||||
RemoteFile sapforHome = new RemoteFile(user.workspace, Utils.getDateName("sapfor"));
|
||||
tryMKDir(sapforHome);
|
||||
RemoteFile repoSapforBin = new RemoteFile(repoSapforHome, "Sapfor_F");
|
||||
RemoteFile sapforBin = new RemoteFile(sapforHome, "Sapfor_F");
|
||||
copy(repoSapforBin, sapforBin);
|
||||
target = new RemoteSapfor();
|
||||
target.description = "";
|
||||
target.home_path = sapforHome.full_name;
|
||||
target.call_command = sapforBin.full_name;
|
||||
target.languageName = LanguageName.fortran;
|
||||
target.machine_id = Current.getMachine().id;
|
||||
ParseVersion();
|
||||
}
|
||||
}
|
||||
public void ParseVersion() throws Exception {
|
||||
String raw = ShellCommand(target.getVersionCommand());
|
||||
String[] data = raw.split(" ");
|
||||
if (data.length >= 4)
|
||||
target.version = data[3].replace(",", "");
|
||||
}
|
||||
@Override
|
||||
protected boolean validate() {
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
protected void performDone() throws Exception {
|
||||
super.performDone();
|
||||
Global.db.Insert(target);
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
super.showDone();
|
||||
Global.db.remoteSapfors.ShowUI(target.getPK());
|
||||
}
|
||||
}
|
||||
114
src/Visual_DVM_2021/Passes/All/InstallServerSapfor.java
Normal file
114
src/Visual_DVM_2021/Passes/All/InstallServerSapfor.java
Normal file
@@ -0,0 +1,114 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Constants.Constants;
|
||||
import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import GlobalData.RemoteFile.RemoteFile;
|
||||
import ProjectData.LanguageName;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import SapforTestingSystem.ServerSapfor.ServerSapfor;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.SSH.ConnectionPass;
|
||||
import Visual_DVM_2021.Passes.TestingSystemPass;
|
||||
|
||||
import java.util.Date;
|
||||
public class InstallServerSapfor extends ConnectionPass<Object> {
|
||||
boolean result;
|
||||
ServerSapfor serverSapfor;
|
||||
String version_text;
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
return "/icons/DownloadAll.png";
|
||||
}
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
public void Connect() throws Exception {
|
||||
machine = Constants.repository_machine;
|
||||
user = Constants.repository_user;
|
||||
super.Connect();
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) {
|
||||
result = false;
|
||||
version_text = "";
|
||||
serverSapfor = null;
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean needsInitialize() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
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);
|
||||
//-->>
|
||||
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");
|
||||
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);
|
||||
//-->>>
|
||||
serverSapfor = new ServerSapfor();
|
||||
serverSapfor.home_path = sapforHome.full_name;
|
||||
serverSapfor.call_command = sapforBin.full_name;
|
||||
serverSapfor.languageName = LanguageName.fortran;
|
||||
serverSapfor.buildDate = new Date().getTime();
|
||||
///--->>
|
||||
String raw = ShellCommand(serverSapfor.getVersionCommand());
|
||||
String[] data = raw.split(" ");
|
||||
if (data.length >= 4) serverSapfor.version = data[3].replace(",", "");
|
||||
//---
|
||||
result = new TestingSystemPass() {
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Публикация тестовой версии";
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.PublishObject, "", serverSapfor));
|
||||
}
|
||||
}.Do();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected boolean validate() {
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
protected void performFinish() throws Exception {
|
||||
super.performFinish();
|
||||
passes.get(PassCode_2021.SynchronizeTests).Do();
|
||||
}
|
||||
@Override
|
||||
protected void showDone() throws Exception {
|
||||
super.showDone();
|
||||
Global.testingServer.db.serverSapfors.ui_.Show(serverSapfor.getPK());
|
||||
}
|
||||
}
|
||||
/*
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import SapforTestingSystem.ServerSapfor.ServerSapfor;
|
||||
import Visual_DVM_2021.Passes.TestingSystemPass;
|
||||
public class InstallServerSapfor extends TestingSystemPass<ServerSapfor> {
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(ServerCode.InstallSapforForTesting));
|
||||
}
|
||||
}
|
||||
*/
|
||||
Reference in New Issue
Block a user