[msbuild] Updated MetalTaskBase to use the new -m{os}-version-min argument (#4049)

Fixes issue #4019
This commit is contained in:
Jeffrey Stedfast 2018-05-10 08:57:33 -04:00 коммит произвёл Sebastien Pouliot
Родитель e3bb98fa7e
Коммит c00654af82
5 изменённых файлов: 40 добавлений и 2 удалений

Просмотреть файл

@ -1,5 +1,6 @@
using System.IO;
using Xamarin.MacDev;
using Xamarin.MacDev.Tasks;
namespace Xamarin.Mac.Tasks
@ -7,7 +8,11 @@ namespace Xamarin.Mac.Tasks
public class Metal : MetalTaskBase
{
protected override string OperatingSystem {
get { return "osx"; }
get { return "macosx"; }
}
protected override string MinimumDeploymentTargetKey {
get { return ManifestKeys.LSMinimumSystemVersion; }
}
protected override string DevicePlatformBinDir {

Просмотреть файл

@ -305,9 +305,11 @@ Copyright (C) 2014 Xamarin. All rights reserved.
Condition="'$(IsMacEnabled)' == 'true' and '%(Metal.Identity)' != ''"
SessionId="$(BuildSessionId)"
IntermediateOutputPath="$(IntermediateOutputPath)"
AppManifest="$(_AppManifest)"
ProjectDir="$(MSBuildProjectDirectory)"
ResourcePrefix="$(XamMacResourcePrefix)"
SdkDevPath="$(_SdkDevPath)"
SdkVersion="$(MacOSXSdkVersion)"
SourceFile="@(Metal)">
<Output TaskParameter="OutputFile" ItemName="_SmeltedMetal" />
</Metal>

Просмотреть файл

@ -15,6 +15,8 @@ namespace Xamarin.MacDev.Tasks
public string SessionId { get; set; }
public ITaskItem AppManifest { get; set; }
[Required]
public string IntermediateOutputPath { get; set; }
@ -27,6 +29,9 @@ namespace Xamarin.MacDev.Tasks
[Required]
public string SdkDevPath { get; set; }
[Required]
public string SdkVersion { get; set; }
[Required]
public ITaskItem SourceFile { get; set; }
@ -35,6 +40,10 @@ namespace Xamarin.MacDev.Tasks
[Output]
public ITaskItem OutputFile { get; set; }
protected abstract string MinimumDeploymentTargetKey {
get;
}
protected abstract string OperatingSystem {
get;
}
@ -65,10 +74,23 @@ namespace Xamarin.MacDev.Tasks
var path = Path.Combine (intermediate, logicalName);
var args = new CommandLineArgumentBuilder ();
var dir = Path.GetDirectoryName (path);
string minimumDeploymentTarget;
if (!Directory.Exists (dir))
Directory.CreateDirectory (dir);
if (AppManifest != null) {
var plist = PDictionary.FromFile (AppManifest.ItemSpec);
PString value;
if (!plist.TryGetValue (MinimumDeploymentTargetKey, out value) || string.IsNullOrEmpty (value.Value))
minimumDeploymentTarget = SdkVersion;
else
minimumDeploymentTarget = value.Value;
} else {
minimumDeploymentTarget = SdkVersion;
}
OutputFile = new TaskItem (Path.ChangeExtension (path, ".air"));
OutputFile.SetMetadata ("LogicalName", Path.ChangeExtension (logicalName, ".air"));
@ -77,7 +99,6 @@ namespace Xamarin.MacDev.Tasks
args.Add ("-c");
args.Add ("-gline-tables-only");
args.Add ("-ffast-math");
args.Add (string.Format ("-std={0}-metal1.0", OperatingSystem));
args.Add ("-serialize-diagnostics");
args.AddQuoted (Path.ChangeExtension (path, ".dia"));
@ -85,6 +106,8 @@ namespace Xamarin.MacDev.Tasks
args.Add ("-o");
args.AddQuoted (Path.ChangeExtension (path, ".air"));
args.Add (string.Format ("-m{0}-version-min={1}", OperatingSystem, minimumDeploymentTarget));
args.AddQuoted (SourceFile.ItemSpec);
return args.ToString ();

Просмотреть файл

@ -1,5 +1,7 @@
using System.IO;
using Xamarin.MacDev;
namespace Xamarin.iOS.Tasks
{
public abstract class MetalTaskBase : Xamarin.MacDev.Tasks.MetalTaskBase
@ -8,6 +10,10 @@ namespace Xamarin.iOS.Tasks
get { return "ios"; }
}
protected override string MinimumDeploymentTargetKey {
get { return ManifestKeys.MinimumOSVersion; }
}
protected override string DevicePlatformBinDir {
get { return Path.Combine (SdkDevPath, "Platforms", "iPhoneOS.platform", "usr", "bin"); }
}

Просмотреть файл

@ -556,9 +556,11 @@ Copyright (C) 2013-2016 Xamarin. All rights reserved.
SessionId="$(BuildSessionId)"
Condition="'$(IsMacEnabled)' == 'true' and '%(Metal.Identity)' != ''"
IntermediateOutputPath="$(DeviceSpecificIntermediateOutputPath)"
AppManifest="$(_AppManifest)"
ProjectDir="$(MSBuildProjectDirectory)"
ResourcePrefix="$(IPhoneResourcePrefix)"
SdkDevPath="$(_SdkDevPath)"
SdkVersion="$(MtouchSdkVersion)"
SourceFile="@(Metal)">
<Output TaskParameter="OutputFile" ItemName="_SmeltedMetal" />
</Metal>