Skip to content

Commit

Permalink
Revert "Merge pull request #401 from Bram-Hub/gradle"
Browse files Browse the repository at this point in the history
This reverts commit 9aa5f72, reversing
changes made to a555792.
  • Loading branch information
charlestian23 committed Jan 7, 2023
1 parent 9aa5f72 commit fc870fd
Show file tree
Hide file tree
Showing 33 changed files with 2,200 additions and 322 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/publish-javadoc.yml

This file was deleted.

4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img src="https://user-images.githubusercontent.com/46334090/180582690-a65937c6-6766-40f7-a21e-c1d8bbb3b26a.png">
<img src="https://user-images.githubusercontent.com/46334090/180582690-a65937c6-6766-40f7-a21e-c1d8bbb3b26a.png"></a>
<br />
<br />
<a href="https://choosealicense.com/licenses/gpl-3.0/"><img src="https://img.shields.io/badge/license-GPL%203.0-red" alt="GPL 3.0 License"></a>
Expand Down Expand Up @@ -47,8 +47,6 @@ Additionally, if you are interested in computer science and programming, please
## Documentation
Documentation is actively being worked on on the [Legup wiki](https://github.com/Bram-Hub/Legup/wiki).

The Javadocs for our application are currently hosted directly on [our Github Pages site](https://bram-hub.github.io/Legup/).

Documentation is very much in the early stages, and we would greatly appreciate anyone who is willing to help write and structure the documentation. Currently, the priority is to write detailed documentation on how Nurikabe works, as it is the puzzle that is the most developed within Legup.

## Contributing
Expand Down
108 changes: 108 additions & 0 deletions build.gradle
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()
}
90 changes: 0 additions & 90 deletions build.gradle.kts

This file was deleted.

2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
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
Empty file modified gradlew
100755 → 100644
Empty file.
1 change: 1 addition & 0 deletions legup-update/bin/main/edu.rpi.legupupdate/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.0.0
22 changes: 22 additions & 0 deletions legup-update/build.gradle
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 legup-update/src/main/java/edu/rpi/legupupdate/NetUtil.java
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();
}

}
Loading

0 comments on commit fc870fd

Please sign in to comment.