mirror of
https://github.com/OMGeeky/ATCS.git
synced 2025-12-29 15:55:37 +01:00
Compare commits
1 Commits
package-on
...
version-ch
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
85e0a1fd28 |
6
.gitattributes
vendored
6
.gitattributes
vendored
@@ -1,6 +0,0 @@
|
|||||||
# Set default behavior to automatically normalize line endings.
|
|
||||||
* text=auto
|
|
||||||
|
|
||||||
# Force bash scripts to always use LF line endings so that if a repo is accessed
|
|
||||||
# in Unix via a file share from Windows, the scripts will work.
|
|
||||||
*.sh text eol=lf
|
|
||||||
56
.github/workflows/release.yml
vendored
56
.github/workflows/release.yml
vendored
@@ -1,56 +0,0 @@
|
|||||||
name: Release Build
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [created]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: windows-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Get Version
|
|
||||||
id: get_version
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
echo "Reading version from file:"
|
|
||||||
cat res/ATCS_latest
|
|
||||||
echo ""
|
|
||||||
VERSION=$(tr -d '[:space:]' < "res/ATCS_latest")
|
|
||||||
echo "Processed version: $VERSION"
|
|
||||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
|
||||||
echo "Environment variable set to: $VERSION"
|
|
||||||
|
|
||||||
- name: Set up JDK
|
|
||||||
uses: actions/setup-java@v2
|
|
||||||
with:
|
|
||||||
java-version: '11'
|
|
||||||
distribution: 'temurin'
|
|
||||||
|
|
||||||
- name: Build JAR
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
cd packaging
|
|
||||||
chmod +x package.sh
|
|
||||||
echo "Building JAR and ZIP for version: ${{ env.VERSION }}"
|
|
||||||
./package.sh -windows
|
|
||||||
echo "Created artifacts:"
|
|
||||||
ls -la common/ATCS.jar
|
|
||||||
ls -la ATCS_${{ env.VERSION }}.zip
|
|
||||||
|
|
||||||
- name: Install NSIS
|
|
||||||
uses: joncloud/makensis-action@v4
|
|
||||||
with:
|
|
||||||
script-file: packaging/Windows/ATCS_Installer.nsi
|
|
||||||
arguments: /DVERSION="${{ env.VERSION }}"
|
|
||||||
|
|
||||||
- name: Upload Release Assets
|
|
||||||
uses: softprops/action-gh-release@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
files: |
|
|
||||||
./packaging/ATCS_${{ env.VERSION }}.zip
|
|
||||||
./packaging/ATCS_${{ env.VERSION }}_Setup.exe
|
|
||||||
2
packaging/Linux/.gitignore
vendored
Normal file
2
packaging/Linux/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/ATCS_v*.zip
|
||||||
|
/ATCS_v*.zip.rename
|
||||||
20
packaging/Linux/ATCS/ATCS.cmd
Normal file
20
packaging/Linux/ATCS/ATCS.cmd
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
set "ATCS_DIR=%~dp0"
|
||||||
|
set "MAX_MEM=512M"
|
||||||
|
set "CP=%ATCS_DIR%lib\*"
|
||||||
|
set "JAVA=javaw.exe"
|
||||||
|
set "JAVA_OPTS=-DFONT_SCALE=1.0 -Dswing.aatext=true"
|
||||||
|
set "ENV_FILE=%ATCS_DIR%ATCS.env.bat"
|
||||||
|
set "MAIN_CLASS=com.gpl.rpg.atcontentstudio.ATContentStudio"
|
||||||
|
|
||||||
|
if exist "%ENV_FILE%" (
|
||||||
|
call "%ENV_FILE%"
|
||||||
|
) else (
|
||||||
|
echo REM set "MAX_MEM=%MAX_MEM%">"%ENV_FILE%"
|
||||||
|
echo REM set "JAVA=%JAVA%">>"%ENV_FILE%"
|
||||||
|
echo REM set "JAVA_OPTS=%JAVA_OPTS%">>"%ENV_FILE%"
|
||||||
|
echo.>>"%ENV_FILE%"
|
||||||
|
)
|
||||||
|
|
||||||
|
start "" "%JAVA%" %JAVA_OPTS% -Xmx%MAX_MEM% -cp "%CP%" %MAIN_CLASS%
|
||||||
BIN
packaging/Linux/ATCS/ATCS.ico
Normal file
BIN
packaging/Linux/ATCS/ATCS.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
22
packaging/Linux/ATCS/ATCS.sh
Normal file
22
packaging/Linux/ATCS/ATCS.sh
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
ATCS_DIR=$(dirname $(readlink -f "$0" || greadlink -f "$0" || stat -f "$0"))
|
||||||
|
MAX_MEM=512M
|
||||||
|
CP=$(find ${ATCS_DIR}/lib/ -name '*.jar' | paste -sd: -)
|
||||||
|
JAVA=java
|
||||||
|
JAVA_OPTS='-DFONT_SCALE=1.0 -Dswing.aatext=true'
|
||||||
|
ENV_FILE=${ATCS_DIR}/ATCS.env
|
||||||
|
MAIN_CLASS=com.gpl.rpg.atcontentstudio.ATContentStudio
|
||||||
|
|
||||||
|
if [ -f ${ENV_FILE} ]
|
||||||
|
then
|
||||||
|
source ${ENV_FILE}
|
||||||
|
else
|
||||||
|
echo "#MAX_MEM=${MAX_MEM}" > ${ENV_FILE}
|
||||||
|
echo "#JAVA=${JAVA}" >> ${ENV_FILE}
|
||||||
|
echo "#JAVA_OPTS=${JAVA_OPTS}" >> ${ENV_FILE}
|
||||||
|
echo "" >> ${ENV_FILE}
|
||||||
|
fi
|
||||||
|
|
||||||
|
export ENV_FILE
|
||||||
|
|
||||||
|
$JAVA ${JAVA_OPTS} -Xmx${MAX_MEM} -cp ${CP} ${MAIN_CLASS}
|
||||||
1
packaging/Linux/ATCS/lib/.gitignore
vendored
Normal file
1
packaging/Linux/ATCS/lib/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/*.jar
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
!include MUI2.nsh
|
!include MUI2.nsh
|
||||||
|
|
||||||
; Version will be passed as /DVERSION=vx.x.x
|
!define VERSION "0.6.21"
|
||||||
!define TRAINER_VERSION "0.1.5"
|
!define TRAINER_VERSION "0.1.5"
|
||||||
!define JAVA_BIN "java"
|
!define JAVA_BIN "java"
|
||||||
!define ATCS_SOURCE_DIR "..\..\"
|
!define ATCS_SOURCE_DIR "C:\ATCS"
|
||||||
|
|
||||||
Name "Andor's Trail Content Studio ${VERSION}"
|
Name "Andor's Trail Content Studio v${VERSION}"
|
||||||
OutFile "..\ATCS_${VERSION}_Setup.exe"
|
OutFile "ATCS_v${VERSION}_Setup.exe"
|
||||||
InstallDir "$PROGRAMFILES\ATCS\"
|
InstallDir "$PROGRAMFILES\ATCS\"
|
||||||
|
|
||||||
;SetCompressor /SOLID /FINAL lzma
|
;SetCompressor /SOLID /FINAL lzma
|
||||||
@@ -14,10 +14,10 @@ InstallDir "$PROGRAMFILES\ATCS\"
|
|||||||
Var StartMenuFolder
|
Var StartMenuFolder
|
||||||
|
|
||||||
!define MUI_WELCOMEPAGE_TITLE "Welcome to Andor's Trail Content Studio installer"
|
!define MUI_WELCOMEPAGE_TITLE "Welcome to Andor's Trail Content Studio installer"
|
||||||
!define MUI_WELCOMEPAGE_TEXT "This will install Andor's Trail Content Studio ${VERSION}"
|
!define MUI_WELCOMEPAGE_TEXT "This will install Andor's Trail Content Studio v${VERSION}"
|
||||||
!define MUI_FINISHPAGE_TEXT "Andor's Trail Content Studio ${VERSION} - Install completed !"
|
!define MUI_FINISHPAGE_TEXT "Andor's Trail Content Studio v${VERSION} - Install completed !"
|
||||||
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Andor's Trail Content Studio"
|
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Andor's Trail Content Studio"
|
||||||
!define MUI_PAGE_HEADER_TEXT "Installing Andor's Trail Content Studio ${VERSION}"
|
!define MUI_PAGE_HEADER_TEXT "Installing Andor's Trail Content Studio v${VERSION}"
|
||||||
|
|
||||||
|
|
||||||
;Start Menu Folder Page Configuration
|
;Start Menu Folder Page Configuration
|
||||||
|
|||||||
@@ -1,26 +1,21 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
ATCS_DIR="$(dirname "$(readlink -f "$0" || greadlink -f "$0" || stat -f "$0")")"
|
ATCS_DIR=$(dirname $(readlink -f "$0" || greadlink -f "$0" || stat -f "$0"))
|
||||||
echo "ATCS_DIR: '${ATCS_DIR}'"
|
|
||||||
|
|
||||||
MAX_MEM="512M"
|
MAX_MEM=512M
|
||||||
JAVA="java"
|
|
||||||
|
JAVA=java
|
||||||
JAVA_OPTS='-DFONT_SCALE=1.0 -Dswing.aatext=true'
|
JAVA_OPTS='-DFONT_SCALE=1.0 -Dswing.aatext=true'
|
||||||
|
ENV_FILE=${ATCS_DIR}/ATCS.env
|
||||||
|
|
||||||
ENV_FILE="${ATCS_DIR}/ATCS.env"
|
if [ -f ${ENV_FILE} ]; then
|
||||||
|
source ${ENV_FILE}
|
||||||
if [ -f "${ENV_FILE}" ]; then
|
|
||||||
source "${ENV_FILE}"
|
|
||||||
else
|
else
|
||||||
{
|
echo "#MAX_MEM=${MAX_MEM}" >${ENV_FILE}
|
||||||
echo "#MAX_MEM=\"${MAX_MEM}\""
|
echo "#JAVA=${JAVA}" >>${ENV_FILE}
|
||||||
echo "#JAVA=\"${JAVA}\""
|
echo "#JAVA_OPTS=${JAVA_OPTS}" >>${ENV_FILE}
|
||||||
echo "#JAVA_OPTS=\"${JAVA_OPTS}\""
|
echo "" >>${ENV_FILE}
|
||||||
echo ""
|
|
||||||
}>"${ENV_FILE}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export ENV_FILE
|
export ENV_FILE
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
$JAVA ${JAVA_OPTS} -Xmx${MAX_MEM} -jar ${ATCS_DIR}/ATCS.jar
|
||||||
# (spellchecker is disabled for this line, because we want it to be split into multiple arguments)
|
|
||||||
$JAVA ${JAVA_OPTS} -Xmx${MAX_MEM} -jar "${ATCS_DIR}/ATCS.jar"
|
|
||||||
|
|||||||
@@ -18,9 +18,10 @@ ATCS_SOURCE_DIR=$(dirname "${PACKAGING_DIR}")
|
|||||||
TEMP_DIR="${PACKAGING_DIR}/tmp"
|
TEMP_DIR="${PACKAGING_DIR}/tmp"
|
||||||
JAR_LOCATION="${PACKAGING_DIR}/ATCS.jar" # Output JAR location as per script
|
JAR_LOCATION="${PACKAGING_DIR}/ATCS.jar" # Output JAR location as per script
|
||||||
MANIFEST_LOCATION="${PACKAGING_DIR}/Manifest.txt"
|
MANIFEST_LOCATION="${PACKAGING_DIR}/Manifest.txt"
|
||||||
VERSION_FILE="${ATCS_SOURCE_DIR}/res/ATCS_latest"
|
VERSION_FILE="${PACKAGING_DIR}/ATCS_latest"
|
||||||
SOURCE_BASE_DIR="${ATCS_SOURCE_DIR}/src" # Base directory for standard source code
|
SOURCE_BASE_DIR="${ATCS_SOURCE_DIR}/src" # Base directory for standard source code
|
||||||
LIB_BASE_DIR="${ATCS_SOURCE_DIR}/lib" # Base directory for libraries
|
LIB_BASE_DIR="${ATCS_SOURCE_DIR}/lib" # Base directory for libraries
|
||||||
|
OUTPUT_JAR_DIR="${PACKAGING_DIR}" # Directory where the final JAR will be placed - as per script
|
||||||
|
|
||||||
# --- **ADDITIONAL SOURCE CODE FOLDERS** ---
|
# --- **ADDITIONAL SOURCE CODE FOLDERS** ---
|
||||||
EXTRA_SOURCE_DIRS=(
|
EXTRA_SOURCE_DIRS=(
|
||||||
@@ -29,7 +30,7 @@ EXTRA_SOURCE_DIRS=(
|
|||||||
"siphash-zackehh/src/main/java"
|
"siphash-zackehh/src/main/java"
|
||||||
)
|
)
|
||||||
|
|
||||||
# --- Libraries to include ---
|
# --- Libraries to include (from IntelliJ artifact definition) ---
|
||||||
LIBRARIES=(
|
LIBRARIES=(
|
||||||
"AndorsTrainer_v0.1.5.jar"
|
"AndorsTrainer_v0.1.5.jar"
|
||||||
"bsh-2.0b4.jar"
|
"bsh-2.0b4.jar"
|
||||||
@@ -44,7 +45,7 @@ LIBRARIES=(
|
|||||||
|
|
||||||
# --- Get version ---
|
# --- Get version ---
|
||||||
echo "Getting version"
|
echo "Getting version"
|
||||||
VERSION=$(tr -d '[:space:]' < "${VERSION_FILE}")
|
VERSION=$(cat "${VERSION_FILE}")
|
||||||
echo "Got version ${VERSION}"
|
echo "Got version ${VERSION}"
|
||||||
|
|
||||||
# --- Prepare temporary directory ---
|
# --- Prepare temporary directory ---
|
||||||
@@ -62,7 +63,7 @@ done
|
|||||||
|
|
||||||
# --- Set ClassPath ---
|
# --- Set ClassPath ---
|
||||||
echo "Getting source files"
|
echo "Getting source files"
|
||||||
# Find all java files in source directories
|
# Find all java files in source directories and compile them
|
||||||
SOURCE_FILES=$(find "${SOURCE_BASE_DIR}" "${EXTRA_SOURCE_DIRS[@]/#/${ATCS_SOURCE_DIR}/}" -name "*.java" -print)
|
SOURCE_FILES=$(find "${SOURCE_BASE_DIR}" "${EXTRA_SOURCE_DIRS[@]/#/${ATCS_SOURCE_DIR}/}" -name "*.java" -print)
|
||||||
#echo "SourceFiles: ${SOURCE_FILES}"
|
#echo "SourceFiles: ${SOURCE_FILES}"
|
||||||
echo ""
|
echo ""
|
||||||
@@ -70,8 +71,6 @@ echo ""
|
|||||||
# --- Build Java classes ---
|
# --- Build Java classes ---
|
||||||
echo 'Building java classes'
|
echo 'Building java classes'
|
||||||
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
# (we need word splitting here to pass multiple files)
|
|
||||||
javac -cp "${TEMP_DIR}" -d "${TEMP_DIR}" ${SOURCE_FILES}
|
javac -cp "${TEMP_DIR}" -d "${TEMP_DIR}" ${SOURCE_FILES}
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Compilation failed. Please check errors above."
|
echo "Compilation failed. Please check errors above."
|
||||||
@@ -86,7 +85,6 @@ mkdir -p "${TEMP_DIR}/com/gpl/rpg/atcontentstudio/img"
|
|||||||
mkdir -p "${TEMP_DIR}/tiled/io/resources/"
|
mkdir -p "${TEMP_DIR}/tiled/io/resources/"
|
||||||
cp -r "${ATCS_SOURCE_DIR}"/src/com/gpl/rpg/atcontentstudio/img/* "${TEMP_DIR}/com/gpl/rpg/atcontentstudio/img/" # some icons
|
cp -r "${ATCS_SOURCE_DIR}"/src/com/gpl/rpg/atcontentstudio/img/* "${TEMP_DIR}/com/gpl/rpg/atcontentstudio/img/" # some icons
|
||||||
cp -r "${ATCS_SOURCE_DIR}"/hacked-libtiled/tiled/io/resources/* "${TEMP_DIR}/tiled/io/resources/" # dtd file for tmx maps
|
cp -r "${ATCS_SOURCE_DIR}"/hacked-libtiled/tiled/io/resources/* "${TEMP_DIR}/tiled/io/resources/" # dtd file for tmx maps
|
||||||
cp "${VERSION_FILE}" "${TEMP_DIR}/" # Copy version file
|
|
||||||
|
|
||||||
# --- Create JAR file ---
|
# --- Create JAR file ---
|
||||||
echo ""
|
echo ""
|
||||||
@@ -105,22 +103,17 @@ cd "${PACKAGING_DIR}" || exit # Go back to packaging dir
|
|||||||
|
|
||||||
echo ''
|
echo ''
|
||||||
echo "Done creating jar at ${JAR_LOCATION}"
|
echo "Done creating jar at ${JAR_LOCATION}"
|
||||||
cp -f "${JAR_LOCATION}" "${PACKAGING_DIR}/common/ATCS.jar" # Copy JAR to versioned name
|
cp -f "${JAR_LOCATION}" "${OUTPUT_JAR_DIR}/common/ATCS.jar" # Copy JAR to versioned name
|
||||||
|
|
||||||
# --- Create archive ---
|
# --- Create archive ---
|
||||||
cd "${PACKAGING_DIR}" || exit
|
if [ "$PLATFORM" = "LINUX" ]; then
|
||||||
echo "Creating archive"
|
cd "${OUTPUT_JAR_DIR}" || exit
|
||||||
if [ "$PLATFORM" = "WINDOWS" ]; then
|
echo "Creating archive"
|
||||||
# Use PowerShell's Compress-Archive which is available by default on Windows
|
tar caf "ATCS_${VERSION}.tar.gz" common/* # archive the 'common' folder which now contains the JAR and libs
|
||||||
powershell.exe -Command "Compress-Archive -Path './common/*' -DestinationPath './ATCS_${VERSION}.zip' -Force"
|
echo "Created archive at ${OUTPUT_JAR_DIR}/ATCS_${VERSION}.tar.gz"
|
||||||
|
cd "${PACKAGING_DIR}" || exit
|
||||||
else
|
else
|
||||||
# Use zip command on Linux
|
echo "Can't create zip files on windows yet. Please pack the content of the '${OUTPUT_JAR_DIR}/common/' folder yourself"
|
||||||
zip -r "ATCS_${VERSION}.zip" common/* # archive the 'common' folder which now contains the JAR and libs
|
|
||||||
fi
|
fi
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Archive creation failed."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "Created archive at ${PACKAGING_DIR}/ATCS_${VERSION}.zip"
|
|
||||||
|
|
||||||
echo "Script finished."
|
echo "Script finished."
|
||||||
|
|||||||
@@ -14,7 +14,11 @@ import java.io.InputStreamReader;
|
|||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.*;
|
import java.util.Enumeration;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -38,7 +42,8 @@ import com.gpl.rpg.atcontentstudio.ui.WorkspaceSelector;
|
|||||||
public class ATContentStudio {
|
public class ATContentStudio {
|
||||||
|
|
||||||
public static final String APP_NAME = "Andor's Trail Content Studio";
|
public static final String APP_NAME = "Andor's Trail Content Studio";
|
||||||
public static final String APP_VERSION = readVersionFromFile();
|
public static final String APP_VERSION = "v0.6.21";
|
||||||
|
|
||||||
public static final String CHECK_UPDATE_URL = "https://andorstrail.com/static/ATCS_latest";
|
public static final String CHECK_UPDATE_URL = "https://andorstrail.com/static/ATCS_latest";
|
||||||
public static final String DOWNLOAD_URL = "https://andorstrail.com/viewtopic.php?f=6&t=4806";
|
public static final String DOWNLOAD_URL = "https://andorstrail.com/viewtopic.php?f=6&t=4806";
|
||||||
|
|
||||||
@@ -148,8 +153,7 @@ public static final String APP_VERSION = readVersionFromFile();
|
|||||||
while ((inputLine = in.readLine()) != null) {
|
while ((inputLine = in.readLine()) != null) {
|
||||||
lastLine = inputLine;
|
lastLine = inputLine;
|
||||||
}
|
}
|
||||||
if (lastLine != null && !lastLine.equals(APP_VERSION)) {
|
if (lastLine != null && compareVersions(lastLine) < 0) {
|
||||||
|
|
||||||
// for copying style
|
// for copying style
|
||||||
JLabel label = new JLabel();
|
JLabel label = new JLabel();
|
||||||
Font font = label.getFont();
|
Font font = label.getFont();
|
||||||
@@ -226,13 +230,19 @@ public static final String APP_VERSION = readVersionFromFile();
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private static String readVersionFromFile() {
|
|
||||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(
|
/// returns The difference between the the latest version and the current one (CURRENT - LATEST)
|
||||||
Objects.requireNonNull(ATContentStudio.class.getResourceAsStream("/ATCS_latest"))))) {
|
private static int compareVersions(String latest) {
|
||||||
return reader.readLine();
|
String[] levels1 = ATContentStudio.APP_VERSION.substring(1).split("\\.");
|
||||||
} catch (IOException e) {
|
String[] levels2 = latest.substring(1).split("\\.");
|
||||||
e.printStackTrace();
|
int length = Math.max(levels1.length, levels2.length);
|
||||||
return "unknown";
|
for (int i = 0; i < length; i++) {
|
||||||
|
int v1 = i < levels1.length ? Integer.parseInt(levels1[i]) : 0;
|
||||||
|
int v2 = i < levels2.length ? Integer.parseInt(levels2[i]) : 0;
|
||||||
|
if (v1 != v2) {
|
||||||
|
return v1 - v2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user