-
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
17 changed files
with
595 additions
and
61 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
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,39 @@ | ||
namespace Cake.Unity.Arguments | ||
{ | ||
public class AssetServerUpdate | ||
{ | ||
public string IP { get; } | ||
public int? Port { get; } | ||
public string ProjectName { get; } | ||
public string Username { get; } | ||
public string Password { get; } | ||
public string Revision { get; } | ||
|
||
public AssetServerUpdate(string ip, string projectName, string userName, string password) | ||
{ | ||
IP = ip; | ||
ProjectName = projectName; | ||
Username = userName; | ||
Password = password; | ||
} | ||
|
||
public AssetServerUpdate(string ip, int port, string projectName, string userName, string password) | ||
: this(ip, projectName, userName, password) | ||
{ | ||
Port = port; | ||
} | ||
|
||
public AssetServerUpdate(string ip, string projectName, string userName, string password, string revision) | ||
: this(ip, projectName, userName, password) | ||
{ | ||
Revision = revision; | ||
} | ||
|
||
public AssetServerUpdate(string ip, int port, string projectName, string userName, string password, string revision) | ||
: this(ip, projectName, userName, password) | ||
{ | ||
Port = port; | ||
Revision = revision; | ||
} | ||
} | ||
} |
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,12 @@ | ||
namespace Cake.Unity.Arguments | ||
{ | ||
public enum DefaultPlatformTextureFormat | ||
{ | ||
dxt, | ||
pvrtc, | ||
atc, | ||
etc, | ||
etc2, | ||
astc | ||
} | ||
} |
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,12 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Cake.Unity.Arguments | ||
{ | ||
public class ExportPackage | ||
{ | ||
public string[] AssetPaths { get; set; } | ||
public string PackageName { get; set; } | ||
} | ||
} |
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,21 @@ | ||
namespace Cake.Unity.Arguments | ||
{ | ||
public enum ForceGLCore | ||
{ | ||
Auto = 0, | ||
v32 = 32, | ||
v33 = 33, | ||
v40 = 40, | ||
v41 = 41, | ||
v42 = 42, | ||
v43 = 43, | ||
v44 = 44, | ||
v45 = 45 | ||
} | ||
|
||
internal static class ForceGLCoreExtension | ||
{ | ||
public static string Render(this ForceGLCore version) => | ||
version == ForceGLCore.Auto ? "" : ((int) version).ToString(); | ||
} | ||
} |
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,16 @@ | ||
namespace Cake.Unity.Arguments | ||
{ | ||
public enum ForceGLES | ||
{ | ||
Auto = 0, | ||
v30 = 30, | ||
v31 = 31, | ||
v32 = 32 | ||
} | ||
|
||
internal static class ForceGLESExtension | ||
{ | ||
public static string Render(this ForceGLES version) => | ||
version == ForceGLES.Auto ? "" : ((int)version).ToString(); | ||
} | ||
} |
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,9 @@ | ||
namespace Cake.Unity.Arguments | ||
{ | ||
public enum StackTraceLogType | ||
{ | ||
None, | ||
ScriptOnly, | ||
Full | ||
} | ||
} |
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 System.Linq; | ||
using System.Xml.Linq; | ||
using Cake.Core; | ||
using Cake.Core.Diagnostics; | ||
using Cake.Core.IO; | ||
using Cake.Unity.Version; | ||
|
||
namespace Cake.Unity.SeekersOfEditors | ||
{ | ||
internal class OSXSeekerOfEditors : SeekerOfEditors | ||
{ | ||
public OSXSeekerOfEditors(ICakeEnvironment environment, IGlobber globber, ICakeLog log) | ||
: base(environment, globber, log) | ||
{ } | ||
|
||
protected override string SearchPattern => "/Applications/**/Unity*.app/Contents/MacOS/Unity"; | ||
|
||
protected override UnityVersion DetermineVersion(FilePath editorPath) | ||
{ | ||
log.Debug($"Determining version of Unity Editor at path {editorPath}..."); | ||
|
||
var version = UnityVersionFromInfoPlist(editorPath); | ||
|
||
if (version == null) | ||
{ | ||
log.Debug($"Can't find UnityVersion for {editorPath}"); | ||
return null; | ||
} | ||
|
||
var unityVersion = UnityVersion.Parse(version); | ||
|
||
log.Debug($"Result Unity Editor version (full): {unityVersion}"); | ||
return unityVersion; | ||
} | ||
|
||
private static string UnityVersionFromInfoPlist(FilePath editorPath) => | ||
XElement | ||
.Load(PlistPath(editorPath)) | ||
.Descendants() | ||
.SkipWhile((element) => element.Value != "CFBundleVersion") | ||
.Skip(1) | ||
.FirstOrDefault() | ||
?.Value; | ||
|
||
private static string PlistPath(FilePath editorPath) => | ||
editorPath.FullPath.Replace("/MacOS/Unity", "/Info.plist"); | ||
} | ||
} |
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,59 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Cake.Core; | ||
using Cake.Core.Diagnostics; | ||
using Cake.Core.IO; | ||
using Cake.Unity.Version; | ||
|
||
namespace Cake.Unity.SeekersOfEditors | ||
{ | ||
internal abstract class SeekerOfEditors | ||
{ | ||
protected readonly ICakeEnvironment environment; | ||
private readonly IGlobber globber; | ||
protected readonly ICakeLog log; | ||
|
||
public static SeekerOfEditors GetSeeker(ICakeEnvironment environment, IGlobber globber, ICakeLog log) | ||
{ | ||
if (environment.Platform.Family == PlatformFamily.Windows) | ||
return new WindowsSeekerOfEditors(environment, globber, log); | ||
|
||
if (environment.Platform.Family == PlatformFamily.OSX) | ||
return new OSXSeekerOfEditors(environment, globber, log); | ||
|
||
throw new NotSupportedException("Cannot locate Unity Editors. Only Windows and OSX platform is supported."); | ||
} | ||
|
||
protected SeekerOfEditors(ICakeEnvironment environment, IGlobber globber, ICakeLog log) | ||
{ | ||
this.environment = environment; | ||
this.globber = globber; | ||
this.log = log; | ||
} | ||
|
||
public IReadOnlyCollection<UnityEditorDescriptor> Seek() | ||
{ | ||
var searchPattern = SearchPattern; | ||
|
||
log.Debug("Searching for available Unity Editors..."); | ||
log.Debug("Search pattern: {0}", searchPattern); | ||
var candidates = globber.GetFiles(searchPattern).ToList(); | ||
|
||
log.Debug("Found {0} candidates.", candidates.Count); | ||
log.Debug(string.Empty); | ||
|
||
var editors = | ||
from candidatePath in candidates | ||
let version = DetermineVersion(candidatePath) | ||
where version != null | ||
select new UnityEditorDescriptor(version, candidatePath); | ||
|
||
return editors.ToList(); | ||
} | ||
|
||
protected abstract string SearchPattern { get; } | ||
|
||
protected abstract UnityVersion DetermineVersion(FilePath editorPath); | ||
} | ||
} |
44 changes: 8 additions & 36 deletions
44
src/Cake.Unity/SeekerOfEditors.cs → ...eekersOfEditors/WindowsSeekerOfEditors.cs
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
Oops, something went wrong.