diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 8fa236a..e5a7da7 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -6,10 +6,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
+ - uses: cachix/install-nix-action@v18
- name: Build project
- run: |
- export PATH=$ANDROID_HOME/build-tools/32.0.0:$PATH
- lein uberdex
+ run: "nix develop -c lein uberdex"
- name: Upload desktop build
uses: actions/upload-artifact@v3
with:
diff --git a/.idea/extra-logging.iml b/.idea/extra-logging.iml
index 8460777..d49dbe0 100644
--- a/.idea/extra-logging.iml
+++ b/.idea/extra-logging.iml
@@ -14,6 +14,7 @@
+
diff --git a/.idea/runConfigurations/android.xml b/.idea/runConfigurations/Android_build.xml
similarity index 76%
rename from .idea/runConfigurations/android.xml
rename to .idea/runConfigurations/Android_build.xml
index 6470bce..051ff20 100644
--- a/.idea/runConfigurations/android.xml
+++ b/.idea/runConfigurations/Android_build.xml
@@ -1,6 +1,6 @@
-
-
+
+
@@ -9,7 +9,7 @@
-
+
diff --git a/.idea/runConfigurations/Desktop_build.xml b/.idea/runConfigurations/Desktop_build.xml
new file mode 100644
index 0000000..4fdd17f
--- /dev/null
+++ b/.idea/runConfigurations/Desktop_build.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations/foo.xml b/.idea/runConfigurations/Foo.xml
similarity index 73%
rename from .idea/runConfigurations/foo.xml
rename to .idea/runConfigurations/Foo.xml
index 67078b7..748c4fa 100644
--- a/.idea/runConfigurations/foo.xml
+++ b/.idea/runConfigurations/Foo.xml
@@ -1,6 +1,6 @@
-
-
+
+
@@ -9,7 +9,7 @@
-
+
diff --git a/.idea/runConfigurations/vanilla.xml b/.idea/runConfigurations/Vanilla.xml
similarity index 73%
rename from .idea/runConfigurations/vanilla.xml
rename to .idea/runConfigurations/Vanilla.xml
index f4ce59a..fa5c59c 100644
--- a/.idea/runConfigurations/vanilla.xml
+++ b/.idea/runConfigurations/Vanilla.xml
@@ -1,6 +1,6 @@
-
-
+
+
@@ -9,7 +9,7 @@
-
+
diff --git a/flake.lock b/flake.lock
new file mode 100644
index 0000000..c60cf66
--- /dev/null
+++ b/flake.lock
@@ -0,0 +1,90 @@
+{
+ "nodes": {
+ "android": {
+ "inputs": {
+ "devshell": "devshell",
+ "flake-utils": "flake-utils",
+ "nixpkgs": [
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1674418837,
+ "narHash": "sha256-UGgO9ARQeov7Y4S4sOvvdCjl5Hj+oKXV1OTwD1OEZkE=",
+ "owner": "tadfisher",
+ "repo": "android-nixpkgs",
+ "rev": "d8eb3f3b71f023b176cc5c3af07a27184218a75e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "tadfisher",
+ "ref": "stable",
+ "repo": "android-nixpkgs",
+ "type": "github"
+ }
+ },
+ "devshell": {
+ "inputs": {
+ "flake-utils": [
+ "android",
+ "nixpkgs"
+ ],
+ "nixpkgs": [
+ "android",
+ "nixpkgs"
+ ]
+ },
+ "locked": {
+ "lastModified": 1671489820,
+ "narHash": "sha256-qoei5HDJ8psd1YUPD7DhbHdhLIT9L2nadscp4Qk37uk=",
+ "owner": "numtide",
+ "repo": "devshell",
+ "rev": "5aa3a8039c68b4bf869327446590f4cdf90bb634",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "devshell",
+ "type": "github"
+ }
+ },
+ "flake-utils": {
+ "locked": {
+ "lastModified": 1667395993,
+ "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
+ "nixpkgs": {
+ "locked": {
+ "lastModified": 1674412549,
+ "narHash": "sha256-wqZIlr/KIYnxoO13bhBCaXeB+fafOcd1aUg9fOE8PN0=",
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "rev": "7eb824334de36d6fe7a15c95a958e00a50eac319",
+ "type": "github"
+ },
+ "original": {
+ "owner": "NixOS",
+ "repo": "nixpkgs",
+ "type": "github"
+ }
+ },
+ "root": {
+ "inputs": {
+ "android": "android",
+ "nixpkgs": "nixpkgs"
+ }
+ }
+ },
+ "root": "root",
+ "version": 7
+}
diff --git a/flake.nix b/flake.nix
new file mode 100644
index 0000000..cb8bdab
--- /dev/null
+++ b/flake.nix
@@ -0,0 +1,38 @@
+{
+ description = "Extra Logging development shell";
+
+ inputs = {
+ nixpkgs.url = "github:NixOS/nixpkgs";
+ android = {
+ url = "github:tadfisher/android-nixpkgs/stable";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
+ };
+
+ outputs = { self, nixpkgs, android }:
+ with nixpkgs.legacyPackages.x86_64-linux;
+ let
+ android-sdk = android.sdk.x86_64-linux (sdkPkgs: with sdkPkgs; [
+ cmdline-tools-latest
+ build-tools-32-0-0
+ emulator
+ # platform-tools
+ platforms-android-32
+ ]);
+ in
+ {
+ formatter.x86_64-linux = nixpkgs-fmt;
+ devShells.x86_64-linux.default = mkShell {
+ buildInputs = [
+ temurin-bin
+ leiningen
+ android-sdk
+ ];
+ shellHook = ''
+ export JAVA_HOME=${temurin-bin} \
+ ANDROID_SDK_ROOT=${android-sdk}/share/android-sdk \
+ PATH=$JAVA_HOME/bin:$ANDROID_SDK_ROOT/build-tools/32.0.0:$PATH
+ '';
+ };
+ };
+}
diff --git a/lein b/lein
deleted file mode 100755
index ddc2029..0000000
--- a/lein
+++ /dev/null
@@ -1,423 +0,0 @@
-#!/usr/bin/env bash
-
-# Ensure this file is executable via `chmod a+x lein`, then place it
-# somewhere on your $PATH, like ~/bin. The rest of Leiningen will be
-# installed upon first run into the ~/.lein/self-installs directory.
-
-function msg {
- echo "$@" 1>&2
-}
-
-export LEIN_VERSION="2.10.0"
-# Must be sha256sum, will be replaced by bin/release
-export LEIN_CHECKSUM='2a0e9114e0d623c748a9ade5d72b54128b31b5ddb13f51b04c533f104bb0c48d'
-
-case $LEIN_VERSION in
- *SNAPSHOT) SNAPSHOT="YES" ;;
- *) SNAPSHOT="NO" ;;
-esac
-
-if [[ "$CLASSPATH" != "" ]]; then
- cat <<-'EOS' 1>&2
- WARNING: You have $CLASSPATH set, probably by accident.
- It is strongly recommended to unset this before proceeding.
- EOS
-fi
-
-if [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]]; then
- delimiter=";"
-else
- delimiter=":"
-fi
-
-if [[ "$OSTYPE" == "cygwin" ]]; then
- cygwin=true
-else
- cygwin=false
-fi
-
-function command_not_found {
- msg "Leiningen couldn't find $1 in your \$PATH ($PATH), which is required."
- exit 1
-}
-
-function make_native_path {
- # ensure we have native paths
- if $cygwin && [[ "$1" == /* ]]; then
- echo -n "$(cygpath -wp "$1")"
- elif [[ "$OSTYPE" == "msys" && "$1" == /?/* ]]; then
- echo -n "$(sh -c "(cd $1 2&2
- Failed to download $1 (exit code $2)
- It's possible your HTTP client's certificate store does not have the
- correct certificate authority needed. This is often caused by an
- out-of-date version of libssl. It's also possible that you're behind a
- firewall and haven't set HTTP_PROXY and HTTPS_PROXY.
- EOS
-}
-
-function checksum_failed_message {
- cat <<-EOS 1>&2
- Failed to properly download $1
- The checksum was mismatched. and we could not verify the downloaded
- file. We expected a sha256 of
- $2 and actually had
- $3.
- We used '$SHASUM_CMD' to verify the downloaded file.
- EOS
-}
-
-function self_install {
- if [ -r "$LEIN_JAR" ]; then
- cat <<-EOS 1>&2
- The self-install jar already exists at $LEIN_JAR.
- If you wish to re-download, delete it and rerun "$0 self-install".
- EOS
- exit 1
- fi
- msg "Downloading Leiningen to $LEIN_JAR now..."
- mkdir -p "$(dirname "$LEIN_JAR")"
- LEIN_URL="https://github.com/technomancy/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar"
- $HTTP_CLIENT "$LEIN_JAR.pending" "$LEIN_URL"
- local exit_code=$?
- if [ $exit_code == 0 ]; then
- printf "$LEIN_CHECKSUM $LEIN_JAR.pending\n" > "$LEIN_JAR.pending.shasum"
- $SHASUM_CMD -c "$LEIN_JAR.pending.shasum"
- if [ $? == 0 ]; then
- mv -f "$LEIN_JAR.pending" "$LEIN_JAR"
- else
- got_sum="$($SHASUM_CMD "$LEIN_JAR.pending" | cut -f 1 -d ' ')"
- checksum_failed_message "$LEIN_URL" "$LEIN_CHECKSUM" "$got_sum"
- rm "$LEIN_JAR.pending" 2> /dev/null
- exit 1
- fi
- else
- rm "$LEIN_JAR.pending" 2> /dev/null
- download_failed_message "$LEIN_URL" "$exit_code"
- exit 1
- fi
-}
-
-NOT_FOUND=1
-ORIGINAL_PWD="$PWD"
-while [ ! -r "$PWD/project.clj" ] && [ "$PWD" != "/" ] && [ $NOT_FOUND -ne 0 ]
-do
- cd ..
- if [ "$(dirname "$PWD")" = "/" ]; then
- NOT_FOUND=0
- cd "$ORIGINAL_PWD"
- fi
-done
-
-export LEIN_HOME="${LEIN_HOME:-"$HOME/.lein"}"
-
-for f in "/etc/leinrc" "$LEIN_HOME/leinrc" ".leinrc"; do
- if [ -e "$f" ]; then
- source "$f"
- fi
-done
-
-if $cygwin; then
- export LEIN_HOME=$(cygpath -w "$LEIN_HOME")
-fi
-
-LEIN_JAR="${LEIN_JAR:-${LEIN_HOME}/self-installs/leiningen-${LEIN_VERSION}-standalone.jar}"
-
-# normalize $0 on certain BSDs
-if [ "$(dirname "$0")" = "." ]; then
- SCRIPT="$(which "$(basename "$0")")"
- if [ -z "$SCRIPT" ]; then
- SCRIPT="$0"
- fi
-else
- SCRIPT="$0"
-fi
-
-# resolve symlinks to the script itself portably
-while [ -h "$SCRIPT" ] ; do
- ls=$(ls -ld "$SCRIPT")
- link=$(expr "$ls" : '.*-> \(.*\)$')
- if expr "$link" : '/.*' > /dev/null; then
- SCRIPT="$link"
- else
- SCRIPT="$(dirname "$SCRIPT"$)/$link"
- fi
-done
-
-BIN_DIR="$(dirname "$SCRIPT")"
-
-export LEIN_JVM_OPTS="${LEIN_JVM_OPTS-"-XX:+TieredCompilation -XX:TieredStopAtLevel=1"}"
-
-# This needs to be defined before we call HTTP_CLIENT below
-if [ "$HTTP_CLIENT" = "" ]; then
- if type -p curl >/dev/null 2>&1; then
- if [ "$https_proxy" != "" ]; then
- CURL_PROXY="-x $https_proxy"
- fi
- HTTP_CLIENT="curl $CURL_PROXY -f -L -o"
- else
- HTTP_CLIENT="wget -O"
- fi
-fi
-
-# This needs to be defined before we call SHASUM_CMD below
-if [ "$SHASUM_CMD" = "" ]; then
- if type -p sha256sum >/dev/null 2>&1; then
- export SHASUM_CMD="sha256sum"
- elif type -p shasum >/dev/null 2>&1; then
- export SHASUM_CMD="shasum --algorithm 256"
- elif type -p sha256 >/dev/null 2>&1; then
- export SHASUM_CMD="sha256 -q"
- else
- command_not_found sha256sum
- fi
-fi
-
-# When :eval-in :classloader we need more memory
-grep -E -q '^\s*:eval-in\s+:classloader\s*$' project.clj 2> /dev/null && \
- export LEIN_JVM_OPTS="$LEIN_JVM_OPTS -Xms64m -Xmx512m"
-
-if [ -r "$BIN_DIR/../src/leiningen/version.clj" ]; then
- # Running from source checkout
- LEIN_DIR="$(cd $(dirname "$BIN_DIR");pwd -P)"
-
- # Need to use lein release to bootstrap the leiningen-core library (for aether)
- if [ ! -r "$LEIN_DIR/leiningen-core/.lein-bootstrap" ]; then
- cat <<-'EOS' 1>&2
- Leiningen is missing its dependencies.
- Please run "lein bootstrap" in the leiningen-core/ directory
- with a stable release of Leiningen. See CONTRIBUTING.md for details.
- EOS
- exit 1
- fi
-
- # If project.clj for lein or leiningen-core changes, we must recalculate
- LAST_PROJECT_CHECKSUM=$(cat "$LEIN_DIR/.lein-project-checksum" 2> /dev/null)
- PROJECT_CHECKSUM=$(sum "$LEIN_DIR/project.clj" "$LEIN_DIR/leiningen-core/project.clj")
- if [ "$PROJECT_CHECKSUM" != "$LAST_PROJECT_CHECKSUM" ]; then
- if [ -r "$LEIN_DIR/.lein-classpath" ]; then
- rm "$LEIN_DIR/.lein-classpath"
- fi
- fi
-
- # Use bin/lein to calculate its own classpath.
- if [ ! -r "$LEIN_DIR/.lein-classpath" ] && [ "$1" != "classpath" ]; then
- msg "Recalculating Leiningen's classpath."
- cd "$LEIN_DIR"
-
- LEIN_NO_USER_PROFILES=1 "$LEIN_DIR/bin/lein" classpath .lein-classpath
- sum "$LEIN_DIR/project.clj" "$LEIN_DIR/leiningen-core/project.clj" > \
- .lein-project-checksum
- cd -
- fi
-
- mkdir -p "$LEIN_DIR/target/classes"
- export LEIN_JVM_OPTS="$LEIN_JVM_OPTS -Dclojure.compile.path=$LEIN_DIR/target/classes"
- add_path CLASSPATH "$LEIN_DIR/leiningen-core/src/" "$LEIN_DIR/leiningen-core/resources/" \
- "$LEIN_DIR/test:$LEIN_DIR/target/classes" "$LEIN_DIR/src" ":$LEIN_DIR/resources"
-
- if [ -r "$LEIN_DIR/.lein-classpath" ]; then
- add_path CLASSPATH "$(cat "$LEIN_DIR/.lein-classpath" 2> /dev/null)"
- else
- add_path CLASSPATH "$(cat "$LEIN_DIR/leiningen-core/.lein-bootstrap" 2> /dev/null)"
- fi
-else # Not running from a checkout
- add_path CLASSPATH "$LEIN_JAR"
-
- if [ "$LEIN_USE_BOOTCLASSPATH" != "no" ]; then
- LEIN_JVM_OPTS="-Xbootclasspath/a:$LEIN_JAR $LEIN_JVM_OPTS"
- fi
-
- if [ ! -r "$LEIN_JAR" -a "$1" != "self-install" ]; then
- self_install
- fi
-fi
-
-if [ ! -x "$JAVA_CMD" ] && ! type -f java >/dev/null
-then
- msg "Leiningen couldn't find 'java' executable, which is required."
- msg "Please either set JAVA_CMD or put java (>=1.6) in your \$PATH ($PATH)."
- exit 1
-fi
-
-export LEIN_JAVA_CMD="${LEIN_JAVA_CMD:-${JAVA_CMD:-java}}"
-
-if [[ -z "${DRIP_INIT+x}" && "$(basename "$LEIN_JAVA_CMD")" == *drip* ]]; then
- export DRIP_INIT="$(printf -- '-e\n(require (quote leiningen.repl))')"
- export DRIP_INIT_CLASS="clojure.main"
-fi
-
-# Support $JAVA_OPTS for backwards-compatibility.
-export JVM_OPTS="${JVM_OPTS:-"$JAVA_OPTS"}"
-
-# Handle jline issue with cygwin not propagating OSTYPE through java subprocesses: https://github.com/jline/jline2/issues/62
-cygterm=false
-if $cygwin; then
- case "$TERM" in
- rxvt* | xterm* | vt*) cygterm=true ;;
- esac
-fi
-
-if $cygterm; then
- LEIN_JVM_OPTS="$LEIN_JVM_OPTS -Djline.terminal=jline.UnixTerminal"
- stty -icanon min 1 -echo > /dev/null 2>&1
-fi
-
-# TODO: investigate http://skife.org/java/unix/2011/06/20/really_executable_jars.html
-# If you're packaging this for a package manager (.deb, homebrew, etc)
-# you need to remove the self-install and upgrade functionality or see lein-pkg.
-if [ "$1" = "self-install" ]; then
- if [ -r "$BIN_DIR/../src/leiningen/version.clj" ]; then
- cat <<-'EOS' 1>&2
- Running self-install from a checkout is not supported.
- See CONTRIBUTING.md for SNAPSHOT-specific build instructions.
- EOS
- exit 1
- fi
- msg "Manual self-install is deprecated; it will run automatically when necessary."
- self_install
-elif [ "$1" = "upgrade" ] || [ "$1" = "downgrade" ]; then
- if [ "$LEIN_DIR" != "" ]; then
- msg "The upgrade task is not meant to be run from a checkout."
- exit 1
- fi
- if [ $SNAPSHOT = "YES" ]; then
- cat <<-'EOS' 1>&2
- The upgrade task is only meant for stable releases.
- See the "Bootstrapping" section of CONTRIBUTING.md.
- EOS
- exit 1
- fi
- if [ ! -w "$SCRIPT" ]; then
- msg "You do not have permission to upgrade the installation in $SCRIPT"
- exit 1
- else
- TARGET_VERSION="${2:-stable}"
- echo "The script at $SCRIPT will be upgraded to the latest $TARGET_VERSION version."
- echo -n "Do you want to continue [Y/n]? "
- read RESP
- case "$RESP" in
- y|Y|"")
- echo
- msg "Upgrading..."
- TARGET="/tmp/lein-${$}-upgrade"
- if $cygwin; then
- TARGET=$(cygpath -w "$TARGET")
- fi
- LEIN_SCRIPT_URL="https://github.com/technomancy/leiningen/raw/$TARGET_VERSION/bin/lein"
- $HTTP_CLIENT "$TARGET" "$LEIN_SCRIPT_URL"
- if [ $? == 0 ]; then
- cmp -s "$TARGET" "$SCRIPT"
- if [ $? == 0 ]; then
- msg "Leiningen is already up-to-date."
- fi
- mv "$TARGET" "$SCRIPT" && chmod +x "$SCRIPT"
- unset CLASSPATH
- exec "$SCRIPT" version
- else
- download_failed_message "$LEIN_SCRIPT_URL"
- fi;;
- *)
- msg "Aborted."
- exit 1;;
- esac
- fi
-else
- if $cygwin; then
- # When running on Cygwin, use Windows-style paths for java
- ORIGINAL_PWD=$(cygpath -w "$ORIGINAL_PWD")
- fi
-
- # apply context specific CLASSPATH entries
- if [ -f .lein-classpath ]; then
- add_path CLASSPATH "$(cat .lein-classpath)"
- fi
-
- if [ -n "$DEBUG" ]; then
- msg "Leiningen's classpath: $CLASSPATH"
- fi
-
- if [ -r .lein-fast-trampoline ]; then
- export LEIN_FAST_TRAMPOLINE='y'
- fi
-
- if [ "$LEIN_FAST_TRAMPOLINE" != "" ] && [ -r project.clj ]; then
- INPUTS="$* $(cat project.clj) $LEIN_VERSION $(test -f "$LEIN_HOME/profiles.clj" && cat "$LEIN_HOME/profiles.clj") $(test -f profiles.clj && cat profiles.clj)"
-
- INPUT_CHECKSUM=$(echo "$INPUTS" | $SHASUM_CMD | cut -f 1 -d " ")
- # Just don't change :target-path in project.clj, mkay?
- TRAMPOLINE_FILE="target/trampolines/$INPUT_CHECKSUM"
- else
- if hash mktemp 2>/dev/null; then
- # Check if mktemp is available before using it
- TRAMPOLINE_FILE="$(mktemp /tmp/lein-trampoline-XXXXXXXXXXXXX)"
- else
- TRAMPOLINE_FILE="/tmp/lein-trampoline-$$"
- fi
- trap 'rm -f $TRAMPOLINE_FILE' EXIT
- fi
-
- if $cygwin; then
- TRAMPOLINE_FILE=$(cygpath -w "$TRAMPOLINE_FILE")
- fi
-
- if [ "$INPUT_CHECKSUM" != "" ] && [ -r "$TRAMPOLINE_FILE" ]; then
- if [ -n "$DEBUG" ]; then
- msg "Fast trampoline with $TRAMPOLINE_FILE."
- fi
- exec sh -c "exec $(cat "$TRAMPOLINE_FILE")"
- else
- export TRAMPOLINE_FILE
- "$LEIN_JAVA_CMD" \
- -Dfile.encoding=UTF-8 \
- -Dmaven.wagon.http.ssl.easy=false \
- -Dmaven.wagon.rto=10000 \
- $LEIN_JVM_OPTS \
- -Dleiningen.input-checksum="$INPUT_CHECKSUM" \
- -Dleiningen.original.pwd="$ORIGINAL_PWD" \
- -Dleiningen.script="$SCRIPT" \
- -classpath "$CLASSPATH" \
- clojure.main -m leiningen.core.main "$@"
-
- EXIT_CODE=$?
-
- if $cygterm ; then
- stty icanon echo > /dev/null 2>&1
- fi
-
- if [ -r "$TRAMPOLINE_FILE" ] && [ "$LEIN_TRAMPOLINE_WARMUP" = "" ]; then
- TRAMPOLINE="$(cat "$TRAMPOLINE_FILE")"
- if [ "$INPUT_CHECKSUM" = "" ]; then # not using fast trampoline
- rm "$TRAMPOLINE_FILE"
- fi
- if [ "$TRAMPOLINE" = "" ]; then
- exit $EXIT_CODE
- else
- exec sh -c "exec $TRAMPOLINE"
- fi
- else
- exit $EXIT_CODE
- fi
- fi
-fi
\ No newline at end of file
diff --git a/lein.bat b/lein.bat
deleted file mode 100644
index 54246ba..0000000
--- a/lein.bat
+++ /dev/null
@@ -1,428 +0,0 @@
-@echo off
-
-setLocal EnableExtensions EnableDelayedExpansion
-
-set LEIN_VERSION=2.9.8
-
-if "%LEIN_VERSION:~-9%" == "-SNAPSHOT" (
- set SNAPSHOT=YES
-) else (
- set SNAPSHOT=NO
-)
-
-set ORIGINAL_PWD=%CD%
-:: If ORIGINAL_PWD ends with a backslash (such as C:\),
-:: we need to escape it with a second backslash.
-if "%ORIGINAL_PWD:~-1%x" == "\x" set "ORIGINAL_PWD=%ORIGINAL_PWD%\"
-
-call :FIND_DIR_CONTAINING_UPWARDS project.clj
-if "%DIR_CONTAINING%" neq "" cd "%DIR_CONTAINING%"
-
-:: LEIN_JAR and LEIN_HOME variables can be set manually.
-:: Only set LEIN_JAR manually if you know what you are doing.
-:: Having LEIN_JAR pointing to one version of Leiningen as well as
-:: having a different version in PATH has been known to cause problems.
-
-if "x%LEIN_HOME%" == "x" (
- set LEIN_HOME=!USERPROFILE!\.lein
-)
-SET RC=1
-
-if "x%LEIN_JAR%" == "x" set "LEIN_JAR=!LEIN_HOME!\self-installs\leiningen-!LEIN_VERSION!-standalone.jar"
-
-if "%1" == "self-install" goto SELF_INSTALL
-if "%1" == "upgrade" goto UPGRADE
-if "%1" == "downgrade" goto UPGRADE
-
-if not exist "%~dp0..\src\leiningen\version.clj" goto RUN_NO_CHECKOUT
-
- :: Running from source checkout.
- call :SET_LEIN_ROOT "%~dp0.."
-
-
- set "bootstrapfile=!LEIN_ROOT!\leiningen-core\.lein-bootstrap"
- rem in .lein-bootstrap there is only one line where each path is concatenated to each other via a semicolon, there's no semicolon at the end
- rem each path is NOT inside double quotes and may contain spaces (even semicolons but this is not supported here) in their names,
- rem but they won't/cannot contain double quotes " or colons : in their names (at least on windows it's not allowed/won't work)
-
- rem tested when folders contain spaces and when LEIN_ROOT contains semicolon
-
-
- if not "x%DEBUG%" == "x" echo LEIN_ROOT=!LEIN_ROOT!
-
- rem if not "%LEIN_ROOT:;=%" == "%LEIN_ROOT%" (
-
-
- rem oddly enough /G:/ should've worked but doesn't where / they say it's console
- rem findstr is C:\Windows\System32\findstr.exe
- echo.!LEIN_ROOT! | findstr /C:";" >nul 2>&1 && (
- rem aka errorlevel is 0 aka the string ";" was found
- echo Your folder structure !LEIN_ROOT! contains at least one semicolon in its name
- echo This is not allowed and would break things with the generated bootstrap file
- echo Please correct this by renaming the folders to not contain semicolons in their name
- del !bootstrapfile! >nul 2>&1
- echo You'll also have to recreate the bootstrap file just to be sure it has semicolon-free names inside
- echo the bootstrap file ^(which was just deleted^) is: !bootstrapfile!
- echo and the info on how to do that is:
- goto RUN_BOOTSTRAP
- )
-
- if not exist !bootstrapfile! goto NO_DEPENDENCIES
-
- findstr \^" "!bootstrapfile!" >nul 2>&1
- if errorlevel 1 goto PARSE_BOOTSTRAPFILE
- echo double quotes detected inside file: !bootstrapfile!
- echo this should not be happening
- goto RUN_BOOTSTRAP
-
-:PARSE_BOOTSTRAPFILE
-rem will proceed to set LEIN_LIBS and surround each path from bootstrap file in double quotes and separate it from others with a semicolon
-rem the paths inside the bootstrap file do not already contain double quotes but may contain spaces
- rem note worthy: the following won't work due to a hard 1022bytes limit truncation in the variable that was set
- rem set /p LEIN_LIBS=nul 2>&1
-if NOT ERRORLEVEL 0 goto TRY_WGET
- set LAST_HTTP_CLIENT=powershell
- rem By default: Win7 = PS2, Win 8.0 = PS3 (maybe?), Win 8.1 = PS4, Win10 = PS5
- powershell -Command "& {param($a,$f) if (($PSVersionTable.PSVersion | Select-Object -ExpandProperty Major) -lt 4) { exit 111; } else { $client = New-Object System.Net.WebClient; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $client.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials; $client.DownloadFile($a, $f); }}" ""%2"" ""%1""
- SET RC=%ERRORLEVEL%
- goto EXITRC
-
-:TRY_WGET
-call wget --help >nul 2>&1
-if NOT ERRORLEVEL 0 goto TRY_CURL
- set LAST_HTTP_CLIENT=wget
- call wget -O %1 %2
- SET RC=%ERRORLEVEL%
- goto EXITRC
-
-:TRY_CURL
-call curl --help >nul 2>&1
-if NOT ERRORLEVEL 0 GOTO NO_HTTP_CLIENT
- rem We set CURL_PROXY to a space character below to pose as a no-op argument
- set LAST_HTTP_CLIENT=curl
- set CURL_PROXY=
- if NOT "x%HTTPS_PROXY%" == "x" set CURL_PROXY="-x %HTTPS_PROXY%"
- call curl %CURL_PROXY% -f -L -o %1 %2
- SET RC=%ERRORLEVEL%
- goto EXITRC
-
-:NO_LEIN_JAR
-echo.
-echo %LEIN_JAR% can not be found.
-echo You can try running "lein self-install"
-echo or change LEIN_JAR environment variable
-echo or edit lein.bat to set appropriate LEIN_JAR path.
-echo.
-goto EXITRC
-
-:NO_DEPENDENCIES
-echo.
-echo Leiningen is missing its dependencies.
-:RUN_BOOTSTRAP
-echo Please run "lein bootstrap" in the leiningen-core/ directory
-echo with a stable release of Leiningen. See CONTRIBUTING.md for details.
-echo.
-goto EXITRC
-
-:SELF_INSTALL
-if exist "%LEIN_JAR%" (
- echo %LEIN_JAR% already exists. Delete and retry.
- goto EXITRC
-)
-
-for %%f in ("%LEIN_JAR%") do set LEIN_INSTALL_DIR="%%~dpf"
-if not exist %LEIN_INSTALL_DIR% mkdir %LEIN_INSTALL_DIR%
-
-echo Downloading Leiningen now...
-
-set LEIN_JAR_URL=https://github.com/technomancy/leiningen/releases/download/%LEIN_VERSION%/leiningen-%LEIN_VERSION%-standalone.jar
-call :DownloadFile "%LEIN_JAR%.pending" "%LEIN_JAR_URL%"
-SET RC=%ERRORLEVEL%
-if not %RC% == 0 goto DOWNLOAD_FAILED
-if not exist "%LEIN_JAR%.pending" goto DOWNLOAD_FAILED
-move /y "%LEIN_JAR%.pending" "%LEIN_JAR%" >nul 2>&1
-SET RC=%ERRORLEVEL%
-goto EXITRC
-
-:DOWNLOAD_FAILED
-SET RC=3
-if "%ERRORLEVEL%" == "111" (
- echo.
- echo You seem to be using an old version of PowerShell that
- echo can't download files via TLS 1.2.
- echo Please upgrade your PowerShell to at least version 4.0, e.g. via
- echo https://www.microsoft.com/en-us/download/details.aspx?id=50395
- echo.
- echo Alternatively you can manually download
- echo %LEIN_JAR_URL%
- echo and save it as
- echo %LEIN_JAR%
- echo.
- echo If you have "curl" or "wget" you can try setting the HTTP_CLIENT
- echo variable, but the TLS problem might still persist.
- echo.
- echo a^) set HTTP_CLIENT=wget -O
- echo b^) set HTTP_CLIENT=curl -f -L -o
- echo.
- echo NOTE: Make sure to *not* add double quotes when setting the value
- echo of HTTP_CLIENT
- goto EXITRC
-)
-SET RC=3
-del "%LEIN_JAR%.pending" >nul 2>&1
-echo.
-echo Failed to download %LEIN_JAR_URL%
-echo.
-echo It is possible that the download failed due to "powershell",
-echo "curl" or "wget"'s inability to retrieve GitHub's security certificate.
-echo.
-
-if "%LAST_HTTP_CLIENT%" == "powershell" (
- echo The PowerShell failed to download the latest Leiningen version.
- echo Try to use "curl" or "wget" to download Leiningen by setting up
- echo the HTTP_CLIENT environment variable with one of the following
- echo values:
- echo.
- echo a^) set HTTP_CLIENT=wget -O
- echo b^) set HTTP_CLIENT=curl -f -L -o
- echo.
- echo NOTE: Make sure to *not* add double quotes when setting the value
- echo of HTTP_CLIENT
-)
-
-if "%LAST_HTTP_CLIENT%" == "curl" (
- echo Curl failed to download the latest Leiningen version.
- echo Try to use "wget" to download Leiningen by setting up
- echo the HTTP_CLIENT environment variable with one of the following
- echo values:
- echo.
- echo a^) set HTTP_CLIENT=wget -O
- echo.
- echo NOTE: Make sure to *not* add double quotes when setting the value
- echo of HTTP_CLIENT
- echo.
- echo If neither curl nor wget can download Leiningen, please seek
- echo for help on Leiningen's GitHub project issues page.
-)
-
-if "%LAST_HTTP_CLIENT%" == "wget" (
- echo Curl failed to download the latest Leiningen version.
- echo Try to use "wget" to download Leiningen by setting up
- echo the HTTP_CLIENT environment variable with one of the following
- echo values:
- echo.
- echo. a^) set HTTP_CLIENT=curl -f -L -o
- echo.
- echo NOTE: make sure *not* to add double quotes to set the value of
- echo HTTP_CLIENT
- echo.
- echo If neither curl nor wget can download Leiningen, please seek
- echo for help on Leiningen's GitHub project issues page.
-)
-
-if %SNAPSHOT% == YES echo See README.md for SNAPSHOT build instructions.
-echo.
-goto EOF
-
-
-:UPGRADE
-set LEIN_BAT=%~dp0%~nx0
-set TARGET_VERSION=%2
-if "x%2" == "x" set TARGET_VERSION=stable
-echo The script at %LEIN_BAT% will be upgraded to the latest %TARGET_VERSION% version.
-set /P ANSWER=Do you want to continue (Y/N)?
-if /i {%ANSWER%}=={y} goto YES_UPGRADE
-if /i {%ANSWER%}=={yes} goto YES_UPGRADE
-echo Aborted.
-goto EXITRC
-
-
-:YES_UPGRADE
-echo Downloading latest Leiningen batch script...
-
-set LEIN_BAT_URL=https://github.com/technomancy/leiningen/raw/%TARGET_VERSION%/bin/lein.bat
-set TEMP_BAT=%~dp0temp-lein-%RANDOM%%RANDOM%.bat
-call :DownloadFile "%LEIN_BAT%.pending" "%LEIN_BAT_URL%"
-if ERRORLEVEL 0 goto EXEC_UPGRADE
- del "%LEIN_BAT%.pending" >nul 2>&1
- echo Failed to download %LEIN_BAT_URL%
- goto EXITRC
-:EXEC_UPGRADE
-move /y "%LEIN_BAT%.pending" "%TEMP_BAT%" >nul 2>&1
-echo.
-echo Upgrading...
-set LEIN_JAR=
-call "%TEMP_BAT%" self-install
-(
- rem This is self-modifying batch code. Use brackets to pre-load the exit command.
- rem This way, script execution does not depend on whether the replacement script
- rem has that command at the *very same* file position as the calling batch file.
- move /y "%TEMP_BAT%" "%LEIN_BAT%" >nul 2>&1
- exit /B %ERRORLEVEL%
-)
-
-:NO_HTTP_CLIENT
-echo.
-echo ERROR: Neither PowerShell, Wget, or Curl could be found.
-echo Make sure at least one of these tools is installed
-echo and is in PATH. You can get them from URLs below:
-echo.
-echo PowerShell: "http://www.microsoft.com/powershell"
-
-rem echo Wget: "http://users.ugent.be/~bpuype/wget/"
-rem Note: Stale URL. HTTP 404.
-rem Alternative: wget64.exe compiled by J. Simoncic, rename to wget.exe
-rem MD5 1750c130c5daca8b347d3f7e34824c9b
-rem Check: https://www.virustotal.com/en/file/abf507f8240ed41aac74c9df6de558c88c2f11d7770f02.8.4-SNAPSHOT5f1cc544b9c08b/analysis/
-echo Wget: "https://eternallybored.org/misc/wget/"
-
-echo Curl: "http://curl.haxx.se/dlwiz/?type=bin&os=Win32&flav=-&ver=2000/XP"
-echo.
-goto EXITRC
-
-
-:SET_LEIN_ROOT
-set LEIN_ROOT=%~f1
-goto EOF
-
-:: Find directory containing filename supplied in first argument
-:: looking in current directory, and looking up the parent
-:: chain until we find it, or run out
-:: returns result in %DIR_CONTAINING%
-:: empty string if we don't find it
-:FIND_DIR_CONTAINING_UPWARDS
-set DIR_CONTAINING=%CD%
-set LAST_DIR=
-
-:LOOK_AGAIN
-if "%DIR_CONTAINING%" == "%LAST_DIR%" (
- :: didn't find it
- set DIR_CONTAINING=
- goto EOF
-)
-
-if EXIST "%DIR_CONTAINING%\%1" (
- :: found it - use result in DIR_CONTAINING
- goto EOF
-)
-
-set LAST_DIR=%DIR_CONTAINING%
-call :GET_PARENT_PATH "%DIR_CONTAINING%\.."
-set DIR_CONTAINING=%PARENT_PATH%
-goto LOOK_AGAIN
-
-:GET_PARENT_PATH
-set PARENT_PATH=%~f1
-goto EOF
-
-
-:RUN
-:: We need to disable delayed expansion here because the %* variable
-:: may contain bangs (as in test!). There may also be special
-:: characters inside the TRAMPOLINE_FILE.
-setLocal DisableDelayedExpansion
-
-set "TRAMPOLINE_FILE=%TEMP%\lein-trampoline-%RANDOM%.bat"
-del "%TRAMPOLINE_FILE%" >nul 2>&1
-
-set ERRORLEVEL=
-set RC=0
-"%LEIN_JAVA_CMD%" -client %LEIN_JVM_OPTS% ^
- -Dfile.encoding=UTF-8 ^
- -Dclojure.compile.path="%DIR_CONTAINING%/target/classes" ^
- -Dleiningen.original.pwd="%ORIGINAL_PWD%" ^
- -cp "%CLASSPATH%" clojure.main -m leiningen.core.main %*
-SET RC=%ERRORLEVEL%
-if not %RC% == 0 goto EXITRC
-
-if not exist "%TRAMPOLINE_FILE%" goto EOF
-call "%TRAMPOLINE_FILE%"
-del "%TRAMPOLINE_FILE%" >nul 2>&1
-goto EOF
-
-
-:PROCESSPATH
-rem will surround each path with double quotes before appending it to LEIN_LIBS
- for /f "tokens=1* delims=;" %%a in ("%tmpline%") do (
- set LEIN_LIBS=!LEIN_LIBS!"%%a";
- set tmpline=%%b
- )
- if not "%tmpline%" == "" goto PROCESSPATH
- goto EOF
-
-:EXITRC
-exit /B %RC%
-
-:EOF
\ No newline at end of file
diff --git a/tasks/leiningen/copy.clj b/tasks/leiningen/copy.clj
index 1d7efc0..f0baa99 100644
--- a/tasks/leiningen/copy.clj
+++ b/tasks/leiningen/copy.clj
@@ -3,23 +3,24 @@
[leiningen.core.main :as main]
[leiningen.jar :as jar]))
-(defn- find-mods []
- (let [os (System/getProperty "os.name")]
- (cond
- (.contains os "Windows") (io/file (System/getenv "AppData") "Mindustry/mods")
- (.contains os "Linux") (io/file (System/getenv "HOME") ".local/share/Mindustry/mods")
- (.contains os "Mac OS") (io/file (System/getenv "HOME") "Library/Application Support/Mindustry/mods"))))
+(def ^:private mods-folder
+ (delay
+ (io/file
+ (condp #(.contains %1 %2) (System/getProperty "os.name")
+ "Windows" (System/getenv "AppData")
+ "Linux" (str (System/getenv "HOME") "/.local/share")
+ "Mac OS" (str (System/getenv "HOME") "/Library/Application Support"))
+ "Mindustry/mods")))
(defn copy
"Copy the jar to the mods folder for easy testing."
[project]
- (let [android-jar (io/file (jar/get-classified-jar-filename project :android))
- desktop-jar (io/file (jar/get-jar-filename project :standalone))
- dst-zip (io/file (find-mods) (str (:name project) ".zip"))]
- (cond
- (.exists android-jar) (do (io/copy android-jar dst-zip)
- (print "Copied" (.getAbsolutePath android-jar)))
- (.exists desktop-jar) (do (io/copy desktop-jar dst-zip)
- (print "Copied" (.getAbsolutePath desktop-jar)))
- :else (main/abort "No jar found."))
- (println " to" (.getAbsolutePath dst-zip))))
+ (let [android-jar (io/file (jar/get-classified-jar-filename project :android))
+ desktop-jar (io/file (jar/get-jar-filename project :standalone))
+ dst-zip (io/file @mods-folder (str (:name project) ".zip"))
+ selected-jar (if (.exists android-jar) android-jar
+ (when (.exists desktop-jar) desktop-jar))]
+ (if selected-jar (do (println "Copying" (.getAbsolutePath selected-jar)
+ "to" (.getAbsolutePath dst-zip) "...")
+ (io/copy selected-jar dst-zip))
+ (main/abort "No jar found."))))
diff --git a/tasks/leiningen/dex.clj b/tasks/leiningen/dex.clj
index 2d077eb..b4ae157 100644
--- a/tasks/leiningen/dex.clj
+++ b/tasks/leiningen/dex.clj
@@ -9,7 +9,7 @@
[leiningen.core.project :as project]
[leiningen.jar :as jar]))
-(def android-jar
+(def ^:private android-jar
(delay
(if-let [plat-dir
(if-let [sdk-root (or (System/getenv "ANDROID_SDK_ROOT")
@@ -30,26 +30,28 @@
The ANDROID_SDK_ROOT (or ANDROID_HOME as fallback) environment variable
must be set and an Android SDK platform must be installed."
[project]
- (let [scoped-profiles (set (project/pom-scope-profiles project :provided))
- default-profiles (set (project/expand-profile project :default))
+ (let [scoped-profiles (set (project/pom-scope-profiles project :provided))
+ default-profiles (set (project/expand-profile project :default))
provided-profiles (remove
(set/difference default-profiles scoped-profiles)
(-> project meta :included-profiles))
- project (->> (into [:uberjar] provided-profiles)
- (project/merge-profiles project))
- classpath (for [cp (cp/get-classpath project)
- :when (.exists (io/file cp))]
- ["--classpath" cp])
- out-name (jar/get-classified-jar-filename project :android)
- standalone-name (jar/get-jar-filename project :standalone)]
- ;; --min-api is 26 because d8 says that MethodHandle.invoke and
- ;; MethodHandle.invokeExact are only supported
- ;; starting with Android 8.
+ project (->> (into [:uberjar] provided-profiles)
+ (project/merge-profiles project))
+ classpath (for [cp (cp/get-classpath project)
+ :when (.exists (io/file cp))]
+ ["--classpath" cp])
+ out-name (jar/get-classified-jar-filename project :android)
+ standalone-name (jar/get-jar-filename project :standalone)]
+ (println "Creating classes.dex ...")
(apply shell/sh (flatten ["d8"
+ ;; --min-api is 26 because d8 says that
+ ;; MethodHandle.invoke and MethodHandle.invokeExact
+ ;; are only supported starting with Android 8.
"--min-api" "26"
"--lib" @android-jar
classpath
- "--output" out-name
- standalone-name]))))
-;; (shell/sh "jar" "-uf" out-name "classes.dex")
-;; (io/delete-file "classes.dex" true)
+ standalone-name]))
+ (println "Creating" out-name "...")
+ (shell/sh "cp" standalone-name out-name)
+ (shell/sh "jar" "-uf" out-name "classes.dex")
+ (io/delete-file "classes.dex" true)))
diff --git a/tasks/leiningen/launch.clj b/tasks/leiningen/launch.clj
index 1abe4a0..ee8b4cd 100644
--- a/tasks/leiningen/launch.clj
+++ b/tasks/leiningen/launch.clj
@@ -1,12 +1,14 @@
(ns leiningen.launch
- (:require [clojure.java.shell :as shell]))
+ (:require [clojure.java.shell :as shell]
+ [clojure.string :as str]
+ [leiningen.core.main :as main]))
(defn launch
"Launch the mindustry jar specified by the environment variable `MINDUSTRY_JAR`."
[_]
(if-let [jar (System/getenv "MINDUSTRY_JAR")]
(shell/sh "java" "-jar" jar)
- (do (println "Please set the environment variable MINDUSTRY_JAR"
- "to the absolute path of your Mindustry jar. You can"
- "do so in Intellij's run configuration settings.")
- (System/exit 1))))
+ (main/abort
+ (str/join " " ["Please set the environment variable MINDUSTRY_JAR"
+ "to the absolute path of your Mindustry jar. You can"
+ "do so in Intellij's run configuration settings."]))))