mirror of
https://github.com/OMGeeky/ATCS.git
synced 2025-12-26 15:57:22 +01:00
Merge branch 'pulls/1195352/8'
This commit is contained in:
6
.gitattributes
vendored
Normal file
6
.gitattributes
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
# 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
Normal file
56
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
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
2
packaging/Linux/.gitignore
vendored
@@ -1,2 +0,0 @@
|
||||
/ATCS_v*.zip
|
||||
/ATCS_v*.zip.rename
|
||||
@@ -1,20 +0,0 @@
|
||||
@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%
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 24 KiB |
@@ -1,22 +0,0 @@
|
||||
#!/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
1
packaging/Linux/ATCS/lib/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
/*.jar
|
||||
@@ -1,12 +1,12 @@
|
||||
!include MUI2.nsh
|
||||
|
||||
!define VERSION "0.6.21"
|
||||
; Version will be passed as /DVERSION=vx.x.x
|
||||
!define TRAINER_VERSION "0.1.5"
|
||||
!define JAVA_BIN "java"
|
||||
!define ATCS_SOURCE_DIR "C:\ATCS"
|
||||
!define ATCS_SOURCE_DIR "..\..\"
|
||||
|
||||
Name "Andor's Trail Content Studio v${VERSION}"
|
||||
OutFile "ATCS_v${VERSION}_Setup.exe"
|
||||
Name "Andor's Trail Content Studio ${VERSION}"
|
||||
OutFile "..\ATCS_${VERSION}_Setup.exe"
|
||||
InstallDir "$PROGRAMFILES\ATCS\"
|
||||
|
||||
;SetCompressor /SOLID /FINAL lzma
|
||||
@@ -14,10 +14,10 @@ InstallDir "$PROGRAMFILES\ATCS\"
|
||||
Var StartMenuFolder
|
||||
|
||||
!define MUI_WELCOMEPAGE_TITLE "Welcome to Andor's Trail Content Studio installer"
|
||||
!define MUI_WELCOMEPAGE_TEXT "This will install Andor's Trail Content Studio v${VERSION}"
|
||||
!define MUI_FINISHPAGE_TEXT "Andor's Trail Content Studio v${VERSION} - Install completed !"
|
||||
!define MUI_WELCOMEPAGE_TEXT "This will install Andor's Trail Content Studio ${VERSION}"
|
||||
!define MUI_FINISHPAGE_TEXT "Andor's Trail Content Studio ${VERSION} - Install completed !"
|
||||
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Andor's Trail Content Studio"
|
||||
!define MUI_PAGE_HEADER_TEXT "Installing Andor's Trail Content Studio v${VERSION}"
|
||||
!define MUI_PAGE_HEADER_TEXT "Installing Andor's Trail Content Studio ${VERSION}"
|
||||
|
||||
|
||||
;Start Menu Folder Page Configuration
|
||||
@@ -86,23 +86,23 @@ Section install
|
||||
FileClose $9
|
||||
|
||||
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
||||
|
||||
|
||||
|
||||
|
||||
!insertmacro MUI_STARTMENU_WRITE_BEGIN "ATCS"
|
||||
|
||||
|
||||
;--- Create shortcuts
|
||||
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
|
||||
CreateShortcut "$SMPROGRAMS\$StartMenuFolder\Andor's Trail Content Studio.lnk" "$INSTDIR\ATCS.cmd" "" "$INSTDIR\ATCS.ico"
|
||||
CreateShortcut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
|
||||
|
||||
|
||||
!insertmacro MUI_STARTMENU_WRITE_END
|
||||
|
||||
|
||||
SectionEnd
|
||||
|
||||
|
||||
;------------------------------------------------------------------------------------
|
||||
Section uninstall
|
||||
|
||||
|
||||
Delete "$INSTDIR\lib\jide-oss.jar"
|
||||
Delete "$INSTDIR\lib\ui.jar"
|
||||
Delete "$INSTDIR\lib\junit-4.10.jar"
|
||||
@@ -120,13 +120,13 @@ Section uninstall
|
||||
Delete "$INSTDIR\ATCS.jar"
|
||||
Delete "$INSTDIR\Uninstall.exe"
|
||||
RMDir "$INSTDIR"
|
||||
|
||||
|
||||
!insertmacro MUI_STARTMENU_GETFOLDER "ATCS" $StartMenuFolder
|
||||
|
||||
|
||||
Delete "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk"
|
||||
Delete "$SMPROGRAMS\$StartMenuFolder\Andor's Trail Content Studio.lnk"
|
||||
RMDir "$SMPROGRAMS\$StartMenuFolder"
|
||||
|
||||
|
||||
SectionEnd
|
||||
|
||||
|
||||
@@ -138,28 +138,28 @@ Function GetJRE
|
||||
; 2 - in JAVA_HOME environment variable
|
||||
; 3 - in the registry
|
||||
; 4 - assume java.exe in current dir or PATH
|
||||
|
||||
|
||||
Push $R0
|
||||
Push $R1
|
||||
|
||||
|
||||
;ClearErrors
|
||||
;StrCpy $R0 "$EXEDIR\jre\bin\java.exe"
|
||||
;IfFileExists $R0 JreFound
|
||||
;StrCpy $R0 ""
|
||||
|
||||
|
||||
ClearErrors
|
||||
ReadEnvStr $R0 "JAVA_HOME"
|
||||
StrCpy $R0 "$R0\bin\${JAVA_BIN}.exe"
|
||||
IfErrors 0 JreFound
|
||||
|
||||
|
||||
ClearErrors
|
||||
ReadRegStr $R1 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"
|
||||
ReadRegStr $R0 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$R1" "JavaHome"
|
||||
StrCpy $R0 "$R0\bin\${JAVA_BIN}.exe"
|
||||
|
||||
|
||||
IfErrors 0 JreFound
|
||||
StrCpy $R0 "${JAVA_BIN}.exe"
|
||||
|
||||
|
||||
JreFound:
|
||||
Pop $R1
|
||||
Exch $R0
|
||||
|
||||
@@ -1,21 +1,26 @@
|
||||
#!/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
|
||||
|
||||
JAVA=java
|
||||
MAX_MEM="512M"
|
||||
JAVA="java"
|
||||
JAVA_OPTS='-DFONT_SCALE=1.0 -Dswing.aatext=true'
|
||||
ENV_FILE=${ATCS_DIR}/ATCS.env
|
||||
|
||||
if [ -f ${ENV_FILE} ]; then
|
||||
source ${ENV_FILE}
|
||||
ENV_FILE="${ATCS_DIR}/ATCS.env"
|
||||
|
||||
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}
|
||||
{
|
||||
echo "#MAX_MEM=\"${MAX_MEM}\""
|
||||
echo "#JAVA=\"${JAVA}\""
|
||||
echo "#JAVA_OPTS=\"${JAVA_OPTS}\""
|
||||
echo ""
|
||||
}>"${ENV_FILE}"
|
||||
fi
|
||||
|
||||
export ENV_FILE
|
||||
|
||||
$JAVA ${JAVA_OPTS} -Xmx${MAX_MEM} -jar ${ATCS_DIR}/ATCS.jar
|
||||
# shellcheck disable=SC2086
|
||||
# (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,10 +18,9 @@ ATCS_SOURCE_DIR=$(dirname "${PACKAGING_DIR}")
|
||||
TEMP_DIR="${PACKAGING_DIR}/tmp"
|
||||
JAR_LOCATION="${PACKAGING_DIR}/ATCS.jar" # Output JAR location as per script
|
||||
MANIFEST_LOCATION="${PACKAGING_DIR}/Manifest.txt"
|
||||
VERSION_FILE="${PACKAGING_DIR}/ATCS_latest"
|
||||
VERSION_FILE="${ATCS_SOURCE_DIR}/res/ATCS_latest"
|
||||
SOURCE_BASE_DIR="${ATCS_SOURCE_DIR}/src" # Base directory for standard source code
|
||||
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** ---
|
||||
EXTRA_SOURCE_DIRS=(
|
||||
@@ -30,7 +29,7 @@ EXTRA_SOURCE_DIRS=(
|
||||
"siphash-zackehh/src/main/java"
|
||||
)
|
||||
|
||||
# --- Libraries to include (from IntelliJ artifact definition) ---
|
||||
# --- Libraries to include ---
|
||||
LIBRARIES=(
|
||||
"AndorsTrainer_v0.1.5.jar"
|
||||
"bsh-2.0b4.jar"
|
||||
@@ -45,7 +44,7 @@ LIBRARIES=(
|
||||
|
||||
# --- Get version ---
|
||||
echo "Getting version"
|
||||
VERSION=$(cat "${VERSION_FILE}")
|
||||
VERSION=$(tr -d '[:space:]' < "${VERSION_FILE}")
|
||||
echo "Got version ${VERSION}"
|
||||
|
||||
# --- Prepare temporary directory ---
|
||||
@@ -63,7 +62,7 @@ done
|
||||
|
||||
# --- Set ClassPath ---
|
||||
echo "Getting source files"
|
||||
# Find all java files in source directories and compile them
|
||||
# Find all java files in source directories
|
||||
SOURCE_FILES=$(find "${SOURCE_BASE_DIR}" "${EXTRA_SOURCE_DIRS[@]/#/${ATCS_SOURCE_DIR}/}" -name "*.java" -print)
|
||||
#echo "SourceFiles: ${SOURCE_FILES}"
|
||||
echo ""
|
||||
@@ -71,6 +70,8 @@ echo ""
|
||||
# --- Build 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}
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Compilation failed. Please check errors above."
|
||||
@@ -85,6 +86,7 @@ mkdir -p "${TEMP_DIR}/com/gpl/rpg/atcontentstudio/img"
|
||||
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}"/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 ---
|
||||
echo ""
|
||||
@@ -103,17 +105,22 @@ cd "${PACKAGING_DIR}" || exit # Go back to packaging dir
|
||||
|
||||
echo ''
|
||||
echo "Done creating jar at ${JAR_LOCATION}"
|
||||
cp -f "${JAR_LOCATION}" "${OUTPUT_JAR_DIR}/common/ATCS.jar" # Copy JAR to versioned name
|
||||
cp -f "${JAR_LOCATION}" "${PACKAGING_DIR}/common/ATCS.jar" # Copy JAR to versioned name
|
||||
|
||||
# --- Create archive ---
|
||||
if [ "$PLATFORM" = "LINUX" ]; then
|
||||
cd "${OUTPUT_JAR_DIR}" || exit
|
||||
echo "Creating archive"
|
||||
tar caf "ATCS_${VERSION}.tar.gz" common/* # archive the 'common' folder which now contains the JAR and libs
|
||||
echo "Created archive at ${OUTPUT_JAR_DIR}/ATCS_${VERSION}.tar.gz"
|
||||
cd "${PACKAGING_DIR}" || exit
|
||||
cd "${PACKAGING_DIR}" || exit
|
||||
echo "Creating archive"
|
||||
if [ "$PLATFORM" = "WINDOWS" ]; then
|
||||
# Use PowerShell's Compress-Archive which is available by default on Windows
|
||||
powershell.exe -Command "Compress-Archive -Path './common/*' -DestinationPath './ATCS_${VERSION}.zip' -Force"
|
||||
else
|
||||
echo "Can't create zip files on windows yet. Please pack the content of the '${OUTPUT_JAR_DIR}/common/' folder yourself"
|
||||
# Use zip command on Linux
|
||||
zip -r "ATCS_${VERSION}.zip" common/* # archive the 'common' folder which now contains the JAR and libs
|
||||
fi
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Archive creation failed."
|
||||
exit 1
|
||||
fi
|
||||
echo "Created archive at ${PACKAGING_DIR}/ATCS_${VERSION}.zip"
|
||||
|
||||
echo "Script finished."
|
||||
|
||||
@@ -14,11 +14,7 @@ import java.io.InputStreamReader;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -42,8 +38,7 @@ import com.gpl.rpg.atcontentstudio.ui.WorkspaceSelector;
|
||||
public class ATContentStudio {
|
||||
|
||||
public static final String APP_NAME = "Andor's Trail Content Studio";
|
||||
public static final String APP_VERSION = "v0.6.21";
|
||||
|
||||
public static final String APP_VERSION = readVersionFromFile();
|
||||
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";
|
||||
|
||||
@@ -231,4 +226,13 @@ public class ATContentStudio {
|
||||
}
|
||||
}
|
||||
}
|
||||
private static String readVersionFromFile() {
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(
|
||||
Objects.requireNonNull(ATContentStudio.class.getResourceAsStream("/ATCS_latest"))))) {
|
||||
return reader.readLine();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user