generated from MechanicalFlower/godot-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8ae31e8
commit 6f03c20
Showing
11 changed files
with
86 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const BUILD_INFO_VERSION := "application/config/version" | ||
const BUILD_INFO_COMMIT := "custom_options/build_info/commit" | ||
const BUILD_INFO_DATE := "custom_options/build_info/date" | ||
|
||
|
||
static func setup_build_info_settings(): | ||
var output := [] | ||
|
||
# Commit Hash | ||
OS.execute("git", ["log", '--pretty=format:"%H"', "-1"], output, false) | ||
output[0] = output[0].trim_suffix("\n") | ||
ProjectSettings.set_as_internal(BUILD_INFO_COMMIT, true) | ||
ProjectSettings.set_setting(BUILD_INFO_COMMIT, output[0]) | ||
|
||
# Datetime | ||
OS.execute("date", ["+%Y/%m/%d"], output, false) | ||
output[1] = output[1].trim_suffix("\n") | ||
ProjectSettings.set_as_internal(BUILD_INFO_DATE, true) | ||
ProjectSettings.set_setting(BUILD_INFO_DATE, output[1]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
extends EditorExportPlugin | ||
|
||
const BuildInfo := preload("res://addons/export-build-info/build_info.gd") | ||
|
||
|
||
func _export_begin(_features, _is_debug, _path, _flags) -> void: | ||
BuildInfo.setup_build_info_settings() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
@tool | ||
extends Label | ||
|
||
const BuildInfo := preload("res://addons/export-build-info/build_info.gd") | ||
|
||
|
||
func _ready(): | ||
var build_version = ProjectSettings.get_setting(BuildInfo.BUILD_INFO_VERSION) | ||
var build_commit = ProjectSettings.get_setting(BuildInfo.BUILD_INFO_COMMIT) | ||
var build_date = ProjectSettings.get_setting(BuildInfo.BUILD_INFO_DATE) | ||
|
||
if build_version and build_commit and build_date: | ||
set_text("v%s @ %s\n%s" % [build_version, build_commit.left(7), build_date]) | ||
else: | ||
set_text("") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[plugin] | ||
|
||
name="build_info" | ||
description="" | ||
author="florianvazelle" | ||
version="0.0.0" | ||
script="plugin.gd" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
@tool | ||
extends EditorPlugin | ||
|
||
const BuildInfo := preload("res://addons/export-build-info/build_info.gd") | ||
|
||
var export_plugin := preload("res://addons/export-build-info/export_plugin.gd").new() | ||
|
||
|
||
func _enter_tree(): | ||
add_export_plugin(export_plugin) | ||
|
||
if Engine.is_editor_hint(): | ||
BuildInfo.setup_build_info_settings() | ||
|
||
|
||
func _exit_tree(): | ||
remove_export_plugin(export_plugin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.