Skip to content

A Swiss Army knife for developers.

Fixed MacOS build

Etienne Baudoux3e55697b17c8
diff --git a/src/DevToys-MacOS.sln b/src/DevToys-MacOS.sln
index 5b4fe80b6..9f4efbb83 100644
--- a/src/DevToys-MacOS.sln
+++ b/src/DevToys-MacOS.sln
@@ -20,6 +20,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "shared", "shared", "{9771D1F8-D331-4B26-8E96-6024893009F4}"
ProjectSection(SolutionItems) = preProject
app\dev\shared\GlobalUsings.cs = app\dev\shared\GlobalUsings.cs
+ app\dev\shared\LinkerConfig.xml = app\dev\shared\LinkerConfig.xml
app\dev\shared\SharedAssemblyInfo.cs = app\dev\shared\SharedAssemblyInfo.cs
app\dev\shared\SharedAssemblyVersion.cs = app\dev\shared\SharedAssemblyVersion.cs
EndProjectSection
@@ -34,12 +35,19 @@ 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}") = "macos", "macos", "{8B003389-15D4-4466-A40E-50FC0D603BF6}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "web", "web", "{04F9E03E-B519-49C5-BC6A-2131ED9BADC0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevToys.CLI", "app\dev\platforms\desktop\DevToys.CLI\DevToys.CLI.csproj", "{8C72D38A-658D-4C9D-B0AD-2DA975BE7826}"
+ ProjectSection(ProjectDependencies) = postProject
+ {B6D48157-5257-4B60-B065-3B231B610A54} = {B6D48157-5257-4B60-B065-3B231B610A54}
+ EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "build\_build.csproj", "{745FD4CA-84CC-45D8-A3E2-814A0B9C16C4}"
EndProject
@@ -60,14 +68,23 @@ EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevToys.Wasm", "app\dev\platforms\web\DevToys.Wasm\DevToys.Wasm.csproj", "{9E59352A-836D-47DE-AB02-F404A8345242}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevToys.MacOS", "app\dev\platforms\desktop\macos\DevToys.MacOS\DevToys.MacOS.csproj", "{E3E689D3-FC5E-48B4-961E-DD5C0DB62DAF}"
+ ProjectSection(ProjectDependencies) = postProject
+ {B6D48157-5257-4B60-B065-3B231B610A54} = {B6D48157-5257-4B60-B065-3B231B610A54}
+ EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DevToys.MauiBlazor", "app\dev\platforms\desktop\DevToys.MauiBlazor\DevToys.MauiBlazor.csproj", "{77A35152-832A-47FA-B7B8-2B0E113E8B29}"
+ ProjectSection(ProjectDependencies) = postProject
+ {B6D48157-5257-4B60-B065-3B231B610A54} = {B6D48157-5257-4B60-B065-3B231B610A54}
+ EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "generators", "generators", "{1713A47C-7BCA-4240-8CD6-7A047E377801}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ResxHelperGenerator", "generators\ResxHelperGenerator\ResxHelperGenerator.csproj", "{F404CCE2-597A-485A-B70A-C119E5CC12ED}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DevToys.Localization", "app\dev\DevToys.Localization\DevToys.Localization.csproj", "{A3ABEA5E-48FB-45D5-98D4-042D3DEA53E7}"
+ ProjectSection(ProjectDependencies) = postProject
+ {F404CCE2-597A-485A-B70A-C119E5CC12ED} = {F404CCE2-597A-485A-B70A-C119E5CC12ED}
+ EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
diff --git a/src/app/dev/platforms/desktop/Directory.Build.props b/src/app/dev/platforms/desktop/Directory.Build.props
index a35f697b5..d9ac90858 100644
--- a/src/app/dev/platforms/desktop/Directory.Build.props
+++ b/src/app/dev/platforms/desktop/Directory.Build.props
@@ -3,6 +3,8 @@
<!-- Include DevToys.Tools and other plugins to the output -->
<ItemGroup>
- <Content Include="$(RepoRoot)bin\$(Configuration)\Plugins\**\*" Link="Plugins\%(RecursiveDir)%(Filename)%(Extension)" />
+ <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/web/DevToys.Wasm/DevToys.Wasm.csproj b/src/app/dev/platforms/web/DevToys.Wasm/DevToys.Wasm.csproj
index e0e7cc12b..30536fa0b 100644
--- a/src/app/dev/platforms/web/DevToys.Wasm/DevToys.Wasm.csproj
+++ b/src/app/dev/platforms/web/DevToys.Wasm/DevToys.Wasm.csproj
@@ -73,6 +73,15 @@
<Compile Update="..\..\desktop\windows\DevToys.Wasdk\Core\Theme\ThemeListener.cs">
<Link>Core\Theme\\ThemeListener.cs</Link>
</Compile>
+ <Compile Update="..\..\desktop\windows\DevToys.Wasdk\Core\Settings\SettingsStorage.Unpackaged.cs">
+ <Link>Core\Settings\\SettingsStorage.Unpackaged.cs</Link>
+ </Compile>
+ <Compile Update="..\..\desktop\windows\DevToys.Wasdk\Core\Settings\SettingsStorage.Packaged.cs">
+ <Link>Core\Settings\\SettingsStorage.Packaged.cs</Link>
+ </Compile>
+ <Compile Update="..\..\desktop\windows\DevToys.Wasdk\Core\FileStorage\FileStorage.cs">
+ <Link>Core\FileStorage\\FileStorage.cs</Link>
+ </Compile>
</ItemGroup>
<Import Project="$(RepoRoot)\src\app\dev\shared\App.props" />
</Project>
\ No newline at end of file
diff --git a/src/build/Build.cs b/src/build/Build.cs
index 84204cc09..bce257a77 100644
--- a/src/build/Build.cs
+++ b/src/build/Build.cs
@@ -209,31 +209,42 @@ class Build : NukeBuild
if (PlatformTargets!.Contains(PlatformTarget.MacCatalyst))
{
- // DevToys Uno Mac Catalyst and MAUI Blazor
- Project[] projects = {
- MacSolution!.GetProject("DevToys.MacOS"),
- MacSolution.GetProject("DevToys.MauiBlazor")
- };
-
- foreach (Project project in projects)
+ // DevToys Uno Mac Catalyst
+ foreach (DotnetParameters dotnetParameters in GetDotnetParametersForMacOSApp())
{
- foreach (DotnetParameters dotnetParameters in GetDotnetParametersForMauiBlazorApp())
- {
- 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)
- .SetPublishTrimmed(true) /* Required for MacCatalyst*/
- .SetVerbosity(DotNetVerbosity.Quiet)
- .SetNoRestore(true) /* workaround for https://github.com/xamarin/xamarin-macios/issues/15664#issuecomment-1233123515 */
- .SetProcessArgumentConfigurator(_ => _
- .Add("/p:RuntimeIdentifierOverride=" + dotnetParameters.RuntimeIdentifier)
- .Add("/p:CreatePackage=True") /* Will create an installable .pkg */
- .Add($"/bl:\"{RootDirectory / "publish" / dotnetParameters.OutputPath}.binlog\""))
- .SetOutputDirectory(RootDirectory / "publish" / dotnetParameters.OutputPath));
- }
+ 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)
+ .SetPublishTrimmed(true) /* Required True for MacCatalyst ? */
+ .SetVerbosity(DotNetVerbosity.Quiet)
+ .SetNoRestore(true) /* workaround for https://github.com/xamarin/xamarin-macios/issues/15664#issuecomment-1233123515 */
+ .SetProcessArgumentConfigurator(_ => _
+ .Add("/p:RuntimeIdentifierOverride=" + dotnetParameters.RuntimeIdentifier)
+ .Add("/p:CreatePackage=True") /* Will create an installable .pkg */
+ .Add($"/bl:\"{RootDirectory / "publish" / dotnetParameters.OutputPath}.binlog\""))
+ .SetOutputDirectory(RootDirectory / "publish" / dotnetParameters.OutputPath));
+ }
+
+ // DevToys MAUI Blazor
+ foreach (DotnetParameters dotnetParameters in GetDotnetParametersForMauiBlazorApp())
+ {
+ 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)
+ .SetPublishTrimmed(true) /* Required True for MacCatalyst ? */
+ .SetVerbosity(DotNetVerbosity.Quiet)
+ .SetNoRestore(true) /* workaround for https://github.com/xamarin/xamarin-macios/issues/15664#issuecomment-1233123515 */
+ .SetProcessArgumentConfigurator(_ => _
+ .Add("/p:RuntimeIdentifierOverride=" + dotnetParameters.RuntimeIdentifier)
+ .Add("/p:CreatePackage=True") /* Will create an installable .pkg */
+ .Add($"/bl:\"{RootDirectory / "publish" / dotnetParameters.OutputPath}.binlog\""))
+ .SetOutputDirectory(RootDirectory / "publish" / dotnetParameters.OutputPath));
}
}
@@ -353,5 +364,35 @@ class Build : NukeBuild
throw new NotSupportedException();
}
}
+
+ IEnumerable<DotnetParameters> GetDotnetParametersForMacOSApp()
+ {
+ string publishProject = "DevToys.MacOS";
+ Project project;
+
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
+ {
+ project = MacSolution!.GetProject(publishProject);
+ foreach (string targetFramework in project.GetTargetFrameworks())
+ {
+ yield return new DotnetParameters(project.Path, "maccatalyst-arm64", targetFramework, portable: true);
+ yield return new DotnetParameters(project.Path, "maccatalyst-x64", targetFramework, portable: true);
+ }
+ }
+ else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ project = WindowsSolution!.GetProject(publishProject);
+ foreach (string targetFramework in project.GetTargetFrameworks())
+ {
+ yield return new DotnetParameters(project.Path, "win10-arm64", targetFramework, portable: true);
+ yield return new DotnetParameters(project.Path, "win10-x64", targetFramework, portable: true);
+ yield return new DotnetParameters(project.Path, "win10-x86", targetFramework, portable: true);
+ }
+ }
+ else
+ {
+ throw new NotSupportedException();
+ }
+ }
#pragma warning restore IDE1006 // Naming Styles
}