mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
[FEATURE] MirrorHelper support build script
This commit is contained in:
parent
dbeca56b05
commit
93f916192e
5 changed files with 7 additions and 98 deletions
|
@ -85,7 +85,7 @@ pack project(':LauncherAPI')
|
||||||
bundle group: 'org.ow2.asm', name: 'asm-commons', version: rootProject['verAsm']
|
bundle group: 'org.ow2.asm', name: 'asm-commons', version: rootProject['verAsm']
|
||||||
bundle group: 'io.netty', name: 'netty-all', version: rootProject['verNetty']
|
bundle group: 'io.netty', name: 'netty-all', version: rootProject['verNetty']
|
||||||
bundle group: 'org.slf4j', name: 'slf4j-api', version: rootProject['verSlf4j']
|
bundle group: 'org.slf4j', name: 'slf4j-api', version: rootProject['verSlf4j']
|
||||||
bundle group: 'mysql', name: 'mysql-connector-java', version: rootProject['verMySQLConn']
|
bundle group: 'com.mysql', name: 'mysql-connector-j', version: rootProject['verMySQLConn']
|
||||||
bundle group: 'org.postgresql', name: 'postgresql', version: rootProject['verPostgreSQLConn']
|
bundle group: 'org.postgresql', name: 'postgresql', version: rootProject['verPostgreSQLConn']
|
||||||
bundle group: 'com.guardsquare', name: 'proguard-base', version: rootProject['verProguard']
|
bundle group: 'com.guardsquare', name: 'proguard-base', version: rootProject['verProguard']
|
||||||
bundle group: 'org.apache.logging.log4j', name: 'log4j-core', version: rootProject['verLog4j']
|
bundle group: 'org.apache.logging.log4j', name: 'log4j-core', version: rootProject['verLog4j']
|
||||||
|
|
|
@ -10,33 +10,8 @@
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class NewLauncherSettings {
|
public class NewLauncherSettings {
|
||||||
@LauncherNetworkAPI
|
|
||||||
public final transient List<HashedStoreEntry> lastHDirs = new ArrayList<>(16);
|
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
public Map<String, UserSettings> userSettings = new HashMap<>();
|
public Map<String, UserSettings> userSettings = new HashMap<>();
|
||||||
@LauncherNetworkAPI
|
@LauncherNetworkAPI
|
||||||
public List<String> features = new ArrayList<>();
|
|
||||||
@LauncherNetworkAPI
|
|
||||||
public String consoleUnlockKey;
|
public String consoleUnlockKey;
|
||||||
|
|
||||||
public void putHDir(String name, Path path, HashedDir dir) {
|
|
||||||
String fullPath = path.toAbsolutePath().toString();
|
|
||||||
lastHDirs.removeIf((e) -> e.fullPath.equals(fullPath) && e.name.equals(name));
|
|
||||||
HashedStoreEntry e = new HashedStoreEntry(dir, name, fullPath);
|
|
||||||
e.needSave = true;
|
|
||||||
lastHDirs.add(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class HashedStoreEntry {
|
|
||||||
public final HashedDir hdir;
|
|
||||||
public final String name;
|
|
||||||
public final String fullPath;
|
|
||||||
public transient boolean needSave = false;
|
|
||||||
|
|
||||||
public HashedStoreEntry(HashedDir hdir, String name, String fullPath) {
|
|
||||||
this.hdir = hdir;
|
|
||||||
this.name = name;
|
|
||||||
this.fullPath = fullPath;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,48 +44,4 @@ public void setConfig(NewLauncherSettings config) {
|
||||||
public NewLauncherSettings getDefaultConfig() {
|
public NewLauncherSettings getDefaultConfig() {
|
||||||
return new NewLauncherSettings();
|
return new NewLauncherSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadHDirStore(Path storePath) throws IOException {
|
|
||||||
Files.createDirectories(storePath);
|
|
||||||
IOHelper.walk(storePath, new StoreFileVisitor(), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void saveHDirStore(Path storeProjectPath) throws IOException {
|
|
||||||
Files.createDirectories(storeProjectPath);
|
|
||||||
for (NewLauncherSettings.HashedStoreEntry e : settings.lastHDirs) {
|
|
||||||
if (!e.needSave) continue;
|
|
||||||
Path file = storeProjectPath.resolve(e.name.concat(".bin"));
|
|
||||||
if (!Files.exists(file)) Files.createFile(file);
|
|
||||||
try (HOutput output = new HOutput(IOHelper.newOutput(file))) {
|
|
||||||
output.writeString(e.name, 128);
|
|
||||||
output.writeString(e.fullPath, 1024);
|
|
||||||
e.hdir.write(output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadHDirStore() throws IOException {
|
|
||||||
loadHDirStore(DirBridge.dirStore);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void saveHDirStore() throws IOException {
|
|
||||||
saveHDirStore(DirBridge.dirProjectStore);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class StoreFileVisitor extends SimpleFileVisitor<Path> {
|
|
||||||
@Override
|
|
||||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
|
|
||||||
throws IOException {
|
|
||||||
try (HInput input = new HInput(IOHelper.newInput(file))) {
|
|
||||||
String dirName = input.readString(128);
|
|
||||||
String fullPath = input.readString(1024);
|
|
||||||
HashedDir dir = new HashedDir(input);
|
|
||||||
settings.lastHDirs.add(new NewLauncherSettings.HashedStoreEntry(dir, dirName, fullPath));
|
|
||||||
} catch (IOException e) {
|
|
||||||
LogHelper.error("Skip file %s exception: %s", file.toAbsolutePath().toString(), e.getMessage());
|
|
||||||
}
|
|
||||||
return super.visitFile(file, attrs);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,10 +19,6 @@ public class DirBridge {
|
||||||
|
|
||||||
public static Path dir;
|
public static Path dir;
|
||||||
|
|
||||||
public static Path dirStore;
|
|
||||||
|
|
||||||
public static Path dirProjectStore;
|
|
||||||
|
|
||||||
public static Path dirUpdates;
|
public static Path dirUpdates;
|
||||||
|
|
||||||
public static Path defaultUpdatesDir;
|
public static Path defaultUpdatesDir;
|
||||||
|
@ -36,10 +32,6 @@ public class DirBridge {
|
||||||
if (!IOHelper.exists(DirBridge.dir)) Files.createDirectories(DirBridge.dir);
|
if (!IOHelper.exists(DirBridge.dir)) Files.createDirectories(DirBridge.dir);
|
||||||
DirBridge.defaultUpdatesDir = DirBridge.dir.resolve("updates");
|
DirBridge.defaultUpdatesDir = DirBridge.dir.resolve("updates");
|
||||||
if (!IOHelper.exists(DirBridge.defaultUpdatesDir)) Files.createDirectories(DirBridge.defaultUpdatesDir);
|
if (!IOHelper.exists(DirBridge.defaultUpdatesDir)) Files.createDirectories(DirBridge.defaultUpdatesDir);
|
||||||
DirBridge.dirStore = getStoreDir(projectName);
|
|
||||||
if (!IOHelper.exists(DirBridge.dirStore)) Files.createDirectories(DirBridge.dirStore);
|
|
||||||
DirBridge.dirProjectStore = getProjectStoreDir(projectName);
|
|
||||||
if (!IOHelper.exists(DirBridge.dirProjectStore)) Files.createDirectories(DirBridge.dirProjectStore);
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LogHelper.error(e);
|
LogHelper.error(e);
|
||||||
}
|
}
|
||||||
|
@ -95,19 +87,6 @@ public static Path getLauncherDir(String projectname) throws IOException {
|
||||||
return getAppDataDir().resolve(projectname);
|
return getAppDataDir().resolve(projectname);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Path getStoreDir(String projectname) throws IOException {
|
|
||||||
if (JVMHelper.OS_TYPE == JVMHelper.OS.LINUX)
|
|
||||||
return getAppDataDir().resolve("store");
|
|
||||||
else if (JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE)
|
|
||||||
return getAppDataDir().resolve("GravitLauncherStore");
|
|
||||||
else
|
|
||||||
return getAppDataDir().resolve("minecraftStore");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Path getProjectStoreDir(String projectname) throws IOException {
|
|
||||||
return getStoreDir(projectname).resolve(projectname);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Path getGuardDir() {
|
public static Path getGuardDir() {
|
||||||
return dir.resolve("guard");
|
return dir.resolve("guard");
|
||||||
}
|
}
|
||||||
|
|
13
props.gradle
13
props.gradle
|
@ -1,7 +1,7 @@
|
||||||
project.ext {
|
project.ext {
|
||||||
verAsm = '9.5'
|
verAsm = '9.6'
|
||||||
verNetty = '4.1.94.Final'
|
verNetty = '4.1.99.Final'
|
||||||
verOshiCore = '6.4.4'
|
verOshiCore = '6.4.6'
|
||||||
verJunit = '5.9.3'
|
verJunit = '5.9.3'
|
||||||
verGuavaC = '30.1.1-jre'
|
verGuavaC = '30.1.1-jre'
|
||||||
verJansi = '2.4.0'
|
verJansi = '2.4.0'
|
||||||
|
@ -11,10 +11,9 @@
|
||||||
verGson = '2.10.1'
|
verGson = '2.10.1'
|
||||||
verBcpkix = '1.70'
|
verBcpkix = '1.70'
|
||||||
verSlf4j = '1.7.36'
|
verSlf4j = '1.7.36'
|
||||||
verLog4j = '2.19.0'
|
verLog4j = '2.20.0'
|
||||||
verMySQLConn = '8.0.33'
|
verMySQLConn = '8.1.0'
|
||||||
verPostgreSQLConn = '42.6.0'
|
verPostgreSQLConn = '42.6.0'
|
||||||
verProguard = '7.3.2'
|
verProguard = '7.4.0-beta02'
|
||||||
verLaunch4j = '3.50'
|
verLaunch4j = '3.50'
|
||||||
verHibernate = '5.5.6.Final'
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue