Skip to content

Commit

Permalink
Merge pull request #2276 from cwensley/curtis/macos-templates
Browse files Browse the repository at this point in the history
Add macOS platform templates
  • Loading branch information
cwensley authored Aug 6, 2022
2 parents 5859a94 + d9aa32d commit 2c7b2d8
Show file tree
Hide file tree
Showing 61 changed files with 544 additions and 45 deletions.
73 changes: 54 additions & 19 deletions build/Build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -200,41 +200,75 @@
<Framework Include="net48" Value="net48" />

<OtherOptions Include="none" Value="" />
<OtherOptions Include="macos" Value="-macos" />
<OtherOptions Include="wf" Value="-wf" />
<OtherOptions Include="wf_macos" Value="-wf -macos" />
<OtherOptions Include="wf_xm" Value="-wf -xm" />
<OtherOptions Include="xm" Value="-xm" />

<CombinedProject1 Include="*" LanguageId="%(Language.Identity)" Language="%(Language.Value)" />
<CombinedProject2 Include="@(CombinedProject1)" ModeId="%(Mode.Identity)" Mode="%(Mode.Identity)" />
<CombinedProject3 Include="@(CombinedProject2)" CombinedId="%(Combined.Identity)" Combined="%(Combined.Value)" />
<CombinedProject4 Include="@(CombinedProject3)" FrameworkId="%(Framework.Identity)" Framework="%(Framework.Value)" />
<CombinedProject Include="@(CombinedProject4)" OtherId="%(OtherOptions.Identity)" Other="%(OtherOptions.Value)" />
<CombinedProject2 Include="@(CombinedProject1)" CombinedId="%(Combined.Identity)" Combined="%(Combined.Value)" />
<CombinedProject3 Include="@(CombinedProject2)" FrameworkId="%(Framework.Identity)" Framework="%(Framework.Value)" />
<CombinedProject4 Include="@(CombinedProject3)" OtherId="%(OtherOptions.Identity)" Other="%(OtherOptions.Value)" />
<CombinedProject Include="@(CombinedProject4)" ModeId="%(Mode.Identity)" Mode="%(Mode.Identity)" />
<CombinedProject Update="@(CombinedProject)"
OutputPath="$(ArtifactsDir)templates\App.%(LanguageId)-%(CombinedId)-%(OtherId)-%(ModeId)-%(FrameworkId)"
BuildCommand="&amp;&amp; dotnet build" />
ProjectName="App.%(LanguageId)-%(CombinedId)-%(OtherId)-%(ModeId)-%(FrameworkId)" />

<!-- Combined Rules -->

<!-- By default, use dotnet build to build combined project-->
<CombinedProject Update="@(CombinedProject)"
Condition="%(CombinedId) == 'combined'"
BuildCommand="&amp;&amp; dotnet build" />
<!-- Xamarin.Mac doesn't support VB -->
<CombinedProject Remove="@(CombinedProject)" Condition="%(CombinedId) == 'combined' and %(LanguageId) == 'vb' and (%(OtherId) == 'xm' or %(OtherId) == 'wf_xm')" />
<CombinedProject Remove="@(CombinedProject)"
Condition="%(CombinedId) == 'combined' and %(LanguageId) == 'vb' and (%(OtherId) == 'xm' or %(OtherId) == 'wf_xm')" />
<!-- Xamarin.Mac only supports net4x -->
<CombinedProject Remove="@(CombinedProject)"
Condition="$([MSBuild]::IsOSPlatform(osx)) and %(CombinedId) == 'combined' and (%(OtherId) == 'xm' or %(OtherId) == 'wf_xm') and %(FrameworkId) != 'net48'" />
<!-- Xamarin.Mac can only use dotnet to build in C#, F# requires msbuild -->
<CombinedProject Update="@(CombinedProject)"
Condition="$([MSBuild]::IsOSPlatform(osx)) and %(CombinedId) == 'combined' and (%(LanguageId) != 'cs' and (%(OtherId) == 'xm' or %(OtherId) == 'wf_xm'))"
BuildCommand='&amp;&amp; env -i HOME="$HOME" bash -l -c "msbuild /restore /v:Minimal"' />
<!-- macos doesn't support VB -->
<CombinedProject Remove="@(CombinedProject)"
Condition="%(CombinedId) == 'combined' and %(LanguageId) == 'vb' and (%(OtherId) == 'macos' or %(OtherId) == 'wf_macos')" />
<!-- Wpf doesn't support F# -->
<CombinedProject Remove="@(CombinedProject)" Condition="%(LanguageId) == 'fs' and (%(OtherId) == 'none' or %(OtherId) == 'xm')" />
<CombinedProject Remove="@(CombinedProject)"
Condition="$([MSBuild]::IsOSPlatform(Windows)) and %(CombinedId) == 'combined' and %(LanguageId) == 'fs' and (%(OtherId) != 'wf_macos' and %(OtherId) != 'wf' and %(OtherId) != 'wf_xm')" />

