-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
91 additions
and
8 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
[Bb]uild/ | ||
*.sln.ide/ | ||
/src/.vs | ||
/src/.idea | ||
|
||
# Build related | ||
tools/** | ||
|
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,28 @@ | ||
module Cake.Unity.Tests.OSXSeekerOfEditorsTests | ||
|
||
open Cake.Core | ||
open Cake.Core.IO | ||
open NUnit.Framework | ||
open Cake.Unity.SeekersOfEditors | ||
open Cake.Testing | ||
open System.Runtime.InteropServices | ||
|
||
let seek (seeker : OSXSeekerOfEditors) = seeker.Seek () | ||
let runningOnWindows = RuntimeInformation.IsOSPlatform OSPlatform.Windows | ||
|
||
[<Test>] | ||
let ``seek should not fail on real file system`` () = | ||
|
||
if runningOnWindows then | ||
Assert.Inconclusive () | ||
|
||
else | ||
let environment = FakeEnvironment PlatformFamily.OSX | ||
let fileSystem = FileSystem () | ||
let globber = Globber (fileSystem, environment) | ||
let log = FakeLog () | ||
|
||
(environment, globber, log, fileSystem) | ||
|> OSXSeekerOfEditors | ||
|> seek | ||
|> ignore |
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,2 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=globber/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> |
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,3 @@ | ||
using System.Runtime.CompilerServices; | ||
|
||
[assembly: InternalsVisibleTo("Cake.Unity.FSharp.Tests")] |
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,48 @@ | ||
using Cake.Core; | ||
using Cake.Core.Diagnostics; | ||
using Cake.Core.IO; | ||
using Cake.Unity.Version; | ||
using System.Text.RegularExpressions; | ||
|
||
namespace Cake.Unity.SeekersOfEditors | ||
{ | ||
internal class LinuxSeekerOfEditors : SeekerOfEditors | ||
{ | ||
private readonly IFileSystem fileSystem; | ||
private readonly Regex VersionRegex = new Regex("(?<major>\\d+)\\.(?<minor>\\d+)\\.(?<patch>\\d+)(?<branch>\\w)(?<build>\\d+)"); | ||
|
||
public LinuxSeekerOfEditors(ICakeEnvironment environment, IGlobber globber, ICakeLog log, IFileSystem fileSystem) | ||
: base(environment, globber, log) | ||
{ | ||
this.fileSystem = fileSystem; | ||
} | ||
|
||
protected override string[] SearchPatterns => new[] { | ||
"/home/*/Unity/Hub/Editor/*/Editor/Unity" | ||
}; | ||
|
||
protected override UnityVersion DetermineVersion(FilePath editorPath) | ||
{ | ||
log.Debug($"Determining version of Unity Editor at path {editorPath}..."); | ||
|
||
var versionMatch = VersionRegex.Match(editorPath.FullPath); | ||
|
||
if(!versionMatch.Success) | ||
{ | ||
log.Debug($"Can't find UnityVersion for {editorPath}"); | ||
return null; | ||
} | ||
|
||
var major = int.Parse(versionMatch.Groups["major"].Value); | ||
var minor = int.Parse(versionMatch.Groups["minor"].Value); | ||
var patch = int.Parse(versionMatch.Groups["patch"].Value); | ||
var branch = char.Parse(versionMatch.Groups["branch"].Value); | ||
var build = int.Parse(versionMatch.Groups["build"].Value); | ||
|
||
var unityVersion = new UnityVersion(major, minor, patch, branch, build); | ||
|
||
log.Debug($"Result Unity Editor version (full): {unityVersion}"); | ||
return unityVersion; | ||
} | ||
} | ||
} |
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