跳转到内容

打包计划

This plan details the steps to build a self-contained, ready-to-run Windows ZIP package for the refactored Genshin RPG project, including a slimmed-down MySQL instance, custom startup/shutdown scripts, and compiled binaries.

We will construct the distribution in E:\AI\zcode\object\ke-she\dist\genshinrpg\.


The main entry point for the user. It will call start_mysql.bat, compile/run the application, and call stop_mysql.bat upon exit.

Detects if port 3306 is open, dynamically generates my.ini with absolute paths mapping to the current folder, initializes MySQL if data/mysql is missing, starts mysqld.exe in the background, and polls the port until ready.

Attempts to read mysql/mysqld.pid and kill the process cleanly, or defaults to killing the local mysqld.exe process if the PID is not found.

Instructions for the end-user (requirements, launch steps, admin password, troubleshooting).

Standard ignore rules for runtime files (e.g., mysql/data/, mysql/my.ini, mysql/mysqld.pid).


2. MySQL Embedded Database (Slimming Down)

Section titled “2. MySQL Embedded Database (Slimming Down)”

Copy E:\SQL\mysql\ to E:\AI\zcode\object\ke-she\dist\genshinrpg\mysql\ and apply the following slimming rules:

  1. Delete from bin/:
    • bin/*.pdb (~360MB total)
    • All .exe files except mysqld.exe. (Keep mysqld.exe and all .dll files in the bin/ folder).
  2. Delete from lib/:
    • lib/*.lib (e.g. libmysql.lib, mysqlclient.lib, mysqlservices.lib)
    • lib/private/
  3. Delete directories:
    • include/
    • docs/
  4. Clean up data/:
    • We will copy E:\SQL\mysql\data but delete: binlog.*, *.err, *.pid, auto.cnf, ib_logfile*, ibdata1, undo_*, #innodb_temp, mysql.sock.
    • We will keep: mysql/, genshin_rpg/ (pre-created game DB), sys/, performance_schema/, *.pem, ib_buffer_pool.

Copy all files from E:\AI\zcode\object\ke-she\refactored\src\ to E:\AI\zcode\object\ke-she\dist\genshinrpg\src\.

Copy mysql-connector-j-8.0.33.jar to E:\AI\zcode\object\ke-she\dist\genshinrpg\lib\.

Copy E:\C\cDownKeShe\db\genshin_rpg.sql to E:\AI\zcode\object\ke-she\dist\genshinrpg\db\.

Output folder for compiled classes. We will compile the sources here using javac.


Modify only the database path resolution segment inside connectDB() to use relative paths instead of E:\SQL\mysql.


We will run a series of terminal tests in PowerShell:

  1. Compilation Check:
    • Run javac -encoding UTF-8 -d bin @sources.txt in the package root. Verify that compilation completes with 0 errors.
  2. Environment Simulation:
    • Stop any existing local MySQL service (e.g. via taskkill or net stop).
    • Run start_mysql.bat in a new CMD/PowerShell session and ensure my.ini is generated correctly.
    • Run stop_mysql.bat and ensure the database shuts down.
  3. Clean Database Boot:
    • Delete dist\genshinrpg\mysql\data completely and run run.bat to test the fallback initialization using mysqld --initialize-insecure.
  1. Run the application using run.bat.
  2. Register a new user, log in, perform a battle, and verify that the data persists successfully to the local database.
  3. Exit the application, re-run run.bat, and verify that the startup script detects the existing port and skips the initialization sequence.
  4. Package the folder into a ZIP and check that the file size is under 50MB.
  5. Create dist\PACK_NOTE.md detailing the results.