2025-03-04 14:19:04 +03:00
|
|
|
package _VisualDVM.ServerObjectsCache;
|
|
|
|
|
import Common.Utils.Utils_;
|
|
|
|
|
import _VisualDVM.GlobalData.CompilerEnvironment.Json.EnvironmentsJson;
|
|
|
|
|
import _VisualDVM.GlobalData.CompilerEnvironment.Json.EnvironmentsSetJson;
|
|
|
|
|
import _VisualDVM.GlobalData.CompilerOption.Json.OptionsJson;
|
|
|
|
|
import _VisualDVM.GlobalData.CompilerOption.Json.OptionsSetJson;
|
|
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMSettings.DVMSettings;
|
2025-03-04 16:30:32 +03:00
|
|
|
import javafx.util.Pair;
|
2025-03-04 14:19:04 +03:00
|
|
|
|
|
|
|
|
import java.util.Vector;
|
|
|
|
|
public class DVMSettingsCache extends VisualCache {
|
2025-03-13 00:32:20 +03:00
|
|
|
public OptionsSetJson optionsSetJson = null;
|
|
|
|
|
public EnvironmentsSetJson environmentsSetJson = null;
|
2025-03-04 14:19:04 +03:00
|
|
|
//--
|
|
|
|
|
public String optionsSummary = null;
|
|
|
|
|
public String environmentsSummary = null;
|
|
|
|
|
//--
|
|
|
|
|
public DVMSettingsCache(DVMSettings dvmSettings) {
|
|
|
|
|
//-->>
|
|
|
|
|
if (dvmSettings.packedCompilationOptionsJson.isEmpty())
|
|
|
|
|
optionsSetJson = new OptionsSetJson();
|
|
|
|
|
else
|
|
|
|
|
optionsSetJson = Utils_.gson.fromJson(dvmSettings.packedCompilationOptionsJson, OptionsSetJson.class);
|
|
|
|
|
//-->>
|
|
|
|
|
if (dvmSettings.packedRunEnvironmentValuesJson.isEmpty())
|
|
|
|
|
environmentsSetJson = new EnvironmentsSetJson();
|
|
|
|
|
else
|
|
|
|
|
environmentsSetJson = Utils_.gson.fromJson(dvmSettings.packedRunEnvironmentValuesJson, EnvironmentsSetJson.class);
|
|
|
|
|
//--
|
2025-03-13 00:32:20 +03:00
|
|
|
Vector<String> optionsSummary_ = new Vector<>();
|
|
|
|
|
for (OptionsJson optionsJson : optionsSetJson.values) {
|
2025-03-04 14:19:04 +03:00
|
|
|
optionsSummary_.add(optionsJson.toLine());
|
|
|
|
|
}
|
2025-03-04 16:30:32 +03:00
|
|
|
optionsSummary = String.join(";\n", optionsSummary_);
|
2025-03-04 14:19:04 +03:00
|
|
|
Vector<String> environmentsSummary_ = new Vector<>();
|
2025-03-13 00:32:20 +03:00
|
|
|
for (EnvironmentsJson environmentsJson : environmentsSetJson.values) {
|
2025-03-04 14:19:04 +03:00
|
|
|
environmentsSummary_.add(environmentsJson.toLine());
|
|
|
|
|
}
|
2025-03-04 16:30:32 +03:00
|
|
|
environmentsSummary = String.join(";\n", environmentsSummary_);
|
|
|
|
|
}
|
2025-03-13 00:32:20 +03:00
|
|
|
public Vector<Pair<String, String>> getTasksParameters() {
|
2025-03-04 16:30:32 +03:00
|
|
|
//уравниваем количество наборов опций и окружений и сопоставляем 1 к 1
|
|
|
|
|
Vector<Pair<String, String>> res = new Vector<>();
|
2025-03-13 00:32:20 +03:00
|
|
|
for (int i = 0; i < optionsSetJson.values.size(); ++i) {
|
|
|
|
|
String optionsLine = optionsSetJson.values.get(i).toLine();
|
|
|
|
|
String environmentsLine = (i < environmentsSetJson.values.size()) ?
|
2025-03-04 16:30:32 +03:00
|
|
|
environmentsSetJson.values.get(i).toLine() : "";
|
|
|
|
|
res.add(new Pair<>(
|
|
|
|
|
optionsLine,
|
|
|
|
|
environmentsLine));
|
|
|
|
|
}
|
2025-03-13 00:32:20 +03:00
|
|
|
if (optionsSetJson.values.size() < environmentsSetJson.values.size()) {
|
|
|
|
|
for (int i = optionsSetJson.values.size(); i < environmentsSetJson.values.size(); ++i) {
|
2025-03-04 16:30:32 +03:00
|
|
|
res.add(new Pair<>(
|
|
|
|
|
"",
|
|
|
|
|
environmentsSetJson.values.get(i).toLine()
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return res;
|
2025-03-04 14:19:04 +03:00
|
|
|
}
|
|
|
|
|
}
|