2024-10-14 12:14:01 +03:00
|
|
|
|
package _VisualDVM.Passes.All;
|
2024-10-14 12:54:52 +03:00
|
|
|
|
import Common.Utils.Utils_;
|
2024-10-13 22:08:13 +03:00
|
|
|
|
import _VisualDVM.Global;
|
2024-10-09 22:21:57 +03:00
|
|
|
|
import _VisualDVM.Repository.Component.Component;
|
2024-10-14 12:14:01 +03:00
|
|
|
|
import _VisualDVM.Passes.PassCode;
|
2024-10-10 23:57:36 +03:00
|
|
|
|
import Common.Passes.PassException;
|
2024-10-14 12:14:01 +03:00
|
|
|
|
import _VisualDVM.Passes.ProcessPass;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
|
|
|
|
|
|
import java.nio.file.Files;
|
|
|
|
|
|
import java.nio.file.StandardCopyOption;
|
|
|
|
|
|
public class BuildComponent extends ProcessPass<Component> {
|
|
|
|
|
|
@Override
|
2024-10-09 23:37:58 +03:00
|
|
|
|
protected PassCode necessary() {
|
|
|
|
|
|
return PassCode.DownloadRepository;
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected boolean resetsNecessary() {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected boolean canStart(Object... args) throws Exception {
|
2024-10-13 22:08:13 +03:00
|
|
|
|
target = Global.mainModule.getComponent();
|
2023-09-17 22:13:42 +03:00
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void performPreparation() throws Exception {
|
2024-10-14 12:54:52 +03:00
|
|
|
|
Utils_.forceDeleteWithCheck(target.getAssemblyFile());
|
2023-09-17 22:13:42 +03:00
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void body() throws Exception {
|
|
|
|
|
|
ShowMessage1("Сборка " + target.getComponentType().getDescription());
|
|
|
|
|
|
PerformScript(target.getAssemblyCommand());
|
|
|
|
|
|
if (!target.getAssemblyFile().exists())
|
2023-10-03 15:07:17 +03:00
|
|
|
|
throw new PassException("Сборка не найдена");
|
2023-09-17 22:13:42 +03:00
|
|
|
|
Files.copy(target.getAssemblyFile().toPath(),
|
|
|
|
|
|
target.getNewFile().toPath(), StandardCopyOption.REPLACE_EXISTING);
|
|
|
|
|
|
if (!target.getNewFile().exists())
|
|
|
|
|
|
throw new PassException("Не удалось скопировать сборку для установки");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|