Skip to content

Commit

Permalink
在gdextension中添加版本信息
Browse files Browse the repository at this point in the history
  • Loading branch information
Daylily-Zeleen committed Apr 10, 2024
1 parent b682c16 commit 118d872
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ project/
build/

# scons
bin/
bin/
__pycache__/
17 changes: 17 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python
import os
import shutil
import version

env = SConscript("godot-cpp/SConstruct")
lib_name = "libgddragonbones"
Expand All @@ -21,6 +22,8 @@ output_bin_folder = "./bin"
plugin_folder = "./demo/addons/gddragonbones"
plugin_bin_folder = f"{plugin_folder}/bin"

extension_file = "demo/addons/gddragonbones/gddragonbones.gdextension"

if env.debug_features:
env.Append(CPPDEFINES=["TOOLS_ENABLED"])

Expand Down Expand Up @@ -96,6 +99,20 @@ def on_complete(target, source, env):
copy_file("README.md", os.path.join(plugin_folder, "README.md"))
copy_file("LICENSE", os.path.join(plugin_folder, "LICENSE"))

# 更新.gdextension中的版本信息
f = open(extension_file, "r", encoding="utf8")
lines = f.readlines()
f.close()

for i in range(len(lines)):
if lines[i].startswith('version = "') and lines[i].endswith('"\n'):
lines[i] = f'version = "{version.version}"\n'
break

f = open(extension_file, "w", encoding="utf8")
f.writelines(lines)
f.close()


# Disable scons cache for source files
NoCache(sources)
Expand Down
10 changes: 10 additions & 0 deletions demo/addons/gddragonbones/gddragonbones.gdextension
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
[infomation]
name = "Godot-DragonBones"
version = "v0.0.0"
decription = "A DragonBones plugin for Godot."
author = "忘忧の (Daylily Zeleen)"
email = "[email protected]"
support_link = "https://afdian.net/a/Daylily-Zeleen"
repo = "https://github.com/Daylily-Zeleen/Godot-DragonBones"
others = "诚接Godot游戏开发,欢迎邮件联系。/ Receive game development outsourcing, welcome to contact by email."

[configuration]

entry_symbol = "gddragonbones_library_init"
Expand Down

0 comments on commit 118d872

Please sign in to comment.