diff --git a/.gitignore b/.gitignore
index a9a8fd36b4..583a2b8a2b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -176,5 +176,9 @@ nuget
Avalonia.XBuild.sln
project.lock.json
.idea/*
-**/obj-Skia/*
-**/obj-Direct2D1/*
+
+
+##################
+## BenchmarkDotNet
+##################
+BenchmarkDotNet.Artifacts/
diff --git a/.ncrunch/Avalonia.Designer.HostApp.NetFX.v3.ncrunchproject b/.ncrunch/Avalonia.Designer.HostApp.NetFX.v3.ncrunchproject
new file mode 100644
index 0000000000..319cd523ce
--- /dev/null
+++ b/.ncrunch/Avalonia.Designer.HostApp.NetFX.v3.ncrunchproject
@@ -0,0 +1,5 @@
+
+
+ True
+
+
\ No newline at end of file
diff --git a/.ncrunch/BindingDemo.net461.v3.ncrunchproject b/.ncrunch/BindingDemo.net461.v3.ncrunchproject
new file mode 100644
index 0000000000..319cd523ce
--- /dev/null
+++ b/.ncrunch/BindingDemo.net461.v3.ncrunchproject
@@ -0,0 +1,5 @@
+
+
+ True
+
+
\ No newline at end of file
diff --git a/.ncrunch/BindingDemo.netcoreapp2.0.v3.ncrunchproject b/.ncrunch/BindingDemo.netcoreapp2.0.v3.ncrunchproject
new file mode 100644
index 0000000000..319cd523ce
--- /dev/null
+++ b/.ncrunch/BindingDemo.netcoreapp2.0.v3.ncrunchproject
@@ -0,0 +1,5 @@
+
+
+ True
+
+
\ No newline at end of file
diff --git a/.ncrunch/Previewer.v3.ncrunchproject b/.ncrunch/Previewer.v3.ncrunchproject
new file mode 100644
index 0000000000..319cd523ce
--- /dev/null
+++ b/.ncrunch/Previewer.v3.ncrunchproject
@@ -0,0 +1,5 @@
+
+
+ True
+
+
\ No newline at end of file
diff --git a/.ncrunch/RemoteDemo.v3.ncrunchproject b/.ncrunch/RemoteDemo.v3.ncrunchproject
new file mode 100644
index 0000000000..319cd523ce
--- /dev/null
+++ b/.ncrunch/RemoteDemo.v3.ncrunchproject
@@ -0,0 +1,5 @@
+
+
+ True
+
+
\ No newline at end of file
diff --git a/.ncrunch/RenderDemo.net461.v3.ncrunchproject b/.ncrunch/RenderDemo.net461.v3.ncrunchproject
new file mode 100644
index 0000000000..319cd523ce
--- /dev/null
+++ b/.ncrunch/RenderDemo.net461.v3.ncrunchproject
@@ -0,0 +1,5 @@
+
+
+ True
+
+
\ No newline at end of file
diff --git a/.ncrunch/RenderDemo.netcoreapp2.0.v3.ncrunchproject b/.ncrunch/RenderDemo.netcoreapp2.0.v3.ncrunchproject
new file mode 100644
index 0000000000..319cd523ce
--- /dev/null
+++ b/.ncrunch/RenderDemo.netcoreapp2.0.v3.ncrunchproject
@@ -0,0 +1,5 @@
+
+
+ True
+
+
\ No newline at end of file
diff --git a/.ncrunch/VirtualizationDemo.net461.v3.ncrunchproject b/.ncrunch/VirtualizationDemo.net461.v3.ncrunchproject
new file mode 100644
index 0000000000..319cd523ce
--- /dev/null
+++ b/.ncrunch/VirtualizationDemo.net461.v3.ncrunchproject
@@ -0,0 +1,5 @@
+
+
+ True
+
+
\ No newline at end of file
diff --git a/.ncrunch/VirtualizationDemo.netcoreapp2.0.v3.ncrunchproject b/.ncrunch/VirtualizationDemo.netcoreapp2.0.v3.ncrunchproject
new file mode 100644
index 0000000000..319cd523ce
--- /dev/null
+++ b/.ncrunch/VirtualizationDemo.netcoreapp2.0.v3.ncrunchproject
@@ -0,0 +1,5 @@
+
+
+ True
+
+
\ No newline at end of file
diff --git a/Avalonia.sln b/Avalonia.sln
index 39396f3ab8..75bca0bca8 100644
--- a/Avalonia.sln
+++ b/Avalonia.sln
@@ -398,6 +398,7 @@ Global
{3E908F67-5543-4879-A1DC-08EACE79B3CD}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{3E908F67-5543-4879-A1DC-08EACE79B3CD}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{3E908F67-5543-4879-A1DC-08EACE79B3CD}.Debug|NetCoreOnly.ActiveCfg = Debug|Any CPU
+ {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Debug|NetCoreOnly.Build.0 = Debug|Any CPU
{3E908F67-5543-4879-A1DC-08EACE79B3CD}.Debug|x86.ActiveCfg = Debug|Any CPU
{3E908F67-5543-4879-A1DC-08EACE79B3CD}.Debug|x86.Build.0 = Debug|Any CPU
{3E908F67-5543-4879-A1DC-08EACE79B3CD}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -407,6 +408,7 @@ Global
{3E908F67-5543-4879-A1DC-08EACE79B3CD}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{3E908F67-5543-4879-A1DC-08EACE79B3CD}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{3E908F67-5543-4879-A1DC-08EACE79B3CD}.Release|NetCoreOnly.ActiveCfg = Release|Any CPU
+ {3E908F67-5543-4879-A1DC-08EACE79B3CD}.Release|NetCoreOnly.Build.0 = Release|Any CPU
{3E908F67-5543-4879-A1DC-08EACE79B3CD}.Release|x86.ActiveCfg = Release|Any CPU
{3E908F67-5543-4879-A1DC-08EACE79B3CD}.Release|x86.Build.0 = Release|Any CPU
{62024B2D-53EB-4638-B26B-85EEAA54866E}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
diff --git a/build.cake b/build.cake
index 561a33186a..78c166a3bc 100644
--- a/build.cake
+++ b/build.cake
@@ -6,6 +6,7 @@
#addin "nuget:?package=NuGet.Core&version=2.14.0"
#tool "nuget:?package=NuGet.CommandLine&version=4.3.0"
#tool "nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2017.1.20170613.162720"
+
///////////////////////////////////////////////////////////////////////////////
// TOOLS
///////////////////////////////////////////////////////////////////////////////
@@ -98,7 +99,7 @@ Teardown((context, buildContext) =>
// TASKS
///////////////////////////////////////////////////////////////////////////////
-Task("Clean")
+Task("Clean-Impl")
.Does(data =>
{
CleanDirectories(data.Parameters.BuildDirs);
@@ -108,9 +109,9 @@ Task("Clean")
CleanDirectory(data.Parameters.BinRoot);
});
-Task("Restore-NuGet-Packages")
- .IsDependentOn("Clean")
+Task("Restore-NuGet-Packages-Impl")
.WithCriteria((context, data) => data.Parameters.IsRunningOnWindows)
+ .WithCriteria((context, data) => !data.Parameters.IsPlatformNetCoreOnly)
.Does(data =>
{
var maxRetryCount = 5;
@@ -148,11 +149,10 @@ void DotNetCoreBuild(Parameters parameters)
DotNetCoreBuild(parameters.MSBuildSolution, settings);
}
-Task("Build")
- .IsDependentOn("Restore-NuGet-Packages")
+Task("Build-Impl")
.Does(data =>
{
- if(data.Parameters.IsRunningOnWindows)
+ if(data.Parameters.IsRunningOnWindows && !data.Parameters.IsPlatformNetCoreOnly)
{
MSBuild(data.Parameters.MSBuildSolution, settings => {
settings.SetConfiguration(data.Parameters.Configuration);
@@ -171,7 +171,6 @@ Task("Build")
}
});
-
void RunCoreTest(string project, Parameters parameters, bool coreOnly = false)
{
if(!project.EndsWith(".csproj"))
@@ -194,94 +193,91 @@ void RunCoreTest(string project, Parameters parameters, bool coreOnly = false)
}
}
-Task("Run-Unit-Tests")
- .IsDependentOn("Build")
+Task("Run-Unit-Tests-Impl")
.WithCriteria((context, data) => !data.Parameters.SkipTests)
- .Does(data => {
- RunCoreTest("./tests/Avalonia.Base.UnitTests", data.Parameters, false);
- RunCoreTest("./tests/Avalonia.Controls.UnitTests", data.Parameters, false);
- RunCoreTest("./tests/Avalonia.Input.UnitTests", data.Parameters, false);
- RunCoreTest("./tests/Avalonia.Interactivity.UnitTests", data.Parameters, false);
- RunCoreTest("./tests/Avalonia.Layout.UnitTests", data.Parameters, false);
- RunCoreTest("./tests/Avalonia.Markup.UnitTests", data.Parameters, false);
- RunCoreTest("./tests/Avalonia.Markup.Xaml.UnitTests", data.Parameters, false);
- RunCoreTest("./tests/Avalonia.Styling.UnitTests", data.Parameters, false);
- RunCoreTest("./tests/Avalonia.Visuals.UnitTests", data.Parameters, false);
- RunCoreTest("./tests/Avalonia.Skia.UnitTests", data.Parameters, false);
- if (data.Parameters.IsRunningOnWindows)
- {
- RunCoreTest("./tests/Avalonia.Direct2D1.UnitTests", data.Parameters, true);
- }
- });
+ .Does(data =>
+{
+ RunCoreTest("./tests/Avalonia.Base.UnitTests", data.Parameters, false);
+ RunCoreTest("./tests/Avalonia.Controls.UnitTests", data.Parameters, false);
+ RunCoreTest("./tests/Avalonia.Input.UnitTests", data.Parameters, false);
+ RunCoreTest("./tests/Avalonia.Interactivity.UnitTests", data.Parameters, false);
+ RunCoreTest("./tests/Avalonia.Layout.UnitTests", data.Parameters, false);
+ RunCoreTest("./tests/Avalonia.Markup.UnitTests", data.Parameters, false);
+ RunCoreTest("./tests/Avalonia.Markup.Xaml.UnitTests", data.Parameters, false);
+ RunCoreTest("./tests/Avalonia.Styling.UnitTests", data.Parameters, false);
+ RunCoreTest("./tests/Avalonia.Visuals.UnitTests", data.Parameters, false);
+ RunCoreTest("./tests/Avalonia.Skia.UnitTests", data.Parameters, false);
+ if (data.Parameters.IsRunningOnWindows && !data.Parameters.IsPlatformNetCoreOnly)
+ {
+ RunCoreTest("./tests/Avalonia.Direct2D1.UnitTests", data.Parameters, true);
+ }
+});
-Task("Run-Designer-Tests")
- .IsDependentOn("Build")
+Task("Run-Designer-Tests-Impl")
.WithCriteria((context, data) => !data.Parameters.SkipTests)
- .Does(data => {
- RunCoreTest("./tests/Avalonia.DesignerSupport.Tests", data.Parameters, false);
- });
+ .Does(data =>
+{
+ RunCoreTest("./tests/Avalonia.DesignerSupport.Tests", data.Parameters, false);
+});
-Task("Run-Render-Tests")
- .IsDependentOn("Build")
- .WithCriteria((context, data) => !data.Parameters.SkipTests && data.Parameters.IsRunningOnWindows)
- .Does(data => {
- RunCoreTest("./tests/Avalonia.Skia.RenderTests/Avalonia.Skia.RenderTests.csproj", data.Parameters, true);
- RunCoreTest("./tests/Avalonia.Direct2D1.RenderTests/Avalonia.Direct2D1.RenderTests.csproj", data.Parameters, true);
- });
+Task("Run-Render-Tests-Impl")
+ .WithCriteria((context, data) => !data.Parameters.SkipTests)
+ .WithCriteria((context, data) => data.Parameters.IsRunningOnWindows)
+ .WithCriteria((context, data) => !data.Parameters.IsPlatformNetCoreOnly)
+ .Does(data =>
+{
+ RunCoreTest("./tests/Avalonia.Skia.RenderTests/Avalonia.Skia.RenderTests.csproj", data.Parameters, true);
+ RunCoreTest("./tests/Avalonia.Direct2D1.RenderTests/Avalonia.Direct2D1.RenderTests.csproj", data.Parameters, true);
+});
-Task("Run-Leak-Tests")
- .WithCriteria((context, data) => !data.Parameters.SkipTests && data.Parameters.IsRunningOnWindows)
- .IsDependentOn("Build")
+Task("Run-Leak-Tests-Impl")
+ .WithCriteria((context, data) => !data.Parameters.SkipTests)
+ .WithCriteria((context, data) => data.Parameters.IsRunningOnWindows)
+ .WithCriteria((context, data) => !data.Parameters.IsPlatformNetCoreOnly)
.Does(() =>
+{
+ var dotMemoryUnit = Context.Tools.Resolve("dotMemoryUnit.exe");
+ var leakTestsExitCode = StartProcess(dotMemoryUnit, new ProcessSettings
{
- var dotMemoryUnit = Context.Tools.Resolve("dotMemoryUnit.exe");
- var leakTestsExitCode = StartProcess(dotMemoryUnit, new ProcessSettings
- {
- Arguments = new ProcessArgumentBuilder()
- .Append(Context.Tools.Resolve("xunit.console.x86.exe").FullPath)
- .Append("--propagate-exit-code")
- .Append("--")
- .Append("tests\\Avalonia.LeakTests\\bin\\Release\\net461\\Avalonia.LeakTests.dll"),
- Timeout = 120000
- });
-
- if (leakTestsExitCode != 0)
- {
- throw new Exception("Leak Tests failed");
- }
+ Arguments = new ProcessArgumentBuilder()
+ .Append(Context.Tools.Resolve("xunit.console.x86.exe").FullPath)
+ .Append("--propagate-exit-code")
+ .Append("--")
+ .Append("tests\\Avalonia.LeakTests\\bin\\Release\\net461\\Avalonia.LeakTests.dll"),
+ Timeout = 120000
});
-Task("Run-Tests")
- .IsDependentOn("Run-Unit-Tests")
- .IsDependentOn("Run-Render-Tests")
- .IsDependentOn("Run-Designer-Tests")
- .IsDependentOn("Run-Leak-Tests");
+ if (leakTestsExitCode != 0)
+ {
+ throw new Exception("Leak Tests failed");
+ }
+});
-Task("Copy-Files")
- .IsDependentOn("Run-Tests")
+Task("Copy-Files-Impl")
.Does(data =>
{
CopyFiles(data.Packages.BinFiles, data.Parameters.BinRoot);
});
-Task("Zip-Files")
- .IsDependentOn("Copy-Files")
+Task("Zip-Files-Impl")
.Does(data =>
{
Zip(data.Parameters.BinRoot, data.Parameters.ZipCoreArtifacts);
- Zip(data.Parameters.ZipSourceControlCatalogDesktopDirs,
- data.Parameters.ZipTargetControlCatalogDesktopDirs,
- GetFiles(data.Parameters.ZipSourceControlCatalogDesktopDirs.FullPath + "/*.dll") +
- GetFiles(data.Parameters.ZipSourceControlCatalogDesktopDirs.FullPath + "/*.config") +
- GetFiles(data.Parameters.ZipSourceControlCatalogDesktopDirs.FullPath + "/*.so") +
- GetFiles(data.Parameters.ZipSourceControlCatalogDesktopDirs.FullPath + "/*.dylib") +
- GetFiles(data.Parameters.ZipSourceControlCatalogDesktopDirs.FullPath + "/*.exe"));
+ Zip(data.Parameters.NugetRoot, data.Parameters.ZipNuGetArtifacts);
+
+ if (!data.Parameters.IsPlatformNetCoreOnly) {
+ Zip(data.Parameters.ZipSourceControlCatalogDesktopDirs,
+ data.Parameters.ZipTargetControlCatalogDesktopDirs,
+ GetFiles(data.Parameters.ZipSourceControlCatalogDesktopDirs.FullPath + "/*.dll") +
+ GetFiles(data.Parameters.ZipSourceControlCatalogDesktopDirs.FullPath + "/*.config") +
+ GetFiles(data.Parameters.ZipSourceControlCatalogDesktopDirs.FullPath + "/*.so") +
+ GetFiles(data.Parameters.ZipSourceControlCatalogDesktopDirs.FullPath + "/*.dylib") +
+ GetFiles(data.Parameters.ZipSourceControlCatalogDesktopDirs.FullPath + "/*.exe"));
+ }
});
-Task("Create-NuGet-Packages")
- .IsDependentOn("Run-Tests")
- .IsDependentOn("Inspect")
+Task("Create-NuGet-Packages-Impl")
.Does(data =>
{
foreach(var nuspec in data.Packages.NuspecNuGetSettings)
@@ -290,8 +286,7 @@ Task("Create-NuGet-Packages")
}
});
-Task("Publish-MyGet")
- .IsDependentOn("Create-NuGet-Packages")
+Task("Publish-MyGet-Impl")
.WithCriteria((context, data) => !data.Parameters.IsLocalBuild)
.WithCriteria((context, data) => !data.Parameters.IsPullRequest)
.WithCriteria((context, data) => data.Parameters.IsMainRepo)
@@ -324,8 +319,7 @@ Task("Publish-MyGet")
Information("Publish-MyGet Task failed, but continuing with next Task...");
});
-Task("Publish-NuGet")
- .IsDependentOn("Create-NuGet-Packages")
+Task("Publish-NuGet-Impl")
.WithCriteria((context, data) => !data.Parameters.IsLocalBuild)
.WithCriteria((context, data) => !data.Parameters.IsPullRequest)
.WithCriteria((context, data) => data.Parameters.IsMainRepo)
@@ -357,54 +351,67 @@ Task("Publish-NuGet")
Information("Publish-NuGet Task failed, but continuing with next Task...");
});
-Task("Inspect")
+Task("Inspect-Impl")
.WithCriteria((context, data) => data.Parameters.IsRunningOnWindows)
- .IsDependentOn("Restore-NuGet-Packages")
+ .WithCriteria((context, data) => !data.Parameters.IsPlatformNetCoreOnly)
.Does(() =>
- {
- var badIssues = new []{"PossibleNullReferenceException"};
- var whitelist = new []{"tests", "src\\android", "src\\ios",
- "src\\markup\\avalonia.markup.xaml\\portablexaml\\portable.xaml.github"};
- Information("Running code inspections");
-
- var exitCode = StartProcess(Context.Tools.Resolve("inspectcode.exe"),
- new ProcessSettings
- {
- Arguments = "--output=artifacts\\inspectcode.xml --profile=Avalonia.sln.DotSettings Avalonia.sln",
- RedirectStandardOutput = true
- });
+{
+ var badIssues = new []{"PossibleNullReferenceException"};
+ var whitelist = new []{"tests", "src\\android", "src\\ios",
+ "src\\markup\\avalonia.markup.xaml\\portablexaml\\portable.xaml.github"};
+ Information("Running code inspections");
+
+ var exitCode = StartProcess(Context.Tools.Resolve("inspectcode.exe"),
+ new ProcessSettings
+ {
+ Arguments = "--output=artifacts\\inspectcode.xml --profile=Avalonia.sln.DotSettings Avalonia.sln",
+ RedirectStandardOutput = true
+ });
- Information("Analyzing report");
- var doc = XDocument.Parse(System.IO.File.ReadAllText("artifacts\\inspectcode.xml"));
- var failBuild = false;
- foreach(var xml in doc.Descendants("Issue"))
+ Information("Analyzing report");
+ var doc = XDocument.Parse(System.IO.File.ReadAllText("artifacts\\inspectcode.xml"));
+ var failBuild = false;
+ foreach(var xml in doc.Descendants("Issue"))
+ {
+ var typeId = xml.Attribute("TypeId").Value.ToString();
+ if(badIssues.Contains(typeId))
{
- var typeId = xml.Attribute("TypeId").Value.ToString();
- if(badIssues.Contains(typeId))
- {
- var file = xml.Attribute("File").Value.ToString().ToLower();
- if(whitelist.Any(wh => file.StartsWith(wh)))
- continue;
- var line = xml.Attribute("Line").Value.ToString();
- Error(typeId + " - " + file + " on line " + line);
- failBuild = true;
- }
+ var file = xml.Attribute("File").Value.ToString().ToLower();
+ if(whitelist.Any(wh => file.StartsWith(wh)))
+ continue;
+ var line = xml.Attribute("Line").Value.ToString();
+ Error(typeId + " - " + file + " on line " + line);
+ failBuild = true;
}
- if(failBuild)
- throw new Exception("Issues found");
- });
+ }
+ if(failBuild)
+ throw new Exception("Issues found");
+});
///////////////////////////////////////////////////////////////////////////////
// TARGETS
///////////////////////////////////////////////////////////////////////////////
+Task("Run-Tests")
+ .IsDependentOn("Clean-Impl")
+ .IsDependentOn("Restore-NuGet-Packages-Impl")
+ .IsDependentOn("Build-Impl")
+ .IsDependentOn("Run-Unit-Tests-Impl")
+ .IsDependentOn("Run-Render-Tests-Impl")
+ .IsDependentOn("Run-Designer-Tests-Impl")
+ .IsDependentOn("Run-Leak-Tests-Impl");
+
Task("Package")
- .IsDependentOn("Create-NuGet-Packages");
+ .IsDependentOn("Run-Tests")
+ .IsDependentOn("Inspect-Impl")
+ .IsDependentOn("Create-NuGet-Packages-Impl");
Task("AppVeyor")
- .IsDependentOn("Zip-Files")
- .IsDependentOn("Publish-MyGet")
- .IsDependentOn("Publish-NuGet");
+ .IsDependentOn("Package")
+ .IsDependentOn("Copy-Files-Impl")
+ .IsDependentOn("Zip-Files-Impl")
+ .IsDependentOn("Publish-MyGet-Impl")
+ .IsDependentOn("Publish-NuGet-Impl");
Task("Travis")
.IsDependentOn("Run-Tests");
diff --git a/build/System.Memory.props b/build/System.Memory.props
new file mode 100644
index 0000000000..f3253f8882
--- /dev/null
+++ b/build/System.Memory.props
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/packages.cake b/packages.cake
index 7e7e722c82..51d9c48159 100644
--- a/packages.cake
+++ b/packages.cake
@@ -1,3 +1,6 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
using System.Xml.Linq;
public class Packages
@@ -9,12 +12,11 @@ public class Packages
public string SkiaSharpVersion {get; private set; }
public string SkiaSharpLinuxVersion {get; private set; }
public Dictionary>> PackageVersions{get; private set;}
-
-
-
+
class DependencyBuilder : List
{
Packages _parent;
+
public DependencyBuilder(Packages parent)
{
_parent = parent;
@@ -24,8 +26,7 @@ public class Packages
{
return _parent.PackageVersions[name].First().Item1;
}
-
-
+
public DependencyBuilder Dep(string name, params string[] fws)
{
if(fws.Length == 0)
@@ -212,17 +213,33 @@ public class Packages
};
});
- var toolsContent = new[] {
- new NuSpecContent{
- Source = ((FilePath)context.File("./src/tools/Avalonia.Designer.HostApp/bin/" + parameters.DirSuffix + "/netcoreapp2.0/Avalonia.Designer.HostApp.dll")).FullPath,
- Target = "tools/netcoreapp2.0/previewer"
- },
- new NuSpecContent{
- Source = ((FilePath)context.File("./src/tools/Avalonia.Designer.HostApp.NetFx/bin/" + parameters.DirSuffix + "/Avalonia.Designer.HostApp.exe")).FullPath,
- Target = "tools/net461/previewer"
- }
+ var toolHostApp = new NuSpecContent{
+ Source = ((FilePath)context.File("./src/tools/Avalonia.Designer.HostApp/bin/" + parameters.DirSuffix + "/netcoreapp2.0/Avalonia.Designer.HostApp.dll")).FullPath,
+ Target = "tools/netcoreapp2.0/previewer"
+ };
+
+ var toolHostAppNetFx = new NuSpecContent{
+ Source = ((FilePath)context.File("./src/tools/Avalonia.Designer.HostApp.NetFx/bin/" + parameters.DirSuffix + "/Avalonia.Designer.HostApp.exe")).FullPath,
+ Target = "tools/net461/previewer"
};
+ IList coreFiles;
+
+ if (!parameters.IsPlatformNetCoreOnly) {
+ var toolsContent = new[] { toolHostApp, toolHostAppNetFx };
+ coreFiles = coreLibrariesNuSpecContent
+ .Concat(win32CoreLibrariesNuSpecContent).Concat(net45RuntimePlatform)
+ .Concat(netcoreappCoreLibrariesNuSpecContent).Concat(netCoreRuntimePlatform)
+ .Concat(toolsContent)
+ .ToList();
+ } else {
+ var toolsContent = new[] { toolHostApp };
+ coreFiles = coreLibrariesNuSpecContent
+ .Concat(netcoreappCoreLibrariesNuSpecContent).Concat(netCoreRuntimePlatform)
+ .Concat(toolsContent)
+ .ToList();
+ }
+
var nuspecNuGetSettingsCore = new []
{
///////////////////////////////////////////////////////////////////////////////
@@ -253,13 +270,9 @@ public class Packages
}
.Deps(new string[]{null, "netcoreapp2.0"},
"System.ValueTuple", "System.ComponentModel.TypeConverter", "System.ComponentModel.Primitives",
- "System.Runtime.Serialization.Primitives", "System.Xml.XmlDocument", "System.Xml.ReaderWriter")
+ "System.Runtime.Serialization.Primitives", "System.Xml.XmlDocument", "System.Xml.ReaderWriter", "System.Memory")
.ToArray(),
- Files = coreLibrariesNuSpecContent
- .Concat(win32CoreLibrariesNuSpecContent).Concat(net45RuntimePlatform)
- .Concat(netcoreappCoreLibrariesNuSpecContent).Concat(netCoreRuntimePlatform)
- .Concat(toolsContent)
- .ToList(),
+ Files = coreFiles,
BasePath = context.Directory("./"),
OutputDirectory = parameters.NugetRoot
},
@@ -451,22 +464,6 @@ public class Packages
BasePath = context.Directory("./"),
OutputDirectory = parameters.NugetRoot
},
- new NuGetPackSettings()
- {
- Id = "Avalonia.Win32.Interoperability",
- Dependencies = new []
- {
- new NuSpecDependency() { Id = "Avalonia.Win32", Version = parameters.Version },
- new NuSpecDependency() { Id = "Avalonia.Direct2D1", Version = parameters.Version },
- new NuSpecDependency() { Id = "SharpDX.Direct3D9", Version = SharpDXDirect3D9Version },
- },
- Files = new []
- {
- new NuSpecContent { Source = "Avalonia.Win32.Interop/bin/" + parameters.DirSuffix + "/Avalonia.Win32.Interop.dll", Target = "lib/net45" }
- },
- BasePath = context.Directory("./src/Windows"),
- OutputDirectory = parameters.NugetRoot
- },
///////////////////////////////////////////////////////////////////////////////
// Avalonia.LinuxFramebuffer
///////////////////////////////////////////////////////////////////////////////
@@ -487,11 +484,32 @@ public class Packages
}
};
+ var nuspecNuGetSettingInterop = new NuGetPackSettings()
+ {
+ Id = "Avalonia.Win32.Interoperability",
+ Dependencies = new []
+ {
+ new NuSpecDependency() { Id = "Avalonia.Win32", Version = parameters.Version },
+ new NuSpecDependency() { Id = "Avalonia.Direct2D1", Version = parameters.Version },
+ new NuSpecDependency() { Id = "SharpDX.Direct3D9", Version = SharpDXDirect3D9Version },
+ },
+ Files = new []
+ {
+ new NuSpecContent { Source = "Avalonia.Win32.Interop/bin/" + parameters.DirSuffix + "/Avalonia.Win32.Interop.dll", Target = "lib/net45" }
+ },
+ BasePath = context.Directory("./src/Windows"),
+ OutputDirectory = parameters.NugetRoot
+ };
+
NuspecNuGetSettings = new List();
NuspecNuGetSettings.AddRange(nuspecNuGetSettingsCore);
NuspecNuGetSettings.AddRange(nuspecNuGetSettingsDesktop);
- NuspecNuGetSettings.AddRange(nuspecNuGetSettingsMobile);
+
+ if (!parameters.IsPlatformNetCoreOnly) {
+ NuspecNuGetSettings.Add(nuspecNuGetSettingInterop);
+ NuspecNuGetSettings.AddRange(nuspecNuGetSettingsMobile);
+ }
NuspecNuGetSettings.ForEach((nuspec) => SetNuGetNuspecCommonProperties(nuspec));
diff --git a/parameters.cake b/parameters.cake
index ffd472cbd4..e595b8159f 100644
--- a/parameters.cake
+++ b/parameters.cake
@@ -8,11 +8,11 @@ public class Parameters
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 string MSBuildSolution { get; private set; }
public bool IsPlatformAnyCPU { get; private set; }
public bool IsPlatformX86 { get; private set; }
public bool IsPlatformX64 { get; private set; }
+ public bool IsPlatformNetCoreOnly { get; private set; }
public bool IsLocalBuild { get; private set; }
public bool IsRunningOnUnix { get; private set; }
public bool IsRunningOnWindows { get; private set; }
@@ -34,6 +34,7 @@ public class Parameters
public DirectoryPathCollection BuildDirs { get; private set; }
public string FileZipSuffix { get; private set; }
public FilePath ZipCoreArtifacts { get; private set; }
+ public FilePath ZipNuGetArtifacts { get; private set; }
public DirectoryPath ZipSourceControlCatalogDesktopDirs { get; private set; }
public FilePath ZipTargetControlCatalogDesktopDirs { get; private set; }
@@ -53,12 +54,12 @@ public class Parameters
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");
+ IsPlatformNetCoreOnly = StringComparer.OrdinalIgnoreCase.Equals(Platform, "NetCoreOnly");
IsLocalBuild = buildSystem.IsLocalBuild;
IsRunningOnUnix = context.IsRunningOnUnix();
IsRunningOnWindows = context.IsRunningOnWindows();
@@ -71,7 +72,6 @@ public class Parameters
IsReleasable = StringComparer.OrdinalIgnoreCase.Equals(ReleasePlatform, Platform)
&& StringComparer.OrdinalIgnoreCase.Equals(ReleaseConfiguration, Configuration);
IsMyGetRelease = !IsTagged && IsReleasable;
-
// VERSION
Version = context.Argument("force-nuget-version", context.ParseAssemblyInfo(AssemblyInfoPath).AssemblyVersion);
@@ -103,14 +103,12 @@ public class Parameters
NugetRoot = ArtifactsDir.Combine("nuget");
ZipRoot = ArtifactsDir.Combine("zip");
BinRoot = ArtifactsDir.Combine("bin");
-
BuildDirs = context.GetDirectories("**/bin") + context.GetDirectories("**/obj");
-
DirSuffix = Configuration;
DirSuffixIOS = "iPhone" + "/" + Configuration;
-
FileZipSuffix = Version + ".zip";
ZipCoreArtifacts = ZipRoot.CombineWithFilePath("Avalonia-" + FileZipSuffix);
+ ZipNuGetArtifacts = ZipRoot.CombineWithFilePath("Avalonia-NuGet-" + FileZipSuffix);
ZipSourceControlCatalogDesktopDirs = (DirectoryPath)context.Directory("./samples/ControlCatalog.Desktop/bin/" + DirSuffix + "/net461");
ZipTargetControlCatalogDesktopDirs = ZipRoot.CombineWithFilePath("ControlCatalog.Desktop-" + FileZipSuffix);
}
diff --git a/samples/ControlCatalog/SideBar.xaml b/samples/ControlCatalog/SideBar.xaml
index e5baf9e942..7d72d1821b 100644
--- a/samples/ControlCatalog/SideBar.xaml
+++ b/samples/ControlCatalog/SideBar.xaml
@@ -8,7 +8,7 @@
+ SelectedIndex="{TemplateBinding SelectedIndex, Mode=TwoWay}">
@@ -20,7 +20,7 @@
Margin="8 0 0 0"
MemberSelector="{x:Static TabControl.ContentSelector}"
Items="{TemplateBinding Items}"
- SelectedIndex="{TemplateBinding Path=SelectedIndex}"
+ SelectedIndex="{TemplateBinding SelectedIndex}"
PageTransition="{TemplateBinding PageTransition}"
Grid.Row="1"/>
diff --git a/samples/RenderDemo/SideBar.xaml b/samples/RenderDemo/SideBar.xaml
index 29e5d854f9..b5f8ccaf01 100644
--- a/samples/RenderDemo/SideBar.xaml
+++ b/samples/RenderDemo/SideBar.xaml
@@ -9,7 +9,7 @@
+ SelectedIndex="{TemplateBinding SelectedIndex, Mode=TwoWay}">
@@ -21,7 +21,7 @@
Margin="8 0 0 0"
MemberSelector="{x:Static TabControl.ContentSelector}"
Items="{TemplateBinding Items}"
- SelectedIndex="{TemplateBinding Path=SelectedIndex}"
+ SelectedIndex="{TemplateBinding SelectedIndex}"
PageTransition="{TemplateBinding PageTransition}"
Grid.Row="1"/>
diff --git a/src/Avalonia.Base/AvaloniaObject.cs b/src/Avalonia.Base/AvaloniaObject.cs
index 48e72db126..761c0618da 100644
--- a/src/Avalonia.Base/AvaloniaObject.cs
+++ b/src/Avalonia.Base/AvaloniaObject.cs
@@ -10,6 +10,7 @@ using System.Reactive.Linq;
using Avalonia.Data;
using Avalonia.Diagnostics;
using Avalonia.Logging;
+using Avalonia.Reactive;
using Avalonia.Threading;
using Avalonia.Utilities;
@@ -28,17 +29,11 @@ namespace Avalonia
///
private IAvaloniaObject _inheritanceParent;
- ///
- /// The set values/bindings on this object.
- ///
- private readonly Dictionary _values =
- new Dictionary();
-
///
/// Maintains a list of direct property binding subscriptions so that the binding source
/// doesn't get collected.
///
- private List _directBindings;
+ private List _directBindings;
///
/// Event handler for implementation.
@@ -51,6 +46,7 @@ namespace Avalonia
private EventHandler _propertyChanged;
private DeferredSetter _directDeferredSetter;
+ private ValueStore _values;
///
/// Delayed setter helper for direct properties. Used to fix #855.
@@ -227,9 +223,20 @@ namespace Avalonia
{
return ((IDirectPropertyAccessor)GetRegistered(property)).GetValue(this);
}
+ else if (_values != null)
+ {
+ var result = _values.GetValue(property);
+
+ if (result == AvaloniaProperty.UnsetValue)
+ {
+ result = GetDefaultValue(property);
+ }
+
+ return result;
+ }
else
{
- return GetValueInternal(property);
+ return GetDefaultValue(property);
}
}
@@ -256,7 +263,7 @@ namespace Avalonia
Contract.Requires(property != null);
VerifyAccess();
- return _values.TryGetValue(property, out PriorityValue value) ? value.IsAnimating : false;
+ return _values?.IsAnimating(property) ?? false;
}
///
@@ -273,14 +280,7 @@ namespace Avalonia
Contract.Requires(property != null);
VerifyAccess();
- PriorityValue value;
-
- if (_values.TryGetValue(property, out value))
- {
- return value.Value != AvaloniaProperty.UnsetValue;
- }
-
- return false;
+ return _values?.IsSet(property) ?? false;
}
///
@@ -359,36 +359,15 @@ namespace Avalonia
property,
description);
- IDisposable subscription = null;
-
if (_directBindings == null)
{
- _directBindings = new List();
+ _directBindings = new List();
}
- subscription = source
- .Select(x => CastOrDefault(x, property.PropertyType))
- .Do(_ => { }, () => _directBindings.Remove(subscription))
- .Subscribe(x => SetDirectValue(property, x));
-
- _directBindings.Add(subscription);
-
- return Disposable.Create(() =>
- {
- subscription.Dispose();
- _directBindings.Remove(subscription);
- });
+ return new DirectBindingSubscription(this, property, source);
}
else
{
- PriorityValue v;
-
- if (!_values.TryGetValue(property, out v))
- {
- v = CreatePriorityValue(property);
- _values.Add(property, v);
- }
-
Logger.Verbose(
LogArea.Property,
this,
@@ -397,7 +376,12 @@ namespace Avalonia
description,
priority);
- return v.Add(source, (int)priority);
+ if (_values == null)
+ {
+ _values = new ValueStore(this);
+ }
+
+ return _values.AddBinding(property, source, priority);
}
}
@@ -428,20 +412,12 @@ namespace Avalonia
public void Revalidate(AvaloniaProperty property)
{
VerifyAccess();
- PriorityValue value;
-
- if (_values.TryGetValue(property, out value))
- {
- value.Revalidate();
- }
+ _values?.Revalidate(property);
}
///
- void IPriorityValueOwner.Changed(PriorityValue sender, object oldValue, object newValue)
+ void IPriorityValueOwner.Changed(AvaloniaProperty property, int priority, object oldValue, object newValue)
{
- var property = sender.Property;
- var priority = (BindingPriority)sender.ValuePriority;
-
oldValue = (oldValue == AvaloniaProperty.UnsetValue) ?
GetDefaultValue(property) :
oldValue;
@@ -451,7 +427,7 @@ namespace Avalonia
if (!Equals(oldValue, newValue))
{
- RaisePropertyChanged(property, oldValue, newValue, priority);
+ RaisePropertyChanged(property, oldValue, newValue, (BindingPriority)priority);
Logger.Verbose(
LogArea.Property,
@@ -460,14 +436,14 @@ namespace Avalonia
property,
oldValue,
newValue,
- priority);
+ (BindingPriority)priority);
}
}
///
- void IPriorityValueOwner.BindingNotificationReceived(PriorityValue sender, BindingNotification notification)
+ void IPriorityValueOwner.BindingNotificationReceived(AvaloniaProperty property, BindingNotification notification)
{
- UpdateDataValidation(sender.Property, notification);
+ UpdateDataValidation(property, notification);
}
///
@@ -480,10 +456,7 @@ namespace Avalonia
/// Gets all priority values set on the object.
///
/// A collection of property/value tuples.
- internal IDictionary GetSetValues()
- {
- return _values;
- }
+ internal IDictionary GetSetValues() => _values?.GetSetValues();
///
/// Forces revalidation of properties when a property value changes.
@@ -672,68 +645,18 @@ namespace Avalonia
}
}
- ///
- /// Creates a for a .
- ///
- /// The property.
- /// The .
- private PriorityValue CreatePriorityValue(AvaloniaProperty property)
- {
- var validate = ((IStyledPropertyAccessor)property).GetValidationFunc(GetType());
- Func