Skip to content

Commit 2ef4861

Browse files
committed
Add Windows export preset
Annoyingly this needed changes to the version-generator plugin, because exporting generated this warning: WARNING: Invalid version number "v0.1.11-72-g29be516f2". The version number can only contain numeric characters (0-9) and non-consecutive periods (.). I changed it so that "application/config/version" is "0.1.12" for the tag "v0.1.12", and "0.1.11.72" for a build 72 commits ahead of v0.1.11. The full `git describe --tags` output is now in "application/config/full_version". Explicitly qualify the export name with "x86_64". It is possible we will one day add an arm64 export. Update the Linux export accordingly. Ensure the target directory exists for both builds Resolves #2155
1 parent 29be516 commit 2ef4861

6 files changed

Lines changed: 117 additions & 22 deletions

File tree

addons/threadbare_git_describe/export.gd

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,20 @@ func _get_name() -> String:
99
return "threadbare_git_describe_exporter"
1010

1111

12-
func set_version(version: Variant) -> void:
13-
ProjectSettings.set_setting("application/config/version", version)
14-
var err := ProjectSettings.save()
15-
if err != OK:
16-
printerr("Failed to save project settings: %s" % error_string(err))
17-
18-
1912
func _export_begin(
2013
_features: PackedStringArray, _is_debug: bool, _path: String, _flags: int
2114
) -> void:
22-
set_version(Version.git_describe(true))
15+
var describe := Version.git_describe(true)
16+
ProjectSettings.set_setting(Version.FULL_VERSION_KEY, describe)
17+
ProjectSettings.set_setting(Version.VERSION_KEY, Version.simplify(describe))
18+
var err := ProjectSettings.save()
19+
if err != OK:
20+
printerr("Failed to save project settings: %s" % error_string(err))
2321

2422

2523
func _export_end() -> void:
26-
set_version(null)
24+
ProjectSettings.set_setting(Version.FULL_VERSION_KEY, null)
25+
ProjectSettings.set_setting(Version.VERSION_KEY, null)
26+
var err := ProjectSettings.save()
27+
if err != OK:
28+
printerr("Failed to save project settings: %s" % error_string(err))

addons/threadbare_git_describe/version.gd

Lines changed: 31 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,54 @@
33
extends Object
44
## Functions to determine the game version
55

6+
const FULL_VERSION_KEY := &"application/config/full_version"
7+
const VERSION_KEY := &"application/config/version"
8+
69
static var _initialized := false
10+
static var _full_version: String
711
static var _version: String
812

913

1014
## Gets the project version based on [code]git describe[/code],
11-
## or [code]""[/code] if this fails.
15+
## or [code]"v0.0.0"[/code] if this fails.
1216
static func git_describe(warn_on_error: bool) -> String:
1317
var output: Array[String] = []
1418
var ret := OS.execute("git", ["describe", "--tags"], output)
1519
if ret != 0:
1620
if warn_on_error:
1721
printerr("git describe --tags failed: %d" % ret)
18-
return ""
22+
return "v0.0.0"
1923

2024
var version := output[0].strip_edges()
2125
return version
2226

2327

24-
## Gets the game version from the project configuration, falling back to
25-
## calling [member git_describe].
26-
static func get_version() -> String:
27-
if not _initialized:
28-
_version = ProjectSettings.get(&"application/config/version")
28+
static func simplify(full_version: String) -> String:
29+
var regex := RegEx.new()
30+
regex.compile("^v(?<base>\\d+(?:\\.\\d+)+)(?:-(?<count>\\d+).*)?$")
31+
var result := regex.search(full_version)
32+
if not result:
33+
return "0.0.0"
34+
return ".".join(result.strings.slice(1))
35+
36+
37+
## Gets the full `git describe`-style version
38+
static func get_full_version() -> String:
39+
if not _full_version:
40+
_full_version = ProjectSettings.get_setting(FULL_VERSION_KEY, "")
2941

