2023-11-19 02:12:44 +03:00
|
|
|
package Visual_DVM_2021.Passes.All;
|
2023-10-04 22:01:09 +03:00
|
|
|
import Common.Constants;
|
2023-09-17 22:13:42 +03:00
|
|
|
import Common.Global;
|
|
|
|
|
import Common.Utils.Utils;
|
2023-11-19 02:12:44 +03:00
|
|
|
import Visual_DVM_2021.Passes.ProcessPass;
|
2023-09-17 22:13:42 +03:00
|
|
|
import org.apache.commons.io.FileUtils;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.nio.file.Paths;
|
|
|
|
|
public class DownloadRepository extends ProcessPass {
|
|
|
|
|
File dvmHome;
|
|
|
|
|
File sapforHome;
|
|
|
|
|
@Override
|
|
|
|
|
protected boolean canStart(Object... args) throws Exception {
|
|
|
|
|
dvmHome = Paths.get(Global.RepoDirectory.getAbsolutePath(),
|
|
|
|
|
"dvm").toFile();
|
|
|
|
|
sapforHome = Paths.get(Global.RepoDirectory.getAbsolutePath(),
|
|
|
|
|
"sapfor").toFile();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
private void synchronize(String src, File dst) throws Exception {
|
2023-10-03 15:07:17 +03:00
|
|
|
File loadedFile = Paths.get(dst.getAbsolutePath(), Constants.LOADED).toFile();
|
2023-09-17 22:13:42 +03:00
|
|
|
if (loadedFile.exists()) {
|
|
|
|
|
PerformScript("cd " +
|
|
|
|
|
dst.getAbsolutePath() +
|
2023-10-03 15:07:17 +03:00
|
|
|
"\nsvn update " + Constants.REPOSITORY_AUTHENTICATION + "\n");
|
2023-09-17 22:13:42 +03:00
|
|
|
} else {
|
|
|
|
|
Utils.CleanDirectory(dst);
|
2023-10-03 15:07:17 +03:00
|
|
|
PerformScript("cd Repo\nsvn checkout " + Constants.REPOSITORY_AUTHENTICATION + " " + src + "\n"); //export
|
2023-09-17 22:13:42 +03:00
|
|
|
FileUtils.write(loadedFile, "+");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void body() throws Exception {
|
|
|
|
|
ShowProgress(2, 0, true);
|
2023-10-03 15:07:17 +03:00
|
|
|
synchronize(Constants.DVM_REPOSITORY, dvmHome);
|
2023-09-17 22:13:42 +03:00
|
|
|
ShowProgress(2, 1, true);
|
2023-10-03 15:07:17 +03:00
|
|
|
synchronize(Constants.SAPFOR_REPOSITORY, sapforHome);
|
2023-09-17 22:13:42 +03:00
|
|
|
ShowProgress(2, 2, true);
|
|
|
|
|
}
|
|
|
|
|
}
|