-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Merge pull request #401 from Bram-Hub/gradle"
- Loading branch information
1 parent
9aa5f72
commit fc870fd
Showing
33 changed files
with
2,200 additions
and
322 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
plugins { | ||
id 'java' | ||
id 'edu.sc.seis.launch4j' version '2.5.3' | ||
id 'kr.motd.sphinx' version '2.10.0' | ||
} | ||
|
||
version '2.0.0' | ||
|
||
apply plugin: 'java' | ||
apply plugin: 'application' | ||
apply plugin: 'checkstyle' | ||
mainClassName = 'edu.rpi.legup.Legup' | ||
|
||
sourceCompatibility = 1.8 | ||
|
||
dependencies { | ||
implementation 'org.jetbrains:annotations:20.1.0' | ||
implementation 'org.jetbrains:annotations:20.1.0' | ||
compile project(':legup-update') | ||
compile 'com.google.firebase:firebase-admin:6.3.0' | ||
compile 'org.apache.httpcomponents:httpclient:4.5.1' | ||
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25' | ||
compile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.25' | ||
|
||
// compile 'com.google.code.gson:gson:2.8.2' | ||
// compile 'commons-cli:commons-cli:1.4' | ||
// compile 'commons-io:commons-io:2.6' | ||
compile 'org.apache.commons:commons-lang3:3.12.0' | ||
compile 'org.apache.logging.log4j:log4j-api:2.17.2' | ||
compile 'org.apache.logging.log4j:log4j-core:2.17.2' | ||
|
||
testCompile group: 'junit', name: 'junit', version: '4.12' | ||
testCompile 'junit:junit:4.+' | ||
} | ||
|
||
task customFatJar(type: Jar) { | ||
manifest { | ||
attributes('Implementation-Title': 'Legup', | ||
'Implementation-Version': version, | ||
'Main-Class': 'edu.rpi.legup.Legup', | ||
'SplashScreen-Image': 'edu/rpi/legup/images/Legup/LegupSplash.png') | ||
} | ||
archiveName = 'Legup.jar' | ||
baseName = 'Legup.jar' | ||
from { | ||
configurations.compile.collect { | ||
it.isDirectory() ? it : zipTree(it) | ||
} | ||
} | ||
with jar | ||
} | ||
|
||
jar { | ||
from { | ||
configurations.compile.collect { | ||
it.isDirectory() ? it : zipTree(it) | ||
} | ||
configurations.runtime.collect { | ||
it.isDirectory() ? it : zipTree(it) | ||
} | ||
} | ||
manifest { | ||
attributes('Implementation-Title': 'Legup', | ||
'Implementation-Version': version, | ||
'Main-Class': 'edu.rpi.legup.Legup', | ||
'SplashScreen-Image': 'edu/rpi/legup/images/Legup/LegupSplash.png') | ||
} | ||
archiveName = 'Legup.jar' | ||
} | ||
|
||
/* | ||
* CREATES NATIVE WINDOWS EXECUTABLE | ||
* Launches launch4j to create an executable (.exe) file wrapping the jar | ||
* THIS IS NOT THE INSTALLER | ||
* Add "icon = 'path/to/icon.ico'" to set an icon for the executable | ||
*/ | ||
createExe() { | ||
mainClassName = 'edu.rpi.legup.Legup' | ||
outputDir = '../native/windows' | ||
outfile = 'bin/Legup.exe' | ||
bundledJrePath = 'jre' | ||
bundledJre64Bit = true | ||
jdkPreference = 'preferJre' | ||
jreMinVersion = '1.8.0' | ||
jreRuntimeBits = '64/32' | ||
} | ||
|
||
/* | ||
* CREATES NATIVE WINDOWS INSTALLER -- ONLY RUNS ON WINDOWS | ||
* Runs the shipped version of Inno Setup (6.2) to compile the installer | ||
* Modify the setup settings in native/windows/legup_inno_setup.iss | ||
* | ||
* Modifications are likely required to run the setup script on your computer: | ||
* Edit the "CHANGE ME" line in native/windows/legup_inno_setup.iss to reflect | ||
* the path to the Java installation you want to ship inside the executable. | ||
*/ | ||
task buildNativeWindows(type: Exec, dependsOn: 'createExe') { | ||
jar | ||
createExe | ||
|
||
workingDir = "${buildDir}/../native/windows" | ||
commandLine 'cmd', '/c', 'make_windows_installer.bat' | ||
} | ||
|
||
|
||
repositories { | ||
mavenCentral() | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
plugins { | ||
id 'java' | ||
} | ||
|
||
version '2.0' | ||
|
||
sourceCompatibility = 1.8 | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
compile 'com.google.code.gson:gson:2.8.2' | ||
compile 'commons-cli:commons-cli:1.4' | ||
compile 'commons-io:commons-io:2.6' | ||
compile 'org.apache.commons:commons-lang3:3.7' | ||
compile 'org.apache.logging.log4j:log4j-api:2.10.0' | ||
compile 'org.apache.logging.log4j:log4j-core:2.10.0' | ||
|
||
testCompile group: 'junit', name: 'junit', version: '4.12' | ||
} |
112 changes: 112 additions & 0 deletions
112
legup-update/src/main/java/edu/rpi/legupupdate/NetUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
package edu.rpi.legupupdate; | ||
|
||
import java.sql.Timestamp; | ||
import java.text.SimpleDateFormat; | ||
import java.time.LocalDateTime; | ||
import java.time.ZoneId; | ||
import java.time.ZoneOffset; | ||
import java.time.ZonedDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
public class NetUtil { | ||
|
||
public static final String ARIS_NAME = "Aris-Java"; | ||
public static final String AUTH_BAN = "AUTH BAN"; | ||
public static final String AUTH_FAIL = "AUTH FAIL"; | ||
public static final String AUTH_OK = "AUTH OK"; | ||
public static final String AUTH_ERR = "AUTH UNKNOWN_ERROR"; | ||
public static final String AUTH_INVALID = "AUTH INVALID"; | ||
public static final String AUTH = "AUTH"; | ||
public static final String AUTH_PASS = "PASS"; | ||
public static final String AUTH_ACCESS_TOKEN = "TOKEN"; | ||
|
||
public static final String USER_STUDENT = "student"; | ||
public static final String USER_INSTRUCTOR = "instructor"; | ||
|
||
public static final long MAX_FILE_SIZE = 5242880; // 5MiB | ||
public static final String UNAUTHORIZED = "UNAUTHORIZED"; | ||
public static final String ERROR = "UNKNOWN_ERROR"; | ||
public static final String OK = "OK"; | ||
public static final String INVALID = "INVALID"; | ||
|
||
public static final String INVALID_VERSION = "INVALID VERSION"; | ||
public static final String VERSION_OK = "VERSION OK"; | ||
public static final String DONE = "DONE"; | ||
public static final String USER_EXISTS = "EXISTS"; | ||
|
||
public static final String STATUS_GRADING = "Grading"; | ||
public static final String STATUS_CORRECT = "Correct"; | ||
public static final String STATUS_INCORRECT = "Incorrect"; | ||
public static final String STATUS_ERROR = "Grading Error. Please Resubmit"; | ||
public static final String STATUS_NO_SUBMISSION = "No Submissions"; | ||
|
||
public static final int SOCKET_TIMEOUT = 15000; | ||
public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
public static final DateTimeFormatter ZDT_FORMAT = DateTimeFormatter.ISO_DATE_TIME; | ||
public static final String TOO_LARGE = "TOO_LARGE"; | ||
public static final String NO_DATA = "NO_DATA"; | ||
public static final String RENAME = "RENAME"; | ||
public static final String ADD_PROOF = "ADD_PROOF"; | ||
public static final String REMOVE_PROOF = "REMOVE_PROOF"; | ||
public static final String CHANGE_DUE = "CHANGE_DUE"; | ||
public static final String UPLOAD = "UPLOAD"; | ||
|
||
/** | ||
* Compares two version strings. | ||
* <p> | ||
* Use this instead of String.compareTo() for a non-lexicographical | ||
* comparison that works for version strings. e.g. "1.10".compareTo("1.6"). | ||
* <p> | ||
* <p> | ||
* <p> | ||
* Note: It does not work if "1.10" is supposed to be equal to "1.10.0". | ||
* | ||
* @param str1 a string of ordinal numbers separated by decimal points. | ||
* @param str2 a string of ordinal numbers separated by decimal points. | ||
* @return The result is a negative integer if str1 is numerically less than str2. | ||
* The result is a positive integer if str1 is numerically greater than str2. | ||
* The result is zero if the strings are numerically equal. | ||
*/ | ||
public static int versionCompare(String str1, String str2) { | ||
String[] vals1 = str1.split("\\."); | ||
String[] vals2 = str2.split("\\."); | ||
int i = 0; | ||
// set index to first non-equal ordinal or length of shortest version string | ||
while (i < vals1.length && i < vals2.length && vals1[i].equals(vals2[i])) { | ||
i++; | ||
} | ||
// compare first non-equal ordinal number | ||
if (i < vals1.length && i < vals2.length) { | ||
int diff = Integer.valueOf(vals1[i]).compareTo(Integer.valueOf(vals2[i])); | ||
return Integer.signum(diff); | ||
} | ||
// the strings are equal or one string is a substring of the other | ||
// e.g. "1.2.3" = "1.2.3" or "1.2.3" < "1.2.3.4" | ||
return Integer.signum(vals1.length - vals2.length); | ||
} | ||
|
||
public static ZonedDateTime localToUTC(LocalDateTime localDateTime) { | ||
return localDateTime.atZone(ZoneId.systemDefault()).withZoneSameInstant(ZoneOffset.UTC); | ||
} | ||
|
||
public static ZonedDateTime zoneToUTC(ZonedDateTime dateTime) { | ||
return dateTime.withZoneSameInstant(ZoneOffset.UTC); | ||
} | ||
|
||
public static LocalDateTime UTCToLocal(ZonedDateTime utcTime) { | ||
return utcTime.withZoneSameInstant(ZoneId.systemDefault()).toLocalDateTime(); | ||
} | ||
|
||
public static Timestamp ZDTToTimestamp(ZonedDateTime zdt) { | ||
return new Timestamp(UTCToMilli(zoneToUTC(zdt))); | ||
} | ||
|
||
public static ZonedDateTime zoneToLocal(ZonedDateTime dateTime) { | ||
return dateTime.withZoneSameInstant(ZoneOffset.systemDefault()); | ||
} | ||
|
||
public static long UTCToMilli(ZonedDateTime utcTime) { | ||
return zoneToLocal(utcTime).toInstant().toEpochMilli(); | ||
} | ||
|
||
} |
Oops, something went wrong.