Skip to content

Commit

Permalink
Merge pull request #40 from cwensley/net6.0
Browse files Browse the repository at this point in the history
Update to .NET 6
  • Loading branch information
cwensley authored Dec 3, 2021
2 parents daccbb4 + 79fe042 commit d34c2d1
Show file tree
Hide file tree
Showing 29 changed files with 392 additions and 179 deletions.
110 changes: 75 additions & 35 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,51 +8,77 @@ on:
branches: [ main ]

env:
DotNetVersion: "5.0.x"
DotNetVersion: "6.0.x"
BuildConfiguration: "Release"
BuildParameters: "Source/PabloDraw/PabloDraw.csproj /clp:NoSummary /p:Configuration=Release /p:BuildVersion=${{ github.run_id }} /p:BuildBranch=${{ github.ref }}"
BuildParameters: "/clp:NoSummary /p:Configuration=Release /p:BuildVersion=${{ github.run_id }} /p:BuildBranch=${{ github.ref }}"

jobs:
build-windows:

runs-on: windows-latest

steps:
- uses: actions/checkout@v2

- uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DotNetVersion }}

- run: dotnet publish ${{ env.BuildParameters }} -f net5.0-windows -r win-x64
- name: Build PabloDraw
run: dotnet publish Source/PabloDraw/PabloDraw.csproj ${{ env.BuildParameters }} /bl:artifacts/log/pablodraw-windows.binlog

- name: Build PabloDraw.Console
run: dotnet publish Source/PabloDraw.Console/PabloDraw.Console.csproj ${{ env.BuildParameters }} /bl:artifacts/log/pablodraw.console-windows.binlog

- uses: actions/upload-artifact@v2
with:
name: pablodraw-windows
path: artifacts/bin/${{ env.BuildConfiguration }}/net5.0-windows/win-x64/publish/*
name: pablodraw-windows-x64
path: artifacts/bin/PabloDraw/${{ env.BuildConfiguration }}/net6.0-windows/win-x64/publish/*

build-linux:
- uses: actions/upload-artifact@v2
with:
name: pablodraw-windows-x64
path: artifacts/bin/PabloDraw.Console/${{ env.BuildConfiguration }}/net6.0-windows/win-x64/publish/*

runs-on: ubuntu-latest
- name: Upload log files
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: log
path: artifacts/log/**/*

build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DotNetVersion }}

- run: dotnet publish ${{ env.BuildParameters }} -f net5.0 -r linux-x64
- name: Build PabloDraw
run: dotnet publish Source/PabloDraw/PabloDraw.csproj ${{ env.BuildParameters }} /bl:artifacts/log/pablodraw-linux.binlog

- name: Build PabloDraw.Console
run: dotnet publish Source/PabloDraw.Console/PabloDraw.Console.csproj ${{ env.BuildParameters }} /bl:artifacts/log/pablodraw.console-linux.binlog

- uses: actions/upload-artifact@v2
with:
name: pablodraw-linux
path: artifacts/bin/${{ env.BuildConfiguration }}/net5.0/linux-x64/publish/*

build-mac:
name: pablodraw-linux-x64
path: artifacts/bin/PabloDraw/${{ env.BuildConfiguration }}/net6.0/linux-x64/publish/*

runs-on: macos-latest
- uses: actions/upload-artifact@v2
with:
name: pablodraw-linux-x64
path: artifacts/bin/PabloDraw.Console/${{ env.BuildConfiguration }}/net6.0/linux-x64/publish/*

- name: Upload log files
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: log
path: artifacts/log/**/*

build-mac:
runs-on: macos-11
steps:
- uses: actions/checkout@v2

Expand All @@ -64,34 +90,50 @@ jobs:
with:
mono-version: latest
xamarin-mac-version: latest
xcode-version: latest
xcode-version: 13.1

- name: Import code signing certificate
if: github.event_name != 'pull_request'
uses: apple-actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.DEVID_CERTIFICATE_P12 }}
p12-password: ${{ secrets.DEVID_CERTIFICATE_P12_PASSWORD }}

# - name: Import code signing certificate
# if: github.event_name != 'pull_request'
# uses: apple-actions/import-codesign-certs@v1
# with:
# p12-file-base64: ${{ secrets.DEVID_CERTIFICATE_P12 }}
# p12-password: ${{ secrets.DEVID_CERTIFICATE_P12_PASSWORD }}
- name: Enable code signing
if: github.event_name != 'pull_request'
run: echo "BuildParameters=${{ env.BuildParameters }} /p:EnableCodeSigning=True" >> $GITHUB_ENV

# - name: Enable code signing
# if: github.event_name != 'pull_request'
# run: echo "BuildParameters=${{ env.BuildParameters }} /p:EnableCodeSignBuild=True" >> $GITHUB_ENV
- name: Set notarization credentials
if: startsWith(github.ref, 'refs/tags/')
run: |
xcrun altool --store-password-in-keychain-item "AC_PASSWORD" -u "${{ secrets.AC_USERNAME }}" -p "${{ secrets.AC_PASSWORD }}"
echo "BuildParameters=${{ env.BuildParameters }} /p:EnableNotarization=True" >> $GITHUB_ENV
# - name: Set notarization credentials
# if: startsWith(github.ref, 'refs/tags/')
# run: |
# xcrun altool --store-password-in-keychain-item "AC_PASSWORD" -u "${{ secrets.AC_USERNAME }}" -p "${{ secrets.AC_PASSWORD }}"
# echo "BuildParameters=${{ env.BuildParameters }} /p:EnableNotarizationBuild=True" >> $GITHUB_ENV
- name: Build PabloDraw
run: dotnet build Source/PabloDraw/PabloDraw.csproj ${{ env.BuildParameters }} /bl:artifacts/log/pablodraw-mac.binlog

- run: dotnet build ${{ env.BuildParameters }} -f net5.0 -r osx-x64
- name: Build PabloDraw.Console
run: dotnet publish Source/PabloDraw.Console/PabloDraw.Console.csproj ${{ env.BuildParameters }} /bl:artifacts/log/pablodraw.console-mac.binlog

- uses: actions/upload-artifact@v2
with:
name: pablodraw-mac
path: artifacts/bin/${{ env.BuildConfiguration }}/net5.0/osx-x64/PabloDraw.dmg
path: artifacts/bin/PabloDraw/${{ env.BuildConfiguration }}/net6.0/PabloDraw.dmg

- uses: actions/upload-artifact@v2
with:
name: pablodraw-mac
path: artifacts/bin/PabloDraw.Console/${{ env.BuildConfiguration }}/net6.0/osx-x64/publish/PabloDraw.Console

- name: Upload log files
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: log
path: artifacts/log/**/*

update-release:
needs: [ build-windows, build-mac ]
needs: [ build-windows, build-mac, build-linux ]
runs-on: ubuntu-latest
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
steps:
Expand All @@ -104,8 +146,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/download-artifact@v2
with:
name: pablodraw