<!-- Separate Rules -->

<!-- Can only build wpf/winforms .NET 5 projects on windows.. :( -->
<!-- Build Wpf on Windows -->
<CombinedProject Update="@(CombinedProject)"
Condition="%(CombinedId) == 'separate' and !$([MSBuild]::IsOSPlatform(Windows))"
BuildCommand="&amp;&amp; dotnet build **/*.Mac.*proj &amp;&amp;dotnet build **/*.Gtk.*proj" />
Condition="%(CombinedId) == 'separate' and $([MSBuild]::IsOSPlatform(Windows))"
BuildCommand="&amp;&amp; cd %(ProjectName).Wpf &amp;&amp; dotnet build &amp;&amp; cd .." />

<!-- Xamarin.Mac separate projects require msbuild -->
<CombinedProject Update="@(CombinedProject)" Condition="%(CombinedId) == 'separate' and (%(OtherId) == 'xm' or %(OtherId) == 'wf_xm')"
BuildCommand='%(BuildCommand) &amp;&amp;env -i HOME="$HOME" bash -l -c "msbuild /restore /v:Minimal **/*.XamMac.*proj"' />
<!-- Build WinForms on Windows -->
<CombinedProject Update="@(CombinedProject)"
Condition="%(CombinedId) == 'separate' and $([MSBuild]::IsOSPlatform(Windows)) and ( %(OtherId) == 'wf_macos' or %(OtherId) == 'wf' or %(OtherId) == 'wf_xm' )"
BuildCommand="%(BuildCommand) &amp;&amp; cd %(ProjectName).WinForms &amp;&amp; dotnet build &amp;&amp; cd .." />

<!-- Xamarin.Mac combined doesn't support building with dotnet other than csharp :( -->
<CombinedProject Update="@(CombinedProject)" Condition="%(CombinedId) == 'combined' and (%(LanguageId) != 'cs' and (%(OtherId) == 'xm' or %(OtherId) == 'wf_xm'))"
BuildCommand='&amp;&amp; env -i HOME="$HOME" bash -l -c "msbuild /restore /v:Minimal"' />
<!-- Build Mac -->
<CombinedProject Update="@(CombinedProject)"
Condition="%(CombinedId) == 'separate'"
BuildCommand="%(BuildCommand) &amp;&amp; cd %(ProjectName).Mac &amp;&amp; dotnet build &amp;&amp; cd .." />

<!-- Build Gtk -->
<CombinedProject Update="@(CombinedProject)"
Condition="%(CombinedId) == 'separate'"
BuildCommand="%(BuildCommand) &amp;&amp; cd %(ProjectName).Gtk &amp;&amp; dotnet build &amp;&amp; cd .." />

<!-- Build Xamarin.Mac with msbuild on Mac only -->
<CombinedProject Update="@(CombinedProject)"
Condition="$([MSBuild]::IsOSPlatform(osx)) and %(CombinedId) == 'separate' and (%(OtherId) == 'xm' or %(OtherId) == 'wf_xm')"
BuildCommand='%(BuildCommand) &amp;&amp;env -i HOME="$HOME" bash -l -c "msbuild /restore /v:Minimal **/*.XamMac.*proj"' />

<!-- Only build Xamarin.Mac on Mac -->
<CombinedProject Update="@(CombinedProject)" Condition="!$([MSBuild]::IsOSPlatform(OSX)) and (%(OtherId) == 'xm' or %(OtherId) == 'wf_xm')"
BuildCommand="" />
<!-- Build MacOS on Mac only -->
<CombinedProject Update="@(CombinedProject)"
Condition="%(CombinedId) == 'separate' and $([MSBuild]::IsOSPlatform(osx)) and (%(OtherId) == 'macos' or %(OtherId) == 'wf_macos')"
BuildCommand="%(BuildCommand) &amp;&amp; dotnet build **/*.MacOS.*proj" />

</ItemGroup>

Expand All @@ -260,6 +294,7 @@
<RemoveDir Directories="$(ArtifactsDir)mac-publish"/>

<!-- install the current version of the templates -->
<Exec Command="dotnet new -u Eto.Forms.Templates" />
<Exec Command="dotnet new -i $(PackageOutputPath)Eto.Forms.Templates.$(InformationalVersion).nupkg" />

<!-- generate project templates -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
"IncludeWinForms": {
"longName": "include-winforms",
"shortName": "wf"
},
"IncludeMacOS": {
"longName": "include-macos",
"shortName": "macos"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
"dataType": "bool",
"defaultValue": "false"
},
"IncludeMacOS": {
"type": "parameter",
"description": "Include a MacOS workload project when compiling on macOS",
"dataType": "bool",
"defaultValue": "false"
},
"IncludeWinForms": {
"type": "parameter",
"description": "Include Windows Forms as a target.",
Expand Down Expand Up @@ -151,7 +157,8 @@
{ "condition": "!UseCodePreview", "exclude": [ "**/*.eto.*" ] },
{ "condition": "!UseXeto", "exclude": [ "**/*.xeto", "**/*.xeto.*" ] },
{ "condition": "!UseJeto", "exclude": [ "**/*.jeto", "**/*.jeto.*" ] },
{ "condition": "!IncludeXamMac", "exclude": [ "**/EtoApp.1.XamMac.csproj" ] }
{ "condition": "!IncludeXamMac", "exclude": [ "**/EtoApp.1.XamMac.csproj" ] },
{ "condition": "!IncludeMacOS", "exclude": [ "**/EtoApp.1.MacOS.csproj" ] }
]
},
{
Expand All @@ -170,7 +177,8 @@
"condition": "!Combined",
"modifiers": [
{ "condition": "!IncludeWinForms", "exclude": [ "**/EtoApp.1.WinForms/**/*" ] },
{ "condition": "!IncludeXamMac", "exclude": [ "**/EtoApp.1.XamMac/**/*" ] }
{ "condition": "!IncludeXamMac", "exclude": [ "**/EtoApp.1.XamMac/**/*" ] },
{ "condition": "!IncludeMacOS", "exclude": [ "**/EtoApp.1.MacOS/**/*" ] }
]
},
{
Expand All @@ -194,7 +202,8 @@
{ "path": "EtoApp.1.Mac/EtoApp.1.Mac.csproj", "condition": "!Combined" },
{ "path": "EtoApp.1.WinForms/EtoApp.1.WinForms.csproj", "condition": "!Combined && IncludeWinForms" },
{ "path": "EtoApp.1.Wpf/EtoApp.1.Wpf.csproj", "condition": "!Combined" },
{ "path": "EtoApp.1.XamMac/EtoApp.1.XamMac.csproj", "condition": "IncludeXamMac" }
{ "path": "EtoApp.1.XamMac/EtoApp.1.XamMac.csproj", "condition": "!Combined && IncludeXamMac" },
{ "path": "EtoApp.1.MacOS/EtoApp.1.MacOS.csproj", "condition": "!Combined && IncludeMacOS" }
],
"guids": [
"4A7EEA91-18CE-4C33-8501-76049670866D",
Expand All @@ -203,7 +212,8 @@
"19712124-C53F-486F-9C88-2BA310B38BE2",
"05DB20E8-D401-4094-8096-88499C50E28A",
"BCAAFC40-AA8C-4D5A-8DD9-738E2A339097",
"7D9523D1-01EC-4E34-A559-03F332E64346"
"7D9523D1-01EC-4E34-A559-03F332E64346",
"D1C2E89F-8DF5-43F5-B07E-C91A5EDBF6C8"
],
"SpecialCustomOperations": {
"**/*.xeto": {
Expand Down
10 changes: 10 additions & 0 deletions src/Eto.Forms.Templates/content/App-CSharp/EtoApp.1.sln
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EtoApp.1.XamMac", "EtoApp.1.XamMac\EtoApp.1.XamMac.csproj", "{05DB20E8-D401-4094-8096-88499C50E28A}"
EndProject
#endif
#if IncludeMacOS
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EtoApp.1.MacOS", "EtoApp.1.MacOS\EtoApp.1.MacOS.csproj", "{D1C2E89F-8DF5-43F5-B07E-C91A5EDBF6C8}"
EndProject
#endif
#endif
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -58,6 +62,12 @@ Global
{05DB20E8-D401-4094-8096-88499C50E28A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{05DB20E8-D401-4094-8096-88499C50E28A}.Release|Any CPU.Build.0 = Release|Any CPU
#endif
#if IncludeMacOS
{D1C2E89F-8DF5-43F5-B07E-C91A5EDBF6C8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D1C2E89F-8DF5-43F5-B07E-C91A5EDBF6C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D1C2E89F-8DF5-43F5-B07E-C91A5EDBF6C8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D1C2E89F-8DF5-43F5-B07E-C91A5EDBF6C8}.Release|Any CPU.Build.0 = Release|Any CPU
#endif
#endif
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<TargetFramework Condition="$(TargetFrameworkOverride) != ''">TargetFrameworkOverride</TargetFramework>
<RootNamespace Condition="'$(name)' != '$(name{-VALUE-FORMS-}safe_namespace)'">EtoApp._1</RootNamespace>

<UseMacOSWorkload Condition="$(IncludeMacOS) == 'True'">True</UseMacOSWorkload>
<UseXamarinMac Condition="$(IncludeXamMac) == 'True'">True</UseXamarinMac>
<UseWinForms Condition="$(IncludeWinForms) == 'True'">True</UseWinForms>
<UseJeto Condition="$(UseJeto) == 'True'">True</UseJeto>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"images": [
{
"filename": "AppIcon-16.png",
"size": "16x16",
"scale": "1x",
"idiom": "mac"
},
{
"filename": "[email protected]",
"size": "16x16",
"scale": "2x",
"idiom": "mac"
},
{
"filename": "AppIcon-32.png",
"size": "32x32",
"scale": "1x",
"idiom": "mac"
},
{
"filename": "[email protected]",
"size": "32x32",
"scale": "2x",
"idiom": "mac"
},
{
"filename": "AppIcon-128.png",
"size": "128x128",
"scale": "1x",
"idiom": "mac"
},
{
"filename": "[email protected]",
"size": "128x128",
"scale": "2x",
"idiom": "mac"
},
{
"filename": "AppIcon-256.png",
"size": "256x256",
"scale": "1x",
"idiom": "mac"
},
{
"filename": "[email protected]",
"size": "256x256",
"scale": "2x",
"idiom": "mac"
},
{
"filename": "AppIcon-512.png",
"size": "512x512",
"scale": "1x",
"idiom": "mac"
},
{
"filename": "[email protected]",
"size": "512x512",
"scale": "2x",
"idiom": "mac"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-macos</TargetFramework>
<OutputType>Exe</OutputType>
<RootNamespace Condition="'$(name)' != '$(name{-VALUE-FORMS-}safe_namespace)'">EtoApp._1</RootNamespace>
<SupportedOSPlatformVersion>10.14</SupportedOSPlatformVersion>
<RuntimeIdentifiers>osx-x64;osx-arm64</RuntimeIdentifiers>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\EtoApp.1\EtoApp.1.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Eto.Platform.macOS" Version="2.7.1-dev" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key>
<string>EtoApp.1</string>
<key>CFBundleIdentifier</key>
<string>com.companyname.EtoApp.1</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>NSHumanReadableCopyright</key>
<string>${AuthorCopyright:HtmlEncode}</string>
<key>XSAppIconAssets</key>
<string>Assets.xcassets/AppIcon.appiconset</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using Eto.Forms;

namespace EtoApp._1.Mac
{
class Program
{
[STAThread]
public static void Main(string[] args)
{
new Application(Eto.Platforms.macOS).Run(new MainForm());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
"longName": "mode",
"shortName": "m"
},
"GtkVersion": {
"longName": "gtk-version",
"shortName": "g"
},
"Combined": {
"longName": "combined",
"shortName": "c"
Expand All @@ -33,6 +29,10 @@
"IncludeWinForms": {
"longName": "include-winforms",
"shortName": "wf"
},
"IncludeMacOS": {
"longName": "include-macos",
"shortName": "macos"
}
}
}
Loading

0 comments on commit 2c7b2d8

Please sign in to comment.