diff --git a/.gitignore b/.gitignore
index a510c4e49f..d965a09574 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,7 @@
*.suo
*.user
*.sln.docstates
+.vs/
# Build results
@@ -160,3 +161,5 @@ tools/
.nuget
artifacts/
nuget
+Avalonia.XBuild.sln
+project.lock.json
diff --git a/Avalonia.sln b/Avalonia.sln
index a6fdcbd421..3ab8048857 100644
--- a/Avalonia.sln
+++ b/Avalonia.sln
@@ -99,10 +99,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Skia.Desktop", "sr
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Skia.Android", "src\Skia\Avalonia.Skia.Android\Avalonia.Skia.Android.csproj", "{BD43F7C0-396B-4AA1-BAD9-DFDE54D51298}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Skia.Android.TestApp", "src\Skia\Avalonia.Skia.Android.TestApp\Avalonia.Skia.Android.TestApp.csproj", "{F92E55A5-ED73-4CCB-AB4B-0541B6757F31}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Skia.iOS.TestApp", "src\Skia\Avalonia.Skia.iOS.TestApp\Avalonia.Skia.iOS.TestApp.csproj", "{DA49C5F3-BE95-461C-B999-072128CCF59E}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Skia.iOS", "src\Skia\Avalonia.Skia.iOS\Avalonia.Skia.iOS.csproj", "{47BE08A7-5985-410B-9FFC-2264B8EA595F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Android", "Android", "{7CF9789C-F1D3-4D0E-90E5-F1DF67A2753F}"
@@ -130,6 +126,9 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ControlCatalog", "samples\ControlCatalog\ControlCatalog.csproj", "{D0A739B9-3C68-4BA6-A328-41606954B6BD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ControlCatalog.Desktop", "samples\ControlCatalog.Desktop\ControlCatalog.Desktop.csproj", "{2B888490-D14A-4BCA-AB4B-48676FA93C9B}"
+ ProjectSection(ProjectDependencies) = postProject
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658} = {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}
+ EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ControlCatalog.iOS", "samples\ControlCatalog.iOS\ControlCatalog.iOS.csproj", "{57E0455D-D565-44BB-B069-EE1AA20F8337}"
EndProject
@@ -155,19 +154,34 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RenderTest", "samples\Rende
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ControlCatalog.Android", "samples\ControlCatalog.Android\ControlCatalog.Android.csproj", "{29132311-1848-4FD6-AE0C-4FF841151BD3}"
EndProject
+Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "Avalonia.Win32.Shared", "src\Windows\Avalonia.Win32\Avalonia.Win32.Shared.shproj", "{9DEFC6B7-845B-4D8F-AFC0-D32BF0032B8C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Win32.NetStandard", "src\Windows\Avalonia.Win32.NetStandard\Avalonia.Win32.NetStandard.csproj", "{40759A76-D0F2-464E-8000-6FF0F5C4BD7C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.DotNetCoreRuntime", "src\Avalonia.DotNetCoreRuntime\Avalonia.DotNetCoreRuntime.csproj", "{7863EA94-F0FB-4386-BF8C-E5BFA761560A}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Skia.Desktop.NetStandard", "src\Skia\Avalonia.Skia.Desktop.NetStandard\Avalonia.Skia.Desktop.NetStandard.csproj", "{7D2D3083-71DD-4CC9-8907-39A0D86FB322}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.Gtk3", "src\Gtk\Avalonia.Gtk3\Avalonia.Gtk3.csproj", "{BB1F7BB5-6AD4-4776-94D9-C09D0A972658}"
+EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\Skia\Avalonia.Skia\Avalonia.Skia.projitems*{2f59f3d0-748d-4652-b01e-e0d954756308}*SharedItemsImports = 13
src\Shared\RenderHelpers\RenderHelpers.projitems*{3c4c0cb4-0c0f-4450-a37b-148c84ff905f}*SharedItemsImports = 13
src\Shared\RenderHelpers\RenderHelpers.projitems*{3e908f67-5543-4879-a1dc-08eace79b3cd}*SharedItemsImports = 4
+ src\Windows\Avalonia.Win32\Avalonia.Win32.Shared.projitems*{40759a76-d0f2-464e-8000-6ff0f5c4bd7c}*SharedItemsImports = 4
src\Shared\PlatformSupport\PlatformSupport.projitems*{4488ad85-1495-4809-9aa4-ddfe0a48527e}*SharedItemsImports = 4
src\Shared\RenderHelpers\RenderHelpers.projitems*{47be08a7-5985-410b-9ffc-2264b8ea595f}*SharedItemsImports = 4
src\Skia\Avalonia.Skia\Avalonia.Skia.projitems*{47be08a7-5985-410b-9ffc-2264b8ea595f}*SharedItemsImports = 4
tests\Avalonia.RenderTests\Avalonia.RenderTests.projitems*{48840edd-24bf-495d-911e-2eb12ae75d3b}*SharedItemsImports = 13
src\Shared\PlatformSupport\PlatformSupport.projitems*{4a1abb09-9047-4bd5-a4ad-a055e52c5ee0}*SharedItemsImports = 4
- src\Shared\PlatformSupport\PlatformSupport.projitems*{7b92af71-6287-4693-9dcb-bd5b6e927e23}*SharedItemsImports = 4
+ src\Shared\PlatformSupport\PlatformSupport.projitems*{7863ea94-f0fb-4386-bf8c-e5bfa761560a}*SharedItemsImports = 4
+ src\Shared\RenderHelpers\RenderHelpers.projitems*{7d2d3083-71dd-4cc9-8907-39a0d86fb322}*SharedItemsImports = 4
+ src\Skia\Avalonia.Skia\Avalonia.Skia.projitems*{7d2d3083-71dd-4cc9-8907-39a0d86fb322}*SharedItemsImports = 4
+ src\Windows\Avalonia.Win32\Avalonia.Win32.Shared.projitems*{811a76cf-1cf6-440f-963b-bbe31bd72a82}*SharedItemsImports = 4
src\Shared\RenderHelpers\RenderHelpers.projitems*{925dd807-b651-475f-9f7c-cbeb974ce43d}*SharedItemsImports = 4
src\Skia\Avalonia.Skia\Avalonia.Skia.projitems*{925dd807-b651-475f-9f7c-cbeb974ce43d}*SharedItemsImports = 4
+ src\Windows\Avalonia.Win32\Avalonia.Win32.Shared.projitems*{9defc6b7-845b-4d8f-afc0-d32bf0032b8c}*SharedItemsImports = 13
src\Shared\RenderHelpers\RenderHelpers.projitems*{bd43f7c0-396b-4aa1-bad9-dfde54d51298}*SharedItemsImports = 4
src\Skia\Avalonia.Skia\Avalonia.Skia.projitems*{bd43f7c0-396b-4aa1-bad9-dfde54d51298}*SharedItemsImports = 4
tests\Avalonia.RenderTests\Avalonia.RenderTests.projitems*{d35a9f3d-8bb0-496e-bf72-444038a7debb}*SharedItemsImports = 4
@@ -1469,66 +1483,6 @@ Global
{BD43F7C0-396B-4AA1-BAD9-DFDE54D51298}.Release|Mono.ActiveCfg = Release|Any CPU
{BD43F7C0-396B-4AA1-BAD9-DFDE54D51298}.Release|x86.ActiveCfg = Release|Any CPU
{BD43F7C0-396B-4AA1-BAD9-DFDE54D51298}.Release|x86.Build.0 = Release|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.Ad-Hoc|Mono.ActiveCfg = Debug|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.Ad-Hoc|x86.ActiveCfg = Debug|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.Ad-Hoc|x86.Build.0 = Debug|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.Ad-Hoc|x86.Deploy.0 = Debug|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.AppStore|iPhone.ActiveCfg = Release|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.AppStore|Mono.ActiveCfg = Debug|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.AppStore|x86.ActiveCfg = Debug|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.AppStore|x86.Build.0 = Debug|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.AppStore|x86.Deploy.0 = Debug|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.Debug|iPhone.ActiveCfg = Debug|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.Debug|Mono.ActiveCfg = Debug|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.Debug|x86.ActiveCfg = Debug|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.Debug|x86.Build.0 = Debug|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.Debug|x86.Deploy.0 = Debug|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.Release|Any CPU.Build.0 = Release|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.Release|Any CPU.Deploy.0 = Release|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.Release|iPhone.ActiveCfg = Release|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.Release|Mono.ActiveCfg = Release|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.Release|x86.ActiveCfg = Release|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.Release|x86.Build.0 = Release|Any CPU
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31}.Release|x86.Deploy.0 = Release|Any CPU
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.Ad-Hoc|Any CPU.ActiveCfg = Ad-Hoc|iPhone
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Ad-Hoc|iPhoneSimulator
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.Ad-Hoc|iPhoneSimulator.Build.0 = Ad-Hoc|iPhoneSimulator
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.Ad-Hoc|Mono.ActiveCfg = Ad-Hoc|iPhoneSimulator
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.Ad-Hoc|x86.ActiveCfg = Ad-Hoc|iPhoneSimulator
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.AppStore|Any CPU.ActiveCfg = AppStore|iPhone
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.AppStore|iPhone.ActiveCfg = AppStore|iPhone
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.AppStore|iPhone.Build.0 = AppStore|iPhone
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.AppStore|iPhoneSimulator.ActiveCfg = AppStore|iPhoneSimulator
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.AppStore|iPhoneSimulator.Build.0 = AppStore|iPhoneSimulator
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.AppStore|Mono.ActiveCfg = AppStore|iPhoneSimulator
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.AppStore|x86.ActiveCfg = AppStore|iPhoneSimulator
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.Debug|Any CPU.ActiveCfg = Debug|iPhone
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.Debug|iPhone.ActiveCfg = Debug|iPhone
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.Debug|iPhone.Build.0 = Debug|iPhone
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.Debug|Mono.ActiveCfg = Debug|iPhoneSimulator
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.Debug|x86.ActiveCfg = Debug|iPhoneSimulator
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.Release|Any CPU.ActiveCfg = Release|iPhone
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.Release|iPhone.ActiveCfg = Release|iPhone
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.Release|iPhone.Build.0 = Release|iPhone
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.Release|Mono.ActiveCfg = Release|iPhoneSimulator
- {DA49C5F3-BE95-461C-B999-072128CCF59E}.Release|x86.ActiveCfg = Release|iPhoneSimulator
{47BE08A7-5985-410B-9FFC-2264B8EA595F}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
{47BE08A7-5985-410B-9FFC-2264B8EA595F}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
{47BE08A7-5985-410B-9FFC-2264B8EA595F}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
@@ -2329,6 +2283,164 @@ Global
{29132311-1848-4FD6-AE0C-4FF841151BD3}.Release|x86.ActiveCfg = Release|Any CPU
{29132311-1848-4FD6-AE0C-4FF841151BD3}.Release|x86.Build.0 = Release|Any CPU
{29132311-1848-4FD6-AE0C-4FF841151BD3}.Release|x86.Deploy.0 = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Ad-Hoc|Mono.ActiveCfg = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Ad-Hoc|Mono.Build.0 = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Ad-Hoc|x86.Build.0 = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.AppStore|Any CPU.Build.0 = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.AppStore|iPhone.ActiveCfg = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.AppStore|iPhone.Build.0 = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.AppStore|Mono.ActiveCfg = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.AppStore|Mono.Build.0 = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.AppStore|x86.ActiveCfg = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.AppStore|x86.Build.0 = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Debug|Mono.ActiveCfg = Debug|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Debug|x86.Build.0 = Debug|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Release|iPhone.Build.0 = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Release|Mono.ActiveCfg = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Release|x86.ActiveCfg = Release|Any CPU
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C}.Release|x86.Build.0 = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Ad-Hoc|Mono.ActiveCfg = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Ad-Hoc|Mono.Build.0 = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Ad-Hoc|x86.Build.0 = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.AppStore|Any CPU.Build.0 = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.AppStore|iPhone.ActiveCfg = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.AppStore|iPhone.Build.0 = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.AppStore|Mono.ActiveCfg = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.AppStore|Mono.Build.0 = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.AppStore|x86.ActiveCfg = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.AppStore|x86.Build.0 = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Debug|Mono.ActiveCfg = Debug|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Debug|Mono.Build.0 = Debug|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Debug|x86.Build.0 = Debug|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Release|iPhone.Build.0 = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Release|Mono.ActiveCfg = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Release|Mono.Build.0 = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Release|x86.ActiveCfg = Release|Any CPU
+ {7863EA94-F0FB-4386-BF8C-E5BFA761560A}.Release|x86.Build.0 = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Ad-Hoc|Mono.ActiveCfg = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Ad-Hoc|Mono.Build.0 = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Ad-Hoc|x86.Build.0 = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.AppStore|Any CPU.Build.0 = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.AppStore|iPhone.ActiveCfg = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.AppStore|iPhone.Build.0 = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.AppStore|Mono.ActiveCfg = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.AppStore|Mono.Build.0 = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.AppStore|x86.ActiveCfg = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.AppStore|x86.Build.0 = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Debug|Mono.ActiveCfg = Debug|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Debug|Mono.Build.0 = Debug|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Debug|x86.Build.0 = Debug|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Release|iPhone.Build.0 = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Release|Mono.ActiveCfg = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Release|Mono.Build.0 = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Release|x86.ActiveCfg = Release|Any CPU
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322}.Release|x86.Build.0 = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Ad-Hoc|Mono.ActiveCfg = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Ad-Hoc|Mono.Build.0 = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Ad-Hoc|x86.Build.0 = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.AppStore|Any CPU.Build.0 = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.AppStore|iPhone.ActiveCfg = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.AppStore|iPhone.Build.0 = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.AppStore|Mono.ActiveCfg = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.AppStore|Mono.Build.0 = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.AppStore|x86.ActiveCfg = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.AppStore|x86.Build.0 = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Debug|Mono.ActiveCfg = Debug|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Debug|Mono.Build.0 = Debug|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Debug|x86.Build.0 = Debug|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Release|Any CPU.Build.0 = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Release|iPhone.Build.0 = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Release|Mono.ActiveCfg = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Release|Mono.Build.0 = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Release|x86.ActiveCfg = Release|Any CPU
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -2359,8 +2471,6 @@ Global
{2F59F3D0-748D-4652-B01E-E0D954756308} = {3743B0F2-CC41-4F14-A8C8-267F579BF91E}
{925DD807-B651-475F-9F7C-CBEB974CE43D} = {3743B0F2-CC41-4F14-A8C8-267F579BF91E}
{BD43F7C0-396B-4AA1-BAD9-DFDE54D51298} = {3743B0F2-CC41-4F14-A8C8-267F579BF91E}
- {F92E55A5-ED73-4CCB-AB4B-0541B6757F31} = {3743B0F2-CC41-4F14-A8C8-267F579BF91E}
- {DA49C5F3-BE95-461C-B999-072128CCF59E} = {3743B0F2-CC41-4F14-A8C8-267F579BF91E}
{47BE08A7-5985-410B-9FFC-2264B8EA595F} = {3743B0F2-CC41-4F14-A8C8-267F579BF91E}
{7B92AF71-6287-4693-9DCB-BD5B6E927E23} = {7CF9789C-F1D3-4D0E-90E5-F1DF67A2753F}
{FF69B927-C545-49AE-8E16-3D14D621AA12} = {7CF9789C-F1D3-4D0E-90E5-F1DF67A2753F}
@@ -2382,5 +2492,9 @@ Global
{BD7F352C-6DC1-4740-BAF2-2D34A038728C} = {A0CC0258-D18C-4AB3-854F-7101680FC3F9}
{F1FDC5B0-4654-416F-AE69-E3E9BBD87801} = {9B9E3891-2366-4253-A952-D08BCEB71098}
{29132311-1848-4FD6-AE0C-4FF841151BD3} = {9B9E3891-2366-4253-A952-D08BCEB71098}
+ {9DEFC6B7-845B-4D8F-AFC0-D32BF0032B8C} = {B39A8919-9F95-48FE-AD7B-76E08B509888}
+ {40759A76-D0F2-464E-8000-6FF0F5C4BD7C} = {B39A8919-9F95-48FE-AD7B-76E08B509888}
+ {7D2D3083-71DD-4CC9-8907-39A0D86FB322} = {3743B0F2-CC41-4F14-A8C8-267F579BF91E}
+ {BB1F7BB5-6AD4-4776-94D9-C09D0A972658} = {B9894058-278A-46B5-B6ED-AD613FCC03B3}
EndGlobalSection
EndGlobal
diff --git a/Avalonia.sln.DotSettings b/Avalonia.sln.DotSettings
index bf98899847..ab21d6e50b 100644
--- a/Avalonia.sln.DotSettings
+++ b/Avalonia.sln.DotSettings
@@ -2,6 +2,24 @@
ExplicitlyExcluded
ExplicitlyExcluded
HINT
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" />
+ <Policy Inspect="True" Prefix="set_" Suffix="" Style="aa_bb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" />
+ <Policy Inspect="True" Prefix="" Suffix="_" Style="aa_bb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aa_bb" />
<Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" />
<Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" />
<Policy Inspect="False" Prefix="I" Suffix="" Style="AaBb" />
@@ -10,8 +28,9 @@
<Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" />
<Policy Inspect="False" Prefix="" Suffix="" Style="aaBb" />
<Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" />
<Policy Inspect="True" Prefix="s_" Suffix="" Style="aaBb" />
- <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="s_" Suffix="" Style="aaBb" /></Policy>
+ <Policy Inspect="True" Prefix="s_" Suffix="" Style="aaBb" />
<Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
<Policy Inspect="False" Prefix="T" Suffix="" Style="AaBb" />
<Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" />
\ No newline at end of file
diff --git a/build.cake b/build.cake
index e902c5d24e..ee68c74bb3 100644
--- a/build.cake
+++ b/build.cake
@@ -24,574 +24,118 @@ using Polly;
using NuGet;
///////////////////////////////////////////////////////////////////////////////
-// ARGUMENTS
+// SCRIPTS
///////////////////////////////////////////////////////////////////////////////
-var target = Argument("target", "Default");
-var platform = Argument("platform", "Any CPU");
-var configuration = Argument("configuration", "Release");
-var skipTests = HasArgument("skip-tests");
+#load "./parameters.cake"
+#load "./packages.cake"
-///////////////////////////////////////////////////////////////////////////////
-// CONFIGURATION
-///////////////////////////////////////////////////////////////////////////////
-
-var MainRepo = "AvaloniaUI/Avalonia";
-var MasterBranch = "master";
-var AssemblyInfoPath = File("./src/Shared/SharedAssemblyInfo.cs");
-var ReleasePlatform = "Any CPU";
-var ReleaseConfiguration = "Release";
-var MSBuildSolution = "./Avalonia.sln";
-var XBuildSolution = "./Avalonia.sln";
-
-///////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
// PARAMETERS
-///////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////
-var isPlatformAnyCPU = StringComparer.OrdinalIgnoreCase.Equals(platform, "Any CPU");
-var isPlatformX86 = StringComparer.OrdinalIgnoreCase.Equals(platform, "x86");
-var isPlatformX64 = StringComparer.OrdinalIgnoreCase.Equals(platform, "x64");
-var isLocalBuild = BuildSystem.IsLocalBuild;
-var isRunningOnUnix = IsRunningOnUnix();
-var isRunningOnWindows = IsRunningOnWindows();
-var isRunningOnAppVeyor = BuildSystem.AppVeyor.IsRunningOnAppVeyor;
-var isPullRequest = BuildSystem.AppVeyor.Environment.PullRequest.IsPullRequest;
-var isMainRepo = StringComparer.OrdinalIgnoreCase.Equals(MainRepo, BuildSystem.AppVeyor.Environment.Repository.Name);
-var isMasterBranch = StringComparer.OrdinalIgnoreCase.Equals(MasterBranch, BuildSystem.AppVeyor.Environment.Repository.Branch);
-var isTagged = BuildSystem.AppVeyor.Environment.Repository.Tag.IsTag
- && !string.IsNullOrWhiteSpace(BuildSystem.AppVeyor.Environment.Repository.Tag.Name);
-var isReleasable = StringComparer.OrdinalIgnoreCase.Equals(ReleasePlatform, platform)
- && StringComparer.OrdinalIgnoreCase.Equals(ReleaseConfiguration, configuration);
-var isMyGetRelease = !isTagged && isReleasable;
-var isNuGetRelease = isTagged && isReleasable;
+Parameters parameters = new Parameters(Context);
+Packages packages = new Packages(Context, parameters);
///////////////////////////////////////////////////////////////////////////////
-// VERSION
+// SETUP
///////////////////////////////////////////////////////////////////////////////
-var version = ParseAssemblyInfo(AssemblyInfoPath).AssemblyVersion;
-
-if (isRunningOnAppVeyor)
+Setup(context =>
{
- if (isTagged)
- {
- // Use Tag Name as version
- version = BuildSystem.AppVeyor.Environment.Repository.Tag.Name;
- }
- else
+ Information("Building version {0} of Avalonia ({1}, {2}, {3}) using version {4} of Cake.",
+ parameters.Version,
+ parameters.Platform,
+ parameters.Configuration,
+ parameters.Target,
+ typeof(ICakeContext).Assembly.GetName().Version.ToString());
+
+ if (parameters.IsRunningOnAppVeyor)
{
- // Use AssemblyVersion with Build as version
- version += "-build" + EnvironmentVariable("APPVEYOR_BUILD_NUMBER") + "-alpha";
+ Information("Repository Name: " + BuildSystem.AppVeyor.Environment.Repository.Name);
+ Information("Repository Branch: " + BuildSystem.AppVeyor.Environment.Repository.Branch);
}
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// DIRECTORIES
-///////////////////////////////////////////////////////////////////////////////
-var artifactsDir = (DirectoryPath)Directory("./artifacts");
-var nugetRoot = artifactsDir.Combine("nuget");
-var zipRoot = artifactsDir.Combine("zip");
-var binRoot = artifactsDir.Combine("bin");
-var testsRoot = artifactsDir.Combine("tests");
-
-var dirSuffix = configuration;
-var dirSuffixSkia = (isPlatformAnyCPU ? "x86" : platform) + "/" + configuration;
-var dirSuffixIOS = "iPhone" + "/" + configuration;
-
-var buildDirs =
- GetDirectories("./src/**/bin/" + dirSuffix) +
- GetDirectories("./src/**/obj/" + dirSuffix) +
- GetDirectories("./src/Markup/**/bin/" + dirSuffix) +
- GetDirectories("./src/Markup/**/obj/" + dirSuffix) +
- GetDirectories("./src/Android/**/bin/" + dirSuffix) +
- GetDirectories("./src/Android/**/obj/" + dirSuffix) +
- GetDirectories("./src/Gtk/**/bin/" + dirSuffix) +
- GetDirectories("./src/Gtk/**/obj/" + dirSuffix) +
- GetDirectories("./src/iOS/**/bin/" + dirSuffixIOS) +
- GetDirectories("./src/iOS/**/obj/" + dirSuffixIOS) +
- (DirectoryPath)Directory("./src/Skia/Avalonia.Skia.Android/bin/" + dirSuffix) +
- (DirectoryPath)Directory("./src/Skia/Avalonia.Skia.Android/obj/" + dirSuffix) +
- (DirectoryPath)Directory("./src/Skia/Avalonia.Skia.Android.TestApp/bin/" + dirSuffix) +
- (DirectoryPath)Directory("./src/Skia/Avalonia.Skia.Android.TestApp/obj/" + dirSuffix) +
- (DirectoryPath)Directory("./src/Skia/Avalonia.Skia.Desktop/bin/" + dirSuffixSkia) +
- (DirectoryPath)Directory("./src/Skia/Avalonia.Skia.Desktop/obj/" + dirSuffixSkia) +
- (DirectoryPath)Directory("./src/Skia/Avalonia.Skia.iOS/bin/" + dirSuffixIOS) +
- (DirectoryPath)Directory("./src/Skia/Avalonia.Skia.iOS/obj/" + dirSuffixIOS) +
- (DirectoryPath)Directory("./src/Skia/Avalonia.Skia.iOS.TestApp/bin/" + dirSuffixIOS) +
- (DirectoryPath)Directory("./src/Skia/Avalonia.Skia.iOS.TestApp/obj/" + dirSuffixIOS) +
- GetDirectories("./src/Windows/**/bin/" + dirSuffix) +
- GetDirectories("./src/Windows/**/obj/" + dirSuffix) +
- GetDirectories("./tests/**/bin/" + dirSuffix) +
- GetDirectories("./tests/**/obj/" + dirSuffix) +
- GetDirectories("./Samples/**/bin/" + dirSuffix) +
- GetDirectories("./Samples/**/obj/" + dirSuffix);
-
-var fileZipSuffix = version + ".zip";
-var zipCoreArtifacts = zipRoot.CombineWithFilePath("Avalonia-" + fileZipSuffix);
-var zipSourceControlCatalogDesktopDirs = (DirectoryPath)Directory("./samples/ControlCatalog.Desktop/bin/" + dirSuffix);
-var zipTargetControlCatalogDesktopDirs = zipRoot.CombineWithFilePath("ControlCatalog.Desktop-" + fileZipSuffix);
+ Information("Target: " + parameters.Target);
+ Information("Platform: " + parameters.Platform);
+ Information("Configuration: " + parameters.Configuration);
+ Information("IsLocalBuild: " + parameters.IsLocalBuild);
+ Information("IsRunningOnUnix: " + parameters.IsRunningOnUnix);
+ Information("IsRunningOnWindows: " + parameters.IsRunningOnWindows);
+ Information("IsRunningOnAppVeyor: " + parameters.IsRunningOnAppVeyor);
+ Information("IsPullRequest: " + parameters.IsPullRequest);
+ Information("IsMainRepo: " + parameters.IsMainRepo);
+ Information("IsMasterBranch: " + parameters.IsMasterBranch);
+ Information("IsTagged: " + parameters.IsTagged);
+ Information("IsReleasable: " + parameters.IsReleasable);
+ Information("IsMyGetRelease: " + parameters.IsMyGetRelease);
+ Information("IsNuGetRelease: " + parameters.IsNuGetRelease);
+});
///////////////////////////////////////////////////////////////////////////////
-// NUGET NUSPECS
+// TEARDOWN
///////////////////////////////////////////////////////////////////////////////
-Information("Getting git modules:");
-
-var ignoredSubModulesPaths = System.IO.File.ReadAllLines(".git/config").Where(m=>m.StartsWith("[submodule ")).Select(m =>
+Teardown(context =>
{
- var path = m.Split(' ')[1].Trim("\"[] \t".ToArray());
- Information(path);
- return ((DirectoryPath)Directory(path)).FullPath;
-}).ToList();
-
-var normalizePath = new Func(
- path => path.Replace(System.IO.Path.DirectorySeparatorChar, System.IO.Path.AltDirectorySeparatorChar).ToUpperInvariant());
-
-// Key: Package Id
-// Value is Tuple where Item1: Package Version, Item2: The packages.config file path.
-var packageVersions = new Dictionary>>();
-
-System.IO.Directory.EnumerateFiles(((DirectoryPath)Directory("./src")).FullPath, "packages.config", SearchOption.AllDirectories).ToList().ForEach(fileName =>
-{
- if (!ignoredSubModulesPaths.Any(i => normalizePath(fileName).Contains(normalizePath(i))))
- {
- var file = new PackageReferenceFile(fileName);
- foreach (PackageReference packageReference in file.GetPackageReferences())
- {
- IList> versions;
- packageVersions.TryGetValue(packageReference.Id, out versions);
- if (versions == null)
- {
- versions = new List>();
- packageVersions[packageReference.Id] = versions;
- }
- versions.Add(Tuple.Create(packageReference.Version.ToString(), fileName));
- }
- }
+ Information("Finished running tasks.");
});
-Information("Checking installed NuGet package dependencies versions:");
+///////////////////////////////////////////////////////////////////////////////
+// TASKS
+///////////////////////////////////////////////////////////////////////////////
-packageVersions.ToList().ForEach(package =>
+Task("Clean")
+ .Does(() =>
{
- var packageVersion = package.Value.First().Item1;
- bool isValidVersion = package.Value.All(x => x.Item1 == packageVersion);
- if (!isValidVersion)
- {
- Information("Error: package {0} has multiple versions installed:", package.Key);
- foreach (var v in package.Value)
- {
- Information("{0}, file: {1}", v.Item1, v.Item2);
- }
- throw new Exception("Detected multiple NuGet package version installed for different projects.");
- }
-});
-
-Information("Setting NuGet package dependencies versions:");
-
-var SerilogVersion = packageVersions["Serilog"].FirstOrDefault().Item1;
-var SplatVersion = packageVersions["Splat"].FirstOrDefault().Item1;
-var SpracheVersion = packageVersions["Sprache"].FirstOrDefault().Item1;
-var SystemReactiveVersion = packageVersions["System.Reactive"].FirstOrDefault().Item1;
-var SkiaSharpVersion = packageVersions["SkiaSharp"].FirstOrDefault().Item1;
-var SharpDXVersion = packageVersions["SharpDX"].FirstOrDefault().Item1;
-var SharpDXDirect2D1Version = packageVersions["SharpDX.Direct2D1"].FirstOrDefault().Item1;
-var SharpDXDXGIVersion = packageVersions["SharpDX.DXGI"].FirstOrDefault().Item1;
-
-Information("Package: Serilog, version: {0}", SerilogVersion);
-Information("Package: Splat, version: {0}", SplatVersion);
-Information("Package: Sprache, version: {0}", SpracheVersion);
-Information("Package: System.Reactive, version: {0}", SystemReactiveVersion);
-Information("Package: SkiaSharp, version: {0}", SkiaSharpVersion);
-Information("Package: SharpDX, version: {0}", SharpDXVersion);
-Information("Package: SharpDX.Direct2D1, version: {0}", SharpDXDirect2D1Version);
-Information("Package: SharpDX.DXGI, version: {0}", SharpDXDXGIVersion);
-
-var SetNuGetNuspecCommonProperties = new Action ((nuspec) => {
- nuspec.Version = version;
- nuspec.Authors = new [] { "Avalonia Team" };
- nuspec.Owners = new [] { "stevenk" };
- nuspec.LicenseUrl = new Uri("http://opensource.org/licenses/MIT");
- nuspec.ProjectUrl = new Uri("https://github.com/AvaloniaUI/Avalonia/");
- nuspec.RequireLicenseAcceptance = false;
- nuspec.Symbols = false;
- nuspec.NoPackageAnalysis = true;
- nuspec.Description = "The Avalonia UI framework";
- nuspec.Copyright = "Copyright 2015";
- nuspec.Tags = new [] { "Avalonia" };
+ CleanDirectories(parameters.BuildDirs);
+ CleanDirectory(parameters.ArtifactsDir);
+ CleanDirectory(parameters.NugetRoot);
+ CleanDirectory(parameters.ZipRoot);
+ CleanDirectory(parameters.BinRoot);
+ CleanDirectory(parameters.TestsRoot);
});
-var coreLibraries = new string[][]
+Task("Prepare-XBuild-Solution")
+ .Does(() =>
{
- new [] { "./src/", "Avalonia.Animation", ".dll" },
- new [] { "./src/", "Avalonia.Animation", ".xml" },
- new [] { "./src/", "Avalonia.Base", ".dll" },
- new [] { "./src/", "Avalonia.Base", ".xml" },
- new [] { "./src/", "Avalonia.Controls", ".dll" },
- new [] { "./src/", "Avalonia.Controls", ".xml" },
- new [] { "./src/", "Avalonia.DesignerSupport", ".dll" },
- new [] { "./src/", "Avalonia.DesignerSupport", ".xml" },
- new [] { "./src/", "Avalonia.Diagnostics", ".dll" },
- new [] { "./src/", "Avalonia.Diagnostics", ".xml" },
- new [] { "./src/", "Avalonia.Input", ".dll" },
- new [] { "./src/", "Avalonia.Input", ".xml" },
- new [] { "./src/", "Avalonia.Interactivity", ".dll" },
- new [] { "./src/", "Avalonia.Interactivity", ".xml" },
- new [] { "./src/", "Avalonia.Layout", ".dll" },
- new [] { "./src/", "Avalonia.Layout", ".xml" },
- new [] { "./src/", "Avalonia.Logging.Serilog", ".dll" },
- new [] { "./src/", "Avalonia.Logging.Serilog", ".xml" },
- new [] { "./src/", "Avalonia.Visuals", ".dll" },
- new [] { "./src/", "Avalonia.Visuals", ".xml" },
- new [] { "./src/", "Avalonia.Styling", ".dll" },
- new [] { "./src/", "Avalonia.Styling", ".xml" },
- new [] { "./src/", "Avalonia.ReactiveUI", ".dll" },
- new [] { "./src/", "Avalonia.Themes.Default", ".dll" },
- new [] { "./src/", "Avalonia.Themes.Default", ".xml" },
- new [] { "./src/Markup/", "Avalonia.Markup", ".dll" },
- new [] { "./src/Markup/", "Avalonia.Markup", ".xml" },
- new [] { "./src/Markup/", "Avalonia.Markup.Xaml", ".dll" },
- new [] { "./src/Markup/", "Avalonia.Markup.Xaml", ".xml" }
-};
-
-var coreLibrariesFiles = coreLibraries.Select((lib) => {
- return (FilePath)File(lib[0] + lib[1] + "/bin/" + dirSuffix + "/" + lib[1] + lib[2]);
-}).ToList();
-
-var coreLibrariesNuSpecContent = coreLibrariesFiles.Select((file) => {
- return new NuSpecContent {
- Source = file.FullPath, Target = "lib/portable-windows8+net45"
- };
-});
-
-var win32CoreLibrariesNuSpecContent = coreLibrariesFiles.Select((file) => {
- return new NuSpecContent {
- Source = file.FullPath, Target = "lib/net45"
- };
-});
-
-var net45RuntimePlatformExtensions = new [] {".xml", ".dll"};
-var net45RuntimePlatform = net45RuntimePlatformExtensions.Select(libSuffix => {
- return new NuSpecContent {
- Source = ((FilePath)File("./src/Avalonia.DotNetFrameworkRuntime/bin/" + dirSuffix + "/Avalonia.DotNetFrameworkRuntime" + libSuffix)).FullPath,
- Target = "lib/net45"
+ var blacklistedProjects = new[]
+ {
+ "Avalonia.Win32.NetStandard",
+ "Avalonia.DotNetCoreRuntime",
+ "Avalonia.Skia.Desktop.NetStandard",
+ "Avalonia.Gtk3"
};
-});
+ var blacklistedGuids = System.IO.File.ReadAllLines(parameters.MSBuildSolution)
+ .Where(l=>l.StartsWith("Project") && blacklistedProjects.Any(p=>l.Contains(p)))
+ .Select(l => l.Split(',').Select(part => part.Trim()).FirstOrDefault(part => part.StartsWith("\"{")))
+ .Where(g=>g!=null)
+ .Select(l=>l.Trim(new[]{'"', '}', '{'}).ToLower()).ToArray();
-var nuspecNuGetSettingsCore = new []
-{
- ///////////////////////////////////////////////////////////////////////////////
- // Avalonia
- ///////////////////////////////////////////////////////////////////////////////
- new NuGetPackSettings()
- {
- Id = "Avalonia",
- Dependencies = new []
- {
- new NuSpecDependency() { Id = "Serilog", Version = SerilogVersion },
- new NuSpecDependency() { Id = "Splat", Version = SplatVersion },
- new NuSpecDependency() { Id = "Sprache", Version = SpracheVersion },
- new NuSpecDependency() { Id = "System.Reactive", Version = SystemReactiveVersion }
- },
- Files = coreLibrariesNuSpecContent.Concat(win32CoreLibrariesNuSpecContent).Concat(net45RuntimePlatform).ToList(),
- BasePath = Directory("./"),
- OutputDirectory = nugetRoot
- },
- ///////////////////////////////////////////////////////////////////////////////
- // Avalonia.HtmlRenderer
- ///////////////////////////////////////////////////////////////////////////////
- new NuGetPackSettings()
- {
- Id = "Avalonia.HtmlRenderer",
- Dependencies = new []
- {
- new NuSpecDependency() { Id = "Avalonia", Version = version }
- },
- Files = new []
- {
- new NuSpecContent { Source = "Avalonia.HtmlRenderer.dll", Target = "lib/portable-windows8+net45" }
- },
- BasePath = Directory("./src/Avalonia.HtmlRenderer/bin/" + dirSuffix),
- OutputDirectory = nugetRoot
- }
-};
+ Console.WriteLine("Blacklisted guids are: " + string.Join(",", blacklistedGuids));
+ var removeUntilEndProject = false;
-var nuspecNuGetSettingsMobile = new []
-{
- ///////////////////////////////////////////////////////////////////////////////
- // Avalonia.Android
- ///////////////////////////////////////////////////////////////////////////////
- new NuGetPackSettings()
- {
- Id = "Avalonia.Android",
- Dependencies = new []
- {
- new NuSpecDependency() { Id = "Avalonia", Version = version },
- new NuSpecDependency() { Id = "Avalonia.Skia.Android", Version = version }
- },
- Files = new []
+ System.IO.File.WriteAllLines(parameters.XBuildSolution, System.IO.File.ReadAllLines(parameters.MSBuildSolution)
+ .Where(l =>
{
- new NuSpecContent { Source = "Avalonia.Android.dll", Target = "lib/MonoAndroid10" }
- },
- BasePath = Directory("./src/Android/Avalonia.Android/bin/" + dirSuffix),
- OutputDirectory = nugetRoot
- },
- ///////////////////////////////////////////////////////////////////////////////
- // Avalonia.Skia.Android
- ///////////////////////////////////////////////////////////////////////////////
- new NuGetPackSettings()
- {
- Id = "Avalonia.Skia.Android",
- Dependencies = new []
- {
- new NuSpecDependency() { Id = "Avalonia", Version = version },
- new NuSpecDependency() { Id = "SkiaSharp", Version = SkiaSharpVersion }
- },
- Files = new []
- {
- new NuSpecContent { Source = "Avalonia.Skia.Android.dll", Target = "lib/MonoAndroid10" }
- },
- BasePath = Directory("./src/Skia/Avalonia.Skia.Android/bin/" + dirSuffix),
- OutputDirectory = nugetRoot
- },
- ///////////////////////////////////////////////////////////////////////////////
- // Avalonia.iOS
- ///////////////////////////////////////////////////////////////////////////////
- new NuGetPackSettings()
- {
- Id = "Avalonia.iOS",
- Dependencies = new []
- {
- new NuSpecDependency() { Id = "Avalonia", Version = version },
- new NuSpecDependency() { Id = "Avalonia.Skia.iOS", Version = version }
- },
- Files = new []
- {
- new NuSpecContent { Source = "Avalonia.iOS.dll", Target = "lib/Xamarin.iOS10" }
- },
- BasePath = Directory("./src/iOS/Avalonia.iOS/bin/" + dirSuffixIOS),
- OutputDirectory = nugetRoot
- },
- ///////////////////////////////////////////////////////////////////////////////
- // Avalonia.Skia.iOS
- ///////////////////////////////////////////////////////////////////////////////
- new NuGetPackSettings()
- {
- Id = "Avalonia.Skia.iOS",
- Dependencies = new []
- {
- new NuSpecDependency() { Id = "Avalonia", Version = version },
- new NuSpecDependency() { Id = "SkiaSharp", Version = SkiaSharpVersion }
- },
- Files = new []
- {
- new NuSpecContent { Source = "Avalonia.Skia.iOS.dll", Target = "lib/Xamarin.iOS10" }
- },
- BasePath = Directory("./src/Skia/Avalonia.Skia.iOS/bin/" + dirSuffixIOS),
- OutputDirectory = nugetRoot
- },
- ///////////////////////////////////////////////////////////////////////////////
- // Avalonia.Mobile
- ///////////////////////////////////////////////////////////////////////////////
- new NuGetPackSettings()
- {
- Id = "Avalonia.Mobile",
- Dependencies = new []
- {
- new NuSpecDependency() { Id = "Avalonia.Android", Version = version },
- new NuSpecDependency() { Id = "Avalonia.iOS", Version = version }
- },
- Files = new NuSpecContent[]
- {
- new NuSpecContent { Source = "licence.md", Target = "" }
- },
- BasePath = Directory("./"),
- OutputDirectory = nugetRoot
- }
-};
-
-var nuspecNuGetSettingsDesktop = new []
-{
- ///////////////////////////////////////////////////////////////////////////////
- // Avalonia.Win32
- ///////////////////////////////////////////////////////////////////////////////
- new NuGetPackSettings()
- {
- Id = "Avalonia.Win32",
- Dependencies = new []
- {
- new NuSpecDependency() { Id = "Avalonia", Version = version }
- },
- Files = new []
- {
- new NuSpecContent { Source = "Avalonia.Win32.dll", Target = "lib/net45" }
- },
- BasePath = Directory("./src/Windows/Avalonia.Win32/bin/" + dirSuffix),
- OutputDirectory = nugetRoot
- },
- ///////////////////////////////////////////////////////////////////////////////
- // Avalonia.Direct2D1
- ///////////////////////////////////////////////////////////////////////////////
- new NuGetPackSettings()
- {
- Id = "Avalonia.Direct2D1",
- Dependencies = new []
- {
- new NuSpecDependency() { Id = "Avalonia", Version = version },
- new NuSpecDependency() { Id = "SharpDX", Version = SharpDXVersion },
- new NuSpecDependency() { Id = "SharpDX.Direct2D1", Version = SharpDXDirect2D1Version },
- new NuSpecDependency() { Id = "SharpDX.DXGI", Version = SharpDXDXGIVersion }
- },
- Files = new []
- {
- new NuSpecContent { Source = "Avalonia.Direct2D1.dll", Target = "lib/net45" }
- },
- BasePath = Directory("./src/Windows/Avalonia.Direct2D1/bin/" + dirSuffix),
- OutputDirectory = nugetRoot
- },
- ///////////////////////////////////////////////////////////////////////////////
- // Avalonia.Gtk
- ///////////////////////////////////////////////////////////////////////////////
- new NuGetPackSettings()
- {
- Id = "Avalonia.Gtk",
- Dependencies = new []
- {
- new NuSpecDependency() { Id = "Avalonia", Version = version }
- },
- Files = new []
- {
- new NuSpecContent { Source = "Avalonia.Gtk.dll", Target = "lib/net45" }
- },
- BasePath = Directory("./src/Gtk/Avalonia.Gtk/bin/" + dirSuffix),
- OutputDirectory = nugetRoot
- },
- ///////////////////////////////////////////////////////////////////////////////
- // Avalonia.Cairo
- ///////////////////////////////////////////////////////////////////////////////
- new NuGetPackSettings()
- {
- Id = "Avalonia.Cairo",
- Dependencies = new []
- {
- new NuSpecDependency() { Id = "Avalonia", Version = version }
- },
- Files = new []
- {
- new NuSpecContent { Source = "Avalonia.Cairo.dll", Target = "lib/net45" }
- },
- BasePath = Directory("./src/Gtk/Avalonia.Cairo/bin/" + dirSuffix),
- OutputDirectory = nugetRoot
- },
- ///////////////////////////////////////////////////////////////////////////////
- // Avalonia.Skia.Desktop
- ///////////////////////////////////////////////////////////////////////////////
- new NuGetPackSettings()
- {
- Id = "Avalonia.Skia.Desktop",
- Dependencies = new []
- {
- new NuSpecDependency() { Id = "Avalonia", Version = version },
- new NuSpecDependency() { Id = "SkiaSharp", Version = SkiaSharpVersion }
- },
- Files = new []
- {
- new NuSpecContent { Source = "Avalonia.Skia.Desktop.dll", Target = "lib/net45" }
- },
- BasePath = Directory("./src/Skia/Avalonia.Skia.Desktop/bin/" + dirSuffixSkia),
- OutputDirectory = nugetRoot
- },
- ///////////////////////////////////////////////////////////////////////////////
- // Avalonia.Desktop
- ///////////////////////////////////////////////////////////////////////////////
- new NuGetPackSettings()
- {
- Id = "Avalonia.Desktop",
- Dependencies = new []
- {
- new NuSpecDependency() { Id = "Avalonia.Win32", Version = version },
- new NuSpecDependency() { Id = "Avalonia.Direct2D1", Version = version },
- new NuSpecDependency() { Id = "Avalonia.Gtk", Version = version },
- new NuSpecDependency() { Id = "Avalonia.Cairo", Version = version },
- new NuSpecDependency() { Id = "Avalonia.Skia.Desktop", Version = version }
- },
- Files = new NuSpecContent[]
- {
- new NuSpecContent { Source = "licence.md", Target = "" }
- },
- BasePath = Directory("./"),
- OutputDirectory = nugetRoot
- }
-};
-
-var nuspecNuGetSettings = new List();
-
-nuspecNuGetSettings.AddRange(nuspecNuGetSettingsCore);
-nuspecNuGetSettings.AddRange(nuspecNuGetSettingsDesktop);
-nuspecNuGetSettings.AddRange(nuspecNuGetSettingsMobile);
-
-nuspecNuGetSettings.ForEach((nuspec) => SetNuGetNuspecCommonProperties(nuspec));
-
-var nugetPackages = nuspecNuGetSettings.Select(nuspec => {
- return nuspec.OutputDirectory.CombineWithFilePath(string.Concat(nuspec.Id, ".", nuspec.Version, ".nupkg"));
-}).ToArray();
-
-var binFiles = nuspecNuGetSettings.SelectMany(nuspec => {
- return nuspec.Files.Select(file => {
- return ((DirectoryPath)nuspec.BasePath).CombineWithFilePath(file.Source);
- });
-}).GroupBy(f => f.FullPath).Select(g => g.First());
-
-///////////////////////////////////////////////////////////////////////////////
-// INFORMATION
-///////////////////////////////////////////////////////////////////////////////
-
-Information("Building version {0} of Avalonia ({1}, {2}, {3}) using version {4} of Cake.",
- version,
- platform,
- configuration,
- target,
- typeof(ICakeContext).Assembly.GetName().Version.ToString());
-
-if (isRunningOnAppVeyor)
-{
- Information("Repository Name: " + BuildSystem.AppVeyor.Environment.Repository.Name);
- Information("Repository Branch: " + BuildSystem.AppVeyor.Environment.Repository.Branch);
-}
-
-Information("Target: " + target);
-Information("Platform: " + platform);
-Information("Configuration: " + configuration);
-Information("IsLocalBuild: " + isLocalBuild);
-Information("IsRunningOnUnix: " + isRunningOnUnix);
-Information("IsRunningOnWindows: " + isRunningOnWindows);
-Information("IsRunningOnAppVeyor: " + isRunningOnAppVeyor);
-Information("IsPullRequest: " + isPullRequest);
-Information("IsMainRepo: " + isMainRepo);
-Information("IsMasterBranch: " + isMasterBranch);
-Information("IsTagged: " + isTagged);
-Information("IsReleasable: " + isReleasable);
-Information("IsMyGetRelease: " + isMyGetRelease);
-Information("IsNuGetRelease: " + isNuGetRelease);
-
-///////////////////////////////////////////////////////////////////////////////
-// TASKS
-///////////////////////////////////////////////////////////////////////////////
-
-Task("Clean")
- .Does(() =>
-{
- CleanDirectories(buildDirs);
- CleanDirectory(artifactsDir);
- CleanDirectory(nugetRoot);
- CleanDirectory(zipRoot);
- CleanDirectory(binRoot);
- CleanDirectory(testsRoot);
+ if(removeUntilEndProject)
+ {
+ if(l.StartsWith("EndProject"))
+ removeUntilEndProject = false;
+ return false;
+ }
+
+ var blacklist = blacklistedGuids.Any(g => l.ToLower().Contains(g));
+ if(blacklist && l.StartsWith("Project"))
+ removeUntilEndProject = true;
+
+ return !blacklist;
+ }));
});
Task("Restore-NuGet-Packages")
.IsDependentOn("Clean")
+ .IsDependentOn("Prepare-XBuild-Solution")
.Does(() =>
{
var maxRetryCount = 5;
@@ -609,15 +153,15 @@ Task("Restore-NuGet-Packages")
toolTimeout+=0.5;
}})
.Execute(()=> {
- if(isRunningOnWindows)
+ if(parameters.IsRunningOnWindows)
{
- NuGetRestore(MSBuildSolution, new NuGetRestoreSettings {
+ NuGetRestore(parameters.MSBuildSolution, new NuGetRestoreSettings {
ToolTimeout = TimeSpan.FromMinutes(toolTimeout)
});
}
else
{
- NuGetRestore(XBuildSolution, new NuGetRestoreSettings {
+ NuGetRestore(parameters.XBuildSolution, new NuGetRestoreSettings {
ToolTimeout = TimeSpan.FromMinutes(toolTimeout)
});
}
@@ -628,11 +172,11 @@ Task("Build")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
{
- if(isRunningOnWindows)
+ if(parameters.IsRunningOnWindows)
{
- MSBuild(MSBuildSolution, settings => {
- settings.SetConfiguration(configuration);
- settings.WithProperty("Platform", "\"" + platform + "\"");
+ MSBuild(parameters.MSBuildSolution, settings => {
+ settings.SetConfiguration(parameters.Configuration);
+ settings.WithProperty("Platform", "\"" + parameters.Platform + "\"");
settings.SetVerbosity(Verbosity.Minimal);
settings.WithProperty("Windows", "True");
settings.UseToolVersion(MSBuildToolVersion.VS2015);
@@ -641,9 +185,9 @@ Task("Build")
}
else
{
- XBuild(XBuildSolution, settings => {
- settings.SetConfiguration(configuration);
- settings.WithProperty("Platform", "\"" + platform + "\"");
+ XBuild(parameters.XBuildSolution, settings => {
+ settings.SetConfiguration(parameters.Configuration);
+ settings.WithProperty("Platform", "\"" + parameters.Platform + "\"");
settings.SetVerbosity(Verbosity.Minimal);
});
}
@@ -651,23 +195,23 @@ Task("Build")
Task("Run-Unit-Tests")
.IsDependentOn("Build")
- .WithCriteria(() => !skipTests)
+ .WithCriteria(() => !parameters.SkipTests)
.Does(() =>
{
var unitTests = GetDirectories("./tests/Avalonia.*.UnitTests")
.Select(dir => System.IO.Path.GetFileName(dir.FullPath))
- .Where(name => isRunningOnWindows ? true : !(name.IndexOf("Direct2D", StringComparison.OrdinalIgnoreCase) >= 0))
- .Select(name => MakeAbsolute(File("./tests/" + name + "/bin/" + dirSuffix + "/" + name + ".dll")))
+ .Where(name => parameters.IsRunningOnWindows ? true : !(name.IndexOf("Direct2D", StringComparison.OrdinalIgnoreCase) >= 0))
+ .Select(name => MakeAbsolute(File("./tests/" + name + "/bin/" + parameters.DirSuffix + "/" + name + ".dll")))
.ToList();
- if (isRunningOnWindows)
+ if (parameters.IsRunningOnWindows)
{
- var leakTests = GetFiles("./tests/Avalonia.LeakTests/bin/" + dirSuffix + "/*.LeakTests.dll");
+ var leakTests = GetFiles("./tests/Avalonia.LeakTests/bin/" + parameters.DirSuffix + "/*.LeakTests.dll");
unitTests.AddRange(leakTests);
}
- var toolPath = (isPlatformAnyCPU || isPlatformX86) ?
+ var toolPath = (parameters.IsPlatformAnyCPU || parameters.IsPlatformX86) ?
"./tools/xunit.runner.console/tools/xunit.console.x86.exe" :
"./tools/xunit.runner.console/tools/xunit.console.exe";
@@ -678,9 +222,9 @@ Task("Run-Unit-Tests")
ShadowCopy = false
};
- xUnitSettings.NoAppDomain = !isRunningOnWindows;
+ xUnitSettings.NoAppDomain = !parameters.IsRunningOnWindows;
- var openCoverOutput = artifactsDir.GetFilePath(new FilePath("./coverage.xml"));
+ var openCoverOutput = parameters.ArtifactsDir.GetFilePath(new FilePath("./coverage.xml"));
var openCoverSettings = new OpenCoverSettings()
.WithFilter("+[Avalonia.*]* -[*Test*]* -[ControlCatalog*]*")
.WithFilter("-[Avalonia.*]OmniXaml.* -[Avalonia.*]Glass.*")
@@ -690,11 +234,11 @@ Task("Run-Unit-Tests")
foreach(var test in unitTests.Where(testFile => FileExists(testFile)))
{
- CopyDirectory(test.GetDirectory(), testsRoot);
+ CopyDirectory(test.GetDirectory(), parameters.TestsRoot);
}
var testsInDirectoryToRun = new List();
- if(isRunningOnWindows)
+ if(parameters.IsRunningOnWindows)
{
testsInDirectoryToRun.AddRange(GetFiles("./artifacts/tests/*Tests.dll"));
}
@@ -703,7 +247,7 @@ Task("Run-Unit-Tests")
testsInDirectoryToRun.AddRange(GetFiles("./artifacts/tests/*.UnitTests.dll"));
}
- if(isRunningOnWindows)
+ if(parameters.IsRunningOnWindows)
{
OpenCover(context => {
context.XUnit2(testsInDirectoryToRun, xUnitSettings);
@@ -719,26 +263,26 @@ Task("Copy-Files")
.IsDependentOn("Run-Unit-Tests")
.Does(() =>
{
- CopyFiles(binFiles, binRoot);
+ CopyFiles(packages.BinFiles, parameters.BinRoot);
});
Task("Zip-Files")
.IsDependentOn("Copy-Files")
.Does(() =>
{
- Zip(binRoot, zipCoreArtifacts);
+ Zip(parameters.BinRoot, parameters.ZipCoreArtifacts);
- Zip(zipSourceControlCatalogDesktopDirs,
- zipTargetControlCatalogDesktopDirs,
- GetFiles(zipSourceControlCatalogDesktopDirs.FullPath + "/*.dll") +
- GetFiles(zipSourceControlCatalogDesktopDirs.FullPath + "/*.exe"));
+ Zip(parameters.ZipSourceControlCatalogDesktopDirs,
+ parameters.ZipTargetControlCatalogDesktopDirs,
+ GetFiles(parameters.ZipSourceControlCatalogDesktopDirs.FullPath + "/*.dll") +
+ GetFiles(parameters.ZipSourceControlCatalogDesktopDirs.FullPath + "/*.exe"));
});
Task("Create-NuGet-Packages")
.IsDependentOn("Run-Unit-Tests")
.Does(() =>
{
- foreach(var nuspec in nuspecNuGetSettings)
+ foreach(var nuspec in packages.NuspecNuGetSettings)
{
NuGetPack(nuspec);
}
@@ -746,11 +290,11 @@ Task("Create-NuGet-Packages")
Task("Publish-MyGet")
.IsDependentOn("Create-NuGet-Packages")
- .WithCriteria(() => !isLocalBuild)
- .WithCriteria(() => !isPullRequest)
- .WithCriteria(() => isMainRepo)
- .WithCriteria(() => isMasterBranch)
- .WithCriteria(() => isMyGetRelease)
+ .WithCriteria(() => !parameters.IsLocalBuild)
+ .WithCriteria(() => !parameters.IsPullRequest)
+ .WithCriteria(() => parameters.IsMainRepo)
+ .WithCriteria(() => parameters.IsMasterBranch)
+ .WithCriteria(() => parameters.IsMyGetRelease)
.Does(() =>
{
var apiKey = EnvironmentVariable("MYGET_API_KEY");
@@ -765,7 +309,7 @@ Task("Publish-MyGet")
throw new InvalidOperationException("Could not resolve MyGet API url.");
}
- foreach(var nupkg in nugetPackages)
+ foreach(var nupkg in packages.NugetPackages)
{
NuGetPush(nupkg, new NuGetPushSettings {
Source = apiUrl,
@@ -780,11 +324,11 @@ Task("Publish-MyGet")
Task("Publish-NuGet")
.IsDependentOn("Create-NuGet-Packages")
- .WithCriteria(() => !isLocalBuild)
- .WithCriteria(() => !isPullRequest)
- .WithCriteria(() => isMainRepo)
- .WithCriteria(() => isMasterBranch)
- .WithCriteria(() => isNuGetRelease)
+ .WithCriteria(() => !parameters.IsLocalBuild)
+ .WithCriteria(() => !parameters.IsPullRequest)
+ .WithCriteria(() => parameters.IsMainRepo)
+ .WithCriteria(() => parameters.IsMasterBranch)
+ .WithCriteria(() => parameters.IsNuGetRelease)
.Does(() =>
{
var apiKey = EnvironmentVariable("NUGET_API_KEY");
@@ -799,7 +343,7 @@ Task("Publish-NuGet")
throw new InvalidOperationException("Could not resolve NuGet API url.");
}
- foreach(var nupkg in nugetPackages)
+ foreach(var nupkg in packages.NugetPackages)
{
NuGetPush(nupkg, new NuGetPushSettings {
ApiKey = apiKey,
@@ -834,4 +378,4 @@ Task("Travis")
// EXECUTE
///////////////////////////////////////////////////////////////////////////////
-RunTarget(target);
+RunTarget(parameters.Target);
diff --git a/packages.cake b/packages.cake
new file mode 100644
index 0000000000..67483c4579
--- /dev/null
+++ b/packages.cake
@@ -0,0 +1,469 @@
+public class Packages
+{
+ public List NuspecNuGetSettings { get; private set; }
+ public FilePath[] NugetPackages { get; private set; }
+ public FilePath[] BinFiles { get; private set; }
+
+ public Packages(ICakeContext context, Parameters parameters)
+ {
+ // NUGET NUSPECS
+ context.Information("Getting git modules:");
+
+ var ignoredSubModulesPaths = System.IO.File.ReadAllLines(".git/config").Where(m=>m.StartsWith("[submodule ")).Select(m =>
+ {
+ var path = m.Split(' ')[1].Trim("\"[] \t".ToArray());
+ context.Information(path);
+ return ((DirectoryPath)context.Directory(path)).FullPath;
+ }).ToList();
+
+ var normalizePath = new Func(
+ path => path.Replace(System.IO.Path.DirectorySeparatorChar, System.IO.Path.AltDirectorySeparatorChar).ToUpperInvariant());
+
+ // Key: Package Id
+ // Value is Tuple where Item1: Package Version, Item2: The packages.config file path.
+ var packageVersions = new Dictionary>>();
+
+ System.IO.Directory.EnumerateFiles(((DirectoryPath)context.Directory("./src")).FullPath, "packages.config", SearchOption.AllDirectories).ToList().ForEach(fileName =>
+ {
+ if (!ignoredSubModulesPaths.Any(i => normalizePath(fileName).Contains(normalizePath(i))))
+ {
+ var file = new PackageReferenceFile(fileName);
+ foreach (PackageReference packageReference in file.GetPackageReferences())
+ {
+ IList> versions;
+ packageVersions.TryGetValue(packageReference.Id, out versions);
+ if (versions == null)
+ {
+ versions = new List>();
+ packageVersions[packageReference.Id] = versions;
+ }
+ versions.Add(Tuple.Create(packageReference.Version.ToString(), fileName));
+ }
+ }
+ });
+
+ context.Information("Checking installed NuGet package dependencies versions:");
+
+ packageVersions.ToList().ForEach(package =>
+ {
+ var packageVersion = package.Value.First().Item1;
+ bool isValidVersion = package.Value.All(x => x.Item1 == packageVersion);
+ if (!isValidVersion)
+ {
+ context.Information("Error: package {0} has multiple versions installed:", package.Key);
+ foreach (var v in package.Value)
+ {
+ context.Information("{0}, file: {1}", v.Item1, v.Item2);
+ }
+ throw new Exception("Detected multiple NuGet package version installed for different projects.");
+ }
+ });
+
+ context.Information("Setting NuGet package dependencies versions:");
+
+ var SerilogVersion = packageVersions["Serilog"].FirstOrDefault().Item1;
+ var SplatVersion = packageVersions["Splat"].FirstOrDefault().Item1;
+ var SpracheVersion = packageVersions["Sprache"].FirstOrDefault().Item1;
+ var SystemReactiveVersion = packageVersions["System.Reactive"].FirstOrDefault().Item1;
+ var SkiaSharpVersion = packageVersions["SkiaSharp"].FirstOrDefault().Item1;
+ var SharpDXVersion = packageVersions["SharpDX"].FirstOrDefault().Item1;
+ var SharpDXDirect2D1Version = packageVersions["SharpDX.Direct2D1"].FirstOrDefault().Item1;
+ var SharpDXDirect3D11Version = packageVersions["SharpDX.Direct3D11"].FirstOrDefault().Item1;
+ var SharpDXDXGIVersion = packageVersions["SharpDX.DXGI"].FirstOrDefault().Item1;
+
+ context.Information("Package: Serilog, version: {0}", SerilogVersion);
+ context.Information("Package: Splat, version: {0}", SplatVersion);
+ context.Information("Package: Sprache, version: {0}", SpracheVersion);
+ context.Information("Package: System.Reactive, version: {0}", SystemReactiveVersion);
+ context.Information("Package: SkiaSharp, version: {0}", SkiaSharpVersion);
+ context.Information("Package: SharpDX, version: {0}", SharpDXVersion);
+ context.Information("Package: SharpDX.Direct2D1, version: {0}", SharpDXDirect2D1Version);
+ context.Information("Package: SharpDX.Direct3D11, version: {0}", SharpDXDirect3D11Version);
+ context.Information("Package: SharpDX.DXGI, version: {0}", SharpDXDXGIVersion);
+
+ var SetNuGetNuspecCommonProperties = new Action ((nuspec) => {
+ nuspec.Version = parameters.Version;
+ nuspec.Authors = new [] { "Avalonia Team" };
+ nuspec.Owners = new [] { "stevenk" };
+ nuspec.LicenseUrl = new Uri("http://opensource.org/licenses/MIT");
+ nuspec.ProjectUrl = new Uri("https://github.com/AvaloniaUI/Avalonia/");
+ nuspec.RequireLicenseAcceptance = false;
+ nuspec.Symbols = false;
+ nuspec.NoPackageAnalysis = true;
+ nuspec.Description = "The Avalonia UI framework";
+ nuspec.Copyright = "Copyright 2015";
+ nuspec.Tags = new [] { "Avalonia" };
+ });
+
+ var coreLibraries = new string[][]
+ {
+ new [] { "./src/", "Avalonia.Animation", ".dll" },
+ new [] { "./src/", "Avalonia.Animation", ".xml" },
+ new [] { "./src/", "Avalonia.Base", ".dll" },
+ new [] { "./src/", "Avalonia.Base", ".xml" },
+ new [] { "./src/", "Avalonia.Controls", ".dll" },
+ new [] { "./src/", "Avalonia.Controls", ".xml" },
+ new [] { "./src/", "Avalonia.DesignerSupport", ".dll" },
+ new [] { "./src/", "Avalonia.DesignerSupport", ".xml" },
+ new [] { "./src/", "Avalonia.Diagnostics", ".dll" },
+ new [] { "./src/", "Avalonia.Diagnostics", ".xml" },
+ new [] { "./src/", "Avalonia.Input", ".dll" },
+ new [] { "./src/", "Avalonia.Input", ".xml" },
+ new [] { "./src/", "Avalonia.Interactivity", ".dll" },
+ new [] { "./src/", "Avalonia.Interactivity", ".xml" },
+ new [] { "./src/", "Avalonia.Layout", ".dll" },
+ new [] { "./src/", "Avalonia.Layout", ".xml" },
+ new [] { "./src/", "Avalonia.Logging.Serilog", ".dll" },
+ new [] { "./src/", "Avalonia.Logging.Serilog", ".xml" },
+ new [] { "./src/", "Avalonia.Visuals", ".dll" },
+ new [] { "./src/", "Avalonia.Visuals", ".xml" },
+ new [] { "./src/", "Avalonia.Styling", ".dll" },
+ new [] { "./src/", "Avalonia.Styling", ".xml" },
+ new [] { "./src/", "Avalonia.ReactiveUI", ".dll" },
+ new [] { "./src/", "Avalonia.Themes.Default", ".dll" },
+ new [] { "./src/", "Avalonia.Themes.Default", ".xml" },
+ new [] { "./src/Markup/", "Avalonia.Markup", ".dll" },
+ new [] { "./src/Markup/", "Avalonia.Markup", ".xml" },
+ new [] { "./src/Markup/", "Avalonia.Markup.Xaml", ".dll" },
+ new [] { "./src/Markup/", "Avalonia.Markup.Xaml", ".xml" }
+ };
+
+ var coreLibrariesFiles = coreLibraries.Select((lib) => {
+ return (FilePath)context.File(lib[0] + lib[1] + "/bin/" + parameters.DirSuffix + "/" + lib[1] + lib[2]);
+ }).ToList();
+
+ var coreLibrariesNuSpecContent = coreLibrariesFiles.Select((file) => {
+ return new NuSpecContent {
+ Source = file.FullPath, Target = "lib/portable-windows8+net45"
+ };
+ });
+
+ var win32CoreLibrariesNuSpecContent = coreLibrariesFiles.Select((file) => {
+ return new NuSpecContent {
+ Source = file.FullPath, Target = "lib/net45"
+ };
+ });
+
+ var netcoreappCoreLibrariesNuSpecContent = coreLibrariesFiles.Select((file) => {
+ return new NuSpecContent {
+ Source = file.FullPath, Target = "lib/netcoreapp1.0"
+ };
+ });
+
+ var net45RuntimePlatformExtensions = new [] {".xml", ".dll"};
+ var net45RuntimePlatform = net45RuntimePlatformExtensions.Select(libSuffix => {
+ return new NuSpecContent {
+ Source = ((FilePath)context.File("./src/Avalonia.DotNetFrameworkRuntime/bin/" + parameters.DirSuffix + "/Avalonia.DotNetFrameworkRuntime" + libSuffix)).FullPath,
+ Target = "lib/net45"
+ };
+ });
+
+ var netCoreRuntimePlatformExtensions = new [] {".xml", ".dll"};
+ var netCoreRuntimePlatform = netCoreRuntimePlatformExtensions.Select(libSuffix => {
+ return new NuSpecContent {
+ Source = ((FilePath)context.File("./src/Avalonia.DotNetCoreRuntime/bin/" + parameters.DirSuffix + "/Avalonia.DotNetCoreRuntime" + libSuffix)).FullPath,
+ Target = "lib/netcoreapp1.0"
+ };
+ });
+
+ var nuspecNuGetSettingsCore = new []
+ {
+ ///////////////////////////////////////////////////////////////////////////////
+ // Avalonia
+ ///////////////////////////////////////////////////////////////////////////////
+ new NuGetPackSettings()
+ {
+ Id = "Avalonia",
+ Dependencies = new []
+ {
+ new NuSpecDependency() { Id = "Serilog", Version = SerilogVersion },
+ new NuSpecDependency() { Id = "Splat", Version = SplatVersion },
+ new NuSpecDependency() { Id = "Sprache", Version = SpracheVersion },
+ new NuSpecDependency() { Id = "System.Reactive", Version = SystemReactiveVersion },
+ new NuSpecDependency() { Id = "System.Threading.ThreadPool", TargetFramework = "netcoreapp1.0", Version = "4.3.0" },
+ //.NET Core
+ new NuSpecDependency() { Id = "NETStandard.Library", TargetFramework = "netcoreapp1.0", Version = "1.6.0" },
+ new NuSpecDependency() { Id = "Microsoft.NETCore.Portable.Compatibility", TargetFramework = "netcoreapp1.0", Version = "1.0.1" },
+ new NuSpecDependency() { Id = "Splat", TargetFramework = "netcoreapp1.0", Version = "2.0.0" },
+ new NuSpecDependency() { Id = "Serilog", TargetFramework = "netcoreapp1.0", Version = "2.3.0" },
+ new NuSpecDependency() { Id = "Sprache", TargetFramework = "netcoreapp1.0", Version = SpracheVersion },
+ new NuSpecDependency() { Id = "System.Reactive", TargetFramework = "netcoreapp1.0", Version = SystemReactiveVersion }
+ },
+ Files = coreLibrariesNuSpecContent
+ .Concat(win32CoreLibrariesNuSpecContent).Concat(net45RuntimePlatform)
+ .Concat(netcoreappCoreLibrariesNuSpecContent).Concat(netCoreRuntimePlatform)
+ .ToList(),
+ BasePath = context.Directory("./"),
+ OutputDirectory = parameters.NugetRoot
+ },
+ ///////////////////////////////////////////////////////////////////////////////
+ // Avalonia.HtmlRenderer
+ ///////////////////////////////////////////////////////////////////////////////
+ new NuGetPackSettings()
+ {
+ Id = "Avalonia.HtmlRenderer",
+ Dependencies = new []
+ {
+ new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version }
+ },
+ Files = new []
+ {
+ new NuSpecContent { Source = "Avalonia.HtmlRenderer.dll", Target = "lib/portable-windows8+net45" }
+ },
+ BasePath = context.Directory("./src/Avalonia.HtmlRenderer/bin/" + parameters.DirSuffix),
+ OutputDirectory = parameters.NugetRoot
+ }
+ };
+
+ var nuspecNuGetSettingsMobile = new []
+ {
+ ///////////////////////////////////////////////////////////////////////////////
+ // Avalonia.Android
+ ///////////////////////////////////////////////////////////////////////////////
+ new NuGetPackSettings()
+ {
+ Id = "Avalonia.Android",
+ Dependencies = new []
+ {
+ new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version },
+ new NuSpecDependency() { Id = "Avalonia.Skia.Android", Version = parameters.Version }
+ },
+ Files = new []
+ {
+ new NuSpecContent { Source = "Avalonia.Android.dll", Target = "lib/MonoAndroid10" }
+ },
+ BasePath = context.Directory("./src/Android/Avalonia.Android/bin/" + parameters.DirSuffix),
+ OutputDirectory = parameters.NugetRoot
+ },
+ ///////////////////////////////////////////////////////////////////////////////
+ // Avalonia.Skia.Android
+ ///////////////////////////////////////////////////////////////////////////////
+ new NuGetPackSettings()
+ {
+ Id = "Avalonia.Skia.Android",
+ Dependencies = new []
+ {
+ new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version },
+ new NuSpecDependency() { Id = "SkiaSharp", Version = SkiaSharpVersion }
+ },
+ Files = new []
+ {
+ new NuSpecContent { Source = "Avalonia.Skia.Android.dll", Target = "lib/MonoAndroid10" }
+ },
+ BasePath = context.Directory("./src/Skia/Avalonia.Skia.Android/bin/" + parameters.DirSuffix),
+ OutputDirectory = parameters.NugetRoot
+ },
+ ///////////////////////////////////////////////////////////////////////////////
+ // Avalonia.iOS
+ ///////////////////////////////////////////////////////////////////////////////
+ new NuGetPackSettings()
+ {
+ Id = "Avalonia.iOS",
+ Dependencies = new []
+ {
+ new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version },
+ new NuSpecDependency() { Id = "Avalonia.Skia.iOS", Version = parameters.Version }
+ },
+ Files = new []
+ {
+ new NuSpecContent { Source = "Avalonia.iOS.dll", Target = "lib/Xamarin.iOS10" }
+ },
+ BasePath = context.Directory("./src/iOS/Avalonia.iOS/bin/" + parameters.DirSuffixIOS),
+ OutputDirectory = parameters.NugetRoot
+ },
+ ///////////////////////////////////////////////////////////////////////////////
+ // Avalonia.Skia.iOS
+ ///////////////////////////////////////////////////////////////////////////////
+ new NuGetPackSettings()
+ {
+ Id = "Avalonia.Skia.iOS",
+ Dependencies = new []
+ {
+ new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version },
+ new NuSpecDependency() { Id = "SkiaSharp", Version = SkiaSharpVersion }
+ },
+ Files = new []
+ {
+ new NuSpecContent { Source = "Avalonia.Skia.iOS.dll", Target = "lib/Xamarin.iOS10" }
+ },
+ BasePath = context.Directory("./src/Skia/Avalonia.Skia.iOS/bin/" + parameters.DirSuffixIOS),
+ OutputDirectory = parameters.NugetRoot
+ },
+ ///////////////////////////////////////////////////////////////////////////////
+ // Avalonia.Mobile
+ ///////////////////////////////////////////////////////////////////////////////
+ new NuGetPackSettings()
+ {
+ Id = "Avalonia.Mobile",
+ Dependencies = new []
+ {
+ new NuSpecDependency() { Id = "Avalonia.Android", Version = parameters.Version },
+ new NuSpecDependency() { Id = "Avalonia.iOS", Version = parameters.Version }
+ },
+ Files = new NuSpecContent[]
+ {
+ new NuSpecContent { Source = "licence.md", Target = "" }
+ },
+ BasePath = context.Directory("./"),
+ OutputDirectory = parameters.NugetRoot
+ }
+ };
+
+ var nuspecNuGetSettingsDesktop = new []
+ {
+ ///////////////////////////////////////////////////////////////////////////////
+ // Avalonia.Win32
+ ///////////////////////////////////////////////////////////////////////////////
+ new NuGetPackSettings()
+ {
+ Id = "Avalonia.Win32",
+ Dependencies = new []
+ {
+ new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version }
+ },
+ Files = new []
+ {
+ new NuSpecContent { Source = "Avalonia.Win32/bin/" + parameters.DirSuffix + "/Avalonia.Win32.dll", Target = "lib/net45" },
+ new NuSpecContent { Source = "Avalonia.Win32.NetStandard/bin/" + parameters.DirSuffix + "/Avalonia.Win32.dll", Target = "lib/netstandard1.1" }
+ },
+ BasePath = context.Directory("./src/Windows"),
+ OutputDirectory = parameters.NugetRoot
+ },
+ ///////////////////////////////////////////////////////////////////////////////
+ // Avalonia.Direct2D1
+ ///////////////////////////////////////////////////////////////////////////////
+ new NuGetPackSettings()
+ {
+ Id = "Avalonia.Direct2D1",
+ Dependencies = new []
+ {
+ new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version },
+ new NuSpecDependency() { Id = "SharpDX", Version = SharpDXVersion },
+ new NuSpecDependency() { Id = "SharpDX.Direct2D1", Version = SharpDXDirect2D1Version },
+ new NuSpecDependency() { Id = "SharpDX.Direct3D11", Version = SharpDXDirect3D11Version },
+ new NuSpecDependency() { Id = "SharpDX.DXGI", Version = SharpDXDXGIVersion }
+ },
+ Files = new []
+ {
+ new NuSpecContent { Source = "Avalonia.Direct2D1.dll", Target = "lib/net45" }
+ },
+ BasePath = context.Directory("./src/Windows/Avalonia.Direct2D1/bin/" + parameters.DirSuffix),
+ OutputDirectory = parameters.NugetRoot
+ },
+ ///////////////////////////////////////////////////////////////////////////////
+ // Avalonia.Gtk
+ ///////////////////////////////////////////////////////////////////////////////
+ new NuGetPackSettings()
+ {
+ Id = "Avalonia.Gtk",
+ Dependencies = new []
+ {
+ new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version }
+ },
+ Files = new []
+ {
+ new NuSpecContent { Source = "Avalonia.Gtk.dll", Target = "lib/net45" }
+ },
+ BasePath = context.Directory("./src/Gtk/Avalonia.Gtk/bin/" + parameters.DirSuffix),
+ OutputDirectory = parameters.NugetRoot
+ },
+ ///////////////////////////////////////////////////////////////////////////////
+ // Avalonia.Gtk3
+ ///////////////////////////////////////////////////////////////////////////////
+ new NuGetPackSettings()
+ {
+ Id = "Avalonia.Gtk3",
+ Dependencies = new []
+ {
+ new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version }
+ },
+ Files = new []
+ {
+ new NuSpecContent { Source = "Avalonia.Gtk3.dll", Target = "lib/netstandard1.1" }
+ },
+ BasePath = context.Directory("./src/Gtk/Avalonia.Gtk3/bin/" + parameters.DirSuffix),
+ OutputDirectory = parameters.NugetRoot
+ },
+ ///////////////////////////////////////////////////////////////////////////////
+ // Avalonia.Cairo
+ ///////////////////////////////////////////////////////////////////////////////
+ new NuGetPackSettings()
+ {
+ Id = "Avalonia.Cairo",
+ Dependencies = new []
+ {
+ new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version }
+ },
+ Files = new []
+ {
+ new NuSpecContent { Source = "Avalonia.Cairo.dll", Target = "lib/net45" }
+ },
+ BasePath = context.Directory("./src/Gtk/Avalonia.Cairo/bin/" + parameters.DirSuffix),
+ OutputDirectory = parameters.NugetRoot
+ },
+ ///////////////////////////////////////////////////////////////////////////////
+ // Avalonia.Skia.Desktop
+ ///////////////////////////////////////////////////////////////////////////////
+ new NuGetPackSettings()
+ {
+ Id = "Avalonia.Skia.Desktop",
+ Dependencies = new []
+ {
+ new NuSpecDependency() { Id = "Avalonia", Version = parameters.Version },
+ new NuSpecDependency() { Id = "SkiaSharp", Version = SkiaSharpVersion },
+ //.NET Core
+ new NuSpecDependency() { Id = "Avalonia", TargetFramework = "netcoreapp1.0", Version = parameters.Version },
+ new NuSpecDependency() { Id = "SkiaSharp", TargetFramework = "netcoreapp1.0", Version = SkiaSharpVersion },
+ new NuSpecDependency() { Id = "NETStandard.Library", TargetFramework = "netcoreapp1.0", Version = "1.6.0" },
+ new NuSpecDependency() { Id = "Microsoft.NETCore.Portable.Compatibility", TargetFramework = "netcoreapp1.0", Version = "1.0.1" }
+ },
+ Files = new []
+ {
+ new NuSpecContent { Source = "Avalonia.Skia.Desktop/bin/" + parameters.DirSuffixSkia + "/Avalonia.Skia.Desktop.dll", Target = "lib/net45" },
+ new NuSpecContent { Source = "Avalonia.Skia.Desktop.NetStandard/bin/" + parameters.DirSuffix + "/Avalonia.Skia.Desktop.dll", Target = "lib/netcoreapp1.0" }
+ },
+ BasePath = context.Directory("./src/Skia/"),
+ OutputDirectory = parameters.NugetRoot
+ },
+ ///////////////////////////////////////////////////////////////////////////////
+ // Avalonia.Desktop
+ ///////////////////////////////////////////////////////////////////////////////
+ new NuGetPackSettings()
+ {
+ Id = "Avalonia.Desktop",
+ Dependencies = new []
+ {
+ new NuSpecDependency() { Id = "Avalonia.Win32", Version = parameters.Version },
+ new NuSpecDependency() { Id = "Avalonia.Direct2D1", Version = parameters.Version },
+ new NuSpecDependency() { Id = "Avalonia.Gtk", Version = parameters.Version },
+ new NuSpecDependency() { Id = "Avalonia.Cairo", Version = parameters.Version },
+ new NuSpecDependency() { Id = "Avalonia.Skia.Desktop", Version = parameters.Version }
+ },
+ Files = new NuSpecContent[]
+ {
+ new NuSpecContent { Source = "licence.md", Target = "" }
+ },
+ BasePath = context.Directory("./"),
+ OutputDirectory = parameters.NugetRoot
+ }
+ };
+
+ NuspecNuGetSettings = new List();
+
+ NuspecNuGetSettings.AddRange(nuspecNuGetSettingsCore);
+ NuspecNuGetSettings.AddRange(nuspecNuGetSettingsDesktop);
+ NuspecNuGetSettings.AddRange(nuspecNuGetSettingsMobile);
+
+ NuspecNuGetSettings.ForEach((nuspec) => SetNuGetNuspecCommonProperties(nuspec));
+
+ NugetPackages = NuspecNuGetSettings.Select(nuspec => {
+ return nuspec.OutputDirectory.CombineWithFilePath(string.Concat(nuspec.Id, ".", nuspec.Version, ".nupkg"));
+ }).ToArray();
+
+ BinFiles = NuspecNuGetSettings.SelectMany(nuspec => {
+ return nuspec.Files.Select(file => {
+ return ((DirectoryPath)nuspec.BasePath).CombineWithFilePath(file.Source);
+ });
+ }).GroupBy(f => f.FullPath).Select(g => g.First()).ToArray();
+ }
+}
diff --git a/parameters.cake b/parameters.cake
new file mode 100644
index 0000000000..4a7270011c
--- /dev/null
+++ b/parameters.cake
@@ -0,0 +1,143 @@
+public class Parameters
+{
+ public string Target { get; private set; }
+ public string Platform { get; private set; }
+ public string Configuration { get; private set; }
+ public bool SkipTests { get; private set; }
+ public string MainRepo { get; private set; }
+ public string MasterBranch { get; private set; }
+ public string AssemblyInfoPath { get; private set; }
+ public string ReleasePlatform { get; private set; }
+ public string ReleaseConfiguration { get; private set; }
+ public string MSBuildSolution { get; private set; }
+ public string XBuildSolution { get; private set; }
+ public bool IsPlatformAnyCPU { get; private set; }
+ public bool IsPlatformX86 { get; private set; }
+ public bool IsPlatformX64 { get; private set; }
+ public bool IsLocalBuild { get; private set; }
+ public bool IsRunningOnUnix { get; private set; }
+ public bool IsRunningOnWindows { get; private set; }
+ public bool IsRunningOnAppVeyor { get; private set; }
+ public bool IsPullRequest { get; private set; }
+ public bool IsMainRepo { get; private set; }
+ public bool IsMasterBranch { get; private set; }
+ public bool IsTagged { get; private set; }
+ public bool IsReleasable { get; private set; }
+ public bool IsMyGetRelease { get; private set; }
+ public bool IsNuGetRelease { get; private set; }
+ public string Version { get; private set; }
+ public DirectoryPath ArtifactsDir { get; private set; }
+ public DirectoryPath NugetRoot { get; private set; }
+ public DirectoryPath ZipRoot { get; private set; }
+ public DirectoryPath BinRoot { get; private set; }
+ public DirectoryPath TestsRoot { get; private set; }
+ public string DirSuffix { get; private set; }
+ public string DirSuffixSkia { get; private set; }
+ public string DirSuffixIOS { get; private set; }
+ public DirectoryPathCollection BuildDirs { get; private set; }
+ public string FileZipSuffix { get; private set; }
+ public FilePath ZipCoreArtifacts { get; private set; }
+ public DirectoryPath ZipSourceControlCatalogDesktopDirs { get; private set; }
+ public FilePath ZipTargetControlCatalogDesktopDirs { get; private set; }
+
+ public Parameters(ICakeContext context)
+ {
+ var buildSystem = context.BuildSystem();
+
+ // ARGUMENTS
+ Target = context.Argument("target", "Default");
+ Platform = context.Argument("platform", "Any CPU");
+ Configuration = context.Argument("configuration", "Release");
+ SkipTests = context.HasArgument("skip-tests");
+
+ // CONFIGURATION
+ MainRepo = "AvaloniaUI/Avalonia";
+ MasterBranch = "master";
+ AssemblyInfoPath = context.File("./src/Shared/SharedAssemblyInfo.cs");
+ ReleasePlatform = "Any CPU";
+ ReleaseConfiguration = "Release";
+ MSBuildSolution = "./Avalonia.sln";
+ XBuildSolution = "./Avalonia.XBuild.sln";
+
+ // PARAMETERS
+ IsPlatformAnyCPU = StringComparer.OrdinalIgnoreCase.Equals(Platform, "Any CPU");
+ IsPlatformX86 = StringComparer.OrdinalIgnoreCase.Equals(Platform, "x86");
+ IsPlatformX64 = StringComparer.OrdinalIgnoreCase.Equals(Platform, "x64");
+ IsLocalBuild = buildSystem.IsLocalBuild;
+ IsRunningOnUnix = context.IsRunningOnUnix();
+ IsRunningOnWindows = context.IsRunningOnWindows();
+ IsRunningOnAppVeyor = buildSystem.AppVeyor.IsRunningOnAppVeyor;
+ IsPullRequest = buildSystem.AppVeyor.Environment.PullRequest.IsPullRequest;
+ IsMainRepo = StringComparer.OrdinalIgnoreCase.Equals(MainRepo, buildSystem.AppVeyor.Environment.Repository.Name);
+ IsMasterBranch = StringComparer.OrdinalIgnoreCase.Equals(MasterBranch, buildSystem.AppVeyor.Environment.Repository.Branch);
+ IsTagged = buildSystem.AppVeyor.Environment.Repository.Tag.IsTag
+ && !string.IsNullOrWhiteSpace(buildSystem.AppVeyor.Environment.Repository.Tag.Name);
+ IsReleasable = StringComparer.OrdinalIgnoreCase.Equals(ReleasePlatform, Platform)
+ && StringComparer.OrdinalIgnoreCase.Equals(ReleaseConfiguration, Configuration);
+ IsMyGetRelease = !IsTagged && IsReleasable;
+ IsNuGetRelease = IsTagged && IsReleasable;
+
+ // VERSION
+ Version = context.Argument("force-nuget-version", context.ParseAssemblyInfo(AssemblyInfoPath).AssemblyVersion);
+
+ if (IsRunningOnAppVeyor)
+ {
+ if (IsTagged)
+ {
+ // Use Tag Name as version
+ Version = buildSystem.AppVeyor.Environment.Repository.Tag.Name;
+ }
+ else
+ {
+ // Use AssemblyVersion with Build as version
+ Version += "-build" + context.EnvironmentVariable("APPVEYOR_BUILD_NUMBER") + "-alpha";
+ }
+ }
+
+ // DIRECTORIES
+ ArtifactsDir = (DirectoryPath)context.Directory("./artifacts");
+ NugetRoot = ArtifactsDir.Combine("nuget");
+ ZipRoot = ArtifactsDir.Combine("zip");
+ BinRoot = ArtifactsDir.Combine("bin");
+ TestsRoot = ArtifactsDir.Combine("tests");
+
+ DirSuffix = Configuration;
+ DirSuffixSkia = (IsPlatformAnyCPU ? "x86" : Platform) + "/" + Configuration;
+ DirSuffixIOS = "iPhone" + "/" + Configuration;
+
+ BuildDirs =
+ context.GetDirectories("./src/**/bin/" + DirSuffix) +
+ context.GetDirectories("./src/**/obj/" + DirSuffix) +
+ context.GetDirectories("./src/Markup/**/bin/" + DirSuffix) +
+ context.GetDirectories("./src/Markup/**/obj/" + DirSuffix) +
+ context.GetDirectories("./src/Android/**/bin/" + DirSuffix) +
+ context.GetDirectories("./src/Android/**/obj/" + DirSuffix) +
+ context.GetDirectories("./src/Gtk/**/bin/" + DirSuffix) +
+ context.GetDirectories("./src/Gtk/**/obj/" + DirSuffix) +
+ context.GetDirectories("./src/iOS/**/bin/" + DirSuffixIOS) +
+ context.GetDirectories("./src/iOS/**/obj/" + DirSuffixIOS) +
+ (DirectoryPath)context.Directory("./src/Skia/Avalonia.Skia.Android/bin/" + DirSuffix) +
+ (DirectoryPath)context.Directory("./src/Skia/Avalonia.Skia.Android/obj/" + DirSuffix) +
+ (DirectoryPath)context.Directory("./src/Skia/Avalonia.Skia.Android.TestApp/bin/" + DirSuffix) +
+ (DirectoryPath)context.Directory("./src/Skia/Avalonia.Skia.Android.TestApp/obj/" + DirSuffix) +
+ (DirectoryPath)context.Directory("./src/Skia/Avalonia.Skia.Desktop/bin/" + DirSuffixSkia) +
+ (DirectoryPath)context.Directory("./src/Skia/Avalonia.Skia.Desktop/obj/" + DirSuffixSkia) +
+ (DirectoryPath)context.Directory("./src/Skia/Avalonia.Skia.Desktop.NetStandard/bin/" + DirSuffix) +
+ (DirectoryPath)context.Directory("./src/Skia/Avalonia.Skia.Desktop.NetStandard/obj/" + DirSuffix) +
+ (DirectoryPath)context.Directory("./src/Skia/Avalonia.Skia.iOS/bin/" + DirSuffixIOS) +
+ (DirectoryPath)context.Directory("./src/Skia/Avalonia.Skia.iOS/obj/" + DirSuffixIOS) +
+ (DirectoryPath)context.Directory("./src/Skia/Avalonia.Skia.iOS.TestApp/bin/" + DirSuffixIOS) +
+ (DirectoryPath)context.Directory("./src/Skia/Avalonia.Skia.iOS.TestApp/obj/" + DirSuffixIOS) +
+ context.GetDirectories("./src/Windows/**/bin/" + DirSuffix) +
+ context.GetDirectories("./src/Windows/**/obj/" + DirSuffix) +
+ context.GetDirectories("./tests/**/bin/" + DirSuffix) +
+ context.GetDirectories("./tests/**/obj/" + DirSuffix) +
+ context.GetDirectories("./Samples/**/bin/" + DirSuffix) +
+ context.GetDirectories("./Samples/**/obj/" + DirSuffix);
+
+ FileZipSuffix = Version + ".zip";
+ ZipCoreArtifacts = ZipRoot.CombineWithFilePath("Avalonia-" + FileZipSuffix);
+ ZipSourceControlCatalogDesktopDirs = (DirectoryPath)context.Directory("./samples/ControlCatalog.Desktop/bin/" + DirSuffix);
+ ZipTargetControlCatalogDesktopDirs = ZipRoot.CombineWithFilePath("ControlCatalog.Desktop-" + FileZipSuffix);
+ }
+}
diff --git a/samples/ControlCatalog.Android/ControlCatalog.Android.csproj b/samples/ControlCatalog.Android/ControlCatalog.Android.csproj
index 5b39aa3dfb..41d6329d26 100644
--- a/samples/ControlCatalog.Android/ControlCatalog.Android.csproj
+++ b/samples/ControlCatalog.Android/ControlCatalog.Android.csproj
@@ -29,12 +29,15 @@
4
True
None
- False
+ True
False
False
- armeabi,armeabi-v7a,x86
+ armeabi;armeabi-v7a;x86
Xamarin
False
+ False
+ False
+ False
pdbonly
@@ -109,10 +112,6 @@
{7062ae20-5dcc-4442-9645-8195bdece63e}
Avalonia.Diagnostics
-
- {4a1abb09-9047-4bd5-a4ad-a055e52c5ee0}
- Avalonia.DotNetFrameworkRuntime
-
{5fb2b005-0a7f-4dad-add4-3ed01444e63d}
Avalonia.HtmlRenderer
diff --git a/samples/ControlCatalog.Android/MainActivity.cs b/samples/ControlCatalog.Android/MainActivity.cs
index 3f357b0e70..157609088f 100644
--- a/samples/ControlCatalog.Android/MainActivity.cs
+++ b/samples/ControlCatalog.Android/MainActivity.cs
@@ -1,9 +1,8 @@
using System;
using Android.App;
-
using Android.OS;
using Android.Content.PM;
-using Avalonia.Android.Platform.Specific;
+using Avalonia.Android;
using Avalonia.Controls;
using Avalonia.Controls.Templates;
using Avalonia.Markup.Xaml;
@@ -17,29 +16,16 @@ namespace ControlCatalog.Android
[Activity(Label = "ControlCatalog.Android", MainLauncher = true, Icon = "@drawable/icon", LaunchMode = LaunchMode.SingleInstance)]
public class MainActivity : AvaloniaActivity
{
- public MainActivity() : base(typeof (App))
- {
-
- }
-
protected override void OnCreate(Bundle savedInstanceState)
{
- base.OnCreate(savedInstanceState);
-
- App app;
- if (Avalonia.Application.Current != null)
- app = (App)Avalonia.Application.Current;
- else
+ if (Avalonia.Application.Current == null)
{
- app = new App();
- AppBuilder.Configure(app)
+ AppBuilder.Configure(new App())
.UseAndroid()
- .UseSkia()
.SetupWithoutStarting();
+ Content = new MainView();
}
-
- var mainWindow = new MainWindow();
- app.Run(mainWindow);
+ base.OnCreate(savedInstanceState);
}
}
}
diff --git a/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj b/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj
index 53cb277233..ca5743dd5c 100644
--- a/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj
+++ b/samples/ControlCatalog.Desktop/ControlCatalog.Desktop.csproj
@@ -33,6 +33,9 @@
prompt
4
+
+
+
..\..\packages\Serilog.1.5.14\lib\net45\Serilog.dll
@@ -72,6 +75,10 @@
{FB05AC90-89BA-4F2F-A924-F37875FB547C}
Avalonia.Cairo
+
+ {bb1f7bb5-6ad4-4776-94d9-c09d0a972658}
+ Avalonia.Gtk3
+
{54F237D5-A70A-4752-9656-0C70B1A7B047}
Avalonia.Gtk
diff --git a/samples/ControlCatalog.iOS/AppDelegate.cs b/samples/ControlCatalog.iOS/AppDelegate.cs
index 1871facf55..a8fc6b30a0 100644
--- a/samples/ControlCatalog.iOS/AppDelegate.cs
+++ b/samples/ControlCatalog.iOS/AppDelegate.cs
@@ -2,6 +2,8 @@ using Foundation;
using UIKit;
using Avalonia;
using Avalonia.Controls;
+using Avalonia.iOS;
+using Avalonia.Media;
namespace ControlCatalog
{
@@ -11,6 +13,8 @@ namespace ControlCatalog
[Register("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
+ public override UIWindow Window { get; set; }
+
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
@@ -22,10 +26,9 @@ namespace ControlCatalog
{
AppBuilder.Configure()
.UseiOS()
- .UseSkiaViewHost()
- .UseSkia()
- .Start();
-
+ .UseSkia().SetupWithoutStarting();
+ Window = new AvaloniaWindow() {Content = new MainView(), StatusBarColor = Colors.LightSteelBlue};
+ Window.MakeKeyAndVisible();
return true;
}
}
diff --git a/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj b/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj
index 1c4d31b62c..d0c73b2553 100644
--- a/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj
+++ b/samples/ControlCatalog.iOS/ControlCatalog.iOS.csproj
@@ -20,8 +20,21 @@
4
false
i386
- None
- true
+ SdkOnly
+ True
+ 9.1
+ False
+ False
+ False
+ False
+ False
+ False
+ False
+ False
+ True
+ Default
+ HttpClientHandler
+ False
none
diff --git a/samples/ControlCatalog/Pages/ImagePage.xaml b/samples/ControlCatalog/Pages/ImagePage.xaml
index 1aaedc4420..dc93808f27 100644
--- a/samples/ControlCatalog/Pages/ImagePage.xaml
+++ b/samples/ControlCatalog/Pages/ImagePage.xaml
@@ -34,6 +34,10 @@
Width="100" Height="200"
Stretch="UniformToFill"/>
-
+
+
+ Window Icon as an Image
+
+
\ No newline at end of file
diff --git a/samples/ControlCatalog/Pages/ImagePage.xaml.cs b/samples/ControlCatalog/Pages/ImagePage.xaml.cs
index cc35b4d237..792b25963e 100644
--- a/samples/ControlCatalog/Pages/ImagePage.xaml.cs
+++ b/samples/ControlCatalog/Pages/ImagePage.xaml.cs
@@ -1,10 +1,14 @@
+using System.IO;
+using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
+using Avalonia.Media.Imaging;
namespace ControlCatalog.Pages
{
public class ImagePage : UserControl
{
+ private Image iconImage;
public ImagePage()
{
this.InitializeComponent();
@@ -13,6 +17,25 @@ namespace ControlCatalog.Pages
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
+ iconImage = this.Get("Icon");
+ }
+
+ protected override void OnAttachedToVisualTree(VisualTreeAttachmentEventArgs e)
+ {
+ base.OnAttachedToVisualTree(e);
+ if (iconImage.Source == null)
+ {
+ var windowRoot = e.Root as Window;
+ if (windowRoot != null)
+ {
+ using (var stream = new MemoryStream())
+ {
+ windowRoot.Icon.Save(stream);
+ stream.Seek(0, SeekOrigin.Begin);
+ iconImage.Source = new Bitmap(stream);
+ }
+ }
+ }
}
}
}
diff --git a/samples/ControlCatalog/Pages/TreeViewPage.xaml.cs b/samples/ControlCatalog/Pages/TreeViewPage.xaml.cs
index a630b90dbd..a83f9cf43f 100644
--- a/samples/ControlCatalog/Pages/TreeViewPage.xaml.cs
+++ b/samples/ControlCatalog/Pages/TreeViewPage.xaml.cs
@@ -11,7 +11,7 @@ namespace ControlCatalog.Pages
public TreeViewPage()
{
this.InitializeComponent();
- DataContext = CreateNodes(0);
+ DataContext = new Node().Children;
}
private void InitializeComponent()
@@ -19,19 +19,22 @@ namespace ControlCatalog.Pages
AvaloniaXamlLoader.Load(this);
}
- private IList CreateNodes(int level)
+ public class Node
{
- return Enumerable.Range(0, 10).Select(x => new Node
+ private IList _children;
+ public string Header { get; private set; }
+ public IList Children
{
- Header = $"Item {x}",
- Children = level < 5 ? CreateNodes(level + 1) : null,
- }).ToList();
- }
-
- private class Node
- {
- public string Header { get; set; }
- public IList Children { get; set; }
+ get
+ {
+ if (_children == null)
+ {
+ _children = Enumerable.Range(1, 10).Select(i => new Node() {Header = $"Item {i}"})
+ .ToArray();
+ }
+ return _children;
+ }
+ }
}
}
}
diff --git a/src/Android/Avalonia.Android/ActivityTracker.cs b/src/Android/Avalonia.Android/ActivityTracker.cs
new file mode 100644
index 0000000000..2ad1d9e361
--- /dev/null
+++ b/src/Android/Avalonia.Android/ActivityTracker.cs
@@ -0,0 +1,47 @@
+using Android.App;
+using Android.OS;
+
+namespace Avalonia.Android
+{
+ internal class ActivityTracker : Java.Lang.Object, global::Android.App.Application.IActivityLifecycleCallbacks
+ {
+ public static Activity Current { get; private set; }
+ public void OnActivityCreated(Activity activity, Bundle savedInstanceState)
+ {
+ Current = activity;
+ }
+
+ public void OnActivityDestroyed(Activity activity)
+ {
+ if (Current == activity)
+ Current = null;
+ }
+
+ public void OnActivityPaused(Activity activity)
+ {
+ if (Current == activity)
+ Current = null;
+ }
+
+ public void OnActivityResumed(Activity activity)
+ {
+ Current = activity;
+ }
+
+ public void OnActivitySaveInstanceState(Activity activity, Bundle outState)
+ {
+ Current = activity;
+ }
+
+ public void OnActivityStarted(Activity activity)
+ {
+ Current = activity;
+ }
+
+ public void OnActivityStopped(Activity activity)
+ {
+ if (Current == activity)
+ Current = null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Android/Avalonia.Android/AndroidPlatform.cs b/src/Android/Avalonia.Android/AndroidPlatform.cs
index afaa314e6c..2089359c26 100644
--- a/src/Android/Avalonia.Android/AndroidPlatform.cs
+++ b/src/Android/Avalonia.Android/AndroidPlatform.cs
@@ -1,5 +1,8 @@
using System;
using System.IO;
+using System.Linq;
+using Android.Content;
+using Android.Views;
using Avalonia.Android.Platform;
using Avalonia.Android.Platform.Input;
using Avalonia.Android.Platform.SkiaPlatform;
@@ -8,6 +11,7 @@ using Avalonia.Controls.Platform;
using Avalonia.Input;
using Avalonia.Input.Platform;
using Avalonia.Platform;
+using Avalonia.Rendering;
using Avalonia.Shared.PlatformSupport;
using Avalonia.Skia;
@@ -17,7 +21,8 @@ namespace Avalonia
{
public static T UseAndroid(this T builder) where T : AppBuilderBase, new()
{
- builder.UseWindowingSubsystem(Android.AndroidPlatform.Initialize, "Android");
+ builder.UseWindowingSubsystem(() => Android.AndroidPlatform.Initialize(builder.Instance), "Android");
+ builder.UseSkia();
return builder;
}
}
@@ -25,7 +30,7 @@ namespace Avalonia
namespace Avalonia.Android
{
- public class AndroidPlatform : IPlatformSettings, IWindowingPlatform
+ class AndroidPlatform : IPlatformSettings, IWindowingPlatform
{
public static readonly AndroidPlatform Instance = new AndroidPlatform();
public Size DoubleClickSize => new Size(4, 4);
@@ -40,7 +45,7 @@ namespace Avalonia.Android
_scalingFactor = global::Android.App.Application.Context.Resources.DisplayMetrics.ScaledDensity;
}
- public static void Initialize()
+ public static void Initialize(Avalonia.Application app)
{
AvaloniaLocator.CurrentMutable
.Bind().ToTransient()
@@ -51,29 +56,29 @@ namespace Avalonia.Android
.Bind().ToConstant(new AndroidThreadingInterface())
.Bind().ToTransient()
.Bind().ToConstant(Instance)
- .Bind().ToSingleton();
+ .Bind().ToSingleton()
+ .Bind().ToConstant(new DefaultRenderLoop(60))
- SkiaPlatform.Initialize();
- }
+ .Bind().ToConstant(new AssetLoader(app.GetType().Assembly));
- public void Init(Type applicationType)
- {
- StandardRuntimePlatformServices.Register(applicationType.Assembly);
+ SkiaPlatform.Initialize();
+ ((global::Android.App.Application) global::Android.App.Application.Context.ApplicationContext)
+ .RegisterActivityLifecycleCallbacks(new ActivityTracker());
}
public IWindowImpl CreateWindow()
{
- return new WindowImpl();
+ throw new NotSupportedException();
}
public IEmbeddableWindowImpl CreateEmbeddableWindow()
{
- throw new NotImplementedException();
+ throw new NotSupportedException();
}
public IPopupImpl CreatePopup()
{
- throw new NotImplementedException();
+ return new PopupImpl();
}
}
}
\ No newline at end of file
diff --git a/src/Android/Avalonia.Android/AndroidThreadingInterface.cs b/src/Android/Avalonia.Android/AndroidThreadingInterface.cs
index b4059e3114..6327be12a5 100644
--- a/src/Android/Avalonia.Android/AndroidThreadingInterface.cs
+++ b/src/Android/Avalonia.Android/AndroidThreadingInterface.cs
@@ -51,10 +51,16 @@ namespace Avalonia.Android
scheduled = true;
EnsureInvokeOnMainThread(() =>
{
- tick();
- lock (l)
+ try
{
- scheduled = false;
+ tick();
+ }
+ finally
+ {
+ lock (l)
+ {
+ scheduled = false;
+ }
}
});
}
diff --git a/src/Android/Avalonia.Android/AppBuilder.cs b/src/Android/Avalonia.Android/AppBuilder.cs
new file mode 100644
index 0000000000..6078e3bb98
--- /dev/null
+++ b/src/Android/Avalonia.Android/AppBuilder.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using Android.App;
+using Android.Content;
+using Android.OS;
+using Android.Runtime;
+using Android.Views;
+using Android.Widget;
+using Avalonia.Controls;
+using Avalonia.Platform;
+using Avalonia.Shared.PlatformSupport;
+
+namespace Avalonia
+{
+ public sealed class AppBuilder : AppBuilderBase
+ {
+ public AppBuilder() : base(new StandardRuntimePlatform(),
+ builder => StandardRuntimePlatformServices.Register(builder.Instance?.GetType()?.Assembly))
+ {
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Android/Avalonia.Android/Avalonia.Android.csproj b/src/Android/Avalonia.Android/Avalonia.Android.csproj
index 654cb13678..3ee2f5af64 100644
--- a/src/Android/Avalonia.Android/Avalonia.Android.csproj
+++ b/src/Android/Avalonia.Android/Avalonia.Android.csproj
@@ -61,18 +61,22 @@
+
+
+
+
-
-
+
+
+
+
-
-
diff --git a/src/Android/Avalonia.Android/AvaloniaActivity.cs b/src/Android/Avalonia.Android/AvaloniaActivity.cs
new file mode 100644
index 0000000000..21ce555086
--- /dev/null
+++ b/src/Android/Avalonia.Android/AvaloniaActivity.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using Android.App;
+using Android.Content;
+using Android.OS;
+using Android.Runtime;
+using Android.Views;
+using Android.Widget;
+
+namespace Avalonia.Android
+{
+ public abstract class AvaloniaActivity : Activity
+ {
+
+ internal AvaloniaView View;
+ object _content;
+
+ protected override void OnCreate(Bundle savedInstanceState)
+ {
+ RequestWindowFeature(WindowFeatures.NoTitle);
+ View = new AvaloniaView(this);
+ if(_content != null)
+ View.Content = _content;
+ SetContentView(View);
+ TakeKeyEvents(true);
+ base.OnCreate(savedInstanceState);
+ }
+
+ public object Content
+ {
+ get
+ {
+ return _content;
+ }
+ set
+ {
+ _content = value;
+ if (View != null)
+ View.Content = value;
+ }
+ }
+
+ public override bool DispatchKeyEvent(KeyEvent e)
+ {
+ return View.DispatchKeyEvent(e);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Android/Avalonia.Android/AvaloniaView.cs b/src/Android/Avalonia.Android/AvaloniaView.cs
new file mode 100644
index 0000000000..6c4274a6e4
--- /dev/null
+++ b/src/Android/Avalonia.Android/AvaloniaView.cs
@@ -0,0 +1,69 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using Android.App;
+using Android.Content;
+using Android.OS;
+using Android.Runtime;
+using Android.Views;
+using Android.Widget;
+using Avalonia.Android.Platform.SkiaPlatform;
+using Avalonia.Controls;
+using Avalonia.Controls.Embedding;
+using Avalonia.Platform;
+
+namespace Avalonia.Android
+{
+ public class AvaloniaView : FrameLayout
+ {
+ private readonly EmbeddableControlRoot _root;
+ private readonly ViewImpl _view;
+
+ public AvaloniaView(Context context) : base(context)
+ {
+ _view = new ViewImpl(context);
+ AddView(_view.View);
+ _root = new EmbeddableControlRoot(_view);
+ _root.Prepare();
+ }
+
+ public object Content
+ {
+ get { return _root.Content; }
+ set { _root.Content = value; }
+ }
+
+ public override bool DispatchKeyEvent(KeyEvent e)
+ {
+ return _view.View.DispatchKeyEvent(e);
+ }
+
+ class ViewImpl : TopLevelImpl, IEmbeddableWindowImpl
+ {
+ public event Action LostFocus;
+
+ public ViewImpl(Context context) : base(context)
+ {
+ View.Focusable = true;
+ View.FocusChange += ViewImpl_FocusChange;
+ }
+
+ private void ViewImpl_FocusChange(object sender, FocusChangeEventArgs e)
+ {
+ if(!e.HasFocus)
+ LostFocus?.Invoke();
+ }
+
+ protected override void OnResized(Size size)
+ {
+ MaxClientSize = size;
+ base.OnResized(size);
+ }
+
+ public WindowState WindowState { get; set; }
+ public IDisposable ShowDialog() => null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Android/Avalonia.Android/Platform/SkiaPlatform/AndroidFramebuffer.cs b/src/Android/Avalonia.Android/Platform/SkiaPlatform/AndroidFramebuffer.cs
new file mode 100644
index 0000000000..55e729f5a2
--- /dev/null
+++ b/src/Android/Avalonia.Android/Platform/SkiaPlatform/AndroidFramebuffer.cs
@@ -0,0 +1,105 @@
+using System;
+using System.Runtime.InteropServices;
+using Android.Runtime;
+using Android.Views;
+using Avalonia.Controls.Platform.Surfaces;
+
+namespace Avalonia.Android.Platform.SkiaPlatform
+{
+ class AndroidFramebuffer : ILockedFramebuffer
+ {
+ private IntPtr _window;
+
+ public AndroidFramebuffer(Surface surface)
+ {
+ if(surface == null)
+ throw new ArgumentNullException(nameof(surface));
+ _window = ANativeWindow_fromSurface(JNIEnv.Handle, surface.Handle);
+ if (_window == IntPtr.Zero)
+ throw new Exception("Unable to obtain ANativeWindow");
+ ANativeWindow_Buffer buffer;
+ var rc = new ARect()
+ {
+ right = Width = ANativeWindow_getWidth(_window),
+ bottom = Height = ANativeWindow_getHeight(_window)
+ };
+ ANativeWindow_lock(_window, out buffer, ref rc);
+
+ Format = buffer.format == AndroidPixelFormat.WINDOW_FORMAT_RGB_565
+ ? PixelFormat.Rgb565 : PixelFormat.Rgba8888;
+
+ RowBytes = buffer.stride * (Format == PixelFormat.Rgb565 ? 2 : 4);
+ Address = buffer.bits;
+ }
+
+ public void Dispose()
+ {
+ ANativeWindow_unlockAndPost(_window);
+ ANativeWindow_release(_window);
+ _window = IntPtr.Zero;
+ Address = IntPtr.Zero;
+ }
+
+ public IntPtr Address { get; set; }
+ public int Width { get; }
+ public int Height { get; }
+ public int RowBytes { get; }
+ public Size Dpi { get; } = new Size(96, 96);
+ public PixelFormat Format { get; }
+
+ [DllImport("android")]
+ internal static extern IntPtr ANativeWindow_fromSurface(IntPtr jniEnv, IntPtr handle);
+ [DllImport("android")]
+ internal static extern int ANativeWindow_getWidth(IntPtr window);
+ [DllImport("android")]
+ internal static extern int ANativeWindow_getHeight(IntPtr window);
+ [DllImport("android")]
+ internal static extern void ANativeWindow_release(IntPtr window);
+ [DllImport("android")]
+ internal static extern void ANativeWindow_unlockAndPost(IntPtr window);
+
+ [DllImport("android")]
+ internal static extern int ANativeWindow_lock(IntPtr window, out ANativeWindow_Buffer outBuffer, ref ARect inOutDirtyBounds);
+ public enum AndroidPixelFormat
+ {
+ WINDOW_FORMAT_RGBA_8888 = 1,
+ WINDOW_FORMAT_RGBX_8888 = 2,
+ WINDOW_FORMAT_RGB_565 = 4,
+ }
+
+ internal struct ARect
+ {
+ public int left;
+ public int top;
+ public int right;
+ public int bottom;
+ }
+
+ internal struct ANativeWindow_Buffer
+ {
+ // The number of pixels that are show horizontally.
+ public int width;
+
+ // The number of pixels that are shown vertically.
+ public int height;
+
+ // The number of *pixels* that a line in the buffer takes in
+ // memory. This may be >= width.
+ public int stride;
+
+ // The format of the buffer. One of WINDOW_FORMAT_*
+ public AndroidPixelFormat format;
+
+ // The actual bits.
+ public IntPtr bits;
+
+ // Do not touch.
+ uint reserved1;
+ uint reserved2;
+ uint reserved3;
+ uint reserved4;
+ uint reserved5;
+ uint reserved6;
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Skia/Avalonia.Skia.Android/SkiaView.cs b/src/Android/Avalonia.Android/Platform/SkiaPlatform/InvalidationAwareSurfaceView.cs
similarity index 76%
rename from src/Skia/Avalonia.Skia.Android/SkiaView.cs
rename to src/Android/Avalonia.Android/Platform/SkiaPlatform/InvalidationAwareSurfaceView.cs
index a45a80cf18..d2d5909815 100644
--- a/src/Skia/Avalonia.Skia.Android/SkiaView.cs
+++ b/src/Android/Avalonia.Android/Platform/SkiaPlatform/InvalidationAwareSurfaceView.cs
@@ -14,18 +14,17 @@ using Android.Widget;
using Avalonia.Media;
using Avalonia.Platform;
-namespace Avalonia.Skia.Android
+namespace Avalonia.Android
{
- public abstract class SkiaView : SurfaceView, ISurfaceHolderCallback, IPlatformHandle
+ public abstract class InvalidationAwareSurfaceView : SurfaceView, ISurfaceHolderCallback, IPlatformHandle
{
- private readonly Activity _context;
bool _invalidateQueued;
readonly object _lock = new object();
private readonly Handler _handler;
+
- public SkiaView(Activity context) : base(context)
+ public InvalidationAwareSurfaceView(Context context) : base(context)
{
- _context = context;
Holder.AddCallback(this);
_handler = new Handler(context.MainLooper);
}
@@ -38,13 +37,11 @@ namespace Avalonia.Skia.Android
return;
_handler.Post(() =>
{
- lock (_lock)
- {
- _invalidateQueued = false;
- }
+ if (Holder.Surface?.IsValid != true)
+ return;
try
{
- Draw();
+ DoDraw();
}
catch (Exception e)
{
@@ -67,20 +64,29 @@ namespace Avalonia.Skia.Android
public void SurfaceChanged(ISurfaceHolder holder, Format format, int width, int height)
{
Log.Info("AVALONIA", "Surface Changed");
- Draw();
+ DoDraw();
}
public void SurfaceCreated(ISurfaceHolder holder)
{
Log.Info("AVALONIA", "Surface Created");
- Draw();
+ DoDraw();
}
public void SurfaceDestroyed(ISurfaceHolder holder)
{
Log.Info("AVALONIA", "Surface Destroyed");
+
}
+ protected void DoDraw()
+ {
+ lock (_lock)
+ {
+ _invalidateQueued = false;
+ }
+ Draw();
+ }
protected abstract void Draw();
public string HandleDescriptor => "SurfaceView";
}
diff --git a/src/Android/Avalonia.Android/Platform/SkiaPlatform/MainWindowImpl.cs b/src/Android/Avalonia.Android/Platform/SkiaPlatform/MainWindowImpl.cs
deleted file mode 100644
index 690c509b53..0000000000
--- a/src/Android/Avalonia.Android/Platform/SkiaPlatform/MainWindowImpl.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using Android.Views;
-using Avalonia.Android.Platform.Specific;
-using Avalonia.Controls;
-using Avalonia.Input;
-using Avalonia.Platform;
-
-namespace Avalonia.Android.Platform.SkiaPlatform
-{
- public class MainWindowImpl :
- WindowImpl
- , IWindowImpl
- {
- public MainWindowImpl()
- {
- }
-
- public new WindowState WindowState
- {
- get { return WindowState.Normal; }
- set { }
- }
-
- protected override void Init()
- {
- base.Init();
-
- HandleEvents = true;
- _keyboardHelper.ActivateAutoShowKeybord();
- }
-
- void ITopLevelImpl.Show()
- {
- (Parent as ViewGroup)?.RemoveAllViews();
- AvaloniaLocator.Current.GetService().ContentView = this;
- //this.Visibility = ViewStates.Visible;
- }
-
- void ITopLevelImpl.SetInputRoot(IInputRoot inputRoot)
- {
- base.SetInputRoot(inputRoot);
- _keyboardHelper.UpdateKeyboardState(inputRoot);
- }
- }
-}
\ No newline at end of file
diff --git a/src/Android/Avalonia.Android/Platform/SkiaPlatform/PopupImpl.cs b/src/Android/Avalonia.Android/Platform/SkiaPlatform/PopupImpl.cs
new file mode 100644
index 0000000000..e39ba2c121
--- /dev/null
+++ b/src/Android/Avalonia.Android/Platform/SkiaPlatform/PopupImpl.cs
@@ -0,0 +1,91 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+using Android.App;
+using Android.Content;
+using Android.Graphics;
+using Android.OS;
+using Android.Runtime;
+using Android.Views;
+using Android.Widget;
+using Avalonia.Platform;
+
+namespace Avalonia.Android.Platform.SkiaPlatform
+{
+ class PopupImpl : TopLevelImpl, IPopupImpl
+ {
+ private Point _position;
+ private bool _isAdded;
+ public PopupImpl() : base(ActivityTracker.Current, true)
+ {
+ }
+
+ private Size _clientSize = new Size(1, 1);
+ public override Size ClientSize
+ {
+ get { return base.ClientSize; }
+ set
+ {
+ if(View == null)
+ return;
+ _clientSize = value;
+ UpdateParams();
+ }
+ }
+
+ public override Point Position
+ {
+ get { return _position; }
+ set
+ {
+ _position = value;
+ PositionChanged?.Invoke(_position);
+ UpdateParams();
+ }
+ }
+
+ WindowManagerLayoutParams CreateParams() => new WindowManagerLayoutParams(0,
+ WindowManagerFlags.NotTouchModal, Format.Translucent)
+ {
+ Gravity = GravityFlags.Left | GravityFlags.Top,
+ WindowAnimations = 0,
+ X = (int) _position.X,
+ Y = (int) _position.Y,
+ Width = Math.Max(1, (int) _clientSize.Width),
+ Height = Math.Max(1, (int) _clientSize.Height)
+ };
+
+ void UpdateParams()
+ {
+ if (_isAdded)
+ ActivityTracker.Current?.WindowManager?.UpdateViewLayout(View, CreateParams());
+ }
+
+ public override void Show()
+ {
+ if (_isAdded)
+ return;
+ ActivityTracker.Current.WindowManager.AddView(View, CreateParams());
+ _isAdded = true;
+ }
+
+ public override void Hide()
+ {
+ if (_isAdded)
+ {
+ var wm = View.Context.ApplicationContext.GetSystemService(Context.WindowService)
+ .JavaCast();
+ wm.RemoveView(View);
+ _isAdded = false;
+ }
+ }
+
+ public override void Dispose()
+ {
+ Hide();
+ base.Dispose();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs b/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs
new file mode 100644
index 0000000000..d34981b964
--- /dev/null
+++ b/src/Android/Avalonia.Android/Platform/SkiaPlatform/TopLevelImpl.cs
@@ -0,0 +1,225 @@
+using Android.App;
+using Android.Content;
+using Android.Graphics;
+using Android.Views;
+using Avalonia.Android.Platform.Specific;
+using Avalonia.Android.Platform.Specific.Helpers;
+using Avalonia.Input;
+using Avalonia.Input.Raw;
+using Avalonia.Platform;
+using System;
+using System.Collections.Generic;
+using System.Reactive.Disposables;
+using Avalonia.Controls;
+using Avalonia.Controls.Platform.Surfaces;
+
+namespace Avalonia.Android.Platform.SkiaPlatform
+{
+ class TopLevelImpl : IAndroidView, ITopLevelImpl, IFramebufferPlatformSurface
+
+ {
+ private readonly AndroidKeyboardEventsHelper _keyboardHelper;
+ private readonly AndroidTouchEventsHelper _touchHelper;
+ private ViewImpl _view;
+
+ public TopLevelImpl(Context context, bool placeOnTop = false)
+ {
+ _view = new ViewImpl(context, this, placeOnTop);
+ _keyboardHelper = new AndroidKeyboardEventsHelper(this);
+ _touchHelper = new AndroidTouchEventsHelper(this, () => InputRoot,
+ p => GetAvaloniaPointFromEvent(p));
+
+ MaxClientSize = new Size(_view.Resources.DisplayMetrics.WidthPixels,
+ _view.Resources.DisplayMetrics.HeightPixels);
+ }
+
+
+
+ private bool _handleEvents;
+
+ public bool HandleEvents
+ {
+ get { return _handleEvents; }
+ set
+ {
+ _handleEvents = value;
+ _keyboardHelper.HandleEvents = _handleEvents;
+ }
+ }
+
+ public virtual Point GetAvaloniaPointFromEvent(MotionEvent e) => new Point(e.GetX(), e.GetY());
+
+ public IInputRoot InputRoot { get; private set; }
+
+ public virtual Size ClientSize
+ {
+ get
+ {
+ if (_view == null)
+ return new Size(0, 0);
+ return new Size(_view.Width, _view.Height);
+ }
+ set
+ {
+
+ }
+ }
+
+ public Action Closed { get; set; }
+
+ public Action Deactivated { get; set; }
+
+ public Action Input { get; set; }
+
+ public Size MaxClientSize { get; protected set; }
+
+ public Action Paint { get; set; }
+
+ public Action Resized { get; set; }
+
+ public Action ScalingChanged { get; set; }
+
+ public Action PositionChanged { get; set; }
+
+ public View View => _view;
+
+ Action ITopLevelImpl.Activated { get; set; }
+
+ IPlatformHandle ITopLevelImpl.Handle => _view;
+
+ public IEnumerable
-
- Properties\SharedAssemblyInfo.cs
-
-
+
Component
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -123,8 +108,11 @@
-
+
+ Designer
+
+