Skip to content

MSIX Support: Generate AppxManifest.xml (part 1)#187

Open
JoshBashed wants to merge 6 commits intomoreSwift:mainfrom
JoshBashed:feat/appx-manifest
Open

MSIX Support: Generate AppxManifest.xml (part 1)#187
JoshBashed wants to merge 6 commits intomoreSwift:mainfrom
JoshBashed:feat/appx-manifest

Conversation

@JoshBashed
Copy link
Copy Markdown
Contributor

@JoshBashed JoshBashed commented Apr 30, 2026

This pull request introduces initial support for MSIX packaging on Windows, by generating AppxManifest.xml.

Summary

  • Add additional configuration options required for msix generation. (MSIXBundlerConfiguration)
  • Add .windowsPath(relativeTo: Path) for creating relative windows paths.
  • Add windowsName to BuildArchitecture. This could be renamed to msixName because windows uses different names for these architectures depending on where it is uses.
  • Add AppxManifestCreator to create AppxManifests.xml from bundler contexts and additional metadata.
  • Update GenericWindowsBundler to prepare icons for msix and to create AppxManifest.xml.
  • Update GenericWindowsBundlerBundleStructure.swift to support Assets directory. This is where the icon goes.

Progress

  • Update configuration for msix generation.
  • Create AppxManifests.xml when msix field is present.
  • Create icon images from icon.

@JoshBashed JoshBashed changed the title Feat/appx manifest MSIX Support: Generate AppxManifest.xml (part 1) Apr 30, 2026
@JoshBashed JoshBashed marked this pull request as ready for review April 30, 2026 19:10
@JoshBashed
Copy link
Copy Markdown
Contributor Author

@stackotter the commit is ready. if u have free time pls review

@JoshBashed JoshBashed force-pushed the feat/appx-manifest branch 2 times, most recently from a9535e9 to 7cb1fa6 Compare May 4, 2026 22:18
@JoshBashed JoshBashed force-pushed the feat/appx-manifest branch from 7cb1fa6 to 343139c Compare May 5, 2026 20:14
return icoFile
}

static func prepareMSIXIcon(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The GenericWindowsBundler should only perform operations that all Windows bundlers require. These MSIX operations should happen in the MSIX bundler. Given that this PR doesn't fully tackle MSIX bundling, maybe just make a basic MSIXBundler that wraps GenericWindowsBundler and houses these MSIX-specific operations. It's ok if the MSIXBundler doesn't actually produce an MSIX yet, because I can merge this PR into an MSIX feature branch and then merge that branch into main once your series of PRs has landed to finish off the feature.

static func prepareMSIXIcon(
iconPath: String?,
context: BundlerContext,
skipIfPresent: Bool = false,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this skipIfPresent parameter necessary? We should generally recreate the icon every time in case it has changed (because we don't track enough information to be able to tell which build operations can be skipped yet)

}
} else {
image = Image<RGBA>.init(
width: 300, height: 300, pixels: Array(repeating: .init(0, 0, 0, 0), count: 300 * 300)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When wrapping arguments, put each one on a separate line (just as a code style thing that I generally try to follow in this repository)

return try Image<RGBA>.load(from: Array(imageData))
}
} else {
image = Image<RGBA>.init(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need the explicit .init

Comment thread Sources/SwiftBundler/Bundler/AppxManifestCreator.swift
Comment thread Sources/SwiftBundler/Bundler/AppxManifestCreator.swift

case fullTrustProcess = "desktop:FullTrustProcess"

var category: String? {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This category property should be computed on AppxDesktopExtension itself, because I believe this is essentially just computing the enum tag? It seems weird having to skip all the auxiliary fields when computing the enum tag; took me a sec to figure out what was going on.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for the other instance of this pattern below

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It made the most sense to do it here because the coding key defines what item should be encoded. Let me know how you would like me to continue with this. Should it be a function? func getCategory(forCodingKey key: CodingKey)?

Comment thread Sources/SwiftBundler/Bundler/AppxManifestCreator.swift
Comment thread Sources/SwiftBundler/Bundler/AppxManifestCreator.swift
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants