diff --git a/Package.swift.template b/Package.swift.template index 2888b5578f7..6ea73774757 100644 --- a/Package.swift.template +++ b/Package.swift.template @@ -8,7 +8,6 @@ */ import PackageDescription -import Foundation let version = "__VERSION__" let url = "https://ossci-ios.s3.amazonaws.com/executorch/" @@ -144,23 +143,17 @@ for (key, value) in products { packageTargets.append(target) } -// The MLX Metal kernel libraries, one per platform slice, shipped as a single -// resource bundle both MLX products share. Kept out of the generic loop above so -// there is one bundle (executorch_backend_mlx_resources.bundle) rather than a -// separate debug copy, and so the release and debug delegates resolve the same -// name. Each slice's MLX binary asks for its own mlx-.metallib. The files -// are committed to this branch by the release job and gitignored elsewhere, so -// each is included only when present. +// One resource bundle shared by both MLX products (release and debug) so they +// resolve the same bundle name, with a per-slice metallib since one slice's does +// not load on another. Kept out of the loop above to avoid a per-debug copy. The +// release job commits all three files beside the manifest, so copy them +// unconditionally. let mlxMetallibSlices = ["mlx-ios", "mlx-ios-simulator", "mlx-macos"] -let mlxResourcesDir = ".Package.swift/backend_mlx_resources" if products.keys.contains("backend_mlx") { packageTargets.append(.target( name: "backend_mlx_resources", - path: mlxResourcesDir, - resources: mlxMetallibSlices.compactMap { slice in - FileManager.default.fileExists(atPath: "\(mlxResourcesDir)/\(slice).metallib") - ? .copy("\(slice).metallib") : nil - } + path: ".Package.swift/backend_mlx_resources", + resources: mlxMetallibSlices.map { .copy("\($0).metallib") } )) for suffix in ["", debug_suffix] { if let index = packageTargets.firstIndex(where: {