Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/building-apps/build-properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,12 @@ This also applies to how native references are stored inside NuGets.
> [!NOTE]
> 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.

## CopySceneKitAssetsPath

The full path to the `copySceneKitAssets` tool.

The default behavior is to use `xcrun copySceneKitAssets`.

## CoreMLCompilerPath

The full path to the `coremlc` tool.
Expand Down
36 changes: 6 additions & 30 deletions msbuild/Xamarin.MacDev.Tasks/Tasks/CompileSceneKitAssets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

namespace Xamarin.MacDev.Tasks {
public class CompileSceneKitAssets : XamarinTask, ICancelableTask, IHasProjectDir, IHasResourcePrefix {
string? toolExe;

#region Inputs

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

public string CopySceneKitAssetsPath { get; set; } = "";

[Required]
public string IntermediateOutputPath { get; set; } = "";

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

public string ToolExe {
get { return toolExe ?? ToolName; }
set { toolExe = value; }
}

public string ToolPath { get; set; } = "";

#endregion

#region Outputs
Expand All @@ -65,38 +58,19 @@ public string ToolExe {

#endregion

static string ToolName {
get { return "copySceneKitAssets"; }
}
const string ToolName = "copySceneKitAssets";

protected virtual string OperatingSystem {
get {
return PlatformFrameworkHelper.GetOperatingSystem (TargetFrameworkMoniker);
}
}

string DeveloperRootBinDir {
get { return Path.Combine (SdkDevPath, "usr", "bin"); }
}

string GetFullPathToTool ()
{
if (!string.IsNullOrEmpty (ToolPath))
return Path.Combine (ToolPath, ToolExe);

var path = Path.Combine (DeveloperRootBinDir, ToolExe);

return File.Exists (path) ? path : ToolExe;
}

Task CopySceneKitAssets (string scnassets, string output, string intermediate)
{
var environment = new Dictionary<string, string?> ();
var args = new List<string> ();

environment.Add ("PATH", DeveloperRootBinDir);
environment.Add ("XCODE_DEVELOPER_USR_PATH", DeveloperRootBinDir);

args.Add (Path.GetFullPath (scnassets));
args.Add ("-o");
args.Add (Path.GetFullPath (output));
Expand All @@ -111,7 +85,9 @@ Task CopySceneKitAssets (string scnassets, string output, string intermediate)
args.Add ($"--target-build-dir={Path.GetFullPath (intermediate)}");
args.Add ($"--resources-folder-path={AppBundleName}");

return ExecuteAsync (GetFullPathToTool (), args, sdkDevPath: SdkDevPath, environment: environment, showErrorIfFailure: true);
var executable = GetExecutable (args, ToolName, CopySceneKitAssetsPath);

return ExecuteAsync (executable, args, sdkDevPath: SdkDevPath, environment: environment, showErrorIfFailure: true);
}

static bool TryGetScnAssetsPath (string file, out string scnassets)
Expand Down
3 changes: 1 addition & 2 deletions msbuild/Xamarin.Shared/Xamarin.Shared.targets
Original file line number Diff line number Diff line change
Expand Up @@ -1153,8 +1153,7 @@ Copyright (C) 2018 Microsoft. All rights reserved.
SessionId="$(BuildSessionId)"
AppBundleName="$(_AppBundleName)$(AppBundleExtension)"
Condition="'$(IsMacEnabled)' == 'true'"
ToolExe="$(CopySceneKitAssetsExe)"
ToolPath="$(CopySceneKitAssetsPath)"
CopySceneKitAssetsPath="$(CopySceneKitAssetsPath)"
SceneKitAssets="@(SceneKitAsset)"
IntermediateOutputPath="$(DeviceSpecificIntermediateOutputPath)"
TargetFrameworkMoniker="$(_ComputedTargetFrameworkMoniker)"
Expand Down