mirror of
https://github.com/Kizuren/ShantiManti.git
synced 2025-12-21 21:16:04 +01:00
update build pipeline with build date injection
This commit is contained in:
parent
6f205b0a3e
commit
e5519e0b8b
10 changed files with 97 additions and 9 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -73,3 +73,6 @@ crashlytics-build.properties
|
|||
|
||||
# Ignore Rider files
|
||||
/.idea/
|
||||
|
||||
# Auto-generated build files
|
||||
Assets/Resources/BuildInfo.txt*
|
||||
|
|
|
|||
15
Assets/BuildDateInjector.cs
Normal file
15
Assets/BuildDateInjector.cs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
using UnityEditor;
|
||||
using System.IO;
|
||||
|
||||
public class BuildDateInjector
|
||||
{
|
||||
[MenuItem("Build/Inject Build Date")]
|
||||
public static void InjectBuildDate()
|
||||
{
|
||||
var buildDate = System.DateTime.Now.ToString("dd.MM.yyyy");
|
||||
const string path = "Assets/Resources/BuildInfo.txt";
|
||||
|
||||
File.WriteAllText(path, buildDate);
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
}
|
||||
3
Assets/BuildDateInjector.cs.meta
Normal file
3
Assets/BuildDateInjector.cs.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4c9fbe6fc7144df5826f4456a3d8f461
|
||||
timeCreated: 1735478822
|
||||
8
Assets/Editor.meta
Normal file
8
Assets/Editor.meta
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1833fb44ddb54504e8dbf9ceae83db1d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
18
Assets/Editor/BuildDateAutomaticInjector.cs
Normal file
18
Assets/Editor/BuildDateAutomaticInjector.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
using UnityEditor;
|
||||
using UnityEditor.Build;
|
||||
using UnityEditor.Build.Reporting;
|
||||
using System.IO;
|
||||
|
||||
public class BuildDateAutomaticInjector : IPreprocessBuildWithReport
|
||||
{
|
||||
public int callbackOrder => 0;
|
||||
|
||||
public void OnPreprocessBuild(BuildReport report)
|
||||
{
|
||||
var buildDate = System.DateTime.Now.ToString("dd.MM.yyyy");
|
||||
const string path = "Assets/Resources/BuildInfo.txt";
|
||||
|
||||
File.WriteAllText(path, buildDate);
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
}
|
||||
2
Assets/Editor/BuildDateAutomaticInjector.cs.meta
Normal file
2
Assets/Editor/BuildDateAutomaticInjector.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 810ef46d2483209429850c73672e7582
|
||||
|
|
@ -1522,13 +1522,11 @@ MonoBehaviour:
|
|||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_text: 'Version: 2.2
|
||||
m_text: 'Version: {gamever}
|
||||
|
||||
Made with Unity 2021.3.33f1
|
||||
Made with Unity {unityver}
|
||||
|
||||
Release Date: 01.09.2023
|
||||
|
||||
'
|
||||
Release: {builddate}'
|
||||
m_isRightToLeft: 0
|
||||
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
|
||||
|
|
@ -1577,7 +1575,7 @@ MonoBehaviour:
|
|||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 1
|
||||
m_ActiveFontFeatures: 00000000
|
||||
m_ActiveFontFeatures: 6e72656b
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
|
|
@ -2193,6 +2191,7 @@ GameObject:
|
|||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 626197109}
|
||||
- component: {fileID: 626197110}
|
||||
m_Layer: 0
|
||||
m_Name: Info
|
||||
m_TagString: Untagged
|
||||
|
|
@ -2223,6 +2222,19 @@ RectTransform:
|
|||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &626197110
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 626197108}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 749e4081c74524543a779b79e580a3b7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
infoText: {fileID: 469781835}
|
||||
--- !u!1 &757622826
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -3500,7 +3512,7 @@ MonoBehaviour:
|
|||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 1
|
||||
m_ActiveFontFeatures: 00000000
|
||||
m_ActiveFontFeatures: 6e72656b
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
|
|
@ -6442,7 +6454,7 @@ MonoBehaviour:
|
|||
m_linkedTextComponent: {fileID: 0}
|
||||
parentLinkedComponent: {fileID: 0}
|
||||
m_enableKerning: 1
|
||||
m_ActiveFontFeatures: 00000000
|
||||
m_ActiveFontFeatures: 6e72656b
|
||||
m_enableExtraPadding: 0
|
||||
checkPaddingRequired: 0
|
||||
m_isRichText: 1
|
||||
|
|
|
|||
24
Assets/game/Scripts/UI_start/GameInfoInjector.cs
Normal file
24
Assets/game/Scripts/UI_start/GameInfoInjector.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using UnityEngine;
|
||||
using TMPro;
|
||||
|
||||
public class GameInfoInjector : MonoBehaviour
|
||||
{
|
||||
public TextMeshProUGUI infoText;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
if (!infoText)
|
||||
{
|
||||
Debug.LogError($"{nameof(GameInfoInjector)}: {nameof(infoText)} is not set!");
|
||||
return;
|
||||
}
|
||||
var buildInfo = Resources.Load<TextAsset>("BuildInfo");
|
||||
var buildDate = buildInfo ? buildInfo.ToString().Trim() : "undefined";
|
||||
|
||||
var text = infoText.text.Replace("{gamever}", Application.version)
|
||||
.Replace("{unityver}", Application.unityVersion)
|
||||
.Replace("{builddate}", buildDate);
|
||||
|
||||
infoText.text = text;
|
||||
}
|
||||
}
|
||||
2
Assets/game/Scripts/UI_start/GameInfoInjector.cs.meta
Normal file
2
Assets/game/Scripts/UI_start/GameInfoInjector.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 749e4081c74524543a779b79e580a3b7
|
||||
|
|
@ -141,7 +141,8 @@ PlayerSettings:
|
|||
visionOSBundleVersion: 1.0
|
||||
tvOSBundleVersion: 1.0
|
||||
bundleVersion: 2.2.0
|
||||
preloadedAssets: []
|
||||
preloadedAssets:
|
||||
- {fileID: -944628639613478452, guid: bbf97a3321c15364ca23f63ce74f192c, type: 3}
|
||||
metroInputSource: 0
|
||||
wsaTransparentSwapchain: 0
|
||||
m_HolographicPauseOnTrackingLoss: 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue