diff options
author | ene <ene@sils.li> | 2023-02-25 07:54:37 +0100 |
---|---|---|
committer | ene <ene@sils.li> | 2023-02-25 07:54:37 +0100 |
commit | 06696ca201682f63ea50da3ab41d992ed6b61816 (patch) | |
tree | 93152237a2e968cd433d1ca21671dcba52e772b8 /home-manager/packages/scripts/deprecated/java_compiler/no-pack | |
parent | Fix(hosts): Update UUIDs for mammun hosts (diff) | |
download | nixos-config-06696ca201682f63ea50da3ab41d992ed6b61816.tar.gz nixos-config-06696ca201682f63ea50da3ab41d992ed6b61816.zip |
Feat(packages): Add my scripts
Diffstat (limited to '')
-rwxr-xr-x | home-manager/packages/scripts/deprecated/java_compiler/no-pack/jc-no-pack | 22 | ||||
-rwxr-xr-x | home-manager/packages/scripts/deprecated/java_compiler/no-pack/jj-no-pack | 57 |
2 files changed, 79 insertions, 0 deletions
diff --git a/home-manager/packages/scripts/deprecated/java_compiler/no-pack/jc-no-pack b/home-manager/packages/scripts/deprecated/java_compiler/no-pack/jc-no-pack new file mode 100755 index 00000000..bc9db9de --- /dev/null +++ b/home-manager/packages/scripts/deprecated/java_compiler/no-pack/jc-no-pack @@ -0,0 +1,22 @@ +#!/bin/sh +# shellcheck disable=SC2086 + +. ./lib +cd .. + +export CLASSPATH= +scr=$(mktemp) + +while IFS= read -r a;do + export CLASSPATH=$CLASSPATH$a: +done < "$(tmp "find libs/ | sed 1d")" + +while IFS= read -r a;do + echo "$a" >> $scr +done < "$(tmp "find scr/ | sed 1d")" + +javac -d target/ $(cat $scr | tr '\n' ' ') +../jj target/ libs/ +[ "$1" = "r" ] && java -jar out/myJar.jar + +rm $scr diff --git a/home-manager/packages/scripts/deprecated/java_compiler/no-pack/jj-no-pack b/home-manager/packages/scripts/deprecated/java_compiler/no-pack/jj-no-pack new file mode 100755 index 00000000..90a9e74e --- /dev/null +++ b/home-manager/packages/scripts/deprecated/java_compiler/no-pack/jj-no-pack @@ -0,0 +1,57 @@ +#!/bin/sh +# shellcheck disable=SC2086 +. ./lib + +help() { +cat << EOF +Add all dirs with trailing / + +\$1 = java .class files dir +\$2 = java .jar files dir + +if you want to update libs delete this: +"$wd"/libs.cache + +EOF +exit 0 +} + + +class=$(mktemp) +jar=$(mktemp) +pwd=$(pwd) + +mkdir "$pwd"/out/cache 2> /dev/null +wd="$pwd"/out/cache +[ "$1" = "-h" ] && help +[ "$1" = "--help" ] && help + +[ -z "$1" ] && echo "no args" && help && exit 1 +[ -z "$2" ] && echo "no args" && help && exit 1 + +while IFS= read -r i;do + cp "$i" $wd/"$(basename $i)" +done < "$(tmp "find $1 | sed 1d" )" + +while IFS= read -r i;do + if ! grep "^$i$" "$wd"/libs.cache;then + echo "$i" | sed "s|$2||" >> "$wd"/libs.cache + cd $wd + jar -xf "$pwd"/"$i" + cd $pwd + fi +done < "$(tmp "find $2 | sed 1d" )" + +while IFS= read -r a;do + echo "$a" | sed "s|$wd/||" >> $jar +done < "$(tmp "find $wd | sed 1d")" + + + +cd "$wd" || die "No $wd" +jar -c -f myJar.jar -e Main $(cat $jar | tr '\n' ' ') + +mv myJar.jar "$pwd"/out/myJar.jar + +rm $jar +rm $class |