diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ACTool.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ACTool.cs index 639d91cf0848..f7dfbcd5a93d 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ACTool.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ACTool.cs @@ -130,26 +130,24 @@ protected override void AppendCommandLineArguments (IDictionary if (OptimizePNGs) args.Add ("--compress-pngs"); - if (AppleSdkSettings.XcodeVersion.Major >= 7) { - if (!string.IsNullOrEmpty (outputSpecs)) { - args.Add ("--enable-on-demand-resources"); - args.Add (EnableOnDemandResources ? "YES" : "NO"); - } + if (!string.IsNullOrEmpty (outputSpecs)) { + args.Add ("--enable-on-demand-resources"); + args.Add (EnableOnDemandResources ? "YES" : "NO"); + } - if (!string.IsNullOrEmpty (DeviceModel)) { - args.Add ("--filter-for-device-model"); - args.Add (DeviceModel); - } + if (!string.IsNullOrEmpty (DeviceModel)) { + args.Add ("--filter-for-device-model"); + args.Add (DeviceModel); + } - if (!string.IsNullOrEmpty (DeviceOSVersion)) { - args.Add ("--filter-for-device-os-version"); - args.Add (DeviceOSVersion); - } + if (!string.IsNullOrEmpty (DeviceOSVersion)) { + args.Add ("--filter-for-device-os-version"); + args.Add (DeviceOSVersion); + } - if (!string.IsNullOrEmpty (outputSpecs)) { - args.Add ("--asset-pack-output-specifications"); - args.Add (Path.GetFullPath (outputSpecs)); - } + if (!string.IsNullOrEmpty (outputSpecs)) { + args.Add ("--asset-pack-output-specifications"); + args.Add (Path.GetFullPath (outputSpecs)); } if (Platform == ApplePlatform.MacCatalyst) { @@ -422,7 +420,7 @@ public override bool Execute () catalogs.Add (item); } - if (AppleSdkSettings.XcodeVersion.Major >= 7 && SdkPlatform != "WatchSimulator") { + if (SdkPlatform != "WatchSimulator") { var text = File.ReadAllText (assetItem.ItemSpec); if (string.IsNullOrEmpty (text)) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileSceneKitAssets.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileSceneKitAssets.cs index a8a435fe926e..05f4585b98f5 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileSceneKitAssets.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/CompileSceneKitAssets.cs @@ -102,15 +102,12 @@ Task CopySceneKitAssets (string scnassets, string output, string intermediate) args.Add (Path.GetFullPath (output)); args.Add ($"--sdk-root={SdkRoot}"); - if (AppleSdkSettings.XcodeVersion.Major >= 10) { - var platform = PlatformUtils.GetTargetPlatform (SdkPlatform, IsWatchApp); - if (platform is not null) - args.Add ($"--target-platform={platform}"); - - args.Add ($"--target-version={SdkVersion}"); - } else { - args.Add ($"--target-version-{OperatingSystem}={SdkVersion}"); - } + var platform = PlatformUtils.GetTargetPlatform (SdkPlatform, IsWatchApp); + if (platform is not null) + args.Add ($"--target-platform={platform}"); + + args.Add ($"--target-version={SdkVersion}"); + args.Add ($"--target-build-dir={Path.GetFullPath (intermediate)}"); args.Add ($"--resources-folder-path={AppBundleName}"); diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/DSymUtil.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/DSymUtil.cs index 7391e569a1a1..58011d2fbc90 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/DSymUtil.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/DSymUtil.cs @@ -61,13 +61,6 @@ void ExecuteDSymUtil (ITaskItem item, List contentFiles) args.Add ("dsymutil"); args.Add ("-num-threads"); args.Add ("4"); - if (AppleSdkSettings.XcodeVersion < new Version (13, 3)) { - // Apple removed the -z / --minimize option in Xocde 13.3, so now if you use it you get a warning: "ignoring unknown option: -z" - // So just don't pass -z when Xcode >= 13.3 - // Ref: https://github.com/llvm/llvm-project/commit/5d07dc897707f877c45cab6c7e4b65dad7d3ff6d - // Ref: https://github.com/dotnet/runtime/issues/66770 - args.Add ("-z"); - } args.Add ("-o"); args.Add (dSymDir); diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/IBTool.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/IBTool.cs index 04884845e8d3..5ae4938b055e 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/IBTool.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/IBTool.cs @@ -45,11 +45,7 @@ protected bool AutoActivateCustomFonts { } protected override bool UseCompilationDirectory { - get { return AppleSdkSettings.XcodeVersion >= new Version (6, 3); } - } - - protected bool CanLinkStoryboards { - get { return AppleSdkSettings.XcodeVersion.Major > 7 || (AppleSdkSettings.XcodeVersion.Major == 7 && AppleSdkSettings.XcodeVersion.Minor >= 2); } + get => true; } protected override void AppendCommandLineArguments (IDictionary environment, List args, ITaskItem [] items) @@ -65,7 +61,7 @@ protected override void AppendCommandLineArguments (IDictionary args.Add (targetDevice); } - if (AppleSdkSettings.XcodeVersion.Major >= 6 && AutoActivateCustomFonts) + if (AutoActivateCustomFonts) args.Add ("--auto-activate-custom-fonts"); if (!string.IsNullOrEmpty (SdkRoot)) { @@ -222,12 +218,7 @@ bool CompileInterfaceDefinitions (IEnumerable interfaceDefinitions, s if (EnableOnDemandResources && !string.IsNullOrEmpty (resourceTags)) expected.SetMetadata ("ResourceTags", resourceTags); - if (UseCompilationDirectory) { - // Note: When using --compilation-directory, we need to specify the output path as the parent directory - output = Path.GetDirectoryName (path); - } else { - output = expected.ItemSpec; - } + output = Path.GetDirectoryName (path); if (InterfaceDefinitionChanged (item, manifest)) { Directory.CreateDirectory (manifestDir); @@ -252,37 +243,32 @@ bool CompileInterfaceDefinitions (IEnumerable interfaceDefinitions, s continue; } - if (UseCompilationDirectory) { - // Note: When using a compilation-directory, we'll scan dir the baseOutputDir later as - // an optimization to collect all of the compiled output in one fell swoop. - var metadata = expected.CloneCustomMetadata (); + // Note: When using a compilation-directory, we'll scan dir the baseOutputDir later as + // an optimization to collect all of the compiled output in one fell swoop. + var metadata = expected.CloneCustomMetadata (); - foreach (var target in targets) { - var key = name + "~" + target + extension; + foreach (var target in targets) { + var key = name + "~" + target + extension; - // Note: we don't blindly .Add() here because there may already be a mapping for this file if the - // source file is named something like "MyView.xib" and we've already processed "MyView~ipad.xib". - // - // When a situation like this occurs, we don't want to override the metadata. - if (!mapping.ContainsKey (key)) - mapping.Add (key, metadata); - } - - // Note: we don't use .Add() here because there may already be a mapping for this file if the - // source file is named something like "MyView~ipad.xib" and we've already processed "MyView.xib". + // Note: we don't blindly .Add() here because there may already be a mapping for this file if the + // source file is named something like "MyView.xib" and we've already processed "MyView~ipad.xib". // - // In this case, we want to override the metadata for "MyView.xib" with the metadata for - // "MyView~ipad.xib". - mapping [path] = metadata; - } else { - compiled.AddRange (GetCompilationOutput (expected)); + // When a situation like this occurs, we don't want to override the metadata. + if (!mapping.ContainsKey (key)) + mapping.Add (key, metadata); } + // Note: we don't use .Add() here because there may already be a mapping for this file if the + // source file is named something like "MyView~ipad.xib" and we've already processed "MyView.xib". + // + // In this case, we want to override the metadata for "MyView.xib" with the metadata for + // "MyView~ipad.xib". + mapping [path] = metadata; + manifests.Add (manifest); } - if (UseCompilationDirectory) - compiled.AddRange (GetCompilationDirectoryOutput (baseOutputDir, mapping)); + compiled.AddRange (GetCompilationDirectoryOutput (baseOutputDir, mapping)); return !Log.HasLoggedErrors; } @@ -410,12 +396,6 @@ public override bool Execute () if (ShouldExecuteRemotely ()) return ExecuteRemotely (); - if (IsWatchApp && AppleSdkSettings.XcodeVersion < new Version (6, 2)) { - Log.LogError (MSBStrings.E0160, AppleSdkSettings.XcodeVersion); - - return !Log.HasLoggedErrors; - } - var ibtoolManifestDir = Path.Combine (IntermediateOutputPath, "ibtool-manifests"); var ibtoolOutputDir = Path.Combine (IntermediateOutputPath, "ibtool"); var outputManifests = new List (); @@ -436,37 +416,32 @@ public override bool Execute () if (!CompileInterfaceDefinitions (interfaceDefinitions, ibtoolManifestDir, ibtoolOutputDir, compiled, outputManifests, out changed)) return false; - if (CanLinkStoryboards) { - var storyboards = new List (); - var linked = new List (); - var unique = new HashSet (); - - for (int i = 0; i < compiled.Count; i++) { - // pretend that non-storyboardc items (e.g. *.nib) are already 'linked' - if (compiled [i].ItemSpec.EndsWith (".storyboardc", StringComparison.Ordinal)) { - var interfaceDefinition = compiled [i].GetMetadata ("InterfaceDefinition"); - unique.Add (interfaceDefinition); - storyboards.Add (compiled [i]); - continue; - } - - // just pretend any *nib's have already been 'linked'... - compiled [i].RemoveMetadata ("InterfaceDefinition"); - linked.Add (compiled [i]); + var storyboards = new List (); + var linked = new List (); + var unique = new HashSet (); + + for (int i = 0; i < compiled.Count; i++) { + // pretend that non-storyboardc items (e.g. *.nib) are already 'linked' + if (compiled [i].ItemSpec.EndsWith (".storyboardc", StringComparison.Ordinal)) { + var interfaceDefinition = compiled [i].GetMetadata ("InterfaceDefinition"); + unique.Add (interfaceDefinition); + storyboards.Add (compiled [i]); + continue; } - // only link the storyboards if there are multiple unique storyboards - if (unique.Count > 1) { - var linkOutputDir = Path.Combine (IntermediateOutputPath, "ibtool-link"); + // just pretend any *nib's have already been 'linked'... + compiled [i].RemoveMetadata ("InterfaceDefinition"); + linked.Add (compiled [i]); + } - if (!LinkStoryboards (ibtoolManifestDir, linkOutputDir, storyboards, linked, outputManifests, changed)) - return false; + // only link the storyboards if there are multiple unique storyboards + if (unique.Count > 1) { + var linkOutputDir = Path.Combine (IntermediateOutputPath, "ibtool-link"); - compiled = linked; - } - } else { - for (int i = 0; i < compiled.Count; i++) - compiled [i].RemoveMetadata ("InterfaceDefinition"); + if (!LinkStoryboards (ibtoolManifestDir, linkOutputDir, storyboards, linked, outputManifests, changed)) + return false; + + compiled = linked; } } diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/ScnTool.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/ScnTool.cs index 261bfec8ed4b..5f8e9617c1a8 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/ScnTool.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/ScnTool.cs @@ -60,13 +60,8 @@ IList GenerateCommandLineCommands (string inputScene, string outputScene args.Add (outputScene); args.Add ($"--sdk-root={SdkRoot}"); args.Add ($"--target-build-dir={IntermediateOutputPath}"); - if (AppleSdkSettings.XcodeVersion.Major >= 13) { - // I'm not sure which Xcode version these options are available in, but it's at least Xcode 13+ - args.Add ($"--target-version={SdkVersion}"); - args.Add ($"--target-platform={PlatformUtils.GetTargetPlatform (SdkPlatform, IsWatchApp)}"); - } else { - args.Add ($"--target-version-{PlatformFrameworkHelper.GetOperatingSystem (TargetFrameworkMoniker)}={SdkVersion}"); - } + args.Add ($"--target-version={SdkVersion}"); + args.Add ($"--target-platform={PlatformUtils.GetTargetPlatform (SdkPlatform, IsWatchApp)}"); return args; }