feat: modules moved and engine moved to submodule

This commit is contained in:
Jan van der Weide 2025-04-12 18:40:44 +02:00
parent dfb5e645cd
commit c33d2130cc
5136 changed files with 225275 additions and 64485 deletions

View file

@ -191,6 +191,13 @@ namespace GodotTools.ProjectEditor
// Otherwise, it can be removed.
if (mainTfmVersion > minTfmVersion)
{
var propertyTfmVersion = NuGetFramework.Parse(property.Value).Version;
if (propertyTfmVersion == minTfmVersion)
{
// The 'TargetFramework' property already matches the minimum version.
continue;
}
property.Value = minTfmValue;
}
else

View file

@ -37,8 +37,28 @@ namespace GodotTools.Export
public override Godot.Collections.Array<Godot.Collections.Dictionary> _GetExportOptions(EditorExportPlatform platform)
{
return new Godot.Collections.Array<Godot.Collections.Dictionary>()
var exportOptionList = new Godot.Collections.Array<Godot.Collections.Dictionary>();
if (platform.GetOsName().Equals(OS.Platforms.Android, StringComparison.OrdinalIgnoreCase))
{
exportOptionList.Add
(
new Godot.Collections.Dictionary()
{
{
"option", new Godot.Collections.Dictionary()
{
{ "name", "dotnet/android_use_linux_bionic" },
{ "type", (int)Variant.Type.Bool }
}
},
{ "default_value", false }
}
);
}
exportOptionList.Add
(
new Godot.Collections.Dictionary()
{
{
@ -49,7 +69,10 @@ namespace GodotTools.Export
}
},
{ "default_value", false }
},
}
);
exportOptionList.Add
(
new Godot.Collections.Dictionary()
{
{
@ -60,7 +83,10 @@ namespace GodotTools.Export
}
},
{ "default_value", true }
},
}
);
exportOptionList.Add
(
new Godot.Collections.Dictionary()
{
{
@ -72,7 +98,8 @@ namespace GodotTools.Export
},
{ "default_value", false }
}
};
);
return exportOptionList;
}
private void AddExceptionMessage(EditorExportPlatform platform, Exception exception)
@ -158,11 +185,12 @@ namespace GodotTools.Export
throw new NotImplementedException("Target platform not yet implemented.");
}
bool useAndroidLinuxBionic = (bool)GetOption("dotnet/android_use_linux_bionic");
PublishConfig publishConfig = new()
{
BuildConfig = isDebug ? "ExportDebug" : "ExportRelease",
IncludeDebugSymbols = (bool)GetOption("dotnet/include_debug_symbols"),
RidOS = DetermineRuntimeIdentifierOS(platform),
RidOS = DetermineRuntimeIdentifierOS(platform, useAndroidLinuxBionic),
Archs = new List<string>(),
UseTempDir = platform != OS.Platforms.iOS, // xcode project links directly to files in the publish dir, so use one that sticks around.
BundleOutputs = true,
@ -329,6 +357,14 @@ namespace GodotTools.Export
if (IsSharedObject(fileName))
{
if (fileName.EndsWith(".so") && !fileName.StartsWith("lib"))
{
// Add 'lib' prefix required for all native libraries in Android.
string newPath = string.Concat(path.AsSpan(0, path.Length - fileName.Length), "lib", fileName);
Godot.DirAccess.RenameAbsolute(path, newPath);
path = newPath;
}
AddSharedObject(path, tags: new string[] { arch },
Path.Join(projectDataDirName,
Path.GetRelativePath(publishOutputDir,
@ -453,8 +489,14 @@ namespace GodotTools.Export
return path;
}
private string DetermineRuntimeIdentifierOS(string platform)
=> OS.DotNetOSPlatformMap[platform];
private string DetermineRuntimeIdentifierOS(string platform, bool useAndroidLinuxBionic)
{
if (platform == OS.Platforms.Android && useAndroidLinuxBionic)
{
return OS.DotNetOS.LinuxBionic;
}
return OS.DotNetOSPlatformMap[platform];
}
private string DetermineRuntimeIdentifierArch(string arch)
{

View file

@ -8,6 +8,7 @@ namespace GodotTools
MonoDevelop,
VsCode,
Rider,
CustomEditor
CustomEditor,
Fleet,
}
}

View file

@ -286,9 +286,10 @@ namespace GodotTools
case ExternalEditorId.VisualStudioForMac:
goto case ExternalEditorId.MonoDevelop;
case ExternalEditorId.Rider:
case ExternalEditorId.Fleet:
{
string scriptPath = ProjectSettings.GlobalizePath(script.ResourcePath);
RiderPathManager.OpenFile(GodotSharpDirs.ProjectSlnPath, scriptPath, line + 1, col);
RiderPathManager.OpenFile(editorId, GodotSharpDirs.ProjectSlnPath, scriptPath, line + 1, col);
return Error.Ok;
}
case ExternalEditorId.MonoDevelop:
@ -568,7 +569,8 @@ namespace GodotTools
settingsHintStr += $",Visual Studio:{(int)ExternalEditorId.VisualStudio}" +
$",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" +
$",Visual Studio Code and VSCodium:{(int)ExternalEditorId.VsCode}" +
$",JetBrains Rider and Fleet:{(int)ExternalEditorId.Rider}" +
$",JetBrains Rider:{(int)ExternalEditorId.Rider}" +
$",JetBrains Fleet:{(int)ExternalEditorId.Fleet}" +
$",Custom:{(int)ExternalEditorId.CustomEditor}";
}
else if (OS.IsMacOS)
@ -576,14 +578,16 @@ namespace GodotTools
settingsHintStr += $",Visual Studio:{(int)ExternalEditorId.VisualStudioForMac}" +
$",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" +
$",Visual Studio Code and VSCodium:{(int)ExternalEditorId.VsCode}" +
$",JetBrains Rider and Fleet:{(int)ExternalEditorId.Rider}" +
$",JetBrains Rider:{(int)ExternalEditorId.Rider}" +
$",JetBrains Fleet:{(int)ExternalEditorId.Fleet}" +
$",Custom:{(int)ExternalEditorId.CustomEditor}";
}
else if (OS.IsUnixLike)
{
settingsHintStr += $",MonoDevelop:{(int)ExternalEditorId.MonoDevelop}" +
$",Visual Studio Code and VSCodium:{(int)ExternalEditorId.VsCode}" +
$",JetBrains Rider and Fleet:{(int)ExternalEditorId.Rider}" +
$",JetBrains Rider:{(int)ExternalEditorId.Rider}" +
$",JetBrains Fleet:{(int)ExternalEditorId.Fleet}" +
$",Custom:{(int)ExternalEditorId.CustomEditor}";
}
@ -640,7 +644,6 @@ namespace GodotTools
_inspectorPluginWeak = WeakRef(inspectorPlugin);
BuildManager.Initialize();
RiderPathManager.Initialize();
GodotIdeManager = new GodotIdeManager();
AddChild(GodotIdeManager);
@ -664,13 +667,28 @@ namespace GodotTools
private void OnSettingsChanged()
{
// We want to force NoConsoleLogging to true when the VerbosityLevel is at Detailed or above.
// At that point, there's so much info logged that it doesn't make sense to display it in
// the tiny editor window, and it'd make the editor hang or crash anyway.
var verbosityLevel = _editorSettings.GetSetting(Settings.VerbosityLevel).As<VerbosityLevelId>();
var hideConsoleLog = (bool)_editorSettings.GetSetting(Settings.NoConsoleLogging);
if (verbosityLevel >= VerbosityLevelId.Detailed && !hideConsoleLog)
_editorSettings.SetSetting(Settings.NoConsoleLogging, Variant.From(true));
var changedSettings = _editorSettings.GetChangedSettings();
if (changedSettings.Contains(Settings.VerbosityLevel))
{
// We want to force NoConsoleLogging to true when the VerbosityLevel is at Detailed or above.
// At that point, there's so much info logged that it doesn't make sense to display it in
// the tiny editor window, and it'd make the editor hang or crash anyway.
var verbosityLevel = _editorSettings.GetSetting(Settings.VerbosityLevel).As<VerbosityLevelId>();
var hideConsoleLog = (bool)_editorSettings.GetSetting(Settings.NoConsoleLogging);
if (verbosityLevel >= VerbosityLevelId.Detailed && !hideConsoleLog)
_editorSettings.SetSetting(Settings.NoConsoleLogging, Variant.From(true));
}
if (changedSettings.Contains(Settings.ExternalEditor) && !changedSettings.Contains(RiderPathManager.EditorPathSettingName))
{
var editor = _editorSettings.GetSetting(Settings.ExternalEditor).As<ExternalEditorId>();
if (editor != ExternalEditorId.Fleet && editor != ExternalEditorId.Rider)
{
return;
}
RiderPathManager.InitializeIfNeeded(editor);
}
}
protected override void Dispose(bool disposing)

View file

@ -34,7 +34,7 @@
<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3.0" ExcludeAssets="runtime" PrivateAssets="all" />
<PackageReference Include="JetBrains.Rider.PathLocator" Version="1.0.9" />
<PackageReference Include="JetBrains.Rider.PathLocator" Version="1.0.12" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<Reference Include="GodotSharp">

View file

@ -66,6 +66,8 @@ namespace GodotTools.Ides
return "VisualStudioCode";
case ExternalEditorId.Rider:
return "Rider";
case ExternalEditorId.Fleet:
return "Fleet";
case ExternalEditorId.VisualStudioForMac:
return "VisualStudioForMac";
case ExternalEditorId.MonoDevelop:
@ -107,6 +109,7 @@ namespace GodotTools.Ides
case ExternalEditorId.VisualStudio:
case ExternalEditorId.VsCode:
case ExternalEditorId.Rider:
case ExternalEditorId.Fleet:
case ExternalEditorId.CustomEditor:
throw new NotSupportedException();
case ExternalEditorId.VisualStudioForMac:

View file

@ -9,7 +9,7 @@ namespace GodotTools.Ides.Rider
{
public static class RiderPathManager
{
private const string EditorPathSettingName = "dotnet/editor/editor_path_optional";
internal const string EditorPathSettingName = "dotnet/editor/editor_path_optional";
private static readonly RiderPathLocator RiderPathLocator;
private static readonly RiderFileOpener RiderFileOpener;
@ -32,44 +32,40 @@ namespace GodotTools.Ides.Rider
return null;
}
public static void Initialize()
public static void InitializeIfNeeded(ExternalEditorId editor)
{
var editorSettings = EditorInterface.Singleton.GetEditorSettings();
var editor = editorSettings.GetSetting(GodotSharpEditor.Settings.ExternalEditor).As<ExternalEditorId>();
if (editor == ExternalEditorId.Rider)
if (!editorSettings.HasSetting(EditorPathSettingName))
{
if (!editorSettings.HasSetting(EditorPathSettingName))
Globals.EditorDef(EditorPathSettingName, "");
editorSettings.AddPropertyInfo(new Godot.Collections.Dictionary
{
Globals.EditorDef(EditorPathSettingName, "");
editorSettings.AddPropertyInfo(new Godot.Collections.Dictionary
{
["type"] = (int)Variant.Type.String,
["name"] = EditorPathSettingName,
["hint"] = (int)PropertyHint.File,
["hint_string"] = ""
});
}
var riderPath = (string)editorSettings.GetSetting(EditorPathSettingName);
if (File.Exists(riderPath))
{
Globals.EditorDef(EditorPathSettingName, riderPath);
return;
}
var paths = RiderPathLocator.GetAllRiderPaths();
if (paths.Length == 0)
{
return;
}
string newPath = paths.Last().Path;
Globals.EditorDef(EditorPathSettingName, newPath);
editorSettings.SetSetting(EditorPathSettingName, newPath);
["type"] = (int)Variant.Type.String,
["name"] = EditorPathSettingName,
["hint"] = (int)PropertyHint.File,
["hint_string"] = ""
});
}
var editorPath = (string)editorSettings.GetSetting(EditorPathSettingName);
if (File.Exists(editorPath) && IsMatch(editor, editorPath))
{
Globals.EditorDef(EditorPathSettingName, editorPath);
return;
}
var paths = RiderPathLocator.GetAllRiderPaths().Where(info => IsMatch(editor, info.Path)).ToArray();
if (paths.Length == 0)
{
return;
}
string newPath = paths.Last().Path;
Globals.EditorDef(EditorPathSettingName, newPath);
editorSettings.SetSetting(EditorPathSettingName, newPath);
}
public static bool IsRider(string path)
private static bool IsMatch(ExternalEditorId editorId, string path)
{
if (path.IndexOfAny(Path.GetInvalidPathChars()) != -1)
{
@ -77,14 +73,15 @@ namespace GodotTools.Ides.Rider
}
var fileInfo = new FileInfo(path);
return fileInfo.Name.StartsWith("rider", StringComparison.OrdinalIgnoreCase);
var name = editorId == ExternalEditorId.Fleet ? "fleet" : "rider";
return fileInfo.Name.StartsWith(name, StringComparison.OrdinalIgnoreCase);
}
private static string? CheckAndUpdatePath(string? riderPath)
private static string? CheckAndUpdatePath(ExternalEditorId editorId, string? idePath)
{
if (File.Exists(riderPath))
if (File.Exists(idePath))
{
return riderPath;
return idePath;
}
var allInfos = RiderPathLocator.GetAllRiderPaths();
@ -93,9 +90,13 @@ namespace GodotTools.Ides.Rider
return null;
}
// RiderPathLocator includes Rider and Fleet locations, prefer Rider when available.
var preferredInfo = allInfos.LastOrDefault(info => IsRider(info.Path), allInfos[allInfos.Length - 1]);
string newPath = preferredInfo.Path;
// RiderPathLocator includes Rider and Fleet locations.
var matchingIde = allInfos.LastOrDefault(info => IsMatch(editorId, info.Path));
var newPath = matchingIde.Path;
if (string.IsNullOrEmpty(newPath))
{
return null;
}
var editorSettings = EditorInterface.Singleton.GetEditorSettings();
editorSettings.SetSetting(EditorPathSettingName, newPath);
@ -103,10 +104,10 @@ namespace GodotTools.Ides.Rider
return newPath;
}
public static void OpenFile(string slnPath, string scriptPath, int line, int column)
public static void OpenFile(ExternalEditorId editorId, string slnPath, string scriptPath, int line, int column)
{
string? pathFromSettings = GetRiderPathFromSettings();
string? path = CheckAndUpdatePath(pathFromSettings);
var pathFromSettings = GetRiderPathFromSettings();
var path = CheckAndUpdatePath(editorId, pathFromSettings);
if (string.IsNullOrEmpty(path))
{
GD.PushError($"Error when trying to run code editor: JetBrains Rider or Fleet. Could not find path to the editor.");

View file

@ -55,6 +55,7 @@ namespace GodotTools.Utils
public const string Linux = "linux";
public const string Win10 = "win10";
public const string Android = "android";
public const string LinuxBionic = "linux-bionic";
public const string iOS = "ios";
public const string iOSSimulator = "iossimulator";
public const string Browser = "browser";
@ -99,7 +100,6 @@ namespace GodotTools.Utils
[Platforms.iOS] = DotNetOS.iOS,
[Platforms.Web] = DotNetOS.Browser
};
private static bool IsOS(string name)
{
Internal.godot_icall_Utils_OS_GetPlatformName(out godot_string dest);