-
Notifications
You must be signed in to change notification settings - Fork 514
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
Added support for Windows builds of Xamarin.Mac #77
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("Xamarin.Mac.Tasks.Core")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("Xamarin.Mac.Tasks.Core")] | ||
[assembly: AssemblyCopyright("Copyright © 2016")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("af1ac7c3-f6dd-4e46-b897-9dbb90b158ec")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
|
||
using Microsoft.Build.Framework; | ||
using Microsoft.Build.Utilities; | ||
|
||
using Xamarin.MacDev.Tasks; | ||
using Xamarin.MacDev; | ||
|
||
namespace Xamarin.Mac.Tasks | ||
{ | ||
public class DetectSdkLocationsTaskBase : Task | ||
{ | ||
#region Inputs | ||
|
||
public string SessionId { get; set; } | ||
|
||
// This is also an input | ||
[Output] | ||
public string SdkVersion { | ||
get; set; | ||
} | ||
|
||
public string XamarinSdkRoot { | ||
get; set; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same style issue. |
||
} | ||
|
||
#endregion Inputs | ||
|
||
#region Outputs | ||
|
||
[Output] | ||
public string SdkRoot { | ||
get; set; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Style issue. |
||
} | ||
|
||
[Output] | ||
public string SdkBinPath { | ||
get; set; | ||
} | ||
|
||
[Output] | ||
public string SdkDevPath { | ||
get; set; | ||
} | ||
|
||
[Output] | ||
public string SdkUsrPath { | ||
get; set; | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please move the get; set; to the same line :) |
||
#endregion Outputs | ||
|
||
public override bool Execute () | ||
{ | ||
Log.LogTaskName ("DetectSdkLocations"); | ||
Log.LogTaskProperty ("SdkVersion", SdkVersion); | ||
Log.LogTaskProperty ("XamarinSdkRoot", XamarinSdkRoot); | ||
|
||
EnsureAppleSdkRoot (); | ||
EnsureXamarinSdkRoot (); | ||
EnsureSdkPath (); | ||
|
||
return !Log.HasLoggedErrors; | ||
} | ||
|
||
void EnsureSdkPath () | ||
{ | ||
MacOSXSdkVersion requestedSdkVersion; | ||
if (string.IsNullOrEmpty (SdkVersion)) { | ||
requestedSdkVersion = MacOSXSdkVersion.UseDefault; | ||
} else if (!MacOSXSdkVersion.TryParse (SdkVersion, out requestedSdkVersion)) { | ||
Log.LogError ("Could not parse the SDK version '{0}'", SdkVersion); | ||
return; | ||
} | ||
|
||
var sdkVersion = requestedSdkVersion.ResolveIfDefault (MacOSXSdks.Native); | ||
if (!MacOSXSdks.Native.SdkIsInstalled (sdkVersion)) { | ||
sdkVersion = MacOSXSdks.Native.GetClosestInstalledSdk (sdkVersion); | ||
|
||
if (sdkVersion.IsUseDefault || !MacOSXSdks.Native.SdkIsInstalled (sdkVersion)) { | ||
if (requestedSdkVersion.IsUseDefault) { | ||
Log.LogError ("The Apple MacOSX SDK is not installed."); | ||
} else { | ||
Log.LogError ("The MacOSX SDK version '{0}' is not installed, and no newer version was found.", requestedSdkVersion.ToString ()); | ||
} | ||
return; | ||
} | ||
Log.LogWarning ("The MacOSX SDK version '{0}' is not installed. Using newer version '{1}' instead'.", requestedSdkVersion, sdkVersion); | ||
} | ||
|
||
SdkVersion = sdkVersion.ToString (); | ||
|
||
SdkRoot = MacOSXSdks.Native.GetSdkPath (sdkVersion); | ||
if (string.IsNullOrEmpty (SdkRoot)) | ||
Log.LogError ("Could not locate the MacOSX '{0}' SDK at path '{1}'", SdkVersion, SdkRoot); | ||
|
||
SdkUsrPath = DirExists ("SDK usr directory", Path.Combine (MacOSXSdks.Native.DeveloperRoot, "usr")); | ||
if (string.IsNullOrEmpty (SdkUsrPath)) | ||
Log.LogError ("Could not locate the MacOSX '{0}' SDK usr path at '{1}'", SdkVersion, SdkRoot); | ||
|
||
SdkBinPath = DirExists ("SDK bin directory", Path.Combine (SdkUsrPath, "bin")); | ||
if (string.IsNullOrEmpty (SdkBinPath)) | ||
Log.LogError ("Could not locate SDK bin directory"); | ||
} | ||
|
||
void EnsureAppleSdkRoot () | ||
{ | ||
if (!MacOSXSdks.Native.IsInstalled) { | ||
Log.LogError (" Could not find valid a usable Xcode app bundle"); | ||
} else { | ||
Log.LogMessage (MessageImportance.Low, " DeveloperRoot: {0}", MacOSXSdks.Native.DeveloperRoot); | ||
Log.LogMessage (MessageImportance.Low, " GetPlatformPath: {0}", MacOSXSdks.Native.GetPlatformPath ()); | ||
|
||
SdkDevPath = MacOSXSdks.Native.DeveloperRoot; | ||
if (string.IsNullOrEmpty (SdkDevPath)) | ||
Log.LogError (" Could not find valid a usable Xcode developer path"); | ||
} | ||
} | ||
|
||
void EnsureXamarinSdkRoot () | ||
{ | ||
if (string.IsNullOrEmpty (XamarinSdkRoot)) | ||
XamarinSdkRoot = MacOSXSdks.XamMac.FrameworkDirectory; | ||
|
||
if (string.IsNullOrEmpty (XamarinSdkRoot) || !Directory.Exists (XamarinSdkRoot)) | ||
Log.LogError (" Could not find 'Xamarin.Mac'"); | ||
} | ||
|
||
string DirExists (string checkingFor, params string[] paths) | ||
{ | ||
try { | ||
if (paths.Any (p => string.IsNullOrEmpty (p))) | ||
return null; | ||
|
||
var path = Path.GetFullPath (Path.Combine (paths)); | ||
Log.LogMessage (MessageImportance.Low, " Searching for '{0}' in '{1}'", checkingFor, path); | ||
return Directory.Exists (path) ? path : null; | ||
} catch { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we know the expected exception? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as before: this is just moving the file to a new project. I'm not sure what is expected and I rather someone in xammac change it if at all needed. |
||
return null; | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
|
||
using Microsoft.Build.Framework; | ||
using Microsoft.Build.Utilities; | ||
|
||
using Xamarin.MacDev.Tasks; | ||
using Xamarin.MacDev; | ||
|
||
namespace Xamarin.Mac.Tasks | ||
{ | ||
public class EmbedProvisionProfileTaskBase : Task | ||
{ | ||
#region Inputs | ||
|
||
public string SessionId { get; set; } | ||
|
||
[Required] | ||
public string AppBundleDir { get; set; } | ||
|
||
[Required] | ||
public string ProvisioningProfile { get; set; } | ||
|
||
#endregion | ||
|
||
static MobileProvision GetMobileProvision (MobileProvisionPlatform platform, string uuid) | ||
{ | ||
var extension = MobileProvision.GetFileExtension (platform); | ||
var path = Path.Combine (MobileProvision.ProfileDirectory, uuid + extension); | ||
|
||
if (File.Exists (path)) | ||
return MobileProvision.LoadFromFile (path); | ||
|
||
return MobileProvision.GetAllInstalledProvisions (platform, true).FirstOrDefault (x => x.Uuid == uuid); | ||
} | ||
|
||
public override bool Execute () | ||
{ | ||
Log.LogTaskName ("EmbedProvisionProfile"); | ||
Log.LogTaskProperty ("AppBundleDir", AppBundleDir); | ||
Log.LogTaskProperty ("ProvisioningProfile", ProvisioningProfile); | ||
|
||
var profile = GetMobileProvision (MobileProvisionPlatform.MacOS, ProvisioningProfile); | ||
|
||
if (profile == null) { | ||
Log.LogError ("Could not locate the provisioning profile with a UUID of {0}.", ProvisioningProfile); | ||
return false; | ||
} | ||
|
||
var embedded = Path.Combine (AppBundleDir, "Contents", "embedded.provisionprofile"); | ||
|
||
Directory.CreateDirectory (AppBundleDir); | ||
profile.Save (embedded); | ||
|
||
return true; | ||
} | ||
} | ||
} |
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.
Style, move the get; set; to the same line as done in SessionId.
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.
Agreed with all the formatting comments, but this is a copy paste from the original and I didn't want to change it. See here: https://github.com/xamarin/xamarin-macios/pull/77/files#diff-2e650c9beeab2092efcab1aea606b5e6L19
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.
If you have the file moves (only) in a separate commits, then git should properly detect that and not show that many additions/deletions.
Then in a separate commit you can change things (in this case I see you've changed the name of the class, but I have no idea if you've changed anything else in the file, which seriously complicates reviewing the PR).
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 isn't really a move, though. The original files where turned into bases (in a new Core project). The signature of the originals is unchanged, by them inheriting the bases. The only changes in the code of the bases is to add a SessionId property and the naming. My problem with doing it in separate commits is that I will potentially have a commit that will not build, and that breaks Minimum Unit of Cherry-Picking. None of the code in the bases changed, though.
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 why this would not build:
Afaict that should still work, because all you did was move code to a new assembly.
Then the next step would be to make the changes you need.
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.
That would work.
Get Outlook for mobile
On Thu, May 26, 2016 at 2:35 AM -0700, "Rolf Bjarne Kvinge" [email protected] wrote:
In msbuild/Xamarin.Mac.Tasks.Core/Tasks/DetectSdkLocations.cs:
I'm not sure why this would not build:
Create a project for a new assembly (Xamarin.Mac.Tasks.Core)
Move all the files you want to move there, without changing any contents.
Reference Xamarin.Mac.Tasks.Core from where the corresponding files were previously used.
Afaict that should still work, because all you did was move code to a new assembly.
Then the next step would be to make the changes you need.
—
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub