-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Tizen backend #1546
Merged
Merged
Add Tizen backend #1546
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3201e27
Add Tizen backend
rookiejava 92fd7f7
Merge branch 'master' into add-tizen
ghuntley 98d7aa3
red build: added events - require help finishing this
ghuntley 9d0a22f
Fix unexpedted string replacement for generic intstance type
rookiejava eb86f67
Merge branch 'master' into add-tizen
olevett 11e58eb
Merge branch 'master' into add-tizen
vatsalyagoel b15c737
Fix string interpolations and code clean up
rookiejava 37c5396
Merge branch 'master' into add-tizen
olevett File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MS-PL license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using NuGet; | ||
using Polly; | ||
using Serilog; | ||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
|
||
namespace EventBuilder.Platforms | ||
{ | ||
public class Tizen : BasePlatform | ||
{ | ||
private const string _packageName = "Tizen.NET"; | ||
|
||
public Tizen() | ||
{ | ||
var packageUnzipPath = Environment.CurrentDirectory; | ||
|
||
Log.Debug($"Package unzip path is {packageUnzipPath}"); | ||
|
||
var retryPolicy = Policy | ||
.Handle<Exception>() | ||
.WaitAndRetry( | ||
5, | ||
retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)), | ||
(exception, timeSpan, context) => { | ||
Log.Warning( | ||
"An exception was thrown whilst retrieving or installing {0}: {1}", | ||
_packageName, exception); | ||
}); | ||
|
||
retryPolicy.Execute(() => { | ||
var repo = PackageRepositoryFactory.Default.CreateRepository("https://packages.nuget.org/api/v2"); | ||
var packageManager = new PackageManager(repo, packageUnzipPath); | ||
var package = repo.FindPackagesById(_packageName).Single(x => x.Version.ToString() == "4.0.0"); | ||
|
||
Log.Debug("Using Tizen.NET {0} released on {1}", package.Version, package.Published); | ||
Log.Debug("{0}", package.ReleaseNotes); | ||
|
||
packageManager.InstallPackage(package, ignoreDependencies: true, allowPrereleaseVersions: false); | ||
}); | ||
|
||
var elmSharp = Directory.GetFiles(packageUnzipPath, "ElmSharp*.dll", SearchOption.AllDirectories); | ||
Assemblies.AddRange(elmSharp); | ||
|
||
var tizenNet = Directory.GetFiles(packageUnzipPath, "Tizen*.dll", SearchOption.AllDirectories); | ||
Assemblies.AddRange(tizenNet); | ||
|
||
CecilSearchDirectories.Add($"{packageUnzipPath}\\Tizen.NET.4.0.0\\build\\tizen40\\ref"); | ||
CecilSearchDirectories.Add($"{packageUnzipPath}\\Tizen.NET.4.0.0\\lib\\netstandard2.0"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MS-PL license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Reactive.Concurrency; | ||
using System.Reactive.Disposables; | ||
using ElmSharp; | ||
|
||
namespace ReactiveUI | ||
{ | ||
class EcoreMainloopScheduler : IScheduler | ||
{ | ||
public static IScheduler MainThreadScheduler = new EcoreMainloopScheduler(); | ||
|
||
public DateTimeOffset Now => DateTimeOffset.Now; | ||
|
||
public IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action) | ||
{ | ||
var innerDisp = new SingleAssignmentDisposable(); | ||
EcoreMainloop.PostAndWakeUp(() => { | ||
if (!innerDisp.IsDisposed) innerDisp.Disposable = action(this, state); | ||
}); | ||
return innerDisp; | ||
} | ||
|
||
public IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action) | ||
{ | ||
var innerDisp = Disposable.Empty; | ||
bool isCancelled = false; | ||
|
||
IntPtr timer = EcoreMainloop.AddTimer(dueTime.TotalSeconds, () => { | ||
if (!isCancelled) innerDisp = action(this, state); | ||
return false; | ||
}); | ||
|
||
return Disposable.Create(() => { | ||
isCancelled = true; | ||
EcoreMainloop.RemoveTimer(timer); | ||
innerDisp.Dispose(); | ||
}); | ||
} | ||
|
||
public IDisposable Schedule<TState>(TState state, DateTimeOffset dueTime, Func<IScheduler, TState, IDisposable> action) | ||
{ | ||
if (dueTime <= Now) { | ||
return Schedule(state, action); | ||
} | ||
return Schedule(state, dueTime - Now, action); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MS-PL license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
namespace ReactiveUI | ||
{ | ||
/// <summary> | ||
/// Returns the current orientation of the device on tizen. | ||
/// </summary> | ||
public class PlatformOperations : IPlatformOperations | ||
{ | ||
public string GetOrientation() | ||
{ | ||
return null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MS-PL license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Reactive.Concurrency; | ||
|
||
namespace ReactiveUI | ||
{ | ||
public class PlatformRegistrations : IWantsToRegisterStuff | ||
{ | ||
public void Register(Action<Func<object>, Type> registerFunction) | ||
{ | ||
registerFunction(() => new PlatformOperations(), typeof(IPlatformOperations)); | ||
registerFunction(() => new ComponentModelTypeConverter(), typeof(IBindingTypeConverter)); | ||
RxApp.TaskpoolScheduler = TaskPoolScheduler.Default; | ||
RxApp.MainThreadScheduler = EcoreMainloopScheduler.MainThreadScheduler; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I quite get this change, shouldn't we be replacing type names for multiple generic type arguments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a fix to resolve the potential issues (to avoid unintended replacement) mentioned above with minimal changes. It's nothing more, nothing less.