Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
reapazor committed Nov 3, 2021
2 parents c37059a + 98a830e commit c266bd5
Show file tree
Hide file tree
Showing 318 changed files with 694 additions and 145 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.0.1] - 2021-11-02
***"Feature Branches"***
> A lot of experimental work is being now done in _feature_ branches; this should speed up iteration time on releases.
### Added
- `Trace` configuration matrix available in project settings.

### Changed
- Internally used `SettingsStyles` has been split into `SettingsStyles` and `SettingsLayoutOptions` accordingly.
- Moved everything up one folder layer in package to fit with package standards.

### Fixed
- Optimized referencing of `GDXConfig` in author time operations (now similar to runtime).
- `IListExtensions.ContainsItem` now uses `Equals()` to resolve literals issues with strings.
- Categories for Visual Scripting based entries are now correct.
- Resolved issue with newer Package Manager based lock files having no tag identities.

## [2.0.0] - 2021-05-09
***"Fresh Paint"***
> Breaking changes and a new license (BSL-1.0); making GDX even easier to include in projects!
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
67 changes: 67 additions & 0 deletions Editor/ManifestEntry.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
// Copyright (c) 2020-2021 dotBunny Inc.
// dotBunny licenses this file to you under the BSL-1.0 license.
// See the LICENSE file in the project root for more information.

using System;
using GDX;
using GDX.Editor;
using UnityEngine;

namespace GDX.Editor
{
/// <summary>
/// An object representative of the GDX entry in a manifest lockfile.
/// </summary>
[Serializable]
public class ManifestEntry
{
public string version;
public int depth;
public string source;
public string[] dependencies;
public string hash;

[NonSerialized]
public PackageProvider.InstallationType installationType;
[NonSerialized]
public string tag;

public static ManifestEntry Get(string json)
{
ManifestEntry returnObject = JsonUtility.FromJson<ManifestEntry>(json);
if (returnObject == null)
{
return null;
}

// Evaluate for tag
string tag = returnObject.version.GetAfterLast("#");
if (tag != null)
{
if (tag.StartsWith("v"))
{
returnObject.installationType = PackageProvider.InstallationType.UPMTag;
returnObject.tag = tag;
return returnObject;
}

// Check for what we assume is a commit hash
if (tag.Length == 40 && tag.HasLowerCase() && !tag.HasUpperCase())
{
returnObject.installationType = PackageProvider.InstallationType.GitHubCommit;
returnObject.tag = tag;
return returnObject;
}

// Left with assuming its a branch?
returnObject.installationType = PackageProvider.InstallationType.UPMBranch;
returnObject.tag = tag;
return returnObject;
}

returnObject.installationType = PackageProvider.InstallationType.UPM;
returnObject.tag = "main";
return returnObject;
}
}
}
3 changes: 3 additions & 0 deletions Editor/ManifestEntry.cs.meta

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

41 changes: 14 additions & 27 deletions GDX/Editor/PackageProvider.cs → Editor/PackageProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
using System;
using System.IO;
using System.Reflection;
using System.Text;
using UnityEditor;
using UnityEngine;
using Application = UnityEngine.Application;

// ReSharper disable MemberCanBePrivate.Global

Expand Down Expand Up @@ -344,44 +346,29 @@ public static string GetFriendlyName(InstallationType installationType)

