Skip to content

Commit 3d4da51

Browse files
authored
[msbuild] Add support for CopySceneKitAssetsPath to specify the location of the 'copySceneKitAssets' executable.
Also don't set the PATH or XCODE_DEVELOPER_USR_PATH variables anymore, it's not needed.
1 parent 2dc2c3d commit 3d4da51

File tree

3 files changed

+13
-32
lines changed

3 files changed

+13
-32
lines changed

docs/building-apps/build-properties.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,12 @@ This also applies to how native references are stored inside NuGets.
290290
> [!NOTE]
291291
> In some cases it can be beneficial to force a zip file on iOS as well, especially when there's a framework with files that have long names, because the zip file can sometimes work around MAX_PATH issues on Windows.
292292
293+
## CopySceneKitAssetsPath
294+
295+
The full path to the `copySceneKitAssets` tool.
296+
297+
The default behavior is to use `xcrun copySceneKitAssets`.
298+
293299
## CoreMLCompilerPath
294300

295301
The full path to the `coremlc` tool.

msbuild/Xamarin.MacDev.Tasks/Tasks/CompileSceneKitAssets.cs

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616

1717
namespace Xamarin.MacDev.Tasks {
1818
public class CompileSceneKitAssets : XamarinTask, ICancelableTask, IHasProjectDir, IHasResourcePrefix {
19-
string? toolExe;
20-
2119
#region Inputs
2220

2321
[Required]
2422
public string AppBundleName { get; set; } = "";
2523

24+
public string CopySceneKitAssetsPath { get; set; } = "";
25+
2626
[Required]
2727
public string IntermediateOutputPath { get; set; } = "";
2828

@@ -49,13 +49,6 @@ public class CompileSceneKitAssets : XamarinTask, ICancelableTask, IHasProjectDi
4949
[Required]
5050
public string SdkVersion { get; set; } = "";
5151

52-
public string ToolExe {
53-
get { return toolExe ?? ToolName; }
54-
set { toolExe = value; }
55-
}
56-
57-
public string ToolPath { get; set; } = "";
58-
5952
#endregion
6053

6154
#region Outputs
@@ -65,38 +58,19 @@ public string ToolExe {
6558

6659
#endregion
6760

68-
static string ToolName {
69-
get { return "copySceneKitAssets"; }
70-
}
61+
const string ToolName = "copySceneKitAssets";
7162

7263
protected virtual string OperatingSystem {
7364
get {
7465
return PlatformFrameworkHelper.GetOperatingSystem (TargetFrameworkMoniker);
7566
}
7667
}
7768

78-
string DeveloperRootBinDir {
79-
get { return Path.Combine (SdkDevPath, "usr", "bin"); }
80-
}
81-
82-
string GetFullPathToTool ()
83-
{
84-
if (!string.IsNullOrEmpty (ToolPath))
85-
return Path.Combine (ToolPath, ToolExe);
86-
87-
var path = Path.Combine (DeveloperRootBinDir, ToolExe);
88-
89-
return File.Exists (path) ? path : ToolExe;
90-
}
91-
9269
Task CopySceneKitAssets (string scnassets, string output, string intermediate)
9370
{
9471
var environment = new Dictionary<string, string?> ();
9572
var args = new List<string> ();
9673

97-
environment.Add ("PATH", DeveloperRootBinDir);
98-
environment.Add ("XCODE_DEVELOPER_USR_PATH", DeveloperRootBinDir);
99-
10074
args.Add (Path.GetFullPath (scnassets));
10175
args.Add ("-o");
10276
args.Add (Path.GetFullPath (output));
@@ -111,7 +85,9 @@ Task CopySceneKitAssets (string scnassets, string output, string intermediate)
11185
args.Add ($"--target-build-dir={Path.GetFullPath (intermediate)}");
11286
args.Add ($"--resources-folder-path={AppBundleName}");
11387

114-
return ExecuteAsync (GetFullPathToTool (), args, sdkDevPath: SdkDevPath, environment: environment, showErrorIfFailure: true);
88+
var executable = GetExecutable (args, ToolName, CopySceneKitAssetsPath);
89+
90+
return ExecuteAsync (executable, args, sdkDevPath: SdkDevPath, environment: environment, showErrorIfFailure: true);
11591
}
11692

11793
static bool TryGetScnAssetsPath (string file, out string scnassets)

msbuild/Xamarin.Shared/Xamarin.Shared.targets

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,8 +1153,7 @@ Copyright (C) 2018 Microsoft. All rights reserved.
11531153
SessionId="$(BuildSessionId)"
11541154
AppBundleName="$(_AppBundleName)$(AppBundleExtension)"
11551155
Condition="'$(IsMacEnabled)' == 'true'"
1156-
ToolExe="$(CopySceneKitAssetsExe)"
1157-
ToolPath="$(CopySceneKitAssetsPath)"
1156+
CopySceneKitAssetsPath="$(CopySceneKitAssetsPath)"
11581157
SceneKitAssets="@(SceneKitAsset)"
11591158
IntermediateOutputPath="$(DeviceSpecificIntermediateOutputPath)"
11601159
TargetFrameworkMoniker="$(_ComputedTargetFrameworkMoniker)"

0 commit comments

Comments
 (0)