2023-11-19 02:12:44 +03:00
|
|
|
|
package Visual_DVM_2021.Passes.All;
|
2024-10-09 22:01:19 +03:00
|
|
|
|
import _VisualDVM.Current;
|
|
|
|
|
|
import _VisualDVM.Utils;
|
2024-10-09 22:21:57 +03:00
|
|
|
|
import _VisualDVM.Repository.Component.Component;
|
2023-11-19 02:12:44 +03:00
|
|
|
|
import Visual_DVM_2021.Passes.PassCode_2021;
|
|
|
|
|
|
import Visual_DVM_2021.Passes.PassException;
|
|
|
|
|
|
import Visual_DVM_2021.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
|
|
|
|
|
|
protected PassCode_2021 necessary() {
|
|
|
|
|
|
return PassCode_2021.DownloadRepository;
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected boolean resetsNecessary() {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected boolean canStart(Object... args) throws Exception {
|
|
|
|
|
|
target = Current.getComponent();
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
|
|
|
protected void performPreparation() throws Exception {
|
|
|
|
|
|
Utils.forceDeleteWithCheck(target.getAssemblyFile());
|
|
|
|
|
|
}
|
|
|
|
|
|
@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("Не удалось скопировать сборку для установки");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|