доделал создание тестов из версий дерева версий. тоже включил учет исключенных файлов.
This commit is contained in:
@@ -90,12 +90,16 @@ public class CreateTestFromDirectory extends Pass_2021<Test> {
|
||||
} else if (file.isFile() && !Utils.ContainsCyrillic(file.getName()) && !Utils.ContainsForbiddenName(file.getName())) {
|
||||
//если файл. все недопустимые файлы просто игнорируются.
|
||||
ProjectFile projectFile = new ProjectFile(file);
|
||||
System.out.println(projectFile.file);
|
||||
System.out.println("1");
|
||||
if (isNotExcluded(projectFile)) {
|
||||
System.out.println("1.5");
|
||||
switch (projectFile.fileType) {
|
||||
case program:
|
||||
if (projectFile.languageName.equals(group.language)) {
|
||||
active_programs++;
|
||||
project_files.add(projectFile);
|
||||
System.out.println("2");
|
||||
} else
|
||||
other_project_files++;
|
||||
break;
|
||||
@@ -158,11 +162,10 @@ public class CreateTestFromDirectory extends Pass_2021<Test> {
|
||||
//---
|
||||
Utils.ClearProjectData(tempProject);
|
||||
//--
|
||||
|
||||
ZipFolderPass zip = new ZipFolderPass();
|
||||
if (zip.Do(tempProject.getAbsolutePath(), tempArchive.getAbsolutePath())) {
|
||||
target.project_archive_bytes = Utils.packFile(tempArchive);
|
||||
} else throw new PassException("Не удалось создать архив папки с кодом.");
|
||||
ZipFolderPass zip = new ZipFolderPass();
|
||||
if (zip.Do(tempProject.getAbsolutePath(), tempArchive.getAbsolutePath())) {
|
||||
target.project_archive_bytes = Utils.packFile(tempArchive);
|
||||
} else throw new PassException("Не удалось создать архив папки с кодом.");
|
||||
return tempProject;
|
||||
}
|
||||
//-
|
||||
@@ -173,8 +176,9 @@ public class CreateTestFromDirectory extends Pass_2021<Test> {
|
||||
File tempProject = packTestCode(); //создание копии папки, и архивация.
|
||||
//-- получить размерность консольным сапфором. папка уже отправлена и чистить ее не нужно!!
|
||||
ShowMessage2("Синтаксический анализ и определение размерности");
|
||||
if (group.language.equals(LanguageName.fortran) && !Sapfor.getMinMaxDim(Sapfor.getTempCopy(Current.getSapfor().getFile()), tempProject, target))
|
||||
Log.Writeln_("Не удалось определить размерность теста " + Utils.Brackets(tempProject.getName()));
|
||||
if (group.language == LanguageName.fortran) {//если не определит, будут нули.
|
||||
Sapfor.getMinMaxDim(Sapfor.getTempCopy(Current.getSapfor().getFile()), tempProject, target);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected boolean validate() {
|
||||
|
||||
@@ -3,8 +3,9 @@ import Common.Current;
|
||||
import ProjectData.Files.FileState;
|
||||
import ProjectData.Files.ProjectFile;
|
||||
import ProjectData.Project.db_project_info;
|
||||
import TestingSystem.Common.Group.Group;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
public class CreateTestFromCurrentProject extends CreateTestFromDirectory {
|
||||
public class CreateTestFromProject extends CreateTestFromDirectory {
|
||||
db_project_info project;
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
@@ -12,9 +13,19 @@ public class CreateTestFromCurrentProject extends CreateTestFromDirectory {
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (Current.Check(Log, Current.Group, Current.Project)) {
|
||||
project = Current.getProject();
|
||||
return super.canStart(Current.getProject().Home, Current.getGroup());
|
||||
if (args.length == 0) {
|
||||
if (Current.Check(Log, Current.Group, Current.Project)) {
|
||||
project = Current.getProject();
|
||||
from_directory_chooser = true;
|
||||
return super.canStart(Current.getProject().Home, Current.getGroup());
|
||||
}
|
||||
} else {
|
||||
project = (db_project_info) args[0];
|
||||
group = (Group) args[1];
|
||||
from_directory_chooser = false;
|
||||
project.Open();
|
||||
project.Close();
|
||||
return super.canStart(project.Home, group);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -1,7 +1,10 @@
|
||||
package Visual_DVM_2021.Passes.All;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
import Common.UI.UI;
|
||||
import Common.Utils.Utils;
|
||||
import ProjectData.Project.db_project_info;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import Visual_DVM_2021.Passes.PublishTests;
|
||||
|
||||
import java.util.Vector;
|
||||
@@ -20,7 +23,18 @@ public class CreateTestsGroupFromSelectedVersions extends PublishTests {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected boolean findFiles() {
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (!Current.getAccount().CheckRegistered(Log))
|
||||
return false;
|
||||
//---
|
||||
target = new Vector<>();
|
||||
//--------------------------
|
||||
group = null;
|
||||
if (!getGroup()) return false;
|
||||
if (group == null) {
|
||||
Log.Writeln_("Группа не выбрана.");
|
||||
return false;
|
||||
}
|
||||
if (!Global.versions_multiselection) {
|
||||
Log.Writeln_("Нажмите правую клавишу мыши, и перейдите в режим выбора версий.");
|
||||
return false;
|
||||
@@ -31,14 +45,20 @@ public class CreateTestsGroupFromSelectedVersions extends PublishTests {
|
||||
Log.Writeln_("Не отмечено ни одной версии.");
|
||||
return false;
|
||||
}
|
||||
for (db_project_info version : versions)
|
||||
files.add(version.Home);
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
if (!Current.getAccount().CheckRegistered(Log))
|
||||
//---
|
||||
CreateTestFromProject createTestFromProject = (CreateTestFromProject) passes.get(PassCode_2021.CreateTestFromProject);
|
||||
//---
|
||||
for (db_project_info version : versions) {
|
||||
if (createTestFromProject.Do(version, group))
|
||||
target.add(createTestFromProject.target);
|
||||
}
|
||||
//---
|
||||
if (target.isEmpty()) {
|
||||
Log.Writeln_("Не удалось создать ни одного теста.");
|
||||
return false;
|
||||
return super.canStart(args);
|
||||
}
|
||||
//---
|
||||
return UI.Question("В группу " + Utils.Brackets(group.description) +
|
||||
"\nбудет добавлено " + target.size() + " тестов.\nПродолжить");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user