From 8ce19b637746828d3d44b71d11731b0f23d24a50 Mon Sep 17 00:00:00 2001 From: "sigonasr2, Sig, Sigo" Date: Tue, 2 Aug 2022 13:23:37 +0000 Subject: [PATCH] testing on sigplace Co-authored-by: sigonasr2 --- Java/scripts/build.sh | 17 +++++++++++++++++ Java/scripts/clean.sh | 4 ++++ Java/scripts/commit.sh | 20 ++++++++++++++++++++ Java/scripts/jar.sh | 17 +++++++++++++++++ Java/scripts/jar2.sh | 1 + Java/scripts/lean.sh | 1 + Java/scripts/md5 | 5 +++++ Java/scripts/release.sh | 1 + Java/scripts/update.sh | 3 +++ Java/scripts/zip.sh | 1 + src/sig/client.java | 9 +++++---- utils/define.sh | 16 +--------------- 12 files changed, 76 insertions(+), 19 deletions(-) create mode 100755 Java/scripts/build.sh create mode 100755 Java/scripts/clean.sh create mode 100755 Java/scripts/commit.sh create mode 100755 Java/scripts/jar.sh create mode 100644 Java/scripts/jar2.sh create mode 100644 Java/scripts/lean.sh create mode 100644 Java/scripts/md5 create mode 100644 Java/scripts/release.sh create mode 100644 Java/scripts/update.sh create mode 100644 Java/scripts/zip.sh diff --git a/Java/scripts/build.sh b/Java/scripts/build.sh new file mode 100755 index 0000000..c5b6b67 --- /dev/null +++ b/Java/scripts/build.sh @@ -0,0 +1,17 @@ +#Builds and runs the project. +#Java +source ${LANGUAGE}/scripts/version_info +javac -source ${SOURCE_VERSION} -target ${TARGET_VERSION} -Xlint:unchecked -cp ${CLASS_PATH} -d ${OUT_DIR} ${PROJECT_DIR}/*.java +printf "\n\n\nRunning Program...\n\n" +ORIGINAL_LOC=$(pwd) +cd $OUT_DIR +if java ${CUSTOM_PARAMS} -cp .:../lib/bin/ -XX:+UseZGC -Djava.library.path="${LIBRARY_PATH}" ${MAIN_CLASS} "$@"; then + ${ORIGINAL_LOC}/${LANGUAGE}/scripts/clean.sh + exit +fi +if java ${CUSTOM_PARAMS} -cp .:../lib/bin/ -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -Djava.library.path="${LIBRARY_PATH}" ${MAIN_CLASS} "$@"; then + ${ORIGINAL_LOC}/${LANGUAGE}/scripts/clean.sh + exit +fi +java ${CUSTOM_PARAMS} -cp .:../lib/bin/ -XX:+PrintCommandLineFlags -Djava.library.path="${LIBRARY_PATH}" ${MAIN_CLASS} "$@" +${ORIGINAL_LOC}/${LANGUAGE}/scripts/clean.sh \ No newline at end of file diff --git a/Java/scripts/clean.sh b/Java/scripts/clean.sh new file mode 100755 index 0000000..0963522 --- /dev/null +++ b/Java/scripts/clean.sh @@ -0,0 +1,4 @@ +#Cleans up and removes unused files. +#Java +find -type f -name *.class -delete +find -type f -name manifest -delete \ No newline at end of file diff --git a/Java/scripts/commit.sh b/Java/scripts/commit.sh new file mode 100755 index 0000000..36b45b5 --- /dev/null +++ b/Java/scripts/commit.sh @@ -0,0 +1,20 @@ +#Adds a commit message and pushes project to github repository. +#Java +COMMIT_MESSAGE="$*" +FIRST_LINE=true +while IFS= read -r line +do +if [ "$FIRST_LINE" = true ]; then + COMMIT_MESSAGE+=" + +Co-authored-by: $line" +FIRST_LINE=false +else + COMMIT_MESSAGE+=" +Co-authored-by: $line" +fi +done < utils/.coauthors +git add -u +git add * +git commit -m "$COMMIT_MESSAGE" +git push \ No newline at end of file diff --git a/Java/scripts/jar.sh b/Java/scripts/jar.sh new file mode 100755 index 0000000..61d1759 --- /dev/null +++ b/Java/scripts/jar.sh @@ -0,0 +1,17 @@ +#Builds a runnable jar file using ${MAIN_CLASS} as an entry point and then runs the newly generated jar. +#Java +source ${LANGUAGE}/scripts/version_info +rm -Rf bin/* +javac -source ${SOURCE_VERSION} -target ${TARGET_VERSION} -Xlint:unchecked -cp ${CLASS_PATH} -d ${OUT_DIR} ${PROJECT_DIR}/${PROJECT_NAME}.java +printf "\n\n\nGenerating Manifest...\n\n" +touch manifest +echo "Main-Class: ${MAIN_CLASS}" > manifest +printf "\n\n\nCreating Jar...\n\n" +ORIGINAL_LOC=$(pwd) +cd ${OUT_DIR} +jar cfm ${PROJECT_NAME}.jar ${ORIGINAL_LOC}/manifest sig +jar uf ${PROJECT_NAME}.jar -C ../lib/bin/ . +printf "\n\n\nRunning Program...\n\n" +java ${CUSTOM_PARAMS} -cp .:../lib/bin -Djava.library.path="${LIBRARY_PATH}" -jar ${PROJECT_NAME}.jar "$@" +${ORIGINAL_LOC}/${LANGUAGE}/scripts/clean.sh +cd .. diff --git a/Java/scripts/jar2.sh b/Java/scripts/jar2.sh new file mode 100644 index 0000000..1becba2 --- /dev/null +++ b/Java/scripts/jar2.sh @@ -0,0 +1 @@ +404: Not Found \ No newline at end of file diff --git a/Java/scripts/lean.sh b/Java/scripts/lean.sh new file mode 100644 index 0000000..1becba2 --- /dev/null +++ b/Java/scripts/lean.sh @@ -0,0 +1 @@ +404: Not Found \ No newline at end of file diff --git a/Java/scripts/md5 b/Java/scripts/md5 new file mode 100644 index 0000000..c4273a3 --- /dev/null +++ b/Java/scripts/md5 @@ -0,0 +1,5 @@ +build.sh:a833e7598ad65672a9c01306d244b49f - +clean.sh:96ce35f2d2dcb555421e00a6afda23ca - +commit.sh:21af1fa6f09d01679c9e11408967264a - +jar.sh:2ac636f584c43a1124affb9ea6bdc7bf - +lean.sh:3be7b8b182ccd96e48989b4e57311193 - diff --git a/Java/scripts/release.sh b/Java/scripts/release.sh new file mode 100644 index 0000000..1becba2 --- /dev/null +++ b/Java/scripts/release.sh @@ -0,0 +1 @@ +404: Not Found \ No newline at end of file diff --git a/Java/scripts/update.sh b/Java/scripts/update.sh new file mode 100644 index 0000000..26af9ea --- /dev/null +++ b/Java/scripts/update.sh @@ -0,0 +1,3 @@ +#Pulls the latest version of the repository. +# +git pull \ No newline at end of file diff --git a/Java/scripts/zip.sh b/Java/scripts/zip.sh new file mode 100644 index 0000000..1becba2 --- /dev/null +++ b/Java/scripts/zip.sh @@ -0,0 +1 @@ +404: Not Found \ No newline at end of file diff --git a/src/sig/client.java b/src/sig/client.java index 32a6069..97b480f 100644 --- a/src/sig/client.java +++ b/src/sig/client.java @@ -37,17 +37,18 @@ public class client { System.out.println(((HttpResponse)res.run()).body()); */ - /* //Regular POST request with body: - POSTRequest postRes = new POSTRequest("https://postman-echo.com/post","Test body"); + POSTRequest postRes = new POSTRequest("https://8080-sigonasr2-sigplace-5j5fknii87n.ws-us54.gitpod.io/","Test a longer body\nwith much more\nlines now.\n\n"); System.out.println(((HttpResponse)postRes.run()).body()); + /* //POST request with body and headers: postRes = new POSTRequest("https://postman-echo.com/post","Test body", 30000, "header1","value1", "header2","value2"); System.out.println(((HttpResponse)postRes.run()).body());*/ - POSTRequest postRes = new POSTRequest("https://postman-echo.com/post",Path.of("..",".gitignore")); - System.out.println(((HttpResponse)postRes.run()).body()); + //POST request with a file. + //POSTRequest postRes = new POSTRequest("https://postman-echo.com/post",Path.of("..",".gitignore")); + //System.out.println(((HttpResponse)postRes.run()).body()); } catch (FailedResponseException e) { e.printStackTrace(); } diff --git a/utils/define.sh b/utils/define.sh index 0926c6c..cc61202 100755 --- a/utils/define.sh +++ b/utils/define.sh @@ -6,18 +6,4 @@ function define() { eval export "$1"='$value' } -if [[ $(pwd) != *"SigScript" ]]; then - source utils/search.sh - - find . -type f -name md5 -delete - - #Check for hashes - FILES=$(cat utils/.updateDirectories) - for f in $FILES - do - search $f - check $f - done -else - echo "Dev build, no checks required." -fi \ No newline at end of file + echo "Dev build, no checks required." \ No newline at end of file