Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3a5c1666f5f44ffc9b9dd64a17e7754d, type: 3}
m_Name: New Release Note Export Step Asset
m_EditorClassIdentifier:
m_path:
m_encodingType: 0

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions Assets/UGF.Build.Editor.Tests/New Release Note Step Asset.asset
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6622b7b24432465a964b9dccb59827c0, type: 3}
m_Name: New Release Note Step Asset
m_EditorClassIdentifier:

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bcfe52b5278f40a9a5fde4b51a12daed, type: 3}
m_Name: New Unity Cloud Build Manifest Release Note Step Asset
m_EditorClassIdentifier:

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Packages/UGF.Build/Editor/ReleaseNotes.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 63 additions & 0 deletions Packages/UGF.Build/Editor/ReleaseNotes/ReleaseNoteData.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
using System;
using System.Reflection;
using System.Text;
using UnityEditor;

namespace UGF.Build.Editor.ReleaseNotes
{
public class ReleaseNoteData
{
private readonly StringBuilder m_builder = new StringBuilder();

public void AddLine(string value)
{
if (string.IsNullOrEmpty(value)) throw new ArgumentException("Value cannot be null or empty.", nameof(value));

m_builder.AppendLine(value);
}

public void AddField(string name, object value)
{
if (string.IsNullOrEmpty(name)) throw new ArgumentException("Value cannot be null or empty.", nameof(name));

m_builder.AppendFormat("- {0}: '{1}'.", name, value);
m_builder.AppendLine();
}

public void AddSpace()
{
m_builder.AppendLine();
}

public void AddData(object data)
{
if (data == null) throw new ArgumentNullException(nameof(data));

Type type = data.GetType();
PropertyInfo[] properties = type.GetProperties();

AddLine(ObjectNames.NicifyVariableName(type.Name));

foreach (PropertyInfo property in properties)
{
if (property.CanRead)
{
string name = property.Name;
object value = property.GetValue(data);

AddField(name, value);
}
}
}

public void Clear()
{
m_builder.Clear();
}

public string GetString()
{
return m_builder.ToString();
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions Packages/UGF.Build/Editor/ReleaseNotes/ReleaseNoteExportStep.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.IO;
using System.Text;
using UGF.RuntimeTools.Runtime.Contexts;

namespace UGF.Build.Editor.ReleaseNotes
{
public class ReleaseNoteExportStep : BuildStep
{
public string Path { get; }
public Encoding Encoding { get; }

public ReleaseNoteExportStep(string path, Encoding encoding)
{
if (string.IsNullOrEmpty(path)) throw new ArgumentException("Value cannot be null or empty.", nameof(path));

Path = path;
Encoding = encoding ?? throw new ArgumentNullException(nameof(encoding));
}

protected override void OnExecute(IBuildSetup setup, IContext context)
{
var data = context.Get<ReleaseNoteData>();

File.WriteAllText(Path, data.GetString(), Encoding);
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using UGF.RuntimeTools.Runtime.Encodings;
using UnityEngine;

namespace UGF.Build.Editor.ReleaseNotes
{
[CreateAssetMenu(menuName = "Unity Game Framework/Build/Release Note Export Step", order = 2000)]
public class ReleaseNoteExportStepAsset : BuildStepAsset
{
[SerializeField] private string m_path;
[SerializeField] private EncodingType m_encodingType = EncodingType.Default;

public string Path { get { return m_path; } set { m_path = value; } }
public EncodingType EncodingType { get { return m_encodingType; } set { m_encodingType = value; } }

protected override IBuildStep OnBuild()
{
return new ReleaseNoteExportStep(m_path, EncodingUtility.GetEncoding(m_encodingType));
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Packages/UGF.Build/Editor/ReleaseNotes/ReleaseNoteStep.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using UGF.RuntimeTools.Runtime.Contexts;

namespace UGF.Build.Editor.ReleaseNotes
{
public class ReleaseNoteStep : BuildStep
{
protected override void OnExecute(IBuildSetup setup, IContext context)
{
context.Add(new ReleaseNoteData());
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions Packages/UGF.Build/Editor/ReleaseNotes/ReleaseNoteStepAsset.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using UnityEngine;

namespace UGF.Build.Editor.ReleaseNotes
{
[CreateAssetMenu(menuName = "Unity Game Framework/Build/Release Note Step", order = 2000)]
public class ReleaseNoteStepAsset : BuildStepAsset
{
protected override IBuildStep OnBuild()
{
return new ReleaseNoteStep();
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using UGF.Build.Editor.ReleaseNotes;
using UGF.Build.Runtime.UnityCloud;
using UGF.RuntimeTools.Runtime.Contexts;

namespace UGF.Build.Editor.UnityCloud
{
public class UnityCloudBuildManifestReleaseNoteStep : BuildStep
{
protected override void OnExecute(IBuildSetup setup, IContext context)
{
var releaseNote = context.Get<ReleaseNoteData>();
var manifest = context.Get<UnityCloudBuildManifest>();

releaseNote.AddData(manifest);
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using UnityEngine;

namespace UGF.Build.Editor.UnityCloud
{
[CreateAssetMenu(menuName = "Unity Game Framework/Build/Unity Cloud Build Manifest Release Note Step", order = 2000)]
public class UnityCloudBuildManifestReleaseNoteStepAsset : BuildStepAsset
{
protected override IBuildStep OnBuild()
{
return new UnityCloudBuildManifestReleaseNoteStep();
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.