30-
if not _version:
31-
_version = git_describe(false)
42+
if not _full_version:
43+
_full_version = git_describe(false)
44+
45+
return _full_version
46+
47+
48+
## Gets the game version in a Windows .exe-friendly x.y.z.w format
49+
static func get_version() -> String:
50+
if not _version:
51+
_version = ProjectSettings.get_setting(VERSION_KEY, "")
3252

33-
_initialized = true
53+
if not _version:
54+
_version = simplify(get_full_version())
3455

3556
return _version

addons/threadbare_git_describe/version_label.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ extends Label
88

99

1010
func _ready() -> void:
11-
text = preload("./version.gd").get_version()
11+
text = preload("./version.gd").get_full_version()

build/linux-x86_64/.gdignore

Whitespace-only changes.

build/windows-x86_64/.gdignore

Whitespace-only changes.

export_presets.cfg

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ threads/godot_pool_size=4
6363

6464
[preset.1]
6565

66-
name="Linux"
66+
name="Linux x86_64"
6767
platform="Linux"
6868
runnable=true
6969
dedicated_server=false
7070
custom_features=""
7171
export_filter="all_resources"
7272
include_filter=""
7373
exclude_filter=""
74-
export_path="build/threadbare.x86_64"
74+
export_path="build/linux-x86_64/threadbare.x86_64"
7575
patches=PackedStringArray()
7676
patch_delta_encoding=false
7777
patch_delta_compression_level_zstd=19
@@ -107,3 +107,75 @@ unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
107107
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
108108
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
109109
rm -rf \"{temp_dir}\""
110+
111+
[preset.2]
112+
113+
name="Windows x86_64"
114+
platform="Windows Desktop"
115+
runnable=true
116+
dedicated_server=false
117+
custom_features=""
118+
export_filter="all_resources"
119+
include_filter=""
120+
exclude_filter=""
121+
export_path="build/windows-x86_64/threadbare.exe"
122+
patches=PackedStringArray()
123+
patch_delta_encoding=false
124+
patch_delta_compression_level_zstd=19
125+
patch_delta_min_reduction=0.1
126+
patch_delta_include_filters="*"
127+
patch_delta_exclude_filters=""
128+
encryption_include_filters=""
129+
encryption_exclude_filters=""
130+
seed=0
131+
encrypt_pck=false
132+
encrypt_directory=false
133+
script_export_mode=2
134+
135+
[preset.2.options]
136+
137+
custom_template/debug=""
138+
custom_template/release=""
139+
debug/export_console_wrapper=1
140+
binary_format/embed_pck=false
141+
texture_format/s3tc_bptc=true
142+
texture_format/etc2_astc=false
143+
shader_baker/enabled=false
144+
binary_format/architecture="x86_64"
145+
codesign/enable=false
146+
codesign/timestamp=true
147+
codesign/timestamp_server_url=""
148+
codesign/digest_algorithm=1
149+
codesign/description=""
150+
codesign/custom_options=PackedStringArray()
151+
application/modify_resources=true
152+
application/icon=""
153+
application/console_wrapper_icon=""
154+
application/icon_interpolation=4
155+
application/file_version=""
156+
application/product_version=""
157+
application/company_name="Endless Access"
158+
application/product_name="Threadbare"
159+
application/file_description=""
160+
application/copyright="Endless Access LLC & the Threadbare Authors"
161+
application/trademarks=""
162+
application/export_angle=0
163+
application/export_d3d12=0
164+
application/d3d12_agility_sdk_multiarch=true
165+
ssh_remote_deploy/enabled=false
166+
ssh_remote_deploy/host="user@host_ip"
167+
ssh_remote_deploy/port="22"
168+
ssh_remote_deploy/extra_args_ssh=""
169+
ssh_remote_deploy/extra_args_scp=""
170+
ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}'
171+
$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}'
172+
$trigger = New-ScheduledTaskTrigger -Once -At 00:00
173+
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
174+
$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings
175+
Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true
176+
Start-ScheduledTask -TaskName godot_remote_debug
177+
while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 }
178+
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue"
179+
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
180+
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
181+
Remove-Item -Recurse -Force '{temp_dir}'"

0 commit comments

Comments
 (0)