Skip to content

Commit

Permalink
📦 Release 1.1.3
Browse files Browse the repository at this point in the history
- Updated the build updater code to have a ifdef for a deprecated build target.
- Updated the asset generation to use the latest index style setup for build information & settings. Should hlep with warning messages in theory.
  • Loading branch information
JonathanMCarter committed Jun 11, 2023
1 parent 69f7433 commit a10e1a2
Show file tree
Hide file tree
Showing 123 changed files with 2,680 additions and 1,283 deletions.
2 changes: 1 addition & 1 deletion Editor/Art.meta → Art.meta

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

File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
2 changes: 1 addition & 1 deletion Editor/Asset Utilities.meta → Art/File Icons.meta

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

File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes.
8 changes: 8 additions & 0 deletions Code.meta

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

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
using System.Linq;
/*
* Copyright (c) 2018-Present Carter Games
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

using System.Linq;
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
Expand All @@ -7,22 +30,20 @@
namespace CarterGames.Assets.BuildVersions.Editor
{
/// <summary>
/// Handles the updating of the build numbers for the asset...
/// Handles the updating of the build numbers for the asset..
/// </summary>
public class BuildVersionsManager : UnityEditor.Editor, IPreprocessBuildWithReport, IPostprocessBuildWithReport
{
//
//
// Build Information Setters
//
//

/* —————————————————————————————————————————————————————————————————————————————————————————————————————————————
| Build Information Setters
————————————————————————————————————————————————————————————————————————————————————————————————————————————— */

