feat: improve building

This commit is contained in:
shenjack 2023-01-06 21:29:13 +08:00
parent a26084a563
commit c0b3ce7409
7 changed files with 34 additions and 9 deletions

View File

@ -10,6 +10,8 @@ import rtoml
sys.path.append(os.path.abspath(os.curdir))
from Difficult_Rocket import DR_runtime
args = ['-env', '']
if not any([x in sys.argv for x in args]): # 没有输入参数,直接输出默认信息并输出
@ -22,11 +24,15 @@ if not any([x in sys.argv for x in args]): # 没有输入参数,直接输出
rtoml.dump(config_file, open('./configs/main.toml', 'w'))
if os.path.abspath(os.curdir) in sys.path and '-env' in sys.argv:
from Difficult_Rocket import DR_runtime
with open('./.github/workflows/env.ps1', encoding='utf-8', mode='w') as env_file:
print(f'$env:DR_version = "{DR_runtime.DR_version}"', file=env_file)
print(f'$env:DR_language = "{DR_runtime.language}"', file=env_file)
print(f'$env:DR_long_version = "{DR_runtime.DR_long_version}"', file=env_file)
print(f'$env:Build_version = "{DR_runtime.Build_version}"', file=env_file)
if os.path.abspath(os.curdir) in sys.path and '-github-env' in sys.argv:
print(f'DR_version={DR_runtime.DR_version}')
print(f'DR_language={DR_runtime.language}')
print(f'DR_long_version={DR_runtime.DR_long_version}')
print(f'Build_version={DR_runtime.Build_version}')
# os.system(f'echo "DR_version={DR_runtime.DR_version}" >> $GITHUB_OUTPUT')

View File

@ -62,7 +62,7 @@ jobs:
id: DR_info
shell: pwsh
run: |
$infos = python .github/workflows/get_info.py -env
$infos = python .github/workflows/get_info.py -github-env
Write-Output $infos >> $env:GITHUB_ENV
python .github/workflows/get_info.py

5
.gitignore vendored
View File

@ -4,6 +4,10 @@
DR.code-workspace
trytry/
# nuitka build
build/
.github/workflows/env.ps1
# PyCharm file
.idea/
@ -32,7 +36,6 @@ __pycache__/
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/

View File

@ -18,7 +18,7 @@ from Difficult_Rocket.api.types import Options
from libs.MCDR.version import Version
game_version = Version("0.6.4.1") # 游戏版本
build_version = Version("0.0.1.0") # 编译文件版本(与游戏本体无关)
build_version = Version("0.1.0.0") # 编译文件版本(与游戏本体无关)
__version__ = game_version
long_version: ctypes.c_longlong = ctypes.c_longlong(5)

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

View File

@ -1,7 +1,14 @@
$start_time = Get-Uptime
Write-Output $start_time
python .\.github\workflows\get_info.py
python .\.github\workflows\get_info.py -env
if (-Not (Test-Path -Path "./.github/workflows/env.ps1"))
{
Throw "No env file found as ./github/workflows/env.ps1 !"
}
./.github/workflows/env.ps1
$arg = @()
# 输出配置
@ -9,8 +16,8 @@ $arg += @("--standalone")
$arg += @("--output-dir=build/nuitka")
$arg += @("--company-name=tool-shenjack-workshop")
$arg += @("--product-name=Difficult-Rocket")
$arg += @("--product-version=0.6.4.1")
$arg += @("--file-version=0.0.1.0")
$arg += @("--product-version=$env:DR_version")
$arg += @("--file-version=$env:Build_version")
$arg += @("--file-description=Difficult-Rocket!")
$arg += @("--windows-icon-from-ico=textures/icon.png")
$arg += @("--macos-app-icon=textures/icon.png")

View File

@ -1,6 +1,15 @@
$start_time = Get-Uptime
Write-Output $start_time
python .\.github\workflows\get_info.py -env
if (-Not (Test-Path -Path "./.github/workflows/env.ps1"))
{
Throw "No env file found as ./github/workflows/env.ps1 !"
}
./.github/workflows/env.ps1
$arg = @()
# 输出配置
$arg += @("--standalone")