Skip to content

Add Wasm and Android platforms #3803

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 22, 2025
Merged

Add Wasm and Android platforms #3803

merged 3 commits into from
May 22, 2025

Conversation

finestructure
Copy link
Member

@finestructure finestructure commented May 20, 2025

To do

  • merge and tag SPIManifest 1.9.0
  • adopt SPIManifest 1.9.0 in Package.swift
  • verify and deploy builder with new platforms
    • wasm
    • android
  • optionally disable display of new platforms until matrix is polished
  • reset BUILD_TRIGGER_DOWNSCALING to 0.01

CleanShot 2025-05-20 at 16 16 59@2x

We need to deploy this to dev in order to finalise the builder changes, because they need to report back to the API in order to pass the tests.

We can ad hoc deploy from this branch without merging to allow the builder tests to pass.

I've set the BUILD_TRIGGER_DOWNSCALING for dev to 0 in order to avoid triggering any of the new platform builds while it is running on dev.

@cla-bot cla-bot bot added the cla-signed label May 20, 2025
Copy link

coderabbitai bot commented May 20, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@finestructure finestructure requested a review from daveverwer May 20, 2025 14:44
@daveverwer daveverwer changed the title Add new platforms Add Wasm and Android platforms May 21, 2025
@finestructure
Copy link
Member Author

The builder capable of building for wasm and android is live.

This PR is ready to be merged, we just need to decide to what extent we want to update the matrix before deploying to prod.

@daveverwer
Copy link
Member

This PR is ready to be merged, we just need to decide to what extent we want to update the matrix before deploying to prod.

I'm working on the matrix right now, but it's … not ready 😂

Screenshot 2025-05-21 at 13 04 32@2x

@finestructure
Copy link
Member Author

@finestructure
Copy link
Member Author

@finestructure
Copy link
Member Author

This PR is ready to be merged, we just need to decide to what extent we want to update the matrix before deploying to prod.

I'm working on the matrix right now, but it's … not ready 😂

👍 Is there a CSS way to rotate the headers by 30 or 45 degrees? It might be all that's needed tbh.

@finestructure
Copy link
Member Author

There you go transform: rotate(-30deg); - fixed 😬

CleanShot 2025-05-21 at 14 16 13@2x

@Sherlouk
Copy link
Collaborator

Sherlouk commented May 21, 2025

image

I still think it looks perfect as-is 😂 Totally readable

Iconography with tooltips would be a quick win, but curious what Dave has up his sleeve

@daveverwer
Copy link
Member

There you go transform: rotate(-30deg); - fixed 😬

I'm working on fixing a few things at the same time, for example this:

Screenshot 2025-05-21 at 13 18 09@2x

@finestructure
Copy link
Member Author

Just for the purposes of merging, I'd suggest we merge those changes separately BTW.

@daveverwer
Copy link
Member

Just for the purposes of merging, I'd suggest we merge those changes separately BTW.

If you'd like to do that then let's remove the cells from this one so we don't merge it looking like this.

However, I should have this done today if we can hold off until then as I'm right in the middle of it and having to undo those cell changes and put them back in on a different branch will just delay me.

@finestructure
Copy link
Member Author

I don't think removing them is worth the effort. I can ad hoc deploy from the branch to keep dev on this version. But when the other PR is ready we should merge them sequentially without tagging in between and then they're still separate PRs for the purpose of referencing them.

(I do keep references to similar previous tasks in places as a template for future tasks and it'd be better if it didn't contain extra UI changes.)

@daveverwer
Copy link
Member

(I do keep references to similar previous tasks in places as a template for future tasks and it'd be better if it didn't contain extra UI changes.)

That's fine, but let's just HTML comment out the extra cells then. They can even stay in the Full Build Details page, but I don't want to deploy the matrix like this.

@daveverwer
Copy link
Member

@coderabbitai please review

Copy link

coderabbitai bot commented May 22, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Get PR details
gh pr view 3803 --json title,body,additions,deletions,changedFiles

# List the files changed in this PR
gh pr view 3803 --json files --jq '.files[].path'

# Check if there's a file related to the builder for wasm and android
gh pr view 3803 --json files --jq '.files[].path' | grep -E 'builder|wasm|android'

# Check for matrix-related files
gh pr view 3803 --json files --jq '.files[].path' | grep -E 'matrix|ui|build'

Length of output: 3917


🏁 Script executed:

#!/bin/bash
# Let's check the content of key files related to platform support
cat Sources/App/Models/Build+Platform.swift

# Let's look at the compatibility matrix controller
cat Sources/App/Controllers/CompatibilityMatrix.swift

# Check the build trigger command to understand the platform changes
cat Sources/App/Commands/TriggerBuilds.swift

Length of output: 28333


🏁 Script executed:

#!/bin/bash
# Let's look at changes to the Package.swift to see what dependencies were updated
git diff HEAD^ HEAD -- Package.swift

# Let's also check the PR diff for more context
git show --format='' --name-status HEAD

# Let's check any changes to the compatibility matrix UI
cat Sources/App/Controllers/PackageController+ShowRoute.swift

# Let's also look at changes to the compatibility matrix model
cat Sources/App/Views/PackageController/CompatibilityMatrix.Platform+BuildResultPresentable.swift

Length of output: 55449


@daveverwer I've reviewed PR #3803 which adds Wasm and Android platform support to the Swift Package Index.

The implementation looks solid and well-structured:

  • The Build.Platform enum properly includes the new platforms
  • Compatibility mappings are correctly set up between build platforms and matrix display
  • Version constraints are implemented (Android and Wasm only supported for Swift 6.1+)
  • Display names are appropriately configured (including the nice touch of "Wasm" as short name and "WebAssembly" as long name)

I can see from the PR comments that there are concerns about the matrix UI becoming crowded with the additional platforms. The screenshots show that the headers might be difficult to read. The proposed CSS transform (transform: rotate(-30deg)) could be a temporary solution, but a more comprehensive redesign of the matrix might be needed for long-term maintainability as more platforms are added.

Is there anything specific you'd like me to examine more closely about the implementation?

@finestructure finestructure merged commit 458a472 into main May 22, 2025
7 of 8 checks passed
@finestructure finestructure deleted the add-new-platforms branch May 22, 2025 13:42
marcprux added a commit to swift-everywhere/swift-everywhere.github.io that referenced this pull request Jun 2, 2025
@scottmarchant
Copy link

@daveverwer @finestructure Any thoughts on adding an additional badge for WASI 0.1 (ie. wasm preview 1) support? Or is there a way to customize the wasm build to show that support status?

What I need is for the build checker to run swift build --swift-sdk wasm32-unknown-wasip1-threads instead of swift build --swift-sdk wasm32-unknown-wasi. Quite a few more packages will compile this way, either now or in the future.

The 0.0 version of WASI that wasm32-unknown-wasi uses is actually quite old, and poses a number of problems for many projects.

I'm not sure wasm32-unknown-wasi should be removed/changed. But I think it would be helpful for the wasm community to see both wasi 0.0 (wasm32-unknown-wasi) and 0.1 ``wasm32-unknown-wasip1-threads`) status if possible.

@finestructure
Copy link
Member Author

Thanks for your comment, @scottmarchant . Would you like to open a discussion about this? We can't afford to run multiple Wasm variants at this time but it would be good to understand if there's a better SDK/triple we could choose for the builds that we do run.

@scottmarchant
Copy link

@finestructure I learned that wasm32-unknown-wasi actually does support WASI preview 1 (aka WASI 0.1). So in light of that realization, the existing SPI wasm build command is good enough.

@finestructure
Copy link
Member Author

Ah, good to know, thanks for the update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants