Refactor: gradle update

This commit is contained in:
harlekin
2021-05-11 15:36:59 +00:00
committed by Sheepit Renderfarm
parent 3f4a45c2c4
commit 624b3d2234
8 changed files with 53 additions and 76 deletions

View File

@@ -1,13 +1,7 @@
buildscript { plugins {
repositories { id 'java-library'
jcenter() id 'com.github.johnrengelman.shadow' version '7.0.0'
} }
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.4'
}
}
apply plugin: 'java'
apply plugin: 'com.github.johnrengelman.shadow'
sourceCompatibility = '1.8' sourceCompatibility = '1.8'
targetCompatibility = '1.8' targetCompatibility = '1.8'
@@ -24,22 +18,22 @@ shadowJar {
} }
repositories { repositories {
jcenter()
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
compileOnly 'org.projectlombok:lombok:1.18.12' compileOnly 'org.projectlombok:lombok:1.18.20'
annotationProcessor 'org.projectlombok:lombok:1.18.12' annotationProcessor 'org.projectlombok:lombok:1.18.20'
compile 'args4j:args4j:2.33' implementation 'args4j:args4j:2.33'
compile 'net.lingala.zip4j:zip4j:1.3.3' implementation group: 'net.lingala.zip4j', name: 'zip4j', version: '2.7.0'
compile 'net.java.dev.jna:jna-platform:5.0.0' implementation 'net.java.dev.jna:jna-platform:5.0.0' // couldnt upgrade
compile 'org.simpleframework:simple-xml:2.7.1' implementation 'org.simpleframework:simple-xml:2.7.1'
compile 'javax.xml.bind:jaxb-api:2.3.1' implementation 'javax.xml.bind:jaxb-api:2.3.1'
implementation 'com.formdev:flatlaf:0.30' implementation 'com.formdev:flatlaf:1.1.2'
implementation 'com.squareup.okhttp3:okhttp:4.7.2' implementation 'com.squareup.okhttp3:okhttp:4.7.2'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:4.7.2' implementation 'com.squareup.okhttp3:okhttp-urlconnection:4.7.2'
// implementation "com.squareup.okhttp3:okhttp:4.9.0" //missing JavaNetCookieJar
} }
jar { jar {
@@ -48,7 +42,7 @@ jar {
} }
from { from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } configurations.implementation.collect { it.isDirectory() ? it : zipTree(it) }
} }
} }

Binary file not shown.

View File

@@ -1,6 +1,5 @@
#Fri Apr 10 00:43:49 CST 2020
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

2
gradlew vendored
View File

@@ -82,6 +82,7 @@ esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -129,6 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"` APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"` JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath # We build the pattern for arguments to be converted via cygpath

22
gradlew.bat vendored
View File

@@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init if "%ERRORLEVEL%" == "0" goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -54,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=% set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init if exist "%JAVA_EXE%" goto execute
echo. echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -64,28 +64,14 @@ echo location of your Java installation.
goto fail goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell

View File

@@ -19,6 +19,14 @@
package com.sheepit.client; package com.sheepit.client;
import com.sheepit.client.Configuration.ComputeType;
import com.sheepit.client.Error.Type;
import com.sheepit.client.hardware.cpu.CPU;
import com.sheepit.client.hardware.gpu.opencl.OpenCL;
import com.sheepit.client.os.OS;
import lombok.Data;
import lombok.Getter;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileWriter; import java.io.FileWriter;
@@ -40,16 +48,8 @@ import java.util.Observer;
import java.util.TimeZone; import java.util.TimeZone;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import java.util.regex.Pattern;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.sheepit.client.Configuration.ComputeType;
import com.sheepit.client.Error.Type;
import com.sheepit.client.hardware.cpu.CPU;
import com.sheepit.client.hardware.gpu.opencl.OpenCL;
import com.sheepit.client.os.OS;
import lombok.Data;
import lombok.Getter;
@Data public class Job { @Data public class Job {
public static final String UPDATE_METHOD_BY_REMAINING_TIME = "remainingtime"; public static final String UPDATE_METHOD_BY_REMAINING_TIME = "remainingtime";
@@ -70,7 +70,7 @@ import lombok.Getter;
private String script; private String script;
private boolean useGPU; private boolean useGPU;
private String name; private String name;
private String password; private char[] password;
private String extras; private String extras;
private String updateRenderingStatusMethod; private String updateRenderingStatusMethod;
private String blenderShortVersion; private String blenderShortVersion;
@@ -85,7 +85,7 @@ import lombok.Getter;
private Log log; private Log log;
public Job(Configuration config_, Gui gui_, Log log_, String id_, String frame_, String path_, boolean use_gpu, String command_, String validationUrl_, public Job(Configuration config_, Gui gui_, Log log_, String id_, String frame_, String path_, boolean use_gpu, String command_, String validationUrl_,
String script_, String sceneMd5_, String rendererMd5_, String name_, String password_, String extras_, boolean synchronous_upload_, String script_, String sceneMd5_, String rendererMd5_, String name_, char[] password_, String extras_, boolean synchronous_upload_,
String update_method_) { String update_method_) {
configuration = config_; configuration = config_;
id = id_; id = id_;
@@ -208,16 +208,16 @@ import lombok.Getter;
core_script += ignore_signal_script; core_script += ignore_signal_script;
File script_file = null; File script_file = null;
String command1[] = getRendererCommand().split(" "); String[] command1 = getRendererCommand().split(" ");
int size_command = command1.length + 2; // + 2 for script int size_command = command1.length + 2; // + 2 for script
if (configuration.getNbCores() > 0) { // user has specified something if (configuration.getNbCores() > 0) { // user has specified something
size_command += 2; size_command += 2;
} }
List<String> command = new ArrayList<String>(size_command); List<String> command = new ArrayList<>(size_command);
Map<String, String> new_env = new HashMap<String, String>(); Map<String, String> new_env = new HashMap<>();
new_env.put("BLENDER_USER_CONFIG", configuration.getWorkingDirectory().getAbsolutePath().replace("\\", "\\\\")); new_env.put("BLENDER_USER_CONFIG", configuration.getWorkingDirectory().getAbsolutePath().replace("\\", "\\\\"));
new_env.put("TEMP", configuration.getWorkingDirectory().getAbsolutePath().replace("\\", "\\\\")); new_env.put("TEMP", configuration.getWorkingDirectory().getAbsolutePath().replace("\\", "\\\\"));
@@ -366,7 +366,7 @@ import lombok.Getter;
return error; return error;
} }
if (event.isStarted() == false && (process.getMemoryUsed() > 0 || process.getRemainingDuration() > 0)) { if (!event.isStarted() && (process.getMemoryUsed() > 0 || process.getRemainingDuration() > 0)) {
event.doNotifyIsStarted(); event.doNotifyIsStarted();
} }
} }
@@ -581,7 +581,7 @@ import lombok.Getter;
String[] elements = line.toLowerCase().split("(peak)"); String[] elements = line.toLowerCase().split("(peak)");
for (String element : elements) { for (String element : elements) {
if (element.isEmpty() == false && element.charAt(0) == ' ') { if (!element.isEmpty() && element.charAt(0) == ' ') {
int end = element.indexOf(')'); int end = element.indexOf(')');
if (end > 0) { if (end > 0) {
try { try {
@@ -596,7 +596,7 @@ import lombok.Getter;
} }
} }
else { else {
if (element.isEmpty() == false && element.charAt(0) == ':') { if (!element.isEmpty() && element.charAt(0) == ':') {
int end = element.indexOf('|'); int end = element.indexOf('|');
if (end > 0) { if (end > 0) {
try { try {

View File

@@ -19,6 +19,15 @@
package com.sheepit.client; package com.sheepit.client;
import com.sheepit.client.Error.ServerCode;
import com.sheepit.client.exception.FermeExceptionNoSpaceLeftOnDevice;
import net.lingala.zip4j.ZipFile;
import net.lingala.zip4j.exception.ZipException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import javax.xml.bind.DatatypeConverter;
import java.io.BufferedInputStream; import java.io.BufferedInputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
@@ -38,31 +47,18 @@ import java.util.TimeZone;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import javax.xml.bind.DatatypeConverter;
import net.lingala.zip4j.model.UnzipParameters;
import net.lingala.zip4j.core.ZipFile;
import net.lingala.zip4j.exception.ZipException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import com.sheepit.client.Error.ServerCode;
import com.sheepit.client.exception.FermeExceptionNoSpaceLeftOnDevice;
public class Utils { public class Utils {
public static int unzipFileIntoDirectory(String zipFileName_, String destinationDirectory, String password, Log log) public static int unzipFileIntoDirectory(String zipFileName_, String destinationDirectory, char[] password, Log log)
throws FermeExceptionNoSpaceLeftOnDevice { throws FermeExceptionNoSpaceLeftOnDevice {
try { try {
ZipFile zipFile = new ZipFile(zipFileName_); ZipFile zipFile = new ZipFile(zipFileName_);
UnzipParameters unzipParameters = new UnzipParameters(); // unzipParameters.setIgnoreDateTimeAttributes(true);
unzipParameters.setIgnoreDateTimeAttributes(true);
if (password != null && zipFile.isEncrypted()) { if (password != null && zipFile.isEncrypted()) {
zipFile.setPassword(password); zipFile.setPassword(password);
} }
zipFile.extractAll(destinationDirectory, unzipParameters); // zipFile.extractAll(destinationDirectory, unzipParameters);
zipFile.extractAll(destinationDirectory);
} }
catch (ZipException e) { catch (ZipException e) {
StringWriter sw = new StringWriter(); StringWriter sw = new StringWriter();
@@ -135,7 +131,7 @@ public class Utils {
return; return;
} }
if (file.isDirectory()) { if (file.isDirectory()) {
String files[] = file.list(); String[] files = file.list();
if (files != null) { if (files != null) {
if (files.length != 0) { if (files.length != 0) {
for (String temp : files) { for (String temp : files) {

View File

@@ -26,7 +26,7 @@ import org.simpleframework.xml.Root;
@Attribute(name = "name") @Getter private String name; @Attribute(name = "name") @Getter private String name;
@Attribute(name = "password") @Getter private String password; @Attribute(name = "password") @Getter private char[] password;
@Element(name = "renderer") @Getter private RendererInfos rendererInfos; @Element(name = "renderer") @Getter private RendererInfos rendererInfos;