mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
[FEATURE] Use tmpdir for build
This commit is contained in:
parent
5547909c16
commit
40e4949c47
3 changed files with 7 additions and 1 deletions
|
@ -26,6 +26,7 @@
|
||||||
import pro.gravit.utils.helper.CommonHelper;
|
import pro.gravit.utils.helper.CommonHelper;
|
||||||
import pro.gravit.utils.helper.IOHelper;
|
import pro.gravit.utils.helper.IOHelper;
|
||||||
import pro.gravit.utils.helper.JVMHelper;
|
import pro.gravit.utils.helper.JVMHelper;
|
||||||
|
import pro.gravit.utils.helper.SecurityHelper;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -79,6 +80,7 @@ public final class LaunchServer implements Runnable, AutoCloseable, Reconfigurab
|
||||||
* The path to the folder with profiles
|
* The path to the folder with profiles
|
||||||
*/
|
*/
|
||||||
public final Path profilesDir;
|
public final Path profilesDir;
|
||||||
|
public final Path tmpDir;
|
||||||
/**
|
/**
|
||||||
* This object contains runtime configuration
|
* This object contains runtime configuration
|
||||||
*/
|
*/
|
||||||
|
@ -124,6 +126,7 @@ public final class LaunchServer implements Runnable, AutoCloseable, Reconfigurab
|
||||||
|
|
||||||
public LaunchServer(LaunchServerDirectories directories, LaunchServerEnv env, LaunchServerConfig config, LaunchServerRuntimeConfig runtimeConfig, LaunchServerConfigManager launchServerConfigManager, LaunchServerModulesManager modulesManager, KeyAgreementManager keyAgreementManager, CommandHandler commandHandler, CertificateManager certificateManager) throws IOException {
|
public LaunchServer(LaunchServerDirectories directories, LaunchServerEnv env, LaunchServerConfig config, LaunchServerRuntimeConfig runtimeConfig, LaunchServerConfigManager launchServerConfigManager, LaunchServerModulesManager modulesManager, KeyAgreementManager keyAgreementManager, CommandHandler commandHandler, CertificateManager certificateManager) throws IOException {
|
||||||
this.dir = directories.dir;
|
this.dir = directories.dir;
|
||||||
|
this.tmpDir = directories.tmpDir;
|
||||||
this.env = env;
|
this.env = env;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.launchServerConfigManager = launchServerConfigManager;
|
this.launchServerConfigManager = launchServerConfigManager;
|
||||||
|
@ -519,6 +522,7 @@ public static class LaunchServerDirectories {
|
||||||
public Path keyDirectory;
|
public Path keyDirectory;
|
||||||
public Path dir;
|
public Path dir;
|
||||||
public Path trustStore;
|
public Path trustStore;
|
||||||
|
public Path tmpDir;
|
||||||
|
|
||||||
public void collect() {
|
public void collect() {
|
||||||
if (updatesDir == null) updatesDir = dir.resolve(UPDATES_NAME);
|
if (updatesDir == null) updatesDir = dir.resolve(UPDATES_NAME);
|
||||||
|
@ -528,6 +532,7 @@ public void collect() {
|
||||||
if (launcherLibrariesCompileDir == null)
|
if (launcherLibrariesCompileDir == null)
|
||||||
launcherLibrariesCompileDir = dir.resolve(LAUNCHERLIBRARIESCOMPILE_NAME);
|
launcherLibrariesCompileDir = dir.resolve(LAUNCHERLIBRARIESCOMPILE_NAME);
|
||||||
if(keyDirectory == null) keyDirectory = dir.resolve(KEY_NAME);
|
if(keyDirectory == null) keyDirectory = dir.resolve(KEY_NAME);
|
||||||
|
if(tmpDir ==null) tmpDir = Paths.get(System.getProperty("java.io.tmpdir")).resolve(String.format("launchserver-%s", SecurityHelper.randomStringToken()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,6 +93,7 @@ public void build(Path target, boolean deleteTempFiles) throws IOException {
|
||||||
long time_end = System.currentTimeMillis();
|
long time_end = System.currentTimeMillis();
|
||||||
if (isNeedDelete && deleteTempFiles) IOHelper.move(thisPath, target);
|
if (isNeedDelete && deleteTempFiles) IOHelper.move(thisPath, target);
|
||||||
else IOHelper.copy(thisPath, target);
|
else IOHelper.copy(thisPath, target);
|
||||||
|
IOHelper.deleteDir(buildDir, false);
|
||||||
logger.info("Build successful from {} millis", time_end - time_start);
|
logger.info("Build successful from {} millis", time_end - time_start);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ public abstract class LauncherBinary extends BinaryPipeline {
|
||||||
private volatile byte[] digest;
|
private volatile byte[] digest;
|
||||||
|
|
||||||
protected LauncherBinary(LaunchServer server, Path binaryFile, String nameFormat) {
|
protected LauncherBinary(LaunchServer server, Path binaryFile, String nameFormat) {
|
||||||
super(server.dir.resolve("build"), nameFormat);
|
super(server.tmpDir.resolve("build"), nameFormat);
|
||||||
this.server = server;
|
this.server = server;
|
||||||
syncBinaryFile = binaryFile;
|
syncBinaryFile = binaryFile;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue