diff --git a/.gitignore b/.gitignore
index 84b8c44..344efb4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -290,5 +290,6 @@ __pycache__/
*.odx.cs
*.xsd.cs
/build/tools
+/build/nupkg
BuildResults.xml
\ No newline at end of file
diff --git a/ColorCode.Core/ColorCode.Core.csproj b/ColorCode.Core/ColorCode.Core.csproj
index 84c03e5..40023af 100644
--- a/ColorCode.Core/ColorCode.Core.csproj
+++ b/ColorCode.Core/ColorCode.Core.csproj
@@ -19,5 +19,5 @@
full
true
-
+
\ No newline at end of file
diff --git a/ColorCode.UWP/Common/ExtensionMethods.cs b/ColorCode.UWP/Common/ExtensionMethods.cs
index 666bf26..102cc03 100644
--- a/ColorCode.UWP/Common/ExtensionMethods.cs
+++ b/ColorCode.UWP/Common/ExtensionMethods.cs
@@ -1,9 +1,15 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
using System;
+#if WINUI
+using Microsoft.UI.Xaml.Media;
+
+namespace ColorCode.WinUI.Common
+#else
using Windows.UI.Xaml.Media;
namespace ColorCode.UWP.Common
+#endif
{
public static class ExtensionMethods
{
diff --git a/ColorCode.UWP/RichTextBlockFormatter.cs b/ColorCode.UWP/RichTextBlockFormatter.cs
index 540e161..464a6ab 100644
--- a/ColorCode.UWP/RichTextBlockFormatter.cs
+++ b/ColorCode.UWP/RichTextBlockFormatter.cs
@@ -2,13 +2,21 @@
using System.Collections.Generic;
using ColorCode.Parsing;
-using Windows.UI.Xaml.Controls;
-using Windows.UI.Xaml.Documents;
using ColorCode.Styling;
using Windows.UI.Text;
-using ColorCode.UWP.Common;
using ColorCode.Common;
+#if WINUI
+using Microsoft.UI.Xaml.Controls;
+using Microsoft.UI.Xaml.Documents;
+using ColorCode.WinUI.Common;
+using Microsoft.UI.Xaml;
+using Microsoft.UI.Text;
+#else
+using Windows.UI.Xaml.Controls;
+using Windows.UI.Xaml.Documents;
+using ColorCode.UWP.Common;
using Windows.UI.Xaml;
+#endif
namespace ColorCode
{
diff --git a/ColorCode.WinUI/ColorCode.WinUI.csproj b/ColorCode.WinUI/ColorCode.WinUI.csproj
new file mode 100644
index 0000000..06cd796
--- /dev/null
+++ b/ColorCode.WinUI/ColorCode.WinUI.csproj
@@ -0,0 +1,27 @@
+
+
+
+ net5.0-windows10.0.18362.0
+ $(TargetPlatformMinVersion)
+ ColorCode
+ ColorCode.WinUI
+ ColorCode.WinUI
+ Contains the RichTextBlockFormatter, for rendering the Colorized Code to a RichTextBlock.
+ ColorCode Syntax Highlighting SyntaxHighlighting Formatting UWP RichTextBlock Document InlineCollection
+ $(DefineConstants);WINUI
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ColorCode.sln b/ColorCode.sln
index 7adf6f2..7189554 100644
--- a/ColorCode.sln
+++ b/ColorCode.sln
@@ -7,13 +7,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ColorCode.HTML", "ColorCode
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{5B9F207C-2EAB-4F77-95C7-206D65C87137}"
EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ColorCode.UWP", "ColorCode.UWP\ColorCode.UWP.csproj", "{A482CFCC-D474-4C43-A812-1B0B4E6E484F}"
-EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ColorCode.Core", "ColorCode.Core\ColorCode.Core.csproj", "{F6DE802C-9BD7-4BFA-9553-BCBF51E0556B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ColorCode.BasicTests", "Tests\ColorCode.BasicTests\ColorCode.BasicTests.csproj", "{A3E27CD2-6D33-44D3-962F-E56C4CD25F10}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ColorCode.UWPTests", "Tests\ColorCode.UWPTests\ColorCode.UWPTests.csproj", "{A3D5A8A5-1D1F-412D-A829-C3DC1C7D4DF3}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ColorCode.WinUITests", "Tests\ColorCode.WinUITests\ColorCode.WinUITests.csproj", "{F1ED6BD6-2690-4BF3-835C-C3927C33424F}"
+EndProject
+Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "ColorCode.WinUITests (Package)", "Tests\ColorCode.WinUITests (Package)\ColorCode.WinUITests (Package).wapproj", "{DD20D31A-915E-43A2-B819-3A7AE39CA25C}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ColorCode.WinUI", "ColorCode.WinUI\ColorCode.WinUI.csproj", "{5B043ED5-3662-4CE5-9004-637E1739C363}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A4B1B99B-FC3A-4C76-8B46-B96723829FD2}"
ProjectSection(SolutionItems) = preProject
@@ -25,14 +27,20 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
version.json = version.json
EndProjectSection
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ColorCode.UWP", "ColorCode.UWP\ColorCode.UWP.csproj", "{9A628641-BF6E-439F-AF60-BF9E471D45AF}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ColorCode.UWPTests", "Tests\ColorCode.UWPTests\ColorCode.UWPTests.csproj", "{A3D5A8A5-1D1F-412D-A829-C3DC1C7D4DF3}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|ARM = Debug|ARM
+ Debug|ARM64 = Debug|ARM64
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|ARM = Release|ARM
+ Release|ARM64 = Release|ARM64
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
@@ -41,6 +49,8 @@ Global
{33A3FB96-F1EB-4AF0-94E0-F629E1F574A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{33A3FB96-F1EB-4AF0-94E0-F629E1F574A8}.Debug|ARM.ActiveCfg = Debug|Any CPU
{33A3FB96-F1EB-4AF0-94E0-F629E1F574A8}.Debug|ARM.Build.0 = Debug|Any CPU
+ {33A3FB96-F1EB-4AF0-94E0-F629E1F574A8}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {33A3FB96-F1EB-4AF0-94E0-F629E1F574A8}.Debug|ARM64.Build.0 = Debug|Any CPU
{33A3FB96-F1EB-4AF0-94E0-F629E1F574A8}.Debug|x64.ActiveCfg = Debug|Any CPU
{33A3FB96-F1EB-4AF0-94E0-F629E1F574A8}.Debug|x64.Build.0 = Debug|Any CPU
{33A3FB96-F1EB-4AF0-94E0-F629E1F574A8}.Debug|x86.ActiveCfg = Debug|Any CPU
@@ -49,30 +59,18 @@ Global
{33A3FB96-F1EB-4AF0-94E0-F629E1F574A8}.Release|Any CPU.Build.0 = Release|Any CPU
{33A3FB96-F1EB-4AF0-94E0-F629E1F574A8}.Release|ARM.ActiveCfg = Release|Any CPU
{33A3FB96-F1EB-4AF0-94E0-F629E1F574A8}.Release|ARM.Build.0 = Release|Any CPU
+ {33A3FB96-F1EB-4AF0-94E0-F629E1F574A8}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {33A3FB96-F1EB-4AF0-94E0-F629E1F574A8}.Release|ARM64.Build.0 = Release|Any CPU
{33A3FB96-F1EB-4AF0-94E0-F629E1F574A8}.Release|x64.ActiveCfg = Release|Any CPU
{33A3FB96-F1EB-4AF0-94E0-F629E1F574A8}.Release|x64.Build.0 = Release|Any CPU
{33A3FB96-F1EB-4AF0-94E0-F629E1F574A8}.Release|x86.ActiveCfg = Release|Any CPU
{33A3FB96-F1EB-4AF0-94E0-F629E1F574A8}.Release|x86.Build.0 = Release|Any CPU
- {A482CFCC-D474-4C43-A812-1B0B4E6E484F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {A482CFCC-D474-4C43-A812-1B0B4E6E484F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {A482CFCC-D474-4C43-A812-1B0B4E6E484F}.Debug|ARM.ActiveCfg = Debug|Any CPU
- {A482CFCC-D474-4C43-A812-1B0B4E6E484F}.Debug|ARM.Build.0 = Debug|Any CPU
- {A482CFCC-D474-4C43-A812-1B0B4E6E484F}.Debug|x64.ActiveCfg = Debug|Any CPU
- {A482CFCC-D474-4C43-A812-1B0B4E6E484F}.Debug|x64.Build.0 = Debug|Any CPU
- {A482CFCC-D474-4C43-A812-1B0B4E6E484F}.Debug|x86.ActiveCfg = Debug|Any CPU
- {A482CFCC-D474-4C43-A812-1B0B4E6E484F}.Debug|x86.Build.0 = Debug|Any CPU
- {A482CFCC-D474-4C43-A812-1B0B4E6E484F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A482CFCC-D474-4C43-A812-1B0B4E6E484F}.Release|Any CPU.Build.0 = Release|Any CPU
- {A482CFCC-D474-4C43-A812-1B0B4E6E484F}.Release|ARM.ActiveCfg = Release|Any CPU
- {A482CFCC-D474-4C43-A812-1B0B4E6E484F}.Release|ARM.Build.0 = Release|Any CPU
- {A482CFCC-D474-4C43-A812-1B0B4E6E484F}.Release|x64.ActiveCfg = Release|Any CPU
- {A482CFCC-D474-4C43-A812-1B0B4E6E484F}.Release|x64.Build.0 = Release|Any CPU
- {A482CFCC-D474-4C43-A812-1B0B4E6E484F}.Release|x86.ActiveCfg = Release|Any CPU
- {A482CFCC-D474-4C43-A812-1B0B4E6E484F}.Release|x86.Build.0 = Release|Any CPU
{F6DE802C-9BD7-4BFA-9553-BCBF51E0556B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F6DE802C-9BD7-4BFA-9553-BCBF51E0556B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F6DE802C-9BD7-4BFA-9553-BCBF51E0556B}.Debug|ARM.ActiveCfg = Debug|Any CPU
{F6DE802C-9BD7-4BFA-9553-BCBF51E0556B}.Debug|ARM.Build.0 = Debug|Any CPU
+ {F6DE802C-9BD7-4BFA-9553-BCBF51E0556B}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {F6DE802C-9BD7-4BFA-9553-BCBF51E0556B}.Debug|ARM64.Build.0 = Debug|Any CPU
{F6DE802C-9BD7-4BFA-9553-BCBF51E0556B}.Debug|x64.ActiveCfg = Debug|Any CPU
{F6DE802C-9BD7-4BFA-9553-BCBF51E0556B}.Debug|x64.Build.0 = Debug|Any CPU
{F6DE802C-9BD7-4BFA-9553-BCBF51E0556B}.Debug|x86.ActiveCfg = Debug|Any CPU
@@ -81,6 +79,8 @@ Global
{F6DE802C-9BD7-4BFA-9553-BCBF51E0556B}.Release|Any CPU.Build.0 = Release|Any CPU
{F6DE802C-9BD7-4BFA-9553-BCBF51E0556B}.Release|ARM.ActiveCfg = Release|Any CPU
{F6DE802C-9BD7-4BFA-9553-BCBF51E0556B}.Release|ARM.Build.0 = Release|Any CPU
+ {F6DE802C-9BD7-4BFA-9553-BCBF51E0556B}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {F6DE802C-9BD7-4BFA-9553-BCBF51E0556B}.Release|ARM64.Build.0 = Release|Any CPU
{F6DE802C-9BD7-4BFA-9553-BCBF51E0556B}.Release|x64.ActiveCfg = Release|Any CPU
{F6DE802C-9BD7-4BFA-9553-BCBF51E0556B}.Release|x64.Build.0 = Release|Any CPU
{F6DE802C-9BD7-4BFA-9553-BCBF51E0556B}.Release|x86.ActiveCfg = Release|Any CPU
@@ -89,6 +89,8 @@ Global
{A3E27CD2-6D33-44D3-962F-E56C4CD25F10}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A3E27CD2-6D33-44D3-962F-E56C4CD25F10}.Debug|ARM.ActiveCfg = Debug|Any CPU
{A3E27CD2-6D33-44D3-962F-E56C4CD25F10}.Debug|ARM.Build.0 = Debug|Any CPU
+ {A3E27CD2-6D33-44D3-962F-E56C4CD25F10}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {A3E27CD2-6D33-44D3-962F-E56C4CD25F10}.Debug|ARM64.Build.0 = Debug|Any CPU
{A3E27CD2-6D33-44D3-962F-E56C4CD25F10}.Debug|x64.ActiveCfg = Debug|Any CPU
{A3E27CD2-6D33-44D3-962F-E56C4CD25F10}.Debug|x64.Build.0 = Debug|Any CPU
{A3E27CD2-6D33-44D3-962F-E56C4CD25F10}.Debug|x86.ActiveCfg = Debug|Any CPU
@@ -96,14 +98,91 @@ Global
{A3E27CD2-6D33-44D3-962F-E56C4CD25F10}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A3E27CD2-6D33-44D3-962F-E56C4CD25F10}.Release|ARM.ActiveCfg = Release|Any CPU
{A3E27CD2-6D33-44D3-962F-E56C4CD25F10}.Release|ARM.Build.0 = Release|Any CPU
+ {A3E27CD2-6D33-44D3-962F-E56C4CD25F10}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {A3E27CD2-6D33-44D3-962F-E56C4CD25F10}.Release|ARM64.Build.0 = Release|Any CPU
{A3E27CD2-6D33-44D3-962F-E56C4CD25F10}.Release|x64.ActiveCfg = Release|Any CPU
{A3E27CD2-6D33-44D3-962F-E56C4CD25F10}.Release|x64.Build.0 = Release|Any CPU
{A3E27CD2-6D33-44D3-962F-E56C4CD25F10}.Release|x86.ActiveCfg = Release|Any CPU
{A3E27CD2-6D33-44D3-962F-E56C4CD25F10}.Release|x86.Build.0 = Release|Any CPU
+ {F1ED6BD6-2690-4BF3-835C-C3927C33424F}.Debug|Any CPU.ActiveCfg = Debug|x64
+ {F1ED6BD6-2690-4BF3-835C-C3927C33424F}.Debug|ARM.ActiveCfg = Debug|x86
+ {F1ED6BD6-2690-4BF3-835C-C3927C33424F}.Debug|ARM64.ActiveCfg = Debug|arm64
+ {F1ED6BD6-2690-4BF3-835C-C3927C33424F}.Debug|ARM64.Build.0 = Debug|arm64
+ {F1ED6BD6-2690-4BF3-835C-C3927C33424F}.Debug|x64.ActiveCfg = Debug|x64
+ {F1ED6BD6-2690-4BF3-835C-C3927C33424F}.Debug|x64.Build.0 = Debug|x64
+ {F1ED6BD6-2690-4BF3-835C-C3927C33424F}.Debug|x86.ActiveCfg = Debug|x86
+ {F1ED6BD6-2690-4BF3-835C-C3927C33424F}.Debug|x86.Build.0 = Debug|x86
+ {F1ED6BD6-2690-4BF3-835C-C3927C33424F}.Release|Any CPU.ActiveCfg = Release|x64
+ {F1ED6BD6-2690-4BF3-835C-C3927C33424F}.Release|ARM.ActiveCfg = Release|x86
+ {F1ED6BD6-2690-4BF3-835C-C3927C33424F}.Release|ARM64.ActiveCfg = Release|x86
+ {F1ED6BD6-2690-4BF3-835C-C3927C33424F}.Release|x64.ActiveCfg = Release|x64
+ {F1ED6BD6-2690-4BF3-835C-C3927C33424F}.Release|x64.Build.0 = Release|x64
+ {F1ED6BD6-2690-4BF3-835C-C3927C33424F}.Release|x86.ActiveCfg = Release|x86
+ {F1ED6BD6-2690-4BF3-835C-C3927C33424F}.Release|x86.Build.0 = Release|x86
+ {DD20D31A-915E-43A2-B819-3A7AE39CA25C}.Debug|Any CPU.ActiveCfg = Debug|x86
+ {DD20D31A-915E-43A2-B819-3A7AE39CA25C}.Debug|ARM.ActiveCfg = Debug|x86
+ {DD20D31A-915E-43A2-B819-3A7AE39CA25C}.Debug|ARM64.ActiveCfg = Debug|ARM64
+ {DD20D31A-915E-43A2-B819-3A7AE39CA25C}.Debug|ARM64.Build.0 = Debug|ARM64
+ {DD20D31A-915E-43A2-B819-3A7AE39CA25C}.Debug|x64.ActiveCfg = Debug|x64
+ {DD20D31A-915E-43A2-B819-3A7AE39CA25C}.Debug|x64.Build.0 = Debug|x64
+ {DD20D31A-915E-43A2-B819-3A7AE39CA25C}.Debug|x64.Deploy.0 = Debug|x64
+ {DD20D31A-915E-43A2-B819-3A7AE39CA25C}.Debug|x86.ActiveCfg = Debug|x86
+ {DD20D31A-915E-43A2-B819-3A7AE39CA25C}.Debug|x86.Build.0 = Debug|x86
+ {DD20D31A-915E-43A2-B819-3A7AE39CA25C}.Debug|x86.Deploy.0 = Debug|x86
+ {DD20D31A-915E-43A2-B819-3A7AE39CA25C}.Release|Any CPU.ActiveCfg = Release|x86
+ {DD20D31A-915E-43A2-B819-3A7AE39CA25C}.Release|ARM.ActiveCfg = Release|x86
+ {DD20D31A-915E-43A2-B819-3A7AE39CA25C}.Release|ARM64.ActiveCfg = Release|x86
+ {DD20D31A-915E-43A2-B819-3A7AE39CA25C}.Release|x64.ActiveCfg = Release|x64
+ {DD20D31A-915E-43A2-B819-3A7AE39CA25C}.Release|x64.Build.0 = Release|x64
+ {DD20D31A-915E-43A2-B819-3A7AE39CA25C}.Release|x64.Deploy.0 = Release|x64
+ {DD20D31A-915E-43A2-B819-3A7AE39CA25C}.Release|x86.ActiveCfg = Release|x86
+ {DD20D31A-915E-43A2-B819-3A7AE39CA25C}.Release|x86.Build.0 = Release|x86
+ {DD20D31A-915E-43A2-B819-3A7AE39CA25C}.Release|x86.Deploy.0 = Release|x86
+ {5B043ED5-3662-4CE5-9004-637E1739C363}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5B043ED5-3662-4CE5-9004-637E1739C363}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5B043ED5-3662-4CE5-9004-637E1739C363}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {5B043ED5-3662-4CE5-9004-637E1739C363}.Debug|ARM.Build.0 = Debug|Any CPU
+ {5B043ED5-3662-4CE5-9004-637E1739C363}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {5B043ED5-3662-4CE5-9004-637E1739C363}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {5B043ED5-3662-4CE5-9004-637E1739C363}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {5B043ED5-3662-4CE5-9004-637E1739C363}.Debug|x64.Build.0 = Debug|Any CPU
+ {5B043ED5-3662-4CE5-9004-637E1739C363}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {5B043ED5-3662-4CE5-9004-637E1739C363}.Debug|x86.Build.0 = Debug|Any CPU
+ {5B043ED5-3662-4CE5-9004-637E1739C363}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5B043ED5-3662-4CE5-9004-637E1739C363}.Release|Any CPU.Build.0 = Release|Any CPU
+ {5B043ED5-3662-4CE5-9004-637E1739C363}.Release|ARM.ActiveCfg = Release|Any CPU
+ {5B043ED5-3662-4CE5-9004-637E1739C363}.Release|ARM.Build.0 = Release|Any CPU
+ {5B043ED5-3662-4CE5-9004-637E1739C363}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {5B043ED5-3662-4CE5-9004-637E1739C363}.Release|ARM64.Build.0 = Release|Any CPU
+ {5B043ED5-3662-4CE5-9004-637E1739C363}.Release|x64.ActiveCfg = Release|Any CPU
+ {5B043ED5-3662-4CE5-9004-637E1739C363}.Release|x64.Build.0 = Release|Any CPU
+ {5B043ED5-3662-4CE5-9004-637E1739C363}.Release|x86.ActiveCfg = Release|Any CPU
+ {5B043ED5-3662-4CE5-9004-637E1739C363}.Release|x86.Build.0 = Release|Any CPU
+ {9A628641-BF6E-439F-AF60-BF9E471D45AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {9A628641-BF6E-439F-AF60-BF9E471D45AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {9A628641-BF6E-439F-AF60-BF9E471D45AF}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {9A628641-BF6E-439F-AF60-BF9E471D45AF}.Debug|ARM.Build.0 = Debug|Any CPU
+ {9A628641-BF6E-439F-AF60-BF9E471D45AF}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {9A628641-BF6E-439F-AF60-BF9E471D45AF}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {9A628641-BF6E-439F-AF60-BF9E471D45AF}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {9A628641-BF6E-439F-AF60-BF9E471D45AF}.Debug|x64.Build.0 = Debug|Any CPU
+ {9A628641-BF6E-439F-AF60-BF9E471D45AF}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {9A628641-BF6E-439F-AF60-BF9E471D45AF}.Debug|x86.Build.0 = Debug|Any CPU
+ {9A628641-BF6E-439F-AF60-BF9E471D45AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {9A628641-BF6E-439F-AF60-BF9E471D45AF}.Release|Any CPU.Build.0 = Release|Any CPU
+ {9A628641-BF6E-439F-AF60-BF9E471D45AF}.Release|ARM.ActiveCfg = Release|Any CPU
+ {9A628641-BF6E-439F-AF60-BF9E471D45AF}.Release|ARM.Build.0 = Release|Any CPU
+ {9A628641-BF6E-439F-AF60-BF9E471D45AF}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {9A628641-BF6E-439F-AF60-BF9E471D45AF}.Release|ARM64.Build.0 = Release|Any CPU
+ {9A628641-BF6E-439F-AF60-BF9E471D45AF}.Release|x64.ActiveCfg = Release|Any CPU
+ {9A628641-BF6E-439F-AF60-BF9E471D45AF}.Release|x64.Build.0 = Release|Any CPU
+ {9A628641-BF6E-439F-AF60-BF9E471D45AF}.Release|x86.ActiveCfg = Release|Any CPU
+ {9A628641-BF6E-439F-AF60-BF9E471D45AF}.Release|x86.Build.0 = Release|Any CPU
{A3D5A8A5-1D1F-412D-A829-C3DC1C7D4DF3}.Debug|Any CPU.ActiveCfg = Debug|x86
{A3D5A8A5-1D1F-412D-A829-C3DC1C7D4DF3}.Debug|ARM.ActiveCfg = Debug|ARM
{A3D5A8A5-1D1F-412D-A829-C3DC1C7D4DF3}.Debug|ARM.Build.0 = Debug|ARM
{A3D5A8A5-1D1F-412D-A829-C3DC1C7D4DF3}.Debug|ARM.Deploy.0 = Debug|ARM
+ {A3D5A8A5-1D1F-412D-A829-C3DC1C7D4DF3}.Debug|ARM64.ActiveCfg = Debug|x86
{A3D5A8A5-1D1F-412D-A829-C3DC1C7D4DF3}.Debug|x64.ActiveCfg = Debug|x64
{A3D5A8A5-1D1F-412D-A829-C3DC1C7D4DF3}.Debug|x64.Build.0 = Debug|x64
{A3D5A8A5-1D1F-412D-A829-C3DC1C7D4DF3}.Debug|x64.Deploy.0 = Debug|x64
@@ -114,6 +193,7 @@ Global
{A3D5A8A5-1D1F-412D-A829-C3DC1C7D4DF3}.Release|ARM.ActiveCfg = Release|ARM
{A3D5A8A5-1D1F-412D-A829-C3DC1C7D4DF3}.Release|ARM.Build.0 = Release|ARM
{A3D5A8A5-1D1F-412D-A829-C3DC1C7D4DF3}.Release|ARM.Deploy.0 = Release|ARM
+ {A3D5A8A5-1D1F-412D-A829-C3DC1C7D4DF3}.Release|ARM64.ActiveCfg = Release|x86
{A3D5A8A5-1D1F-412D-A829-C3DC1C7D4DF3}.Release|x64.ActiveCfg = Release|x64
{A3D5A8A5-1D1F-412D-A829-C3DC1C7D4DF3}.Release|x64.Build.0 = Release|x64
{A3D5A8A5-1D1F-412D-A829-C3DC1C7D4DF3}.Release|x64.Deploy.0 = Release|x64
@@ -126,6 +206,8 @@ Global
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{A3E27CD2-6D33-44D3-962F-E56C4CD25F10} = {5B9F207C-2EAB-4F77-95C7-206D65C87137}
+ {F1ED6BD6-2690-4BF3-835C-C3927C33424F} = {5B9F207C-2EAB-4F77-95C7-206D65C87137}
+ {DD20D31A-915E-43A2-B819-3A7AE39CA25C} = {5B9F207C-2EAB-4F77-95C7-206D65C87137}
{A3D5A8A5-1D1F-412D-A829-C3DC1C7D4DF3} = {5B9F207C-2EAB-4F77-95C7-206D65C87137}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
diff --git a/Directory.Build.props b/Directory.Build.props
index 4aac4d0..77dd529 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -9,24 +9,50 @@
Copyright © Microsoft Corporation, William Bradley 2017
$(MSBuildProjectName.Contains('UWP'))
+ $(MSBuildProjectName.Contains('WinUI'))
$(MSBuildProjectName.Contains('Test'))
-
+
+
+
+
10.0.16299.0
10.0.14393.0
+
+
+ 10.0.18362.0
+ 10.0.17763.0
+
+
+
+ true
+
+
-
+
true
+
+ true
+
+ true
-
+
+
+
+
+
+
+
+
+
diff --git a/Tests/ColorCode.BasicTests/ColorCode.BasicTests.csproj b/Tests/ColorCode.BasicTests/ColorCode.BasicTests.csproj
index 7af5f42..6a41eee 100644
--- a/Tests/ColorCode.BasicTests/ColorCode.BasicTests.csproj
+++ b/Tests/ColorCode.BasicTests/ColorCode.BasicTests.csproj
@@ -2,7 +2,7 @@
Exe
- netcoreapp2.0
+ netcoreapp2.1
false
diff --git a/Tests/ColorCode.WinUITests (Package)/ColorCode.WinUITests (Package).wapproj b/Tests/ColorCode.WinUITests (Package)/ColorCode.WinUITests (Package).wapproj
new file mode 100644
index 0000000..c9c4b1e
--- /dev/null
+++ b/Tests/ColorCode.WinUITests (Package)/ColorCode.WinUITests (Package).wapproj
@@ -0,0 +1,89 @@
+
+
+
+ 15.0
+
+
+
+ Debug
+ x86
+
+
+ Release
+ x86
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+ Debug
+ arm64
+
+
+ Release
+ arm64
+
+
+
+ $(MSBuildExtensionsPath)\Microsoft\DesktopBridge\
+ ColorCode.WinUITests\
+ net5.0-windows$(TargetPlatformVersion);$(AssetTargetFallback)
+
+
+
+ dd20d31a-915e-43a2-b819-3a7ae39ca25c
+ 10.0.18362.0
+ 10.0.18362.0
+ en-US
+ false
+ ..\ColorCode.WinUITests\ColorCode.WinUITests.csproj
+
+
+
+ Designer
+
+
+
+
+ Images\LockScreenLogo.scale-200.png
+
+
+ Images\SplashScreen.scale-200.png
+
+
+ Images\Square150x150Logo.scale-200.png
+
+
+ Images\Square44x44Logo.scale-200.png
+
+
+ Images\Square44x44Logo.targetsize-24_altform-unplated.png
+
+
+ Images\StoreLogo.png
+
+
+ Images\Wide310x150Logo.scale-200.png
+
+
+
+
+ True
+ Properties\PublishProfiles\win10-$(Platform).pubxml
+
+
+
+
+ build
+
+
+ build
+
+
+
+
\ No newline at end of file
diff --git a/Tests/ColorCode.WinUITests (Package)/Package.appxmanifest b/Tests/ColorCode.WinUITests (Package)/Package.appxmanifest
new file mode 100644
index 0000000..5ff23d4
--- /dev/null
+++ b/Tests/ColorCode.WinUITests (Package)/Package.appxmanifest
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+ ColorCode.WinUITests (Package)
+ alzollin
+ Images\StoreLogo.png
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Tests/ColorCode.WinUITests/App.xaml b/Tests/ColorCode.WinUITests/App.xaml
new file mode 100644
index 0000000..fef6763
--- /dev/null
+++ b/Tests/ColorCode.WinUITests/App.xaml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Tests/ColorCode.WinUITests/App.xaml.cs b/Tests/ColorCode.WinUITests/App.xaml.cs
new file mode 100644
index 0000000..ebed719
--- /dev/null
+++ b/Tests/ColorCode.WinUITests/App.xaml.cs
@@ -0,0 +1,63 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+
+using System;
+using Windows.ApplicationModel;
+using Microsoft.UI.Xaml;
+using WinRT;
+using System.Runtime.InteropServices;
+
+namespace ColorCode.WinUITests
+{
+ ///
+ /// Provides application-specific behavior to supplement the default Application class.
+ ///
+ public partial class App : Application
+ {
+ ///
+ /// Initializes the singleton application object. This is the first line of authored code
+ /// executed, and as such is the logical equivalent of main() or WinMain().
+ ///
+ public App()
+ {
+ this.InitializeComponent();
+ //this.Suspending += OnSuspending;
+ }
+
+ ///
+ /// Invoked when the application is launched normally by the end user. Other entry points
+ /// will be used such as when the application is launched to open a specific file.
+ ///
+ /// Details about the launch request and process.
+ protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
+ {
+ m_window = new MainWindow();
+ IWindowNative windowWrapper = m_window.As();
+ WindowHandle = windowWrapper.WindowHandle;
+ m_window.Activate();
+ }
+
+ public IntPtr WindowHandle { get; private set; }
+
+ [ComImport]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ [Guid("EECDBF0E-BAE9-4CB6-A68E-9598E1CB57BB")]
+ internal interface IWindowNative
+ {
+ IntPtr WindowHandle { get; }
+ }
+
+ ///
+ /// Invoked when application execution is being suspended. Application state is saved
+ /// without knowing whether the application will be terminated or resumed with the contents
+ /// of memory still intact.
+ ///
+ /// The source of the suspend request.
+ /// Details about the suspend request.
+ private void OnSuspending(object sender, SuspendingEventArgs e)
+ {
+ // Save application state and stop any background activity
+ }
+
+ private Window m_window;
+ }
+}
diff --git a/Tests/ColorCode.WinUITests/ColorCode.WinUITests.csproj b/Tests/ColorCode.WinUITests/ColorCode.WinUITests.csproj
new file mode 100644
index 0000000..45e1f03
--- /dev/null
+++ b/Tests/ColorCode.WinUITests/ColorCode.WinUITests.csproj
@@ -0,0 +1,25 @@
+
+
+ WinExe
+ net5.0-windows10.0.18362.0
+ 10.0.17763.0
+ $(TargetPlatformMinVersion)
+ ColorCode.WinUITests
+ app.manifest
+ x86;x64;arm64
+ win10-x86;win10-x64;win10-arm64
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Tests/ColorCode.WinUITests/MainWindow.xaml b/Tests/ColorCode.WinUITests/MainWindow.xaml
new file mode 100644
index 0000000..37b7344
--- /dev/null
+++ b/Tests/ColorCode.WinUITests/MainWindow.xaml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Tests/ColorCode.WinUITests/MainWindow.xaml.cs b/Tests/ColorCode.WinUITests/MainWindow.xaml.cs
new file mode 100644
index 0000000..387a9eb
--- /dev/null
+++ b/Tests/ColorCode.WinUITests/MainWindow.xaml.cs
@@ -0,0 +1,123 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+
+using ColorCode.Common;
+using ColorCode.Styling;
+using ColorCode.WinUI.Common;
+using System;
+using System.IO;
+using System.Threading.Tasks;
+using Windows.Storage;
+using Windows.Storage.Pickers;
+using Windows.System;
+using Microsoft.UI.Xaml;
+using System.Runtime.InteropServices;
+using WinRT;
+
+namespace ColorCode.WinUITests
+{
+ public sealed partial class MainWindow
+ {
+ public MainWindow()
+ {
+ InitializeComponent();
+ }
+
+ #region IInitializeWithWindow
+
+ [ComImport]
+ [Guid("3E68D4BD-7135-4D10-8018-9FB6D9F33FA1")]
+ [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
+ public interface IInitializeWithWindow
+ {
+ void Initialize(IntPtr hwnd);
+ }
+
+ #endregion
+
+ private async Task> GetCodeFileText()
+ {
+ try
+ {
+ var picker = new FileOpenPicker();
+
+ IntPtr windowHandle = (App.Current as App).WindowHandle;
+ IInitializeWithWindow initializeWithWindowWrapper = picker.As();
+ initializeWithWindowWrapper.Initialize(windowHandle);
+
+ picker.FileTypeFilter.Add("*");
+
+ var file = await picker.PickSingleFileAsync();
+ if (file == null) return null;
+
+ System.Diagnostics.Debugger.Launch();
+
+ string text = "";
+ using (var reader = new StreamReader(await file.OpenStreamForReadAsync(), true))
+ {
+ text = await reader.ReadToEndAsync();
+ }
+
+ ILanguage Language = Languages.FindById(file.FileType.Replace(".", "")) ?? Languages.CSharp;
+ return new Tuple(text, Language);
+ }
+ catch (Exception ex)
+ {
+ System.Diagnostics.Debug.WriteLine(ex);
+ return new Tuple("ERROR", Languages.CSharp);
+ }
+ }
+
+ private void RenderLight(object sender, RoutedEventArgs e)
+ {
+ MainGrid.RequestedTheme = ElementTheme.Light;
+ Render();
+ }
+
+ private void RenderDark(object sender, RoutedEventArgs e)
+ {
+ MainGrid.RequestedTheme = ElementTheme.Dark;
+ Render();
+ }
+
+ private async void Render()
+ {
+ PresentationBlock.Blocks.Clear();
+
+ var result = await GetCodeFileText();
+ if (result == null) return;
+
+ var formatter = new RichTextBlockFormatter(MainGrid.RequestedTheme);
+ var plainText = formatter.Styles[ScopeName.PlainText];
+ MainGrid.Background = (plainText?.Background ?? StyleDictionary.White).GetSolidColorBrush();
+ formatter.FormatRichTextBlock(result.Item1, result.Item2, PresentationBlock);
+ }
+
+ private void HTMLLight(object sender, RoutedEventArgs e)
+ {
+ MakeHTML(StyleDictionary.DefaultLight);
+ }
+
+ private void HTMLDark(object sender, RoutedEventArgs e)
+ {
+ MakeHTML(StyleDictionary.DefaultDark);
+ }
+
+ private async void MakeHTML(StyleDictionary Styles)
+ {
+ var result = await GetCodeFileText();
+ if (result == null) return;
+
+ var formatter = new HtmlFormatter(Styles);
+ var html = formatter.GetHtmlString(result.Item1, result.Item2);
+
+ var tempfile = await ApplicationData.Current.TemporaryFolder.CreateFileAsync("HTMLResult.html", CreationCollisionOption.ReplaceExisting);
+ await FileIO.WriteTextAsync(tempfile, html);
+
+ try
+ {
+ await Launcher.LaunchFileAsync(tempfile);
+ }
+ catch { }
+ }
+ }
+}
diff --git a/Tests/ColorCode.WinUITests/app.manifest b/Tests/ColorCode.WinUITests/app.manifest
new file mode 100644
index 0000000..9ebbead
--- /dev/null
+++ b/Tests/ColorCode.WinUITests/app.manifest
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+ true/PM
+ PerMonitorV2, PerMonitor
+
+
+
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index f9258ce..5de5195 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -21,9 +21,9 @@ steps:
displayName: Setup Environment Variables
- task: NuGetToolInstaller@1
- displayName: Use NuGet 5.5.1
+ displayName: Use NuGet 5.8.1
inputs:
- versionSpec: 5.5.1
+ versionSpec: 5.8.1
- task: DotNetCoreCLI@2
inputs:
@@ -35,6 +35,19 @@ steps:
- script: nbgv cloud
displayName: Set Version
+- task: UseDotNet@2
+ displayName: 'Install .NET Core SDK'
+ inputs:
+ version: 5.0.201
+ performMultiLevelLookup: true
+
+- task: DotNetCoreCLI@2
+ inputs:
+ command: custom
+ custom: msbuild
+ arguments: /t:restore .\ColorCode.sln
+ displayName: NuGet restore
+
- powershell: .\build\build.ps1
displayName: Build
diff --git a/build/build.cake b/build/build.cake
index 679abb7..1edbef7 100644
--- a/build/build.cake
+++ b/build/build.cake
@@ -1,7 +1,10 @@
-#module nuget:?package=Cake.LongPath.Module&version=0.7.0
+#module nuget:?package=Cake.LongPath.Module&version=1.0.1
-#addin nuget:?package=Cake.FileHelpers&version=3.2.1
-#addin nuget:?package=Cake.Powershell&version=0.4.8
+#addin nuget:?package=Cake.FileHelpers&version=4.0.1
+#addin nuget:?package=Cake.Powershell&version=1.0.0
+#addin nuget:?package=Cake.GitVersioning&version=3.3.37
+
+#tool nuget:?package=vswhere&version=2.8.4
using System;
using System.Linq;
@@ -19,13 +22,10 @@ var target = Argument("target", "Default");
var baseDir = MakeAbsolute(Directory("../")).ToString();
var buildDir = baseDir + "/build";
-var toolsDir = buildDir + "/tools";
var Solution = baseDir + "/ColorCode.sln";
var nupkgDir = buildDir + "/nupkg";
-var gitVersioningVersion = "2.1.65";
-var versionClient = toolsDir + "/nerdbank.gitversioning/tools/Get-Version.ps1";
string Version = null;
//////////////////////////////////////////////////////////////////////
@@ -80,12 +80,24 @@ void VerifyHeaders(bool Replace)
void RetrieveVersion()
{
- Information("\nRetrieving version...");
- var results = StartPowershellFile(versionClient);
- Version = results[1].Properties["NuGetPackageVersion"].Value.ToString();
+ Information("\nRetrieving version...");
+ Version = GitVersioningGetVersion().NuGetPackageVersion;
Information("\nBuild Version: " + Version);
}
+void UpdateToolsPath(MSBuildSettings buildSettings)
+{
+ // Workaround for https://github.com/cake-build/cake/issues/2128
+ var vsInstallation = VSWhereLatest(new VSWhereLatestSettings { Requires = "Microsoft.Component.MSBuild", IncludePrerelease = true });
+
+ if (vsInstallation != null)
+ {
+ buildSettings.ToolPath = vsInstallation.CombineWithFilePath(@"MSBuild\Current\Bin\MSBuild.exe");
+ if (!FileExists(buildSettings.ToolPath))
+ buildSettings.ToolPath = vsInstallation.CombineWithFilePath(@"MSBuild\15.0\Bin\MSBuild.exe");
+ }
+}
+
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
@@ -101,7 +113,7 @@ Task("Restore-NuGet-Packages")
.IsDependentOn("Clean")
.Does(() =>
{
- NuGetRestore(Solution);
+ DotNetCoreRestore(Solution);
});
Task("Verify")
@@ -120,15 +132,6 @@ Task("Version")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
{
- Information("\nDownloading NerdBank GitVersioning...");
- var installSettings = new NuGetInstallSettings {
- ExcludeVersion = true,
- Version = gitVersioningVersion,
- OutputDirectory = toolsDir
- };
-
- NuGetInstall(new []{"nerdbank.gitversioning"}, installSettings);
-
RetrieveVersion();
});
@@ -142,13 +145,16 @@ Task("Build")
MaxCpuCount = 0
}
.SetConfiguration("Release")
- .WithTarget("Restore;Build")
+ .WithTarget("Pack")
.WithProperty("IncludeSymbols", "true")
.WithProperty("GenerateLibraryLayout", "true")
.WithProperty("PackageOutputPath", nupkgDir)
- .WithProperty("GeneratePackageOnBuild", "true");
+ .WithProperty("SymbolPackageFormat", "snupkg");
+
+ UpdateToolsPath(buildSettings);
EnsureDirectoryExists(nupkgDir);
+
MSBuild(Solution, buildSettings);
});
diff --git a/build/build.ps1 b/build/build.ps1
index 231babc..2636495 100644
--- a/build/build.ps1
+++ b/build/build.ps1
@@ -21,40 +21,57 @@ The build script target to run.
The build configuration to use.
.PARAMETER Verbosity
Specifies the amount of information to be displayed.
-.PARAMETER Experimental
-Tells Cake to use the latest Roslyn release.
-.PARAMETER WhatIf
-Performs a dry run of the build script.
-No tasks will be executed.
-.PARAMETER Mono
-Tells Cake to use the Mono scripting engine.
+.PARAMETER ShowDescription
+Shows description about tasks.
+.PARAMETER DryRun
+Performs a dry run.
.PARAMETER SkipToolPackageRestore
Skips restoring of packages.
.PARAMETER ScriptArgs
Remaining arguments are added here.
.LINK
-http://cakebuild.net
+https://cakebuild.net
#>
[CmdletBinding()]
Param(
- [string]$Script = "build.cake",
- [string]$Target = "Default",
- [ValidateSet("Release", "Debug")]
- [string]$Configuration = "Release",
+ [string]$Script,
+ [string]$Target,
+ [string]$Configuration,
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
- [string]$Verbosity = "Verbose",
- [switch]$Experimental,
- [Alias("DryRun","Noop")]
- [switch]$WhatIf,
- [switch]$Mono,
+ [string]$Verbosity,
+ [switch]$ShowDescription,
+ [Alias("WhatIf", "Noop")]
+ [switch]$DryRun,
[switch]$SkipToolPackageRestore,
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
[string[]]$ScriptArgs
)
+# This is an automatic variable in PowerShell Core, but not in Windows PowerShell 5.x
+if (-not (Test-Path variable:global:IsCoreCLR)) {
+ $IsCoreCLR = $false
+}
+
+# Attempt to set highest encryption available for SecurityProtocol.
+# PowerShell will not set this by default (until maybe .NET 4.6.x). This
+# will typically produce a message for PowerShell v2 (just an info
+# message though)
+try {
+ # Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48)
+ # Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't
+ # exist in .NET 4.0, even though they are addressable if .NET 4.5+ is
+ # installed (.NET 4.5 is an in-place upgrade).
+ # PowerShell Core already has support for TLS 1.2 so we can skip this if running in that.
+ if (-not $IsCoreCLR) {
+ [System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48
+ }
+ } catch {
+ Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to upgrade to .NET Framework 4.5+ and PowerShell v3'
+ }
+
[Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null
function MD5HashFile([string] $filePath)
{
@@ -80,49 +97,52 @@ function MD5HashFile([string] $filePath)
}
}
+function GetProxyEnabledWebClient
+{
+ $wc = New-Object System.Net.WebClient
+ $proxy = [System.Net.WebRequest]::GetSystemWebProxy()
+ $proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
+ $wc.Proxy = $proxy
+ return $wc
+}
+
Write-Host "Preparing to run build script..."
if(!$PSScriptRoot){
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
}
+if(!$Script){
+ $Script = Join-Path $PSScriptRoot "build.cake"
+}
$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
+$ADDINS_DIR = Join-Path $TOOLS_DIR "Addins"
+$MODULES_DIR = Join-Path $TOOLS_DIR "Modules"
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"
$NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config"
$PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum"
+$ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config"
+$MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config"
-# Should we use mono?
-$UseMono = "";
-if($Mono.IsPresent) {
- Write-Verbose -Message "Using the Mono based scripting engine."
- $UseMono = "-mono"
-}
-
-# Should we use the new Roslyn?
-$UseExperimental = "";
-if($Experimental.IsPresent -and !($Mono.IsPresent)) {
- Write-Verbose -Message "Using experimental version of Roslyn."
- $UseExperimental = "-experimental"
-}
-
-# Is this a dry run?
-$UseDryRun = "";
-if($WhatIf.IsPresent) {
- $UseDryRun = "-dryrun"
-}
+$env:CAKE_PATHS_TOOLS = $TOOLS_DIR
+$env:CAKE_PATHS_ADDINS = $ADDINS_DIR
+$env:CAKE_PATHS_MODULES = $MODULES_DIR
# Make sure tools folder exists
if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
Write-Verbose -Message "Creating tools directory..."
- New-Item -Path $TOOLS_DIR -Type directory | out-null
+ New-Item -Path $TOOLS_DIR -Type Directory | Out-Null
}
# Make sure that packages.config exist.
if (!(Test-Path $PACKAGES_CONFIG)) {
Write-Verbose -Message "Downloading packages.config..."
- try { (New-Object System.Net.WebClient).DownloadFile("http://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) } catch {
+ try {
+ $wc = GetProxyEnabledWebClient
+ $wc.DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG)
+ } catch {
Throw "Could not download packages.config."
}
}
@@ -142,14 +162,26 @@ if (!(Test-Path $NUGET_EXE)) {
if (!(Test-Path $NUGET_EXE)) {
Write-Verbose -Message "Downloading NuGet.exe..."
try {
- (New-Object System.Net.WebClient).DownloadFile($NUGET_URL, $NUGET_EXE)
+ $wc = GetProxyEnabledWebClient
+ $wc.DownloadFile($NUGET_URL, $NUGET_EXE)
} catch {
Throw "Could not download NuGet.exe."
}
}
+# These are automatic variables in PowerShell Core, but not in Windows PowerShell 5.x
+if (-not (Test-Path variable:global:ismacos)) {
+ $IsLinux = $false
+ $IsMacOS = $false
+}
+
# Save nuget.exe path to environment to be available to child processed
-$ENV:NUGET_EXE = $NUGET_EXE
+$env:NUGET_EXE = $NUGET_EXE
+$env:NUGET_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) {
+ "mono `"$NUGET_EXE`""
+} else {
+ "`"$NUGET_EXE`""
+}
# Restore tools from NuGet?
if(-Not $SkipToolPackageRestore.IsPresent) {
@@ -157,24 +189,61 @@ if(-Not $SkipToolPackageRestore.IsPresent) {
Set-Location $TOOLS_DIR
# Check for changes in packages.config and remove installed tools if true.
- [string] $md5Hash = MD5HashFile($PACKAGES_CONFIG)
+ [string] $md5Hash = MD5HashFile $PACKAGES_CONFIG
if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or
- ($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) {
+ ($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) {
Write-Verbose -Message "Missing or changed package.config hash..."
- Remove-Item * -Recurse -Exclude packages.config,nuget.exe
+ Get-ChildItem -Exclude packages.config,nuget.exe,Cake.Bakery |
+ Remove-Item -Recurse -Force
}
Write-Verbose -Message "Restoring tools from NuGet..."
- $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""
+
+ $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""
if ($LASTEXITCODE -ne 0) {
- Throw "An error occured while restoring NuGet tools."
+ Throw "An error occurred while restoring NuGet tools."
}
else
{
$md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII"
}
- Write-Verbose -Message ($NuGetOutput | out-string)
+ Write-Verbose -Message ($NuGetOutput | Out-String)
+
+ Pop-Location
+}
+
+# Restore addins from NuGet
+if (Test-Path $ADDINS_PACKAGES_CONFIG) {
+ Push-Location
+ Set-Location $ADDINS_DIR
+
+ Write-Verbose -Message "Restoring addins from NuGet..."
+ $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`""
+
+ if ($LASTEXITCODE -ne 0) {
+ Throw "An error occurred while restoring NuGet addins."
+ }
+
+ Write-Verbose -Message ($NuGetOutput | Out-String)
+
+ Pop-Location
+}
+
+# Restore modules from NuGet
+if (Test-Path $MODULES_PACKAGES_CONFIG) {
+ Push-Location
+ Set-Location $MODULES_DIR
+
+ Write-Verbose -Message "Restoring modules from NuGet..."
+ $NuGetOutput = Invoke-Expression "& $env:NUGET_EXE_INVOCATION install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`""
+
+ if ($LASTEXITCODE -ne 0) {
+ Throw "An error occurred while restoring NuGet modules."
+ }
+
+ Write-Verbose -Message ($NuGetOutput | Out-String)
+
Pop-Location
}
@@ -183,9 +252,23 @@ if (!(Test-Path $CAKE_EXE)) {
Throw "Could not find Cake.exe at $CAKE_EXE"
}
+$CAKE_EXE_INVOCATION = if ($IsLinux -or $IsMacOS) {
+ "mono `"$CAKE_EXE`""
+} else {
+ "`"$CAKE_EXE`""
+}
+
+ # Build an array (not a string) of Cake arguments to be joined later
+$cakeArguments = @()
+if ($Script) { $cakeArguments += "`"$Script`"" }
+if ($Target) { $cakeArguments += "--target=`"$Target`"" }
+if ($Configuration) { $cakeArguments += "--configuration=$Configuration" }
+if ($Verbosity) { $cakeArguments += "--verbosity=$Verbosity" }
+if ($ShowDescription) { $cakeArguments += "--showdescription" }
+if ($DryRun) { $cakeArguments += "--dryrun" }
+$cakeArguments += $ScriptArgs
+
# Start Cake
Write-Host "Running build script..."
-$path = Split-Path -Parent $MyInvocation.MyCommand.Definition
-$Script = "$path/build.cake"
-Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs"
+Invoke-Expression "& $CAKE_EXE_INVOCATION $($cakeArguments -join " ")"
exit $LASTEXITCODE
\ No newline at end of file
diff --git a/build/tools/packages.config b/build/tools/packages.config
index cedcc6a..2a03746 100644
--- a/build/tools/packages.config
+++ b/build/tools/packages.config
@@ -1,4 +1,4 @@
-
+
diff --git a/global.json b/global.json
index 80d84a2..fec540a 100644
--- a/global.json
+++ b/global.json
@@ -1,5 +1,5 @@
{
"msbuild-sdks": {
- "MSBuild.Sdk.Extras": "2.0.54"
+ "MSBuild.Sdk.Extras": "3.0.23"
}
}
\ No newline at end of file
diff --git a/version.json b/version.json
index b5df658..3a8f46a 100644
--- a/version.json
+++ b/version.json
@@ -1,5 +1,5 @@
{
- "version": "2.0.6",
+ "version": "2.0.7",
"publicReleaseRefSpec": [
"^refs/heads/master$", // we release out of master
"^refs/heads/rel/\\d+\\.\\d+\\.\\d+" // we also release branches starting with rel/N.N.N