// Loop through lockfile for the package to determine further information on how it has been added.
bool insidePackage = false;
StringBuilder manifestContent = new StringBuilder();
for (int i = 0; i < lockFileLength; i++)
{
string workingLine = lockFile[i].Trim();
if (workingLine.StartsWith("\"com.dotbunny.gdx\""))
{
insidePackage = true;
manifestContent.AppendLine("{");
continue;
}

// We want to make sure that we are inside the package definition and that we are looking at the version line.
if (!insidePackage || !workingLine.StartsWith("\"version\""))
switch (insidePackage)
{
continue;
case true when workingLine.StartsWith("},"):
{
manifestContent.AppendLine("}");
ManifestEntry manifestEntry = ManifestEntry.Get(manifestContent.ToString());
return (manifestEntry.installationType, manifestEntry.tag);
}
case true:
manifestContent.AppendLine(workingLine);
break;
}

string versionLine = workingLine.Substring(12, workingLine.Length - (12 + 2));
string tag = versionLine.GetAfterLast("#");


// No actual tag found, so we are a straight UPM but we should consider it main line
if (tag == versionLine)
{
return (InstallationType.UPM, "main");
}

// All of our release tags start with 'v'
if (tag.StartsWith("v"))
{
return (InstallationType.UPMTag, tag);
}

// Check for what we assume is a commit hash
if (tag.Length == 40 && tag.HasLowerCase() && !tag.HasUpperCase())
{
return (InstallationType.GitHubCommit, tag);
}

return (InstallationType.UPMBranch, tag);
}

// Well we at least can say it was UPM bound
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ internal static void Draw(SerializedObject settings)

GUILayout.BeginHorizontal();
GUILayout.Label("Local Version:", EditorStyles.boldLabel,
SettingsStyles.FixedWidth130LayoutOptions);
SettingsLayoutOptions.FixedWidth130LayoutOptions);
GUILayout.Label(UpdateProvider.LocalPackage.Definition.version);
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.Label("Installation Method:", EditorStyles.boldLabel,
SettingsStyles.FixedWidth130LayoutOptions);
SettingsLayoutOptions.FixedWidth130LayoutOptions);
GUILayout.Label(PackageProvider.GetFriendlyName(UpdateProvider.LocalPackage.InstallationMethod));
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
Expand All @@ -86,7 +86,7 @@ internal static void Draw(SerializedObject settings)
case PackageProvider.InstallationType.GitHub:
GUILayout.BeginHorizontal();
GUILayout.Label("Source Branch:", EditorStyles.boldLabel,
SettingsStyles.FixedWidth130LayoutOptions);
SettingsLayoutOptions.FixedWidth130LayoutOptions);
GUILayout.Label(!string.IsNullOrEmpty(UpdateProvider.LocalPackage.SourceTag)
? UpdateProvider.LocalPackage.SourceTag
: "N/A");
Expand All @@ -97,7 +97,7 @@ internal static void Draw(SerializedObject settings)
case PackageProvider.InstallationType.GitHubTag:
GUILayout.BeginHorizontal();
GUILayout.Label("Source Tag:", EditorStyles.boldLabel,
SettingsStyles.FixedWidth130LayoutOptions);
SettingsLayoutOptions.FixedWidth130LayoutOptions);
GUILayout.Label(!string.IsNullOrEmpty(UpdateProvider.LocalPackage.SourceTag)
? UpdateProvider.LocalPackage.SourceTag
: "N/A");
Expand All @@ -108,7 +108,7 @@ internal static void Draw(SerializedObject settings)
case PackageProvider.InstallationType.GitHubCommit:
GUILayout.BeginHorizontal();
GUILayout.Label("Source Commit:", EditorStyles.boldLabel,
SettingsStyles.FixedWidth130LayoutOptions);
SettingsLayoutOptions.FixedWidth130LayoutOptions);
GUILayout.Label(!string.IsNullOrEmpty(UpdateProvider.LocalPackage.SourceTag)
? UpdateProvider.LocalPackage.SourceTag
: "N/A");
Expand All @@ -122,14 +122,14 @@ internal static void Draw(SerializedObject settings)
{
GUILayout.BeginHorizontal();
GUILayout.Label("Remote Version:", EditorStyles.boldLabel,
SettingsStyles.FixedWidth130LayoutOptions);
SettingsLayoutOptions.FixedWidth130LayoutOptions);
GUILayout.Label(UpdateProvider.UpdatePackageDefinition.version);
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
}