/// <summary>
/// Updates the cached version number to the latest number...
/// </summary>
public static void UpdateCachedVersionNumber()
{
var options = BuildVersionsEditorUtil.BuildOptions;
var options = UtilEditor.BuildOptions;

options.LastSemanticVersionNumberSaved = SemanticVersionUpdater.GetVersionNumber(EditorUserBuildSettings.activeBuildTarget, false);
EditorUtility.SetDirty(options);
Expand All @@ -37,7 +58,7 @@ public static void UpdateCachedVersionNumber()
/// <param name="value">The value to set</param>
public static void SetBuildType(string value)
{
var info = BuildVersionsEditorUtil.BuildInformation;
var info = UtilEditor.BuildInformation;

info.BuildType = value;
EditorUtility.SetDirty(info);
Expand All @@ -51,7 +72,7 @@ public static void SetBuildType(string value)
/// </summary>
public static void SetDate()
{
var info = BuildVersionsEditorUtil.BuildInformation;
var info = UtilEditor.BuildInformation;

info.SetBuildDate();
EditorUtility.SetDirty(info);
Expand All @@ -66,7 +87,7 @@ public static void SetDate()
/// <param name="value"></param>
public static void SetBuildNumber(int value = -1)
{
var info = BuildVersionsEditorUtil.BuildInformation;
var info = UtilEditor.BuildInformation;

if (value.Equals(-1))
info.IncrementBuildNumber();
Expand All @@ -78,14 +99,10 @@ public static void SetBuildNumber(int value = -1)
AssetDatabase.Refresh();
}


//
//
// Build Process Implementations
//
//


/* —————————————————————————————————————————————————————————————————————————————————————————————————————————————
| Build Process Implementations
————————————————————————————————————————————————————————————————————————————————————————————————————————————— */

/// <summary>
/// Required for the report interfaces...
/// </summary>
Expand All @@ -101,8 +118,8 @@ public void OnPreprocessBuild(BuildReport report)
// Sets the build date to today xD
SetDate();

var settings = BuildVersionsEditorUtil.BuildOptions;
var info = BuildVersionsEditorUtil.BuildInformation;
var settings = UtilEditor.BuildOptions;
var info = UtilEditor.BuildInformation;

// Stops if the asset is disabled from updating the build number...
if (settings.assetStatus == AssetUsageType.Disabled)
Expand Down Expand Up @@ -138,7 +155,7 @@ public void OnPreprocessBuild(BuildReport report)
/// <param name="report">The build report provided automatically</param>
public void OnPostprocessBuild(BuildReport report)
{
var settings = BuildVersionsEditorUtil.BuildOptions;
var settings = UtilEditor.BuildOptions;

// Stops if the asset is disabled from updating the build number...
if (settings.assetStatus == AssetUsageType.Disabled) return;
Expand All @@ -150,21 +167,17 @@ public void OnPostprocessBuild(BuildReport report)
CallUpdaterInterfaces(report.summary.platform);
}


//
//
// Interface Broadcasters
//
//

/* —————————————————————————————————————————————————————————————————————————————————————————————————————————————
| Interface Broadcasters
————————————————————————————————————————————————————————————————————————————————————————————————————————————— */

/// <summary>
/// Calls to run all updater interface listeners...
/// </summary>
/// <param name="target">The build target</param>
private static void CallUpdaterInterfaces(BuildTarget target)
{
var listeners = BuildVersionsEditorUtil.GetAllInterfacesOfType<IBuildUpdater>();
var listeners = UtilEditor.GetAllInterfacesOfType<IBuildUpdater>();

if (listeners.Length <= 0)
{
Expand All @@ -185,21 +198,21 @@ private static void CallUpdaterInterfaces(BuildTarget target)
public static void CallSyncInterfaces()
{
// Stops the sync if the user is not using semantic updating...
if (BuildVersionsEditorUtil.BuildOptions.updateSemantic == AssetUsageType.Disabled)
if (UtilEditor.BuildOptions.updateSemantic == AssetUsageType.Disabled)
{
BvLog.Warning("Update semantic is disabled! Sync will not run while this setting is disabled.");
return;
}

var listeners = BuildVersionsEditorUtil.GetAllInterfacesOfType<ISyncable>();
var listeners = UtilEditor.GetAllInterfacesOfType<ISyncable>();

if (listeners.Length <= 0)
{
BvLog.Normal("No sync implementations found, so nothing will happen!");
return;
}

var lastSaved = BuildVersionsEditorUtil.BuildOptions.LastSemanticVersionNumberSaved;
var lastSaved = UtilEditor.BuildOptions.LastSemanticVersionNumberSaved;

foreach (var t in listeners)
t.OnVersionSync(lastSaved.Length > 0 ? lastSaved : Application.version);
Expand All @@ -211,7 +224,7 @@ public static void CallSyncInterfaces()
/// </summary>
private static void CallRelevantDialogueBoxes(BuildTarget target)
{
var listeners = BuildVersionsEditorUtil.GetAllInterfacesOfType<IPreBuildDialogue>();
var listeners = UtilEditor.GetAllInterfacesOfType<IPreBuildDialogue>();

if (listeners.Length <= 0)
{
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
using UnityEditor;
/*
* Copyright (c) 2018-Present Carter Games
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

using UnityEditor;

namespace CarterGames.Assets.BuildVersions.Editor
{
Expand All @@ -8,7 +31,7 @@ namespace CarterGames.Assets.BuildVersions.Editor
public static class BuildVersionsMenuOptions
{
[MenuItem("Tools/Carter Games/Build Versions/Edit Info", priority = 0)]
public static void EditInfo() => Selection.activeObject = BuildVersionsEditorUtil.BuildInformation;
public static void EditInfo() => Selection.activeObject = UtilEditor.BuildInformation;


[MenuItem("Tools/Carter Games/Build Versions/Edit Settings", priority = 1)]
Expand Down
File renamed without changes.
File renamed without changes.
115 changes: 115 additions & 0 deletions Code/Editor/Custom Inspectors/BuildInformationEditor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
/*
* Copyright (c) 2018-Present Carter Games
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

using UnityEditor;
using UnityEngine;

namespace CarterGames.Assets.BuildVersions.Editor
{
/// <summary>
/// An editor override for the build information asset...
/// </summary>
[CustomEditor(typeof(BuildInformation))]
public class BuildInformationEditor : UnityEditor.Editor
{
/* —————————————————————————————————————————————————————————————————————————————————————————————————————————————
| Fields
————————————————————————————————————————————————————————————————————————————————————————————————————————————— */

private SerializedProperty buildType;
private SerializedProperty buildDate;
private SerializedProperty buildNumber;

/* —————————————————————————————————————————————————————————————————————————————————————————————————————————————
| Unity Methods
————————————————————————————————————————————————————————————————————————————————————————————————————————————— */

private void OnEnable()
{
buildType = serializedObject.FindProperty("buildType");
buildDate = serializedObject.FindProperty("buildDate");
buildNumber = serializedObject.FindProperty("buildNumber");
}


public override void OnInspectorGUI()
{
ShowLogo();

GUILayout.Space(2.5f);

EditorGUILayout.BeginVertical("HelpBox");

EditorGUILayout.LabelField("Information", EditorStyles.boldLabel);
ShowValues();

EditorGUILayout.EndVertical();

serializedObject.ApplyModifiedProperties();
serializedObject.Update();
}

/* —————————————————————————————————————————————————————————————————————————————————————————————————————————————
| Methods
————————————————————————————————————————————————————————————————————————————————————————————————————————————— */

/// <summary>
/// Draws the logo for the asset...
/// </summary>
private static void ShowLogo()
{
// Shows either the Logo if found, if not nothing will show here...
if (UtilEditor.HasFile("BuildVersionsIcon"))
{
GUILayout.Space(5f);

EditorGUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();

// Shows either the Logo if found, if not nothing will show here...
if (GUILayout.Button(UtilEditor.Logo, GUIStyle.none, GUILayout.Width(50), GUILayout.Height(50)))
GUI.FocusControl(null);

GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
}

GUILayout.Space(5f);
}


/// <summary>
/// Draws the property fields for the build info asset...
/// </summary>
private void ShowValues()
{
EditorGUILayout.PropertyField(buildType);

EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(buildDate);
EditorGUI.indentLevel--;

EditorGUILayout.PropertyField(buildNumber);
}
}
}
Loading

0 comments on commit a10e1a2

Please sign in to comment.