Files
VisualSapfor/src/Visual_DVM_2021/Passes/All/BuildComponent.java

41 lines
1.5 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package Visual_DVM_2021.Passes.All;
import Common.Current;
import Common.Utils.Utils;
import Repository.Component.Component;
import Visual_DVM_2021.Passes.PassCode_2021;
import Visual_DVM_2021.Passes.PassException;
import Visual_DVM_2021.Passes.ProcessPass;
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())
throw new PassException("Сборка не найдена");
Files.copy(target.getAssemblyFile().toPath(),
target.getNewFile().toPath(), StandardCopyOption.REPLACE_EXISTING);
if (!target.getNewFile().exists())
throw new PassException("Не удалось скопировать сборку для установки");
}
}