GUILayout.BeginHorizontal();
GUILayout.Label("Last Checked:", EditorStyles.boldLabel, SettingsStyles.FixedWidth130LayoutOptions);
GUILayout.Label("Last Checked:", EditorStyles.boldLabel, SettingsLayoutOptions.FixedWidth130LayoutOptions);
GUILayout.Label(UpdateProvider.GetLastChecked().ToString(Localization.LocalTimestampFormat));
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,35 @@ internal static class EnvironmentSettings
/// Settings content for <see cref="GDXConfig.traceDebugLevels" />.
/// </summary>
private static readonly GUIContent s_debugLevelsContent = new GUIContent(
"Debug Tracing",
"",
"The levels of trace call to be logged in a debug build.");

/// <summary>
/// Settings content for <see cref="GDXConfig.traceDebugOutputToUnityConsole" />.
/// </summary>
private static readonly GUIContent s_debugConsoleOutput = new GUIContent(
"",
"Should traces be outputted to Unity's console in debug builds");

/// <summary>
/// Settings content for <see cref="GDXConfig.traceDevelopmentLevels" />.
/// </summary>
private static readonly GUIContent s_developmentLevelsContent = new GUIContent(
"Development Tracing",
"",
"The levels of trace call to be logged in a development/editor build.");

/// <summary>
/// Settings content for <see cref="GDXConfig.traceDevelopmentOutputToUnityConsole" />.
/// </summary>
private static readonly GUIContent s_developmentConsoleOutput = new GUIContent(
"",
"Should traces be outputted to Unity's console in development builds.");

/// <summary>
/// Settings content for <see cref="GDXConfig.traceReleaseLevels" />.
/// </summary>
private static readonly GUIContent s_releaseLevelsContent = new GUIContent(
"Release Tracing",
"",
"The levels of trace call to be logged in a release build.");

/// <summary>
Expand All @@ -45,6 +59,9 @@ internal static class EnvironmentSettings
"Ensure GDX Symbol",
"Should GDX make sure that there is a GDX scripting define symbol across all viable build target groups.");

private static readonly GUIContent s_traceNoticeContent = new GUIContent(
"Make sure to disable console output if you have subscribed additional logging systems which may echo back to the console.");

internal static void Draw(SerializedObject settings)
{
GUI.enabled = true;
Expand All @@ -60,32 +77,66 @@ internal static void Draw(SerializedObject settings)
s_scriptingDefineSymbolContent);


GUILayout.Space(10);
// Arguments (we're going to make sure they are forced to uppercase).
GUILayout.Label("Traces", SettingsStyles.SubSectionHeaderTextStyle);

GUILayout.BeginHorizontal(SettingsStyles.InfoBoxStyle);
GUILayout.Label(SettingsStyles.NoticeIcon, SettingsStyles.NoHorizontalStretchStyle);
GUILayout.Label(s_traceNoticeContent, SettingsStyles.WordWrappedLabelStyle);
GUILayout.EndHorizontal();

EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(GUIContent.none, SettingsStyles.ColumnHeaderStyle, SettingsLayoutOptions.FixedWidth130LayoutOptions);
GUILayout.Space(10);
EditorGUILayout.LabelField("Flags", SettingsStyles.ColumnHeaderStyle, SettingsLayoutOptions.FixedWidth150LayoutOptions);
GUILayout.Space(10);
EditorGUILayout.LabelField("Console Output", SettingsStyles.ColumnHeaderStyle, SettingsLayoutOptions.FixedWidth150LayoutOptions);
EditorGUILayout.EndHorizontal();

