Skip to content

A Swiss Army knife for developers.

Removed the plugin capability

Etienne Baudouxd6ac3f362b58
diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json
index 5ba738955..08a9bbac2 100644
--- a/.nuke/build.schema.json
+++ b/.nuke/build.schema.json
@@ -66,6 +66,7 @@
"type": "string",
"enum": [
"CLI",
+ "Linux",
"MacCatalyst",
"Wasm",
"Windows"
@@ -94,7 +95,6 @@
"type": "string",
"enum": [
"BuildGenerators",
- "BuildPlugins",
"Clean",
"PreliminaryCheck",
"Publish",
@@ -111,7 +111,6 @@
"type": "string",
"enum": [
"BuildGenerators",
- "BuildPlugins",
"Clean",
"PreliminaryCheck",
"Publish",
diff --git a/src/DevToys-Windows.sln b/src/DevToys-Windows.sln
index bdcab91b5..39d80c78c 100644
--- a/src/DevToys-Windows.sln
+++ b/src/DevToys-Windows.sln
@@ -35,10 +35,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "desktops", "desktops", "{22EE9386-CEFA-47D8-97B2-09A63EDF7F2E}"
- ProjectSection(SolutionItems) = preProject
- app\dev\platforms\desktop\Directory.Build.props = app\dev\platforms\desktop\Directory.Build.props
- app\dev\platforms\desktop\Directory.Build.targets = app\dev\platforms\desktop\Directory.Build.targets
- EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "windows", "windows", "{AFE37797-0A43-4838-8C1E-4D2D1446499C}"
EndProject
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index ffeee8a52..2730049a1 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -5,7 +5,7 @@
<MinimumVisualStudioVersion>16.0</MinimumVisualStudioVersion>
<Windows10SDKVersion>10.0.22000.0</Windows10SDKVersion>
- <Windows10MinSDKVersionTrimmed>10.0.19041</Windows10MinSDKVersionTrimmed>
+ <Windows10MinSDKVersionTrimmed>10.0.22621</Windows10MinSDKVersionTrimmed>
<Windows10MinSDKVersion>$(Windows10MinSDKVersionTrimmed).0</Windows10MinSDKVersion>
<NetCore>net7.0</NetCore>
diff --git a/src/app/dev/DevToys.Core/Mef/MefComposer.cs b/src/app/dev/DevToys.Core/Mef/MefComposer.cs
index 50a5bfc50..aab2f8a3c 100644
--- a/src/app/dev/DevToys.Core/Mef/MefComposer.cs
+++ b/src/app/dev/DevToys.Core/Mef/MefComposer.cs
@@ -73,21 +73,6 @@ public sealed class MefComposer : IDisposable
catalog.Catalogs.Add(new AssemblyCatalog(assembly));
}
- // Dynamically load assemblies coming from the Plugin repository folder and
- // try to discover MEF extensions in them.
- foreach (string pluginFolder in GetPotentialPluginFolders())
- {
- _logger.LogInformation($"Discovering plugin in '{pluginFolder}'...");
- try
- {
- catalog.Catalogs.Add(new RecursiveDirectoryCatalog(pluginFolder));
- }
- catch (Exception ex)
- {
- _logger.LogError(ex, $"Unable to load plugin in '{pluginFolder}'...");
- }
- }
-
// Compose MEF.
var container = new CompositionContainer(catalog);
var batch = new CompositionBatch();
@@ -107,20 +92,4 @@ public sealed class MefComposer : IDisposable
return ExportProvider;
}
-
- private static IEnumerable<string> GetPotentialPluginFolders()
- {
- // TODO: Maybe plugins should be placed in the app's LocalStorage instead?
- string appFolder = AppContext.BaseDirectory;
- if (!string.IsNullOrEmpty(appFolder))
- {
- string pluginFolder = Path.Combine(appFolder!, "Plugins");
- if (Directory.Exists(pluginFolder))
- {
- return Directory.EnumerateDirectories(pluginFolder, "*", SearchOption.TopDirectoryOnly);
- }
- }
-
- return Array.Empty<string>();
- }
}
diff --git a/src/app/dev/DevToys.Core/Mef/RecursiveDirectoryCatalog.cs b/src/app/dev/DevToys.Core/Mef/RecursiveDirectoryCatalog.cs
deleted file mode 100644
index f50369d5a..000000000
--- a/src/app/dev/DevToys.Core/Mef/RecursiveDirectoryCatalog.cs
+++ /dev/null
@@ -1,133 +0,0 @@
-using System.ComponentModel.Composition.Hosting;
-using System.ComponentModel.Composition.Primitives;
-using System.Globalization;
-using System.IO;
-using System.Reflection;
-
-namespace DevToys.Core.Mef;
-
-/// <summary>
-/// Extends <see cref="DirectoryCatalog"/> to support discovery of parts in sub-directories.
-/// </summary>
-internal sealed class RecursiveDirectoryCatalog : ComposablePartCatalog, INotifyComposablePartCatalogChanged, ICompositionElement
-{
- private readonly string _path;
- private AggregateCatalog? _aggregateCatalog;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="RecursiveDirectoryCatalog"/> class with <see cref="ComposablePartDefinition"/> objects based on all the DLL files in the specified directory path and its sub-directories.
- /// </summary>
- /// <param name="path">Path to the directory to scan for assemblies to add to the catalog.</param>
- public RecursiveDirectoryCatalog(string path)
- : this(path, "*.dll")
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="RecursiveDirectoryCatalog"/> class with <see cref="ComposablePartDefinition"/> objects based on the specified search pattern in the specified directory path path and its sub-directories.
- /// </summary>
- /// <param name="path">Path to the directory to scan for assemblies to add to the catalog.</param>
- /// <param name="searchPattern">The pattern to search with. The format of the pattern should be the same as specified for GetFiles.</param>
- /// <exception cref="ArgumentNullException">The value of the <paramref name="path"/> parameter was <see langword="null"/>.</exception>
- public RecursiveDirectoryCatalog(string path, string searchPattern)
- {
- Guard.IsNotNull(path);
-
- _path = path;
-
- Initialize(path, searchPattern);
- }
-
- private static IEnumerable<string> GetFoldersRecursive(string path)
- {
- var result = new List<string> { path };
- foreach (string child in Directory.GetDirectories(path))
- {
- result.AddRange(GetFoldersRecursive(child));
- }
- return result;
- }
-
- private void Initialize(string path, string searchPattern)
- {
- IEnumerable<string> files
- = Directory.EnumerateFiles(path, searchPattern, SearchOption.AllDirectories);
-
- _aggregateCatalog = new AggregateCatalog();
-
- _aggregateCatalog.Changed += (o, e) =>
- {
- Changed?.Invoke(o, e);
- };
-
- _aggregateCatalog.Changing += (o, e) =>
- {
- Changing?.Invoke(o, e);
- };
-
- foreach (string file in files)
- {
- try
- {
- var asmCat = new AssemblyCatalog(file);
-
- // Force MEF to load the plugin and figure out if there are any exports
- // good assemblies will not throw the RTLE exception and can be added to the catalog
- if (asmCat.Parts.ToList().Count > 0)
- {
- _aggregateCatalog.Catalogs.Add(asmCat);
- }
- }
- catch (ReflectionTypeLoadException)
- {
- }
- catch (BadImageFormatException)
- {
- }
- }
- }
-
- /// <summary>
- /// Gets the part definitions that are contained in the recursive directory catalog. (Overrides ComposablePartCatalog.Parts.)
- /// </summary>
- public override IQueryable<ComposablePartDefinition> Parts
- {
- get
- {
- Guard.IsNotNull(_aggregateCatalog);
- return _aggregateCatalog.Parts;
- }
- }
-
- /// <summary>
- /// Occurs when the contents of the catalog has changed.
- /// </summary>
- public event EventHandler<ComposablePartCatalogChangeEventArgs>? Changed;
-
- /// <summary>
- /// Occurs when the catalog is changing.
- /// </summary>
- public event EventHandler<ComposablePartCatalogChangeEventArgs>? Changing;
-
- private string GetDisplayName()
- {
- return string.Format(
- CultureInfo.CurrentCulture,
- "{0} (RecusrivePath=\"{1}\")", new[] { GetType().Name, _path });
- }
-
- public override string ToString()
- {
- return GetDisplayName();
- }
-
- /// <summary>
- /// Gets the display name of the directory catalog.
- /// </summary>
- string ICompositionElement.DisplayName => GetDisplayName();
-
- /// <summary>
- /// Gets the composition element from which the directory catalog originated.
- /// </summary>
- ICompositionElement? ICompositionElement.Origin => null;
-}
diff --git a/src/app/dev/DevToys.Tools/DevToys.Tools.csproj b/src/app/dev/DevToys.Tools/DevToys.Tools.csproj
index 4a970527b..8c7ce9b0f 100644
--- a/src/app/dev/DevToys.Tools/DevToys.Tools.csproj
+++ b/src/app/dev/DevToys.Tools/DevToys.Tools.csproj
@@ -32,17 +32,4 @@
<LastGenOutput>Sample.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
-
- <Target Name="CopyPluginAfterBuild" AfterTargets="Build">
- <ItemGroup>
- <PluginOutput Include="$(OutputPath)\**\*" />
- </ItemGroup>
- <Copy
- SourceFiles="@(PluginOutput)"
- DestinationFolder="$(RepoRoot)bin\$(Configuration)\Plugins\DevToys.Tools"
- SkipUnchangedFiles="false"
- OverwriteReadOnlyFiles="true"
- Retries="10"
- RetryDelayMilliseconds="1000" />
- </Target>
</Project>
\ No newline at end of file
diff --git a/src/app/dev/DevToys.Tools/Dummy.cs b/src/app/dev/DevToys.Tools/Dummy.cs
new file mode 100644
index 000000000..3f58a43f6
--- /dev/null
+++ b/src/app/dev/DevToys.Tools/Dummy.cs
@@ -0,0 +1,4 @@
+namespace DevToys.Tools;
+public class Dummy
+{
+}
diff --git a/src/app/dev/DevToys.UI.Framework/Controls/BackdropWindow/BackdropWindow.Windows.cs b/src/app/dev/DevToys.UI.Framework/Controls/BackdropWindow/BackdropWindow.Windows.cs
index d6d8ef56d..f3cb00fd4 100644
--- a/src/app/dev/DevToys.UI.Framework/Controls/BackdropWindow/BackdropWindow.Windows.cs
+++ b/src/app/dev/DevToys.UI.Framework/Controls/BackdropWindow/BackdropWindow.Windows.cs
@@ -316,7 +316,7 @@ public sealed partial class BackdropWindow : Window
internal int _apartmentType;
}
- [DllImport("CoreMessaging.dll")]
+ [DllImport("CoreMessaging.dll", ExactSpelling = true)]
private static extern int CreateDispatcherQueueController([In] DispatcherQueueOptions options, [In, Out, MarshalAs(UnmanagedType.IUnknown)] ref object dispatcherQueueController);
private object? _dispatcherQueueController = null;
diff --git a/src/app/dev/DevToys.UI.Framework/DevToys.UI.Framework.csproj b/src/app/dev/DevToys.UI.Framework/DevToys.UI.Framework.csproj
index b1b0ec88c..7ae17da71 100644
--- a/src/app/dev/DevToys.UI.Framework/DevToys.UI.Framework.csproj
+++ b/src/app/dev/DevToys.UI.Framework/DevToys.UI.Framework.csproj
@@ -14,6 +14,19 @@
<EnableWindowsTargeting>true</EnableWindowsTargeting>
</PropertyGroup>
+ <ItemGroup>
+ <UpToDateCheckInput Include="**\*.xaml"/>
+ <Page Include="**\*.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
+ <PRIResource Include="**\*.resw" />
+ <Content Include="Assets\**" />
+ <Compile Update="**\*.xaml.cs">
+ <DependentUpon>%(Filename)</DependentUpon>
+ </Compile>
+ </ItemGroup>
+
<Choose>
<When Condition="'$(TargetFramework)' == '$(NetMacCatalyst)'">
<PropertyGroup>
@@ -66,6 +79,10 @@
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" />
<PackageReference Include="Uno.Microsoft.Xaml.Behaviors.WinUI.Managed" />
</ItemGroup>
+ <ItemGroup>
+ <NativeLibrary Include="CoreMessaging.lib" />
+ <DirectPInvoke Include="CoreMessaging" />
+ </ItemGroup>
</When>
</Choose>
@@ -84,17 +101,4 @@
<ProjectReference Include="..\DevToys.Api\DevToys.Api.csproj" />
</ItemGroup>
- <ItemGroup>
- <UpToDateCheckInput Include="**\*.xaml" />
- <Page Include="**\*.xaml">
- <SubType>Designer</SubType>
- <Generator>MSBuild:Compile</Generator>
- </Page>
- <PRIResource Include="**\*.resw" />
- <Content Include="Assets\**" />
- <Compile Update="**\*.xaml.cs">
- <DependentUpon>%(Filename)</DependentUpon>
- </Compile>
- </ItemGroup>
-
</Project>
\ No newline at end of file
diff --git a/src/app/dev/Directory.Build.props b/src/app/dev/Directory.Build.props
index 045b49a8c..166a499a5 100644
--- a/src/app/dev/Directory.Build.props
+++ b/src/app/dev/Directory.Build.props
@@ -23,9 +23,11 @@
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<Optimize>true</Optimize>
- <!-- Trimming settings -->
+ <!-- AOT & Trim settings -->
+ <!-- https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/ -->
<!-- https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/trimming-options?source=recommendations&pivots=dotnet-7-0 -->
<TrimMode>partial</TrimMode>
+ <StripSymbols>true</StripSymbols>
</PropertyGroup>
<ItemGroup>
diff --git a/src/app/dev/platforms/desktop/DevToys.CLI/DevToys.CLI.csproj b/src/app/dev/platforms/desktop/DevToys.CLI/DevToys.CLI.csproj
index 4e7379659..b6d19622e 100644
--- a/src/app/dev/platforms/desktop/DevToys.CLI/DevToys.CLI.csproj
+++ b/src/app/dev/platforms/desktop/DevToys.CLI/DevToys.CLI.csproj
@@ -17,5 +17,6 @@
<ItemGroup>
<ProjectReference Include="..\..\..\DevToys.Api\DevToys.Api.csproj" />
<ProjectReference Include="..\..\..\DevToys.Core\DevToys.Core.csproj" />
+ <ProjectReference Include="..\..\..\DevToys.Tools\DevToys.Tools.csproj" />
</ItemGroup>
</Project>
diff --git a/src/app/dev/platforms/desktop/DevToys.CLI/Program.cs b/src/app/dev/platforms/desktop/DevToys.CLI/Program.cs
index e99b25ed4..7311b3206 100644
--- a/src/app/dev/platforms/desktop/DevToys.CLI/Program.cs
+++ b/src/app/dev/platforms/desktop/DevToys.CLI/Program.cs
@@ -6,6 +6,7 @@ using DevToys.Api;
using DevToys.CLI.Core.FileStorage;
using DevToys.Core.Logging;
using DevToys.Core.Mef;
+using DevToys.Tools;
using Microsoft.Extensions.Logging;
using Uno.Extensions;
@@ -57,7 +58,12 @@ internal class Program
// Initialize MEF.
var mefComposer
- = new MefComposer(new[] { typeof(Program).Assembly });
+ = new MefComposer(
+ new[]
+ {
+ typeof(Dummy).Assembly,
+ typeof(Program).Assembly
+ });
// Get all the command line tools.
IEnumerable<Lazy<ICommandLineTool, CommandLineToolMetadata>> commandLineTools
diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/DevToys.MauiBlazor.csproj b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/DevToys.MauiBlazor.csproj
index 6e2aff806..3e3e5abdd 100644
--- a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/DevToys.MauiBlazor.csproj
+++ b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/DevToys.MauiBlazor.csproj
@@ -91,6 +91,7 @@
<ProjectReference Include="..\..\..\DevToys.Api\DevToys.Api.csproj" />
<ProjectReference Include="..\..\..\DevToys.Core\DevToys.Core.csproj" />
<ProjectReference Include="..\..\..\DevToys.Localization\DevToys.Localization.csproj" />
+ <ProjectReference Include="..\..\..\DevToys.Tools\DevToys.Tools.csproj" />
</ItemGroup>
<ItemGroup>
diff --git a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/MauiProgram.cs b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/MauiProgram.cs
index 6fa61a7a4..902deec17 100644
--- a/src/app/dev/platforms/desktop/DevToys.MauiBlazor/MauiProgram.cs
+++ b/src/app/dev/platforms/desktop/DevToys.MauiBlazor/MauiProgram.cs
@@ -4,6 +4,7 @@ using DevToys.Core.Mef;
using DevToys.Core.Settings;
using DevToys.MauiBlazor.Core.FileStorage;
using DevToys.MauiBlazor.Core.Languages;
+using DevToys.Tools;
using Microsoft.Extensions.Logging;
using Microsoft.Fast.Components.FluentUI;
using Microsoft.Fast.Components.FluentUI.Infrastructure;
@@ -13,7 +14,11 @@ namespace DevToys.MauiBlazor;
public static class MauiProgram
{
- internal static readonly Lazy<MefComposer> MefComposer = new(() => new MefComposer());
+ internal static readonly Lazy<MefComposer> MefComposer
+ = new(() => new MefComposer(
+ new[] {
+ typeof(Dummy).Assembly
+ }));
public static MauiApp CreateMauiApp()
{
diff --git a/src/app/dev/platforms/desktop/Directory.Build.props b/src/app/dev/platforms/desktop/Directory.Build.props
deleted file mode 100644
index d9ac90858..000000000
--- a/src/app/dev/platforms/desktop/Directory.Build.props
+++ /dev/null
@@ -1,10 +0,0 @@
-<Project>
- <Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
-
- <!-- Include DevToys.Tools and other plugins to the output -->
- <ItemGroup>
- <Content Include="$(RepoRoot)bin\$(Configuration)\Plugins\**\*" Link="Plugins\%(RecursiveDir)%(Filename)%(Extension)">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </Content>
- </ItemGroup>
-</Project>
\ No newline at end of file
diff --git a/src/app/dev/platforms/desktop/Directory.Build.targets b/src/app/dev/platforms/desktop/Directory.Build.targets
deleted file mode 100644
index 087650400..000000000
--- a/src/app/dev/platforms/desktop/Directory.Build.targets
+++ /dev/null
@@ -1,18 +0,0 @@
-<Project>
- <Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" />
-
- <Target Name="ImportPluginOnPublish" BeforeTargets="Publish">
- <Message Text="Importing plugins..." Importance="high" />
- <ItemGroup>
- <PluginOutput Include="$(RepoRoot)bin\$(Configuration)\Plugins\**\*" />
- </ItemGroup>
- <Copy
- SourceFiles="@(PluginOutput)"
- DestinationFolder="$(PublishDir)\Plugins\%(RecursiveDir)"
- SkipUnchangedFiles="true"
- OverwriteReadOnlyFiles="true"
- Retries="10"
- RetryDelayMilliseconds="1000" />
- <Message Text="Plugins importanted!" Importance="high" />
- </Target>
-</Project>
\ No newline at end of file
diff --git a/src/app/dev/platforms/desktop/macos/DevToys.MacOS/DevToys.MacOS.csproj b/src/app/dev/platforms/desktop/macos/DevToys.MacOS/DevToys.MacOS.csproj
index 05a094024..2f7ac537f 100644
--- a/src/app/dev/platforms/desktop/macos/DevToys.MacOS/DevToys.MacOS.csproj
+++ b/src/app/dev/platforms/desktop/macos/DevToys.MacOS/DevToys.MacOS.csproj
@@ -62,6 +62,7 @@
<ProjectReference Include="..\..\..\..\DevToys.Api\DevToys.Api.csproj"/>
<ProjectReference Include="..\..\..\..\DevToys.Core\DevToys.Core.csproj"/>
<ProjectReference Include="..\..\..\..\DevToys.MonacoEditor\DevToys.MonacoEditor.csproj"/>
+ <ProjectReference Include="..\..\..\..\DevToys.Tools\DevToys.Tools.csproj" />
<ProjectReference Include="..\..\..\..\DevToys.UI.Framework\DevToys.UI.Framework.csproj"/>
<ProjectReference Include="..\..\..\..\DevToys.UI\DevToys.UI.csproj"/>
</ItemGroup>
diff --git a/src/app/dev/platforms/desktop/windows/DevToys.Wasdk/DevToys.Wasdk.csproj b/src/app/dev/platforms/desktop/windows/DevToys.Wasdk/DevToys.Wasdk.csproj
index db2b9171e..298d3f0c6 100644
--- a/src/app/dev/platforms/desktop/windows/DevToys.Wasdk/DevToys.Wasdk.csproj
+++ b/src/app/dev/platforms/desktop/windows/DevToys.Wasdk/DevToys.Wasdk.csproj
@@ -76,6 +76,7 @@
<ProjectReference Include="..\..\..\..\DevToys.Api\DevToys.Api.csproj" />
<ProjectReference Include="..\..\..\..\DevToys.Core\DevToys.Core.csproj" />
<ProjectReference Include="..\..\..\..\DevToys.MonacoEditor\DevToys.MonacoEditor.csproj" />
+ <ProjectReference Include="..\..\..\..\DevToys.Tools\DevToys.Tools.csproj" />
<ProjectReference Include="..\..\..\..\DevToys.UI.Framework\DevToys.UI.Framework.csproj" />
<ProjectReference Include="..\..\..\..\DevToys.UI\DevToys.UI.csproj" />
</ItemGroup>
diff --git a/src/app/dev/platforms/web/DevToys.Wasm/DevToys.Wasm.csproj b/src/app/dev/platforms/web/DevToys.Wasm/DevToys.Wasm.csproj
index 30536fa0b..cf4829534 100644
--- a/src/app/dev/platforms/web/DevToys.Wasm/DevToys.Wasm.csproj
+++ b/src/app/dev/platforms/web/DevToys.Wasm/DevToys.Wasm.csproj
@@ -62,6 +62,7 @@
<ProjectReference Include="..\..\..\DevToys.Api\DevToys.Api.csproj" />
<ProjectReference Include="..\..\..\DevToys.Core\DevToys.Core.csproj" />
<ProjectReference Include="..\..\..\DevToys.MonacoEditor\DevToys.MonacoEditor.csproj" />
+ <ProjectReference Include="..\..\..\DevToys.Tools\DevToys.Tools.csproj" />
<ProjectReference Include="..\..\..\DevToys.UI.Framework\DevToys.UI.Framework.csproj" />
<ProjectReference Include="..\..\..\DevToys.UI\DevToys.UI.csproj" />
</ItemGroup>
diff --git a/src/app/dev/shared/App.xaml.cs b/src/app/dev/shared/App.xaml.cs
index 038644bfb..04a4df5d0 100644
--- a/src/app/dev/shared/App.xaml.cs
+++ b/src/app/dev/shared/App.xaml.cs
@@ -4,6 +4,7 @@ using DevToys.Api.Core.Theme;
using DevToys.Core.Logging;
using DevToys.Core.Mef;
using DevToys.Core.Settings;
+using DevToys.Tools;
using DevToys.UI;
using DevToys.UI.Framework.Controls;
using DevToys.UI.Views;
@@ -56,6 +57,7 @@ public sealed partial class App : Application
= new MefComposer(
new[]
{
+ typeof(Dummy).Assembly,
typeof(MainWindow).Assembly
});
diff --git a/src/app/dev/shared/LinkerConfig.xml b/src/app/dev/shared/LinkerConfig.xml
index 320de3bd2..56aa3d975 100644
--- a/src/app/dev/shared/LinkerConfig.xml
+++ b/src/app/dev/shared/LinkerConfig.xml
@@ -19,6 +19,7 @@
-->
<type fullname="System.Linq.Expressions*" />
</assembly>
+ <assembly fullname="System.Private.CoreLib" />
<assembly fullname="Uno.UI" />
<assembly fullname="Microsoft.Extensions.Options" />
<assembly fullname="DevToys.API" />
diff --git a/src/build/Build.cs b/src/build/Build.cs
index bce257a77..a4053adba 100644
--- a/src/build/Build.cs
+++ b/src/build/Build.cs
@@ -16,7 +16,6 @@ using static AppVersionTask;
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.IO.PathConstruction;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
-using static Nuke.Common.Tools.MSBuild.MSBuildTasks;
using static RestoreTask;
using Project = Nuke.Common.ProjectModel.Project;
@@ -118,30 +117,12 @@ class Build : NukeBuild
.SetVerbosity(DotNetVerbosity.Quiet)));
});
- Target BuildPlugins => _ => _
- .DependentFor(Publish)
- .After(Restore)
- .After(SetVersion)
- .After(BuildGenerators)
- .Executes(() =>
- {
- Log.Information($"Building plugins ...");
- Project project = WindowsSolution!.GetProject("DevToys.Tools");
- DotNetBuild(s => s
- .SetProjectFile(project)
- .SetConfiguration(Configuration)
- .SetSelfContained(false)
- .SetPublishTrimmed(false)
- .SetVerbosity(DotNetVerbosity.Quiet));
- });
-
#pragma warning disable IDE0051 // Remove unused private members
Target UnitTests => _ => _
.DependentFor(Publish)
.After(Restore)
.After(SetVersion)
.After(BuildGenerators)
- .After(BuildPlugins)
.OnlyWhenDynamic(() => RunTests)
.Executes(() =>
{
@@ -159,7 +140,6 @@ class Build : NukeBuild
.DependsOn(SetVersion)
.DependsOn(Restore)
.DependsOn(BuildGenerators)
- .DependsOn(BuildPlugins)
.Executes(() =>
{
if (PlatformTargets!.Contains(PlatformTarget.Windows))
@@ -176,7 +156,7 @@ class Build : NukeBuild
.SetSelfContained(true)
.SetPublishSingleFile(false)
.SetPublishReadyToRun(false)
- .SetPublishTrimmed(false) // TODO?
+ .SetPublishTrimmed(dotnetParameters.Portable)
.SetVerbosity(DotNetVerbosity.Quiet)
.SetProcessArgumentConfigurator(_ => _
.Add("/p:RuntimeIdentifierOverride=" + dotnetParameters.RuntimeIdentifier)
@@ -195,9 +175,15 @@ class Build : NukeBuild
.SetRuntime(dotnetParameters.RuntimeIdentifier)
.SetPlatform(dotnetParameters.Platform)
.SetSelfContained(true)
- .SetPublishSingleFile(false)
- .SetPublishReadyToRun(false)
- .SetPublishTrimmed(false) // TODO?
+ .SetPublishSingleFile(true)
+ .SetPublishReadyToRun(true)
+ // TODO: Enable trimming. There are some things we will need to workaround to enable it.
+ // Trimming makes that we can't do COM invokes like User32.dll using DllImport.
+ // We use it at least in Backdrop.Windows.cs. We will need to find a workaround by either
+ // upgrading WASDK and use `SystemBackdrop = new MicaBackdrop();` and/or by writing our own
+ // wrapper like here: https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/incompatibilities?source=recommendations#built-in-com-marshalling
+ .SetPublishTrimmed(false)
+ //.SetPublishTrimmed(dotnetParameters.Portable)
.SetVerbosity(DotNetVerbosity.Quiet)
.SetProcessArgumentConfigurator(_ => _
.Add("/p:RuntimeIdentifierOverride=" + dotnetParameters.RuntimeIdentifier)
@@ -209,8 +195,8 @@ class Build : NukeBuild
if (PlatformTargets!.Contains(PlatformTarget.MacCatalyst))
{
- // DevToys Uno Mac Catalyst
- foreach (DotnetParameters dotnetParameters in GetDotnetParametersForMacOSApp())
+ // DevToys MAUI Blazor
+ foreach (DotnetParameters dotnetParameters in GetDotnetParametersForMauiBlazorApp())
{
Log.Information($"Publishing {dotnetParameters.ProjectOrSolutionPath + " - " + dotnetParameters.TargetFramework + " - " + dotnetParameters.RuntimeIdentifier} ...");
DotNetBuild(s => s
@@ -227,16 +213,16 @@ class Build : NukeBuild
.Add($"/bl:\"{RootDirectory / "publish" / dotnetParameters.OutputPath}.binlog\""))
.SetOutputDirectory(RootDirectory / "publish" / dotnetParameters.OutputPath));
}
-
- // DevToys MAUI Blazor
- foreach (DotnetParameters dotnetParameters in GetDotnetParametersForMauiBlazorApp())
+
+ // DevToys Uno Mac Catalyst
+ foreach (DotnetParameters dotnetParameters in GetDotnetParametersForMacOSApp())
{
Log.Information($"Publishing {dotnetParameters.ProjectOrSolutionPath + " - " + dotnetParameters.TargetFramework + " - " + dotnetParameters.RuntimeIdentifier} ...");
DotNetBuild(s => s
.SetProjectFile(dotnetParameters.ProjectOrSolutionPath)
.SetConfiguration(Configuration)
.SetPublishSingleFile(false) // Not supported by MacCatalyst as it would require UseAppHost to be true, which isn't supported on Mac
- .SetPublishReadyToRun(false)
+ .SetPublishReadyToRun(true)
.SetPublishTrimmed(true) /* Required True for MacCatalyst ? */
.SetVerbosity(DotNetVerbosity.Quiet)
.SetNoRestore(true) /* workaround for https://github.com/xamarin/xamarin-macios/issues/15664#issuecomment-1233123515 */
@@ -262,8 +248,7 @@ class Build : NukeBuild
.SetSelfContained(dotnetParameters.Portable)
.SetPublishSingleFile(true)
.SetPublishReadyToRun(true)
- .SetPublishTrimmed(false)
- //.SetPublishTrimmed(dotnetParameters.Portable) // TODO?
+ .SetPublishTrimmed(dotnetParameters.Portable)
.SetVerbosity(DotNetVerbosity.Quiet)
.SetProcessArgumentConfigurator(_ => _
.Add($"/bl:\"{RootDirectory / "publish" / dotnetParameters.OutputPath}.binlog\""))
diff --git a/src/build/PlatformTarget.cs b/src/build/PlatformTarget.cs
index 26d83fe7d..f40322a65 100644
--- a/src/build/PlatformTarget.cs
+++ b/src/build/PlatformTarget.cs
@@ -3,5 +3,6 @@
Windows,
MacCatalyst,
CLI,
- Wasm
+ Wasm,
+ Linux // TODO: https://learn.microsoft.com/en-us/dotnet/core/deploying/native-aot/#prerequisites
}