# - uses: actions/upload-release-asset@v1
# env:
Expand Down
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.DS_Store
*.pbxuser
*.perspectivev3
build/
artifacts/
*.xcuserdatad
*.xcworkspace
*.userprefs
Expand All @@ -10,10 +10,6 @@ build/
*.suo
bin/
obj/
Pablo/deploy/
.svn
Source/packages
Releases/**/*.exe
UpgradeLog.htm
.vs
Source/deploy
6 changes: 3 additions & 3 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
"request": "launch",
"preLaunchTask": "build-pablodraw",
"osx": {
"program": "${workspaceFolder}/artifacts/bin/${config:var.BuildConfiguration}/net5.0/osx-x64/PabloDraw.app/Contents/MacOS/PabloDraw",
"program": "${workspaceFolder}/artifacts/bin/PabloDraw/${config:var.BuildConfiguration}/net6.0/PabloDraw.app/Contents/MacOS/PabloDraw",
},
"windows": {
"program": "${workspaceFolder}/artifacts/bin/${config:var.BuildConfiguration}/net5.0-windows/win-x64/PabloDraw.exe",
"program": "${workspaceFolder}/artifacts/bin/PabloDraw/${config:var.BuildConfiguration}/net6.0-windows/win-x64/PabloDraw.dll",
},
"linux": {
"program": "${workspaceFolder}/artifacts/bin/${config:var.BuildConfiguration}/net5.0/linux-x64/PabloDraw",
"program": "${workspaceFolder}/artifacts/bin/PabloDraw/${config:var.BuildConfiguration}/net6.0/linux-x64/PabloDraw.dll",
},
"args": [],
"cwd": "${workspaceFolder}",
Expand Down
45 changes: 40 additions & 5 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
"args": [
"build",
"${workspaceFolder}/Source/Pablo Desktop.sln",
"/p:Configuration=Debug",
"/p:Platform=Mac",
"/p:Configuration=${config:var.BuildConfiguration}",
"/p:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
Expand Down Expand Up @@ -60,16 +59,52 @@
{
"label": "run-published",
"type": "shell",
"dependsOn": [ "publish-pablodraw" ],
"osx": {
"command": "${workspaceFolder}/artifacts/bin/Release/net5.0/osx-x64/PabloDraw.app/Contents/MacOS/PabloDraw",
"command": "${workspaceFolder}/artifacts/bin/PabloDraw/Release/net6.0/PabloDraw.app/Contents/MacOS/PabloDraw",
},
"windows": {
"command": "${workspaceFolder}/artifacts/bin/Release/net5.0-windows/win-x64/publish/PabloDraw.exe",
"command": "${workspaceFolder}/artifacts/bin/PabloDraw/Release/net6.0-windows/win-x64/publish/PabloDraw.exe",
},
"linux": {
"command": "${workspaceFolder}/artifacts/bin/Release/net5.0/linux-x64/publish/PabloDraw",
"command": "${workspaceFolder}/artifacts/bin/PabloDraw/Release/net6.0/linux-x64/publish/PabloDraw",
},
"problemMatcher": [ ]
},
{
"label": "build-windows-installer",
"command": "msbuild",
"type": "shell",
"args": [
"/t:Build",
"${workspaceFolder}/Source/PabloDraw.WindowsInstaller/PabloDraw.WindowsInstaller.wixproj",
"/p:Configuration=${config:var.BuildConfiguration}",
"/p:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"group": "build",
"presentation": {
"clear": true
},
"problemMatcher": "$msCompile"
},
{
"label": "build-pablodraw-console",
"command": "dotnet",
"type": "shell",
"args": [
"publish",
"${workspaceFolder}/Source/PabloDraw.Console/PabloDraw.Console.csproj",
// "/p:BuildTarget=Linux",
"/p:Configuration=${config:var.BuildConfiguration}",
"/p:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"group": "build",
"presentation": {
"clear": true
},
"problemMatcher": "$msCompile"
}
]
}
9 changes: 8 additions & 1 deletion Source/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,19 @@

<BaseIntermediateOutputPath Condition="$(BaseIntermediateOutputPath) == ''">$(ArtifactsDir)obj\$(OS)\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
<OutputArtifactName Condition="$(OutputArtifactName) == ''">bin</OutputArtifactName>
<BaseOutputPath Condition="$(BaseOutputPath) == ''">$(ArtifactsDir)$(OutputArtifactName)\</BaseOutputPath>
<BaseOutputPath Condition="$(BaseOutputPath) == ''">$(ArtifactsDir)$(OutputArtifactName)\$(MSBuildProjectName)\</BaseOutputPath>
<PackageOutputPath Condition="$(PackageOutputPath) == ''">$(ArtifactsDir)nuget\$(Configuration)\</PackageOutputPath>
<RestoreProjectStyle Condition="'$(RestoreProjectStyle)' == ''">PackageReference</RestoreProjectStyle>

<!-- Uncomment to use Eto from source -->
<!-- <EtoBasePath>..\..\..\Eto\</EtoBasePath> -->

</PropertyGroup>

<PropertyGroup Condition="$(BuildTarget) == ''">
<BuildTarget Condition="$([MSBuild]::IsOSPlatform(Windows))">Windows</BuildTarget>
<BuildTarget Condition="$([MSBuild]::IsOSPlatform(OSX))">Mac</BuildTarget>
<BuildTarget Condition="$([MSBuild]::IsOSPlatform(Linux))">Linux</BuildTarget>
</PropertyGroup>

</Project>
2 changes: 1 addition & 1 deletion Source/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Import Project="EmbedReferences.targets" />
<!-- <Import Project="EmbedReferences.targets" /> -->

<UsingTask TaskName="_ParseVersion" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
<ParameterGroup>
Expand Down
2 changes: 1 addition & 1 deletion Source/Pablo.Interface/Actions/Homepage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public Homepage ()
protected override void OnExecuted(EventArgs e)
{
base.OnExecuted(e);
PabloApplication.Instance.Open("http://picoe.ca/products/pablodraw");
PabloApplication.Instance.Open("https://github.com/cwensley/pablodraw");
}
}
}
Expand Down
16 changes: 12 additions & 4 deletions Source/Pablo.Interface/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;

namespace Pablo.Interface
{
Expand Down Expand Up @@ -439,13 +440,20 @@ protected override void OnKeyDown(KeyEventArgs e)
e.Handled = true;
}
// winforms doesn't support shortcuts without modifiers.. hm.
if (Platform.IsWinForms && e.Modifiers == Keys.None)
if (Platform.IsWinForms)
{
var menuItem = FindMenu(args.Menu, e.KeyData);
if (menuItem != null)
{
menuItem.PerformClick();
e.Handled = true;
// hack, we need to validate the menu item
menuItem?.GetType().GetMethod("OnValidate", BindingFlags.NonPublic | BindingFlags.Instance)?.Invoke(menuItem, new object[] { EventArgs.Empty });

// winforms does not support shortcuts with no modifiers.. currently
if (menuItem != null && menuItem.Enabled && e.Modifiers == Keys.None)
{
menuItem.PerformClick();
e.Handled = true;
}
}
}
}
Expand Down Expand Up @@ -817,7 +825,7 @@ void Document_Loaded(object sender, EventArgs e)
{
if (loadingStream != null)
{
loadingStream.Dispose();
// loadingStream.Dispose();
loadingStream = null;
PabloApplication.Instance.Invoke(delegate
{
Expand Down
5 changes: 3 additions & 2 deletions Source/Pablo.Interface/Pablo.Interface.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<AssemblyTitle>Pablo.Interface</AssemblyTitle>
<AssemblyDescription>Main Interface</AssemblyDescription>
</PropertyGroup>
Expand All @@ -14,7 +14,8 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Eto.Forms" Version="2.5.10 " />
<PackageReference Include="Eto.Forms" Version="2.6.0" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Pablo\Pablo.csproj" />
Expand Down
Loading

0 comments on commit d34c2d1

Please sign in to comment.