EditorGUILayout.BeginHorizontal();
GUILayout.Label("Development", SettingsLayoutOptions.FixedWidth130LayoutOptions);
GUILayout.Space(10);
SerializedProperty developmentLevelsProperty = settings.FindProperty("traceDevelopmentLevels");
EditorGUI.BeginChangeCheck();
ushort newDevelopmentLevels = (ushort)EditorGUILayout.MaskField(s_developmentLevelsContent, developmentLevelsProperty.intValue,
developmentLevelsProperty.enumDisplayNames);
developmentLevelsProperty.enumDisplayNames, SettingsLayoutOptions.FixedWidth150LayoutOptions);
if (EditorGUI.EndChangeCheck())
{
developmentLevelsProperty.intValue = newDevelopmentLevels;
}
GUILayout.Space(10);
EditorGUILayout.PropertyField(settings.FindProperty("traceDevelopmentOutputToUnityConsole"), s_developmentConsoleOutput, SettingsLayoutOptions.FixedWidth150LayoutOptions);
EditorGUILayout.EndHorizontal();

EditorGUILayout.BeginHorizontal();
GUILayout.Label("Debug", SettingsLayoutOptions.FixedWidth130LayoutOptions);
GUILayout.Space(10);
SerializedProperty debugLevelsProperty = settings.FindProperty("traceDebugLevels");
EditorGUI.BeginChangeCheck();
ushort newDebugLevels = (ushort)EditorGUILayout.MaskField(s_debugLevelsContent, debugLevelsProperty.intValue,
debugLevelsProperty.enumDisplayNames);
debugLevelsProperty.enumDisplayNames, SettingsLayoutOptions.FixedWidth150LayoutOptions);
if (EditorGUI.EndChangeCheck())
{
debugLevelsProperty.intValue = newDebugLevels;
}
GUILayout.Space(10);
EditorGUILayout.PropertyField(settings.FindProperty("traceDebugOutputToUnityConsole"),
s_debugConsoleOutput, SettingsLayoutOptions.FixedWidth150LayoutOptions);
EditorGUILayout.EndHorizontal();

EditorGUILayout.BeginHorizontal();
GUILayout.Label("Release", SettingsLayoutOptions.FixedWidth130LayoutOptions);
GUILayout.Space(10);
SerializedProperty releaseLevelsProperty = settings.FindProperty("traceReleaseLevels");
EditorGUI.BeginChangeCheck();
ushort newReleaseLevels = (ushort)EditorGUILayout.MaskField(s_releaseLevelsContent, releaseLevelsProperty.intValue,
releaseLevelsProperty.enumDisplayNames);
releaseLevelsProperty.enumDisplayNames,SettingsLayoutOptions.FixedWidth150LayoutOptions);
if (EditorGUI.EndChangeCheck())
{
releaseLevelsProperty.intValue = newReleaseLevels;
}
EditorGUILayout.EndHorizontal();
}
}
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ internal static void Draw()


GUILayout.BeginHorizontal();
GUILayout.Label("-", SettingsStyles.BulletLayoutOptions);
GUILayout.Label("-", SettingsLayoutOptions.BulletLayoutOptions);
#if UNITY_2021_1_OR_NEWER
if (EditorGUILayout.LinkButton("Repository"))
#elif UNITY_2019_1_OR_NEWER
Expand All @@ -54,7 +54,7 @@ internal static void Draw()
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.Label("-", SettingsStyles.BulletLayoutOptions);
GUILayout.Label("-", SettingsLayoutOptions.BulletLayoutOptions);
#if UNITY_2021_1_OR_NEWER
if (EditorGUILayout.LinkButton("Documentation"))
#elif UNITY_2019_1_OR_NEWER
Expand All @@ -71,7 +71,7 @@ internal static void Draw()
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.Label("-", SettingsStyles.BulletLayoutOptions);
GUILayout.Label("-", SettingsLayoutOptions.BulletLayoutOptions);
#if UNITY_2021_1_OR_NEWER
if (EditorGUILayout.LinkButton("Report an Issue"))
#elif UNITY_2019_1_OR_NEWER
Expand Down
Loading

0 comments on commit c266bd5

Please sign